@ifset ONLYDEFINECLASSREF @set CLASSREF @end ifset @ifclear ONLYDEFINECLASSREF @c Emulate the @ifnottex and @ifnotinfo commands in Texinfo 4.0 @iftex @set ISTEX @end iftex @ifinfo @set ISINFO @end ifinfo @c These are used for both TeX and HTML @set BEFORE1 @set AFTER1 @set BEFORE2 @set AFTER2 @ifset ISINFO @c Use asis so that leading and trailing spaces are meaningful. @c Remember we're inside a @menu command, hence the blanks are @c kept in the output. @set BEFORE1 @asis{* } @set AFTER1 @asis{::} @set BEFORE2 @asis{ (} @set AFTER2 @asis{)} @end ifset @macro class {a,b} @value{BEFORE1}\a\\a\@b{\b\}@value{AFTER1} @end macro @macro superclass {a,b} \a\\a\@value{BEFORE2}@i{\b\}@value{AFTER2} @end macro @ifclear ISINFO @macro begindetailmenu @display @end macro @macro enddetailmenu @end display @end macro @end ifclear @ifset ISINFO @macro begindetailmenu @detailmenu @end macro @macro enddetailmenu @end detailmenu @end macro @end ifset @ifset ISTEX @macro beginmenu @end macro @macro endmenu @end macro @end ifset @ifclear ISTEX @macro beginmenu @menu @end macro @macro endmenu @end menu @end macro @end ifclear @beginmenu @ifclear ISTEX Classes described in this manual: * ActiveHandlersList:: * Array:: * ArrayedCollection:: * Association:: * Autoload:: * Bag:: * Behavior:: * BlockClosure:: * BlockContext:: * Boolean:: * Browser:: * ByteArray:: * ByteMemory:: * ByteStream:: * CAggregate:: * CArray:: * CArrayCType:: * CBoolean:: * CByte:: * CChar:: * CDouble:: * CFloat:: * CFunctionDescriptor:: * Character:: * CharacterArray:: * CInt:: * Class:: * ClassDescription:: * CLong:: * CObject:: * Collection:: * CompiledBlock:: * CompiledCode:: * CompiledMethod:: * ContextPart:: * CPtr:: * CPtrCType:: * CScalar:: * CScalarCType:: * CShort:: * CSmalltalk:: * CString:: * CStruct:: * CType:: * CUChar:: * CUInt:: * CULong:: * CUShort:: * Date:: * Delay:: * DelayedAdaptor:: * Dictionary:: * DirectedMessage:: * Directory:: * DLD:: * DumperProxy:: * Exception:: * ExceptionCollection:: * ExceptionHandler:: * False:: * File:: * FileSegment:: * FileStream:: * Float:: * Fraction:: * IdentityDictionary:: * IdentitySet:: * Integer:: * Interval:: * LargeInteger:: * LargeNegativeInteger:: * LargePositiveInteger:: * LargeZeroInteger:: * Link:: * LinkedList:: * LookupKey:: * LookupTable:: * Magnitude:: * MappedCollection:: * Memory:: * Message:: * Metaclass:: * MethodContext:: * MethodDictionary:: * MethodInfo:: * Namespace:: * NullProxy:: * NullValueHolder:: * Number:: * Object:: * ObjectDumper:: * OrderedCollection:: * PackageLoader:: * PluggableAdaptor:: * Point:: * PositionableStream:: * Process:: * ProcessorScheduler:: * Random:: * ReadStream:: * ReadWriteStream:: * Rectangle:: * RootNamespace:: * RunArray:: * Semaphore:: * SequenceableCollection:: * Set:: * SharedQueue:: * Signal:: * SmallInteger:: * SortedCollection:: * Stream:: * String:: * Symbol:: * SymLink:: * SystemDictionary:: * TextCollector:: * Time:: * TokenStream:: * TrappableEvent:: * True:: * UndefinedObject:: * ValueAdaptor:: * ValueHolder:: * WeakArray:: * WeakIdentitySet:: * WeakKeyIdentityDictionary:: * WeakKeyLookupTable:: * WeakSet:: * WeakValueIdentityDictionary:: * WeakValueLookupTable:: * WordMemory:: * WriteStream:: @end ifclear @ifset ISINFO Class tree: @end ifset @ifset ISTEX @section Tree @end ifset @ifclear ISINFO Classes documented in this manual are @b{boldfaced}. @end ifclear @begindetailmenu @class{@t{}, Autoload} @class{@t{}, Object} @class{@t{ }, ActiveHandlersList} @class{@t{ }, Behavior} @class{@t{ }, ClassDescription} @class{@t{ }, Class} @class{@t{ }, Metaclass} @class{@t{ }, BlockClosure} @class{@t{ }, Boolean} @class{@t{ }, False} @class{@t{ }, True} @class{@t{ }, Browser} @class{@t{ }, CFunctionDescriptor} @class{@t{ }, CObject} @class{@t{ }, CAggregate} @class{@t{ }, CArray} @class{@t{ }, CPtr} @class{@t{ }, CScalar} @class{@t{ }, CChar} @class{@t{ }, CDouble} @class{@t{ }, CFloat} @class{@t{ }, CInt} @class{@t{ }, CLong} @class{@t{ }, CShort} @class{@t{ }, CSmalltalk} @class{@t{ }, CString} @class{@t{ }, CUChar} @class{@t{ }, CByte} @class{@t{ }, CBoolean} @class{@t{ }, CUInt} @class{@t{ }, CULong} @class{@t{ }, CUShort} @class{@t{ }, CStruct} @class{@t{ }, Collection} @class{@t{ }, Bag} @class{@t{ }, MappedCollection} @class{@t{ }, SequenceableCollection} @class{@t{ }, ArrayedCollection} @class{@t{ }, Array} @class{@t{ }, WeakArray} @class{@t{ }, ByteArray} @class{@t{ }, CharacterArray} @class{@t{ }, String} @class{@t{ }, Symbol} @class{@t{ }, CompiledCode} @class{@t{ }, CompiledBlock} @class{@t{ }, CompiledMethod} @class{@t{ }, Interval} @class{@t{ }, LinkedList} @class{@t{ }, Semaphore} @class{@t{ }, OrderedCollection} @class{@t{ }, RunArray} @class{@t{ }, SortedCollection} @class{@t{ }, Set} @class{@t{ }, Dictionary} @class{@t{ }, LookupTable} @class{@t{ }, IdentityDictionary} @class{@t{ }, MethodDictionary} @class{@t{ }, WeakKeyLookupTable} @class{@t{ }, WeakKeyIdentityDictionary} @class{@t{ }, WeakValueLookupTable} @class{@t{ }, WeakValueIdentityDictionary} @class{@t{ }, RootNamespace} @class{@t{ }, Namespace} @class{@t{ }, SystemDictionary} @class{@t{ }, IdentitySet} @class{@t{ }, WeakSet} @class{@t{ }, WeakIdentitySet} @class{@t{ }, ContextPart} @class{@t{ }, BlockContext} @class{@t{ }, MethodContext} @class{@t{ }, CType} @class{@t{ }, CPtrCType} @class{@t{ }, CArrayCType} @class{@t{ }, CScalarCType} @class{@t{ }, Delay} @class{@t{ }, DLD} @class{@t{ }, DumperProxy} @class{@t{ }, ExceptionHandler} @class{@t{ }, File} @class{@t{ }, Directory} @class{@t{ }, FileSegment} @class{@t{ }, Link} @class{@t{ }, Process} @class{@t{ }, SymLink} @class{@t{ }, Magnitude} @class{@t{ }, Character} @class{@t{ }, Date} @class{@t{ }, LookupKey} @class{@t{ }, Association} @class{@t{ }, Number} @class{@t{ }, Float} @class{@t{ }, Fraction} @class{@t{ }, Integer} @class{@t{ }, LargeInteger} @class{@t{ }, LargeNegativeInteger} @class{@t{ }, LargePositiveInteger} @class{@t{ }, LargeZeroInteger} @class{@t{ }, SmallInteger} @class{@t{ }, Time} @class{@t{ }, Memory} @class{@t{ }, ByteMemory} @class{@t{ }, WordMemory} @class{@t{ }, Message} @class{@t{ }, DirectedMessage} @class{@t{ }, MethodInfo} @class{@t{ }, NullProxy} @class{@t{ }, PackageLoader} @class{@t{ }, Point} @class{@t{ }, ProcessorScheduler} @class{@t{ }, Rectangle} @class{@t{ }, SharedQueue} @class{@t{ }, Signal} @class{@t{ }, Stream} @class{@t{ }, ObjectDumper} @class{@t{ }, PositionableStream} @class{@t{ }, ReadStream} @class{@t{ }, WriteStream} @class{@t{ }, ReadWriteStream} @class{@t{ }, ByteStream} @class{@t{ }, FileStream} @class{@t{ }, Random} @class{@t{ }, TextCollector} @class{@t{ }, TokenStream} @class{@t{ }, TrappableEvent} @class{@t{ }, Exception} @class{@t{ }, ExceptionCollection} @class{@t{ }, UndefinedObject} @class{@t{ }, ValueAdaptor} @class{@t{ }, NullValueHolder} @class{@t{ }, PluggableAdaptor} @class{@t{ }, DelayedAdaptor} @class{@t{ }, ValueHolder} @enddetailmenu @endmenu @unmacro class @unmacro superclass @unmacro endmenu @unmacro beginmenu @unmacro enddetailmenu @unmacro begindetailmenu @node ActiveHandlersList @section ActiveHandlersList @table @b @item Category: Language-Exceptions I track the active handlers for a given exception. I can add one, remove one, and track which are already executing (used for implementing #outer and #pass); I can also handle a stack that saves the state of the list around invocations of #on:do:... methods. @end table @menu * ActiveHandlersList class-instance creation:: (class) * ActiveHandlersList-list handling:: (instance) @end menu @node ActiveHandlersList class-instance creation @subsection ActiveHandlersList class: instance creation @table @b @item new Answer a new instance of the receiver and initialize it @*@* @end table @node ActiveHandlersList-list handling @subsection ActiveHandlersList: list handling @table @b @item add: handler Add another handler for the exception to which the receiver is attached. @*@* @item atEnd Answer whether all handlers have been activated and the system must activate the default handler @*@* @item next Answer the next handler to be activated, and advance the pointer. @*@* @item peek Look which is the next handler to be activated, but don't advance the pointer. @*@* @item pop Pop from the state stack a snapshot of the current handlers @*@* @item push Push on the state stack a snapshot of the current handlers @*@* @item reset Reinstate all handlers @*@* @end table @node Array @section Array @table @b @item 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. @end table @menu * Array-mutating objects:: (instance) * Array-printing:: (instance) * Array-testing:: (instance) @end menu @node Array-mutating objects @subsection Array: mutating objects @table @b @item multiBecome: anArray Transform every object in the receiver in each corresponding object in anArray. anArray and the receiver must have the same size @*@* @end table @node Array-printing @subsection Array: printing @table @b @item printOn: aStream Print a representation for the receiver on aStream @*@* @end table @node Array-testing @subsection Array: testing @table @b @item isArray Answer `true'.@*@* @end table @node ArrayedCollection @section ArrayedCollection @table @b @item 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. @end table @menu * ArrayedCollection class-instance creation:: (class) * ArrayedCollection-basic:: (instance) * ArrayedCollection-built ins:: (instance) * ArrayedCollection-copying Collections:: (instance) * ArrayedCollection-enumerating the elements of a collection:: (instance) * ArrayedCollection-storing:: (instance) @end menu @node ArrayedCollection class-instance creation @subsection ArrayedCollection class: instance creation @table @b @item new Answer an empty collection @*@* @item new: size withAll: anObject Answer a collection with the given size, whose elements are all set to anObject @*@* @item with: element1 Answer a collection whose only element is element1 @*@* @item with: element1 with: element2 Answer a collection whose only elements are the parameters in the order they were passed @*@* @item with: element1 with: element2 with: element3 Answer a collection whose only elements are the parameters in the order they were passed @*@* @item with: element1 with: element2 with: element3 with: element4 Answer a collection whose only elements are the parameters in the order they were passed @*@* @item withAll: aCollection Answer a collection whose elements are the same as those in aCollection @*@* @end table @node ArrayedCollection-basic @subsection ArrayedCollection: basic @table @b @item , aSequenceableCollection Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection @*@* @item add: value This method should not be called for instances of this class.@*@* @item copyWith: anElement Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by the single item anElement @*@* @item copyWithout: oldElement Answer a copy of the receiver to which all occurrences of oldElement are removed @*@* @end table @node ArrayedCollection-built ins @subsection ArrayedCollection: built ins @table @b @item size Answer the size of the receiver @*@* @end table @node ArrayedCollection-copying Collections @subsection ArrayedCollection: copying Collections @table @b @item reverse Answer the receivers' contents in reverse order @*@* @end table @node ArrayedCollection-enumerating the elements of a collection @subsection ArrayedCollection: enumerating the elements of a collection @table @b @item collect: aBlock Answer a new instance of an ArrayedCollection containing all the results of evaluating aBlock passing each of the receiver's elements @*@* @item reject: aBlock Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer false @*@* @item select: aBlock Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer true @*@* @item with: aSequenceableCollection collect: aBlock Evaluate aBlock for each pair of elements took respectively from the re- ceiver and from aSequenceableCollection; answer a collection of the same kind of the receiver, made with the block's return values. Fail if the receiver has not the same size as aSequenceableCollection. @*@* @end table @node ArrayedCollection-storing @subsection ArrayedCollection: storing @table @b @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Association @section Association @table @b @item 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. @end table @menu * Association class-basic:: (class) * Association-accessing:: (instance) * Association-printing:: (instance) * Association-storing:: (instance) * Association-testing:: (instance) @end menu @node Association class-basic @subsection Association class: basic @table @b @item key: aKey value: aValue Answer a new association with the given key and value @*@* @end table @node Association-accessing @subsection Association: accessing @table @b @item key: aKey value: aValue Set the association's key to aKey, and its value to aValue @*@* @item value Answer the association's value @*@* @item value: aValue Set the association's value to aValue @*@* @end table @node Association-printing @subsection Association: printing @table @b @item printOn: aStream Put on aStream a representation of the receiver @*@* @end table @node Association-storing @subsection Association: storing @table @b @item storeOn: aStream Put on aStream some Smalltalk code compiling to the receiver @*@* @end table @node Association-testing @subsection Association: testing @table @b @item = anAssociation Answer whether the association's key and value are the same as anAssociation's, or false if anAssociation is not an Association @*@* @item hash Answer an hash value for the receiver @*@* @end table @node Autoload @section Autoload @table @b @item Category: Examples-Useful tools I am not a part of the normal Smalltalk kernel class system. I provide the ability to do late-loading or "on demand loading" of class definitions. Through me, you can define any class to be loaded when any message is sent to the class itself (such as to create an instance). @end table @menu * Autoload class-instance creation:: (class) * Autoload-accessing:: (instance) @end menu @node Autoload class-instance creation @subsection Autoload class: instance creation @table @b @item class: classNameString from: fileNameString Make Smalltalk automatically load the class named classNameString from fileNameString when needed @*@* @end table @node Autoload-accessing @subsection Autoload: accessing @table @b @item doesNotUnderstand: aMessage Load the file, then reinvoke the method forwarding it to the newly loaded class. @*@* @end table @node Bag @section Bag @table @b @item 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. @end table @menu * Bag class-basic:: (class) * Bag-Adding to a collection:: (instance) * Bag-enumerating the elements of a collection:: (instance) * Bag-extracting items:: (instance) * Bag-printing:: (instance) * Bag-Removing from a collection:: (instance) * Bag-storing:: (instance) * Bag-testing collections:: (instance) @end menu @node Bag class-basic @subsection Bag class: basic @table @b @item new Answer a new instance of the receiver @*@* @end table @node Bag-Adding to a collection @subsection Bag: Adding to a collection @table @b @item add: newObject Add an occurrence of newObject to the receiver. Answer newObject @*@* @item add: newObject withOccurrences: anInteger If anInteger > 0, add anInteger occurrences of newObject to the receiver. If anInteger < 0, remove them. Answer newObject @*@* @end table @node Bag-enumerating the elements of a collection @subsection Bag: enumerating the elements of a collection @table @b @item asSet Answer a set with the elements of the receiver @*@* @item do: aBlock Evaluate the block for all members in the collection. @*@* @end table @node Bag-extracting items @subsection Bag: extracting items @table @b @item sortedByCount Answer a collection of counts with elements, sorted by decreasing count. @*@* @end table @node Bag-printing @subsection Bag: printing @table @b @item printOn: aStream Put on aStream a representation of the receiver @*@* @end table @node Bag-Removing from a collection @subsection Bag: Removing from a collection @table @b @item remove: oldObject ifAbsent: anExceptionBlock Remove oldObject from the collection and return it. If can't be found, answer instead the result of evaluationg anExceptionBlock @*@* @end table @node Bag-storing @subsection Bag: storing @table @b @item storeOn: aStream Put on aStream some Smalltalk code compiling to the receiver @*@* @end table @node Bag-testing collections @subsection Bag: testing collections @table @b @item = aBag Answer whether the receiver and aBag contain the same objects @*@* @item hash Answer an hash value for the receiver @*@* @item includes: anObject Answer whether we include anObject @*@* @item occurrencesOf: anObject Answer the number of occurrences of anObject found in the receiver @*@* @item size Answer the total number of objects found in the receiver @*@* @end table @node Behavior @section Behavior @table @b @item 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. @end table @menu * Behavior class-C interface:: (class) * Behavior-accessing class hierarchy:: (instance) * Behavior-accessing instances and variables:: (instance) * Behavior-accessing the methodDictionary:: (instance) * Behavior-browsing:: (instance) * Behavior-built ins:: (instance) * Behavior-C callout:: (instance) * Behavior-compilation (alternative):: (instance) * Behavior-creating a class hierarchy:: (instance) * Behavior-creating method dictionary:: (instance) * Behavior-enumerating:: (instance) * Behavior-evaluating:: (instance) * Behavior-hierarchy browsing:: (instance) * Behavior-instance variables:: (instance) * Behavior-support for lightweight classes:: (instance) * Behavior-testing the class hierarchy:: (instance) * Behavior-testing the form of the instances:: (instance) * Behavior-testing the method dictionary:: (instance) @end menu @node Behavior class-C interface @subsection Behavior class: C interface @table @b @item 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. @*@* @end table @node Behavior-accessing class hierarchy @subsection Behavior: accessing class hierarchy @table @b @item allSubclasses Answer the direct and indirect subclasses of the receiver in a Set @*@* @item allSuperclasses Answer all the receiver's superclasses in a collection @*@* @item subclasses Answer the direct subclasses of the receiver in a Set @*@* @item superclass Answer the receiver's superclass (if any, otherwise answer nil) @*@* @item withAllSubclasses Answer a Set containing the receiver together with its direct and indirect subclasses @*@* @item withAllSuperclasses Answer the receiver and all of its superclasses in a collection @*@* @end table @node Behavior-accessing instances and variables @subsection Behavior: accessing instances and variables @table @b @item allClassVarNames Return all the class variables understood by the receiver @*@* @item allInstances Returns a set of all instances of the receiver @*@* @item allInstVarNames Answer the names of every instance variables the receiver contained in the receiver's instances @*@* @item allSharedPools Return the names of the shared pools defined by the class and any of its superclasses @*@* @item 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. @*@* @item classVarNames Answer all the class variables for instances of the receiver @*@* @item instanceCount Return a count of all the instances of the receiver @*@* @item instVarNames Answer an Array containing the instance variables defined by the receiver @*@* @item sharedPools Return the names of the shared pools defined by the class @*@* @item subclassInstVarNames Answer the names of the instance variables the receiver inherited from its superclass @*@* @end table @node Behavior-accessing the methodDictionary @subsection Behavior: accessing the methodDictionary @table @b @item >> selector Return the compiled method associated with selector, from the local method dictionary. Error if not found. @*@* @item allSelectors Answer a Set of all the selectors understood by the receiver @*@* @item compiledMethodAt: selector Return the compiled method associated with selector, from the local method dictionary. Error if not found. @*@* @item selectorAt: method Return selector for the given compiledMethod @*@* @item selectors Answer a Set of the receiver's selectors @*@* @item sourceCodeAt: selector Answer source code (if available) for the given compiledMethod @*@* @item sourceMethodAt: selector This is too dependent on the original implementation @*@* @end table @node Behavior-browsing @subsection Behavior: browsing @table @b @item 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 @*@* @item 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 @*@* @item 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 @*@* @item getMethods Answer the receiver's complete method dictionary - including inherited and not overridden methods @*@* @item 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 @*@* @item methodDictionary Answer the receiver's method dictionary @*@* @item 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 @*@* @end table @node Behavior-built ins @subsection Behavior: built ins @table @b @item basicNew Create a new instance of a class with no indexed instance variables @*@* @item basicNew: numInstanceVariables Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables. @*@* @item 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 @*@* @item 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 @*@* @item flushCache Invalidate the method cache kept by the virtual machine. This message should not need to be called by user programs. @*@* @item makeDescriptorFor: funcNameString returning: returnTypeSymbol withArgs: argsArray Private - Answer a CFunctionDescriptor @*@* @item methodsFor: category ifTrue: condition Compile the following code inside the receiver, with the given category, if condition is true; else ignore it @*@* @item new Create a new instance of a class with no indexed instance variables @*@* @item new: numInstanceVariables Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables. @*@* @item someInstance Private - Answer the first instance of the receiver in the object table @*@* @end table @node Behavior-C callout @subsection Behavior: C callout @table @b @item defineCFunc: cFuncName withSelectorArgs: selector returning: aReturnType args: argsArray Too complex to describe it here - Look up the C interface in the manual. @*@* @end table @node Behavior-compilation (alternative) @subsection Behavior: compilation (alternative) @table @b @item methods Don't use this, it's only present to file in from Smalltalk/V @*@* @item methodsFor Don't use this, it's only present to file in from Dolphin Smalltalk @*@* @item methodsFor: category ifFeatures: features Start compiling methods in the receiver if this implementation of Smalltalk has the given features, else skip the section @*@* @item methodsFor: category stamp: notUsed Don't use this, it's only present to file in from Squeak @*@* @item privateMethods Don't use this, it's only present to file in from IBM Smalltalk @*@* @item publicMethods Don't use this, it's only present to file in from IBM Smalltalk @*@* @end table @node Behavior-creating a class hierarchy @subsection Behavior: creating a class hierarchy @table @b @item addSubclass: aClass Add aClass asone of the receiver's subclasses. @*@* @item removeSubclass: aClass Remove aClass from the list of the receiver's subclasses @*@* @item superclass: aClass Set the receiver's superclass. @*@* @end table @node Behavior-creating method dictionary @subsection Behavior: creating method dictionary @table @b @item addSelector: selector withMethod: compiledMethod Add the given compiledMethod to the method dictionary, giving it the passed selector. Answer compiledMethod @*@* @item compile: code Compile method source. If there are parsing errors, answer nil. Else, return a CompiledMethod result of compilation @*@* @item 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 @*@* @item 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 @*@* @item compileAll Recompile all selectors in the receiver. Ignore errors. @*@* @item compileAll: aNotifier Recompile all selectors in the receiver. Notify aNotifier by sen- ding #error: messages if something goes wrong. @*@* @item compileAllSubclasses Recompile all selector of all subclasses. Notify aNotifier by sen- ding #error: messages if something goes wrong. @*@* @item compileAllSubclasses: aNotifier Recompile all selector of all subclasses. Notify aNotifier by sen- ding #error: messages if something goes wrong. @*@* @item createGetMethod: what Create a method accessing the variable `what'. @*@* @item createGetMethod: what default: value Create a method accessing the variable `what', with a default value of `value', using lazy initialization @*@* @item createSetMethod: what Create a method which sets the variable `what'. @*@* @item decompile: selector Decompile the bytecodes for the given selector. @*@* @item edit: selector Open Emacs to edit the method with the passed selector, then compile it @*@* @item methodDictionary: aDictionary Set the receiver's method dictionary to aDictionary @*@* @item recompile: selector Recompile the given selector, answer nil if something goes wrong or the new CompiledMethod if everything's ok. @*@* @item 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 @*@* @item removeSelector: selector Remove the given selector from the method dictionary, answer the CompiledMethod attached to that selector @*@* @item 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. @*@* @end table @node Behavior-enumerating @subsection Behavior: enumerating @table @b @item allInstancesDo: aBlock Invokes aBlock for all instances of the receiver @*@* @item allSubclassesDo: aBlock Invokes aBlock for all subclasses, both direct and indirect. @*@* @item allSubinstancesDo: aBlock Invokes aBlock for all instances of each of the receiver's subclasses. @*@* @item allSuperclassesDo: aBlock Invokes aBlock for all superclasses, both direct and indirect. @*@* @item selectSubclasses: aBlock Return a Set of subclasses of the receiver satisfying aBlock. @*@* @item selectSuperclasses: aBlock Return a Set of superclasses of the receiver satisfying aBlock. @*@* @item subclassesDo: aBlock Invokes aBlock for all direct subclasses. @*@* @item withAllSubclassesDo: aBlock Invokes aBlock for the receiver and all subclasses, both direct and indirect. @*@* @item withAllSuperclassesDo: aBlock Invokes aBlock for the receiver and all superclasses, both direct and indirect. @*@* @end table @node Behavior-evaluating @subsection Behavior: evaluating @table @b @item 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 @*@* @item 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 @*@* @item evaluate: code Evaluate Smalltalk expression in 'code' and return result. @*@* @item evaluate: code ifError: block Evaluate 'code'. If a parsing error is detected, invoke 'block' @*@* @item evaluate: code notifying: requestor Evaluate Smalltalk expression in 'code'. If a parsing error is encountered, invoke error block, 'block' @*@* @item evaluate: code to: anObject Evaluate Smalltalk expression as part of anObject's method definition @*@* @item 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' @*@* @end table @node Behavior-hierarchy browsing @subsection Behavior: hierarchy browsing @table @b @item printHierarchy Print my entire subclass hierarchy on the terminal. @*@* @item printHierarchyEmacs Print my entire subclass hierarchy on the terminal, in a format suitable for Emacs parsing. @*@* @end table @node Behavior-instance variables @subsection Behavior: instance variables @table @b @item addInstVarName: aString Add the given instance variable to instance of the receiver @*@* @item removeInstVarName: aString Remove the given instance variable from the receiver and recompile all of the receiver's subclasses @*@* @end table @node Behavior-support for lightweight classes @subsection Behavior: support for lightweight classes @table @b @item article Answer an article (`a' or `an') which is ok for the receiver's name @*@* @item asClass Answer the first superclass that is a full-fledged Class object @*@* @item environment Answer the namespace that this class belongs to - the same as the superclass, since Behavior does not support namespaces yet. @*@* @item name Answer the class name; this prints to the name of the superclass enclosed in braces. This class name is used, for example, to print the receiver. @*@* @item nameIn: aNamespace Answer the class name when the class is referenced from aNamespace - a dummy one, since Behavior does not support names. @*@* @end table @node Behavior-testing the class hierarchy @subsection Behavior: testing the class hierarchy @table @b @item inheritsFrom: aClass Returns true if aClass is a superclass of the receiver @*@* @item kindOfSubclass Return a string indicating the type of class the receiver is @*@* @end table @node Behavior-testing the form of the instances @subsection Behavior: testing the form of the instances @table @b @item instSize Answer how many fixed instance variables are reserved to each of the receiver's instances @*@* @item isBits Answer whether the instance variables of the receiver's instances are bytes or words @*@* @item isBytes Answer whether the instance variables of the receiver's instances are bytes @*@* @item isFixed Answer whether the receiver's instances have no indexed instance variables @*@* @item isIdentity Answer whether x = y implies x == y for instances of the receiver @*@* @item isImmediate Answer whether, if x is an instance of the receiver, x copy == x @*@* @item isPointers Answer whether the instance variables of the receiver's instances are objects @*@* @item isVariable Answer whether the receiver's instances have indexed instance variables @*@* @item isWords Answer whether the instance variables of the receiver's instances are words @*@* @end table @node Behavior-testing the method dictionary @subsection Behavior: testing the method dictionary @table @b @item canUnderstand: selector Returns true if the instances of the receiver understand the given selector @*@* @item hasMethods Return whether the receiver has any methods defined @*@* @item includesSelector: selector Returns true if the local method dictionary contains the given selector @*@* @item scopeHas: name ifTrue: aBlock If methods understood by the receiver's instances have access to a symbol named 'name', evaluate aBlock @*@* @item 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) @*@* @item whichSelectorsAccess: instVarName Answer a Set of selectors which access the given instance variable @*@* @item whichSelectorsReferTo: anObject Returns a Set of selectors that refer to anObject @*@* @item whichSelectorsReferToByteCode: aByteCode Return the collection of selectors in the class which reference the byte code, aByteCode @*@* @end table @node BlockClosure @section BlockClosure @table @b @item 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. @end table @menu * BlockClosure class-instance creation:: (class) * BlockClosure class-testing:: (class) * BlockClosure-accessing:: (instance) * BlockClosure-built ins:: (instance) * BlockClosure-control structures:: (instance) * BlockClosure-exception handling:: (instance) * BlockClosure-multiple process:: (instance) * BlockClosure-overriding:: (instance) * BlockClosure-testing:: (instance) @end menu @node BlockClosure class-instance creation @subsection BlockClosure class: instance creation @table @b @item block: aCompiledBlock Answer a BlockClosure that activates the passed CompiledBlock. @*@* @item numArgs: args numTemps: temps bytecodes: bytecodes depth: depth literals: literalArray Answer a BlockClosure for a new CompiledBlock that is created using the passed parameters. To make it work, you must put the BlockClosure into a CompiledMethod's literals. @*@* @end table @node BlockClosure class-testing @subsection BlockClosure class: testing @table @b @item isImmediate Answer whether, if x is an instance of the receiver, x copy == x @*@* @end table @node BlockClosure-accessing @subsection BlockClosure: accessing @table @b @item block Answer the CompiledBlock which contains the receiver's bytecodes @*@* @item block: aCompiledBlock Set the CompiledBlock which contains the receiver's bytecodes @*@* @item finalIP Answer the last instruction that can be executed by the receiver @*@* @item fixTemps This should fix the values of the temporary variables used in the block that are ordinarily shared with the method in which the block is defined. Not defined yet, but it is not harmful that it isn't. Answer the receiver. @*@* @item initialIP Answer the initial instruction pointer into the receiver. @*@* @item method Answer the CompiledMethod in which the receiver lies @*@* @item numArgs Answer the number of arguments passed to the receiver @*@* @item numTemps Answer the number of temporary variables used by the receiver @*@* @item outerContext Answer the method/block context which is the immediate outer of the receiver @*@* @item outerContext: containingContext Set the method/block context which is the immediate outer of the receiver @*@* @item receiver Answer the object that is used as `self' when executing the receiver (if nil, it might mean that the receiver is not valid though...) @*@* @item receiver: anObject Set the object that is used as `self' when executing the receiver @*@* @item stackDepth Answer the number of stack slots needed for the receiver @*@* @end table @node BlockClosure-built ins @subsection BlockClosure: built ins @table @b @item blockCopy: outerContext Generate a BlockClosure identical to the receiver, with the given context as its outer context. @*@* @item value Evaluate the receiver passing no parameters @*@* @item value: arg1 Evaluate the receiver passing arg1 as the only parameter @*@* @item value: arg1 value: arg2 Evaluate the receiver passing arg1 and arg2 as the parameters @*@* @item value: arg1 value: arg2 value: arg3 Evaluate the receiver passing arg1, arg2 and arg3 as the parameters @*@* @item valueWithArguments: argumentsArray Evaluate the receiver passing argArray's elements as the parameters @*@* @end table @node BlockClosure-control structures @subsection BlockClosure: control structures @table @b @item repeat Evaluate the receiver 'forever' (actually until a return is executed or the process is terminated). @*@* @item whileFalse Evaluate the receiver until it returns true @*@* @item whileFalse: aBlock Evaluate the receiver. If it returns false, evaluate aBlock and re- start @*@* @item whileTrue Evaluate the receiver until it returns false @*@* @item whileTrue: aBlock Evaluate the receiver. If it returns true, evaluate aBlock and re- start @*@* @end table @node BlockClosure-exception handling @subsection BlockClosure: exception handling @table @b @item 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 @*@* @item 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 @*@* @item 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: @*@* @item 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: @*@* @item 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: @*@* @item 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: @*@* @item 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: @*@* @item 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: @*@* @end table @node BlockClosure-multiple process @subsection BlockClosure: multiple process @table @b @item fork Create a new process executing the receiver and start it @*@* @item forkAt: priority Create a new process executing the receiver with given priority and start it @*@* @item 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 @*@* @item 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 @*@* @end table @node BlockClosure-overriding @subsection BlockClosure: overriding @table @b @item deepCopy Answer the receiver.@*@* @item shallowCopy Answer the receiver.@*@* @end table @node BlockClosure-testing @subsection BlockClosure: testing @table @b @item hasMethodReturn Answer whether the block contains a method return @*@* @end table @node BlockContext @section BlockContext @table @b @item 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. @end table @menu * BlockContext-accessing:: (instance) * BlockContext-printing:: (instance) @end menu @node BlockContext-accessing @subsection BlockContext: accessing @table @b @item caller Answer the context that called the receiver @*@* @item home Answer the MethodContext to which the receiver refers, or nil if it has been optimized away @*@* @item isBlock Answer whether the receiver is a block context @*@* @item isEnvironment 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. Answer whether the receiver is that kind of context (always false, since those contexts are always MethodContexts). @*@* @item nthOuterContext: n Answer the n-th outer block/method context for the receiver @*@* @item outerContext Answer the outer block/method context for the receiver @*@* @end table @node BlockContext-printing @subsection BlockContext: printing @table @b @item printOn: aStream Print a representation for the receiver on aStream @*@* @end table @node Boolean @section Boolean @table @b @item 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. @end table @menu * Boolean class-testing:: (class) * Boolean-basic:: (instance) * Boolean-C hacks:: (instance) * Boolean-overriding:: (instance) * Boolean-storing:: (instance) @end menu @node Boolean class-testing @subsection Boolean class: testing @table @b @item isIdentity Answer whether x = y implies x == y for instances of the receiver @*@* @item isImmediate Answer whether, if x is an instance of the receiver, x copy == x @*@* @end table @node Boolean-basic @subsection Boolean: basic @table @b @item & aBoolean This method's functionality should be implemented by subclasses of Boolean@*@* @item and: aBlock This method's functionality should be implemented by subclasses of Boolean@*@* @item eqv: aBoolean This method's functionality should be implemented by subclasses of Boolean@*@* @item ifFalse: falseBlock This method's functionality should be implemented by subclasses of Boolean@*@* @item ifFalse: falseBlock ifTrue: trueBlock This method's functionality should be implemented by subclasses of Boolean@*@* @item ifTrue: trueBlock This method's functionality should be implemented by subclasses of Boolean@*@* @item ifTrue: trueBlock ifFalse: falseBlock This method's functionality should be implemented by subclasses of Boolean@*@* @item not This method's functionality should be implemented by subclasses of Boolean@*@* @item or: aBlock This method's functionality should be implemented by subclasses of Boolean@*@* @item xor: aBoolean This method's functionality should be implemented by subclasses of Boolean@*@* @item | aBoolean This method's functionality should be implemented by subclasses of Boolean@*@* @end table @node Boolean-C hacks @subsection Boolean: C hacks @table @b @item asCBooleanValue This method's functionality should be implemented by subclasses of Boolean@*@* @end table @node Boolean-overriding @subsection Boolean: overriding @table @b @item deepCopy Answer the receiver.@*@* @item shallowCopy Answer the receiver.@*@* @end table @node Boolean-storing @subsection Boolean: storing @table @b @item storeOn: aStream Store on aStream some Smalltalk code which compiles to the receiver @*@* @end table @node Browser @section Browser @table @b @item Category: Language-Implementation @end table @menu * Browser class-browsing:: (class) @end menu @node Browser class-browsing @subsection Browser class: browsing @table @b @item browseHierarchy Tell Emacs tp browse the Smalltalk class hierarchy @*@* @item 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 @*@* @item emacsFunction: funcName on: aBlock Send to Emacs something like (funcName ) @*@* @item emacsListFunction: funcName on: aBlock Send to Emacs something like (funcName '()) @*@* @item finishEmacsMessage Finish a message to be processed by emacs - does nothing for now @*@* @item getAllSelectors: selector inBuffer: bufferName Send to Emacs code that browses the implementors of the given selectors in a buffer with the given name @*@* @item initialize Initialize the Emacs browsing system @*@* @item loadClassNames Tell Emacs the class names (new version) @*@* @item oldloadClassNames Tell Emacs the class names @*@* @item oldShowInstanceMethods: class Send to Emacs code that browses instance methods for class @*@* @item oldShowMethods: class for: methodType Send to Emacs code that browses methods of the given type for class (methodType is either `class' or `instance') @*@* @item selectorsForEmacs Tell Emacs the names of ALL the defined selectors @*@* @item 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 @*@* @item showDirectMethods: class inBuffer: bufferName Send to Emacs code that browses methods defined in the given class, in a buffer with the given name @*@* @item 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 @*@* @item showMethods: class for: methodType Send to Emacs code that browses methods of the given type for class (methodType is either `class' or `instance') @*@* @item startEmacsMessage Start a message to be processed by emacs as Lisp @*@* @item testMethods: aClass for: methodType Send to Emacs code that browses methods of the given type for class (methodType is either `class' or `instance') @*@* @item withGcOff: aBlock Evaluate aBlock while the `GC flipping...' message is off @*@* @end table @node ByteArray @section ByteArray @table @b @item 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. @end table @menu * ByteArray-built ins:: (instance) * ByteArray-converting:: (instance) * ByteArray-copying:: (instance) * ByteArray-more advanced accessing:: (instance) @end menu @node ByteArray-built ins @subsection ByteArray: built ins @table @b @item asCData: aCType Convert the receiver to a CObject with the given type @*@* @item byteAt: index Answer the index-th indexed instance variable of the receiver @*@* @item byteAt: index put: value Store the `value' byte in the index-th indexed instance variable of the receiver @*@* @item hash Answer an hash value for the receiver @*@* @item 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 @*@* @item 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 @*@* @end table @node ByteArray-converting @subsection ByteArray: converting @table @b @item asString Answer a String whose character's ASCII codes are the receiver's contents @*@* @end table @node ByteArray-copying @subsection ByteArray: copying @table @b @item deepCopy Answer a shallow copy of the receiver @*@* @item shallowCopy Answer a shallow copy of the receiver @*@* @end table @node ByteArray-more advanced accessing @subsection ByteArray: more advanced accessing @table @b @item 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. @*@* @item 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. @*@* @item doubleAt: index Access the C double at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. @*@* @item 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. @*@* @item floatAt: index Access the C float at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. @*@* @item 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. @*@* @item intAt: index Access the C int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. @*@* @item 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. @*@* @item longAt: index Access the C long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. @*@* @item 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. @*@* @item objectAt: index Access the Smalltalk object (OOP) at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. @*@* @item 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. @*@* @item shortAt: index Access the C short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item unsignedIntAt: index Access the C unsigned int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @end table @node ByteMemory @section ByteMemory @table @b @item 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. @end table @menu * ByteMemory class-basic:: (class) @end menu @node ByteMemory class-basic @subsection ByteMemory class: basic @table @b @item at: address Returns the byte at address as an integer @*@* @item at: address put: value Sets the byte at ADDRESS (an integer) to be VALUE (INTEGER 0..255) @*@* @end table @node ByteStream @section ByteStream @table @b @item Category: Streams-Collections My instances are read/write streams specially crafted for ByteArrays. They are able to write binary data to them. @end table @menu * ByteStream-basic:: (instance) @end menu @node ByteStream-basic @subsection ByteStream: basic @table @b @item next Return the next *character* in the ByteArray @*@* @item nextByte Return the next byte in the byte array @*@* @item nextByteArray: numBytes Return the next numBytes bytes in the byte array @*@* @item nextLong Return the next 4 bytes in the byte array, interpreted as a 32 bit signed int @*@* @item nextPut: aChar Store aChar on the byte array @*@* @item nextPutAll: aCollection Write all the objects in aCollection to the receiver @*@* @item nextPutByte: anInteger Store anInteger (range: -128..255) on the byte array @*@* @item nextPutByteArray: aByteArray Store aByteArray on the byte array @*@* @item nextPutLong: anInteger Store anInteger (range: -2^31..2^32-1) on the byte array as 4 bytes @*@* @item nextPutShort: anInteger Store anInteger (range: -32768..65535) on the byte array as 2 bytes @*@* @item nextShort Return the next 2 bytes in the byte array, interpreted as a 16 bit signed int @*@* @item nextSignedByte Return the next byte in the byte array, interpreted as a 8 bit signed number @*@* @item nextUlong Return the next 4 bytes in the byte array, interpreted as a 32 bit unsigned int @*@* @item nextUshort Return the next 2 bytes in the byte array, interpreted as a 16 bit unsigned int @*@* @end table @node CAggregate @section CAggregate @table @b @item Category: Language-C interface @end table @menu * CAggregate class-accessing:: (class) * CAggregate-accessing:: (instance) @end menu @node CAggregate class-accessing @subsection CAggregate class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CAggregate-accessing @subsection CAggregate: accessing @table @b @item + anInteger Return another instance of the receiver's class which points at &receiver[anInteger] (or, if you prefer, what `receiver + anInteger' does in C). @*@* @item - intOrPtr If intOrPtr is an integer, return another instance of the receiver's class pointing at &receiver[-anInteger] (or, if you prefer, what `receiver - anInteger' does in C). If it is the same class as the receiver, return the difference in chars, i.e. in bytes, between the two pointed addresses (or, if you prefer, what `receiver - anotherCharPtr' does in C) @*@* @item 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. @*@* @item decr Adjust the pointer by sizeof(elementType) bytes down (i.e. --receiver) @*@* @item decrBy: anInteger Adjust the pointer by anInteger elements down (i.e. receiver -= anInteger) @*@* @item 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. @*@* @item deref: aValue Modify the object, storing the object of the element type into the pointed address or in the first element of the array. @*@* @item derefAt: 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. @*@* @item derefAt: 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. @*@* @item incr Adjust the pointer by sizeof(elementType) bytes up (i.e. ++receiver) @*@* @item incrBy: anInteger Adjust the pointer by anInteger elements up (i.e. receiver += anInteger) @*@* @item value Answer the address of the beginning of the data pointed to by the receiver. @*@* @item value: aValue Set the address of the beginning of the data pointed to by the receiver. @*@* @end table @node CArray @section CArray @table @b @item Category: Language-C interface @end table @menu * CArray-accessing:: (instance) @end menu @node CArray-accessing @subsection CArray: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item sizeof Answer the receiver's size @*@* @end table @node CArrayCType @section CArrayCType @table @b @item Category: Language-C interface @end table @menu * CArrayCType class-instance creation:: (class) * CArrayCType-accessing:: (instance) @end menu @node CArrayCType class-instance creation @subsection CArrayCType class: instance creation @table @b @item elementType: aCType This method should not be called for instances of this class.@*@* @item 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). @*@* @end table @node CArrayCType-accessing @subsection CArrayCType: accessing @table @b @item alignof Answer the alignment of the receiver's instances @*@* @item numberOfElements Answer the number of elements in the receiver's instances @*@* @item sizeof Answer the size of the receiver's instances @*@* @end table @node CBoolean @section CBoolean @table @b @item Category: Language-C interface I return true if a byte is not zero, false otherwise. @end table @menu * CBoolean-accessing:: (instance) @end menu @node CBoolean-accessing @subsection CBoolean: accessing @table @b @item value Get the receiver's value - answer true if it is != 0, false if it is 0. @*@* @item value: aBoolean Set the receiver's value - it's the same as for CBytes, but we get a Boolean, not a Character @*@* @end table @node CByte @section CByte @table @b @item Category: Language-C interface You're a marine. You adapt -- you improvise -- you overcome - Gunnery Sgt. Thomas Highway Heartbreak Ridge @end table @menu * CByte class-conversion:: (class) * CByte-accessing:: (instance) @end menu @node CByte class-conversion @subsection CByte class: conversion @table @b @item scalarIndex Nothing special in the default case - answer a CType for the receiver @*@* @item type Nothing special in the default case - answer a CType for the receiver @*@* @end table @node CByte-accessing @subsection CByte: accessing @table @b @item scalarIndex Nothing special in the default case - answer the receiver's CType @*@* @item type Answer a CType for the receiver @*@* @item value Answer the value the receiver is pointing to. The returned is a SmallInteger @*@* @item value: aValue Set the receiver to point to the value, aValue (a SmallInteger). @*@* @end table @node CChar @section CChar @table @b @item Category: Language-C interface @end table @menu * CChar class-accessing:: (class) * CChar-accessing:: (instance) @end menu @node CChar class-accessing @subsection CChar class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CChar-accessing @subsection CChar: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CDouble @section CDouble @table @b @item Category: Language-C interface @end table @menu * CDouble class-accessing:: (class) * CDouble-accessing:: (instance) @end menu @node CDouble class-accessing @subsection CDouble class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CDouble-accessing @subsection CDouble: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CFloat @section CFloat @table @b @item Category: Language-C interface @end table @menu * CFloat class-accessing:: (class) * CFloat-accessing:: (instance) @end menu @node CFloat class-accessing @subsection CFloat class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CFloat-accessing @subsection CFloat: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CFunctionDescriptor @section CFunctionDescriptor @table @b @item 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. @end table @menu * CFunctionDescriptor class-testing:: (class) * CFunctionDescriptor-accessing:: (instance) * CFunctionDescriptor-printing:: (instance) @end menu @node CFunctionDescriptor class-testing @subsection CFunctionDescriptor class: testing @table @b @item 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. @*@* @item isFunction: function Answer whether a function is registered (on the C side) with the given name or is dynamically loadable. @*@* @end table @node CFunctionDescriptor-accessing @subsection CFunctionDescriptor: accessing @table @b @item address Answer the address (CObject) of the function represented by the receiver @*@* @item isValid Answer whether the function represented by the receiver is actually a registered one @*@* @item name Answer the name of the function (on the C side) represented by the receiver @*@* @end table @node CFunctionDescriptor-printing @subsection CFunctionDescriptor: printing @table @b @item printOn: aStream Print a representation of the receiver onto aStream @*@* @end table @node Character @section Character @table @b @item 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. @end table @menu * Character class-built ins:: (class) * Character class-constants:: (class) * Character class-initializing lookup tables:: (class) * Character class-Instance creation:: (class) * Character class-testing:: (class) * Character-built ins:: (instance) * Character-Coercion methods:: (instance) * Character-comparing:: (instance) * Character-converting:: (instance) * Character-printing:: (instance) * Character-storing:: (instance) * Character-testing:: (instance) * Character-testing functionality:: (instance) @end menu @node Character class-built ins @subsection Character class: built ins @table @b @item asciiValue: anInteger Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..255. @*@* @item value: anInteger Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..255. @*@* @end table @node Character class-constants @subsection Character class: constants @table @b @item backspace Returns the character 'backspace' @*@* @item bell Returns the character 'bel' @*@* @item cr Returns the character 'cr' @*@* @item eof Returns the character 'eof', aka 'sub' @*@* @item eot Returns the character 'eot', aka 'Ctrl-D' @*@* @item esc Returns the character 'esc' @*@* @item lf Returns the character 'lf', aka 'nl' @*@* @item newPage Returns the character 'newPage', aka 'ff' @*@* @item nl Returns the character 'nl', aka 'lf' @*@* @item nul Returns the character 'nul' @*@* @item space Returns the character 'space' @*@* @item tab Returns the character 'tab' @*@* @end table @node Character class-initializing lookup tables @subsection Character class: initializing lookup tables @table @b @item 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. @*@* @end table @node Character class-Instance creation @subsection Character class: Instance creation @table @b @item digitValue: anInteger Returns a character that corresponds to anInteger. 0-9 map to $0-$9, 10-35 map to $A-$Z @*@* @end table @node Character class-testing @subsection Character class: testing @table @b @item isIdentity Answer whether x = y implies x == y for instances of the receiver @*@* @item isImmediate Answer whether, if x is an instance of the receiver, x copy == x @*@* @end table @node Character-built ins @subsection Character: built ins @table @b @item = char Boolean return value; true if the characters are equal @*@* @item asciiValue Returns the integer value corresponding to self @*@* @item asInteger Returns the integer value corresponding to self @*@* @item value Returns the integer value corresponding to self @*@* @end table @node Character-Coercion methods @subsection Character: Coercion methods @table @b @item asLowercase Returns self as a lowercase character if it's an uppercase letter, otherwise returns the character unchanged. @*@* @item asString Returns the character self as a string. @*@* @item asSymbol Returns the character self as a symbol. @*@* @item asUppercase Returns self as a uppercase character if it's an lowercase letter, otherwise returns the character unchanged. @*@* @end table @node Character-comparing @subsection Character: comparing @table @b @item < aCharacter Compare the character's ASCII value. Answer whether the receiver's is the least. @*@* @item <= aCharacter Compare the character's ASCII value. Answer whether the receiver's is the least or their equal. @*@* @item > aCharacter Compare the character's ASCII value. Answer whether the receiver's is the greatest. @*@* @item >= aCharacter Compare the character's ASCII value. Answer whether the receiver's is the greatest or their equal. @*@* @end table @node Character-converting @subsection Character: converting @table @b @item digitValue Returns the value of self interpreted as a digit. Here, 'digit' means either 0-9, or A-Z, which maps to 10-35. @*@* @end table @node Character-printing @subsection Character: printing @table @b @item displayOn: aStream Print a representation of the receiver on aStream. Unlike #printOn:, this method strips the leading dollar. @*@* @item printOn: aStream Store a representation of the receiver on aStream @*@* @end table @node Character-storing @subsection Character: storing @table @b @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Character-testing @subsection Character: testing @table @b @item isAlphaNumeric True if self is a letter or a digit @*@* @item isDigit True if self is a 0-9 digit @*@* @item isLetter True if self is an upper- or lowercase letter @*@* @item isLowercase True if self is a lowercase letter @*@* @item isPunctuation Returns true if self is one of '.,:;!?' @*@* @item isSeparator Returns true if self is a space, cr, tab, nl, or newPage @*@* @item isUppercase True if self is uppercase @*@* @item isVowel Returns true if self is a, e, i, o, or u; case insensitive @*@* @end table @node Character-testing functionality @subsection Character: testing functionality @table @b @item isCharacter Answer True. We're definitely characters @*@* @end table @node CharacterArray @section CharacterArray @table @b @item Category: Language-Data types My instances represent a generic textual (string) data type. I provide accessing and manipulation methods for strings. @end table @menu * CharacterArray class-basic:: (class) * CharacterArray-basic:: (instance) * CharacterArray-built ins:: (instance) * CharacterArray-comparing:: (instance) * CharacterArray-converting:: (instance) * CharacterArray-copying:: (instance) * CharacterArray-printing:: (instance) * CharacterArray-storing:: (instance) * CharacterArray-string processing:: (instance) * CharacterArray-testing functionality:: (instance) @end menu @node CharacterArray class-basic @subsection CharacterArray class: basic @table @b @item fromString: aCharacterArray Make up an instance of the receiver containing the same characters as aCharacterArray, and answer it. @*@* @item lineDelimiter Answer a CharacterArray which one can use as a line delimiter. @*@* @end table @node CharacterArray-basic @subsection CharacterArray: basic @table @b @item basicAt: index Answer the index-th character of the receiver. This is an exception to the `do not override' rule that allows storage optimization by storing the characters as values instead of as objects. @*@* @item basicAt: index put: anObject Set the index-th character of the receiver to be anObject. 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 @*@* @end table @node CharacterArray-built ins @subsection CharacterArray: built ins @table @b @item valueAt: index Answer the ascii value of index-th character variable of the receiver @*@* @item valueAt: index put: value Store (Character value: value) in the index-th indexed instance variable of the receiver @*@* @end table @node CharacterArray-comparing @subsection CharacterArray: comparing @table @b @item < aCharacterArray Return true if the receiver is less than aCharacterArray, ignoring case differences. @*@* @item <= aCharacterArray Returns true if the receiver is less than or equal to aCharacterArray, ignoring case differences. If is receiver is an initial substring of aCharacterArray, it is considered to be less than aCharacterArray. @*@* @item > aCharacterArray Return true if the receiver is greater than aCharacterArray, ignoring case differences. @*@* @item >= aCharacterArray Returns true if the receiver is greater than or equal to aCharacterArray, ignoring case differences. If is aCharacterArray is an initial substring of the receiver, it is considered to be less than the receiver. @*@* @item indexOf: aCharacterArray matchCase: aBoolean startingAt: anIndex Answer an Interval of indices in the receiver which match the aCharacterArray pattern. # in aCharacterArray means 'match any character', * in aCharacterArray 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. @*@* @item match: aCharacterArray Answer whether the receiver matches the aCharacterArray pattern. # in aCharacterArray means 'match any character', * in aCharacterArray means 'match any sequence of characters' @*@* @item sameAs: aCharacterArray Returns true if the receiver is the same CharacterArray as aCharacterArray, ignoring case differences. @*@* @end table @node CharacterArray-converting @subsection CharacterArray: converting @table @b @item asByteArray Return the receiver, converted to a ByteArray of ASCII values @*@* @item asClassPoolKey Return the receiver, ready to be put in a class pool dictionary @*@* @item asGlobalKey Return the receiver, ready to be put in the Smalltalk dictionary @*@* @item asInteger Parse an Integer number from the receiver until the input character is invalid and answer the result at this point @*@* @item asLowercase Returns a copy of self as a lowercase CharacterArray @*@* @item asNumber Parse a Number from the receiver until the input character is invalid and answer the result at this point @*@* @item asPoolKey Return the receiver, ready to be put in a pool dictionary @*@* @item asString But I already am a String! Really! @*@* @item asSymbol Returns the symbol corresponding to the CharacterArray @*@* @item asUppercase Returns a copy of self as an uppercase CharacterArray @*@* @item fileName But I don't HAVE a file name! @*@* @item filePos But I don't HAVE a file position! @*@* @item isNumeric Answer whether the receiver denotes a number @*@* @item trimSeparators Return a copy of the reciever without any spaces on front or back. The implementation is protected against the `all blanks' case. @*@* @end table @node CharacterArray-copying @subsection CharacterArray: copying @table @b @item deepCopy Returns a deep copy of the receiver. This is the same thing as a shallow copy for CharacterArrays @*@* @item shallowCopy Returns a shallow copy of the receiver @*@* @end table @node CharacterArray-printing @subsection CharacterArray: printing @table @b @item displayOn: aStream Print a representation of the receiver on aStream. Unlike #printOn:, this method strips extra quotes. @*@* @item displayString Answer a String representing the receiver. For most objects this is simply its #printString, but for CharacterArrays and characters, superfluous dollars or extra pair of quotes are stripped. @*@* @item printOn: aStream Print a representation of the receiver on aStream @*@* @end table @node CharacterArray-storing @subsection CharacterArray: storing @table @b @item storeOn: aStream Print Smalltalk code compiling to the receiver on aStream @*@* @end table @node CharacterArray-string processing @subsection CharacterArray: string processing @table @b @item bindWith: s1 Answer the receiver with every %1 replaced by s1 @*@* @item bindWith: s1 with: s2 Answer the receiver with every %1 or %2 replaced by s1 or s2, respectively @*@* @item bindWith: s1 with: s2 with: s3 Answer the receiver with every %1, %2 or %3 replaced by s1, s2 or s3, respectively @*@* @item 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 @*@* @item bindWithArguments: anArray Answer the receiver with every %n (1<=n<=9) replaced by the n-th element of anArray @*@* @item contractTo: smallSize Either return myself, or a copy shortened to smallSize characters by inserting an ellipsis (three dots: ...) @*@* @item 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 @*@* @item 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 @*@* @end table @node CharacterArray-testing functionality @subsection CharacterArray: testing functionality @table @b @item isCharacterArray Answer `true'.@*@* @end table @node CInt @section CInt @table @b @item Category: Language-C interface @end table @menu * CInt class-accessing:: (class) * CInt-accessing:: (instance) @end menu @node CInt class-accessing @subsection CInt class: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CInt-accessing @subsection CInt: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node Class @section Class @table @b @item Category: Language-Implementation I am THE class object. My instances are the classes of the system. I provide information commonly attributed to classes: 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. @end table @menu * Class-accessing instances and variables:: (instance) * Class-filing:: (instance) * Class-instance creation:: (instance) * Class-instance creation - alternative:: (instance) * Class-printing:: (instance) * Class-testing:: (instance) * Class-testing functionality:: (instance) @end menu @node Class-accessing instances and variables @subsection Class: accessing instances and variables @table @b @item addClassVarName: aString Add a class variable with the given name to the class pool dictionary @*@* @item addSharedPool: aDictionary Add the given shared pool to the list of the class' pool dictionaries @*@* @item allClassVarNames Answer the names of the variables in the receiver's class pool dictionary and in each of the superclasses' class pool dictionaries @*@* @item category Answer the class category @*@* @item category: aString Change the class category to aString @*@* @item classPool Answer the class pool dictionary @*@* @item classVarNames Answer the names of the variables in the class pool dictionary @*@* @item comment Answer the class comment @*@* @item comment: aString Change the class name @*@* @item environment Answer `environment'.@*@* @item environment: aNamespace Set the receiver's environment to aNamespace and recompile everything @*@* @item initialize redefined in children (?) @*@* @item name Answer the class name @*@* @item removeClassVarName: aString Removes the class variable from the class, error if not present, or still in use. @*@* @item removeSharedPool: aDictionary Remove the given dictionary to the list of the class' pool dictionaries @*@* @item sharedPools Return the names of the shared pools defined by the class @*@* @end table @node Class-filing @subsection Class: filing @table @b @item fileOutDeclarationOn: aFileStream File out class definition to aFileStream @*@* @item fileOutHeaderOn: aFileStream Write date and time stamp to aFileStream @*@* @item fileOutOn: aFileStream File out complete class description: class definition, class and instance methods @*@* @end table @node Class-instance creation @subsection Class: instance creation @table @b @item extend Redefine a version of the receiver in the current namespace. Note: this method can bite you in various ways when sent to system classes; read the section on namespaces in the manual for some examples of the problems you can encounter. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @end table @node Class-instance creation - alternative @subsection Class: instance creation - alternative @table @b @item categoriesFor: method are: categories Don't use this, it is only present to file in from IBM Smalltalk @*@* @item subclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item subclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableByteSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableByteSubclass: classNameString classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableLongSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableLongSubclass: classNameString classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @end table @node Class-printing @subsection Class: printing @table @b @item article Answer an article (`a' or `an') which is ok for the receiver's name @*@* @item printOn: aStream Print a representation of the receiver on aStream @*@* @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Class-testing @subsection Class: testing @table @b @item = aClass Returns true if the two class objects are to be considered equal. @*@* @end table @node Class-testing functionality @subsection Class: testing functionality @table @b @item asClass Answer the receiver.@*@* @item isClass Answer `true'.@*@* @end table @node ClassDescription @section ClassDescription @table @b @item Category: Language-Implementation My instances provide methods that access classes by category, and allow whole categories of classes to be filed out to external disk files. @end table @menu * ClassDescription-compiling:: (instance) * ClassDescription-conversion:: (instance) * ClassDescription-copying:: (instance) * ClassDescription-filing:: (instance) * ClassDescription-organization of messages and classes:: (instance) * ClassDescription-printing:: (instance) @end menu @node ClassDescription-compiling @subsection ClassDescription: compiling @table @b @item 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. @*@* @item 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 @*@* @item 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 @*@* @end table @node ClassDescription-conversion @subsection ClassDescription: conversion @table @b @item asClass This method's functionality should be implemented by subclasses of ClassDescription@*@* @item asMetaclass Answer the metaclass associated to the receiver @*@* @end table @node ClassDescription-copying @subsection ClassDescription: copying @table @b @item copy: selector from: aClass Copy the given selector from aClass, assigning it the same category @*@* @item copy: selector from: aClass classified: categoryName Copy the given selector from aClass, assigning it the given category @*@* @item copyAll: arrayOfSelectors from: class Copy all the selectors in arrayOfSelectors from class, assigning them the same category they have in class @*@* @item copyAll: arrayOfSelectors from: class classified: categoryName Copy all the selectors in arrayOfSelectors from aClass, assigning them the given category @*@* @item copyAllCategoriesFrom: aClass Copy all the selectors in aClass, assigning them the original category @*@* @item copyCategory: categoryName from: aClass Copy all the selectors in from aClass that belong to the given category @*@* @item 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 @*@* @end table @node ClassDescription-filing @subsection ClassDescription: filing @table @b @item fileOut: fileName Open the given file and to file out a complete class description to it @*@* @item fileOutCategory: categoryName to: fileName File out all the methods belonging to the method category, categoryName, to the fileName file @*@* @item fileOutCategory: category toStream: aFileStream File out all the methods belonging to the method category, categoryName, to aFileStream @*@* @item fileOutOn: aFileStream File out complete class description: class definition, class and instance methods @*@* @item fileOutSelector: selector to: fileName File out the given selector to fileName @*@* @end table @node ClassDescription-organization of messages and classes @subsection ClassDescription: organization of messages and classes @table @b @item createGetMethod: what Create a method accessing the variable `what'. @*@* @item createGetMethod: what default: value Create a method accessing the variable `what', with a default value of `value', using lazy initialization @*@* @item createSetMethod: what Create a method which sets the variable `what'. @*@* @item defineCFunc: cFuncNameString withSelectorArgs: selectorAndArgs returning: returnTypeSymbol args: argsArray See documentation. Too complex to describe it here ;-) @*@* @item removeCategory: aString Remove from the receiver every method belonging to the given category @*@* @item whichCategoryIncludesSelector: selector Answer the category for the given selector, or nil if the selector is not found @*@* @end table @node ClassDescription-printing @subsection ClassDescription: printing @table @b @item classVariableString This method's functionality should be implemented by subclasses of ClassDescription@*@* @item instanceVariableString Answer a string containing the name of the receiver's instance variables. @*@* @item nameIn: aNamespace Answer the class name when the class is referenced from aNamespace @*@* @item sharedVariableString This method's functionality should be implemented by subclasses of ClassDescription@*@* @end table @node CLong @section CLong @table @b @item Category: Language-C interface @end table @menu * CLong class-accessing:: (class) * CLong-accessing:: (instance) @end menu @node CLong class-accessing @subsection CLong class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CLong-accessing @subsection CLong: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CObject @section CObject @table @b @item 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. @end table @menu * CObject class-conversion:: (class) * CObject class-instance creation:: (class) * CObject-accessing:: (instance) * CObject-C data access:: (instance) * CObject-conversion:: (instance) * CObject-finalization:: (instance) @end menu @node CObject class-conversion @subsection CObject class: conversion @table @b @item scalarIndex Nothing special in the default case - answer a CType for the receiver @*@* @item type Nothing special in the default case - answer a CType for the receiver @*@* @end table @node CObject class-instance creation @subsection CObject class: instance creation @table @b @item address: anInteger Answer a new object pointing to the passed address, anInteger @*@* @item alloc: nBytes Allocate nBytes bytes and return an instance of the receiver @*@* @item alloc: nBytes type: cTypeObject Allocate nBytes bytes and return a CObject of the given type @*@* @item new: nBytes Allocate nBytes bytes and return an instance of the receiver @*@* @end table @node CObject-accessing @subsection CObject: accessing @table @b @item address Answer the address the receiver is pointing to. @*@* @item address: anInteger Set the receiver to point to the passed address, anInteger @*@* @item at: byteOffset Get a CObject of the same type as the receiver, pointing byteOffset bytes after the receiver. @*@* @item at: byteOffset put: value Store value byteOffset bytes after the receiver, treating it as a CObject of the same type as the receiver (this is used for computing the size of the data to be stored). @*@* @item printOn: aStream Print a representation of the receiver @*@* @item type: aCType Set the receiver's type to aCType. @*@* @item value What can I return? So fail @*@* @item value: anObject What can I set? So fail @*@* @end table @node CObject-C data access @subsection CObject: C data access @table @b @item at: byteOffset put: aValue type: aType Store aValue as data of the given type from byteOffset bytes after the pointer stored in the receiver @*@* @item at: byteOffset type: aType Answer some data of the given type from byteOffset bytes after the pointer stored in the receiver @*@* @item 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. @*@* @end table @node CObject-conversion @subsection CObject: conversion @table @b @item castTo: aType Answer another CObject, pointing to the same address as the receiver, but belonging to the aType CType. @*@* @item scalarIndex Nothing special in the default case - answer the receiver's CType @*@* @item type Answer a CType for the receiver @*@* @end table @node CObject-finalization @subsection CObject: finalization @table @b @item 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. @*@* @end table @node Collection @section Collection @table @b @item 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. @end table @menu * Collection class-instance creation:: (class) * Collection-Adding to a collection:: (instance) * Collection-converting:: (instance) * Collection-copying Collections:: (instance) * Collection-enumerating the elements of a collection:: (instance) * Collection-printing:: (instance) * Collection-Removing from a collection:: (instance) * Collection-storing:: (instance) * Collection-testing collections:: (instance) @end menu @node Collection class-instance creation @subsection Collection class: instance creation @table @b @item with: anObject Answer a collection whose only element is anObject @*@* @item with: firstObject with: secondObject Answer a collection whose only elements are the parameters in the order they were passed @*@* @item with: firstObject with: secondObject with: thirdObject Answer a collection whose only elements are the parameters in the order they were passed @*@* @item with: firstObject with: secondObject with: thirdObject with: fourthObject Answer a collection whose only elements are the parameters in the order they were passed @*@* @item withAll: aCollection Answer a collection whose elements are all those in aCollection @*@* @end table @node Collection-Adding to a collection @subsection Collection: Adding to a collection @table @b @item add: newObject Add newObject to the receiver, answer it @*@* @item addAll: aCollection Adds all the elements of 'aCollection' to the receiver, answer aCollection @*@* @end table @node Collection-converting @subsection Collection: converting @table @b @item asArray Answer an Array containing all the elements in the receiver @*@* @item asBag Answer a Bag containing all the elements in the receiver @*@* @item asByteArray Answer a ByteArray containing all the elements in the receiver @*@* @item asOrderedCollection Answer an OrderedCollection containing all the elements in the receiver @*@* @item 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. @*@* @item asSet Answer a Set containing all the elements in the receiver with no duplicates @*@* @item asSortedCollection Answer a SortedCollection containing all the elements in the receiver with the default sort block - [ :a :b | a <= b ] @*@* @item asSortedCollection: aBlock Answer a SortedCollection whose elements are the elements of the receiver, sorted according to the sort block aBlock @*@* @end table @node Collection-copying Collections @subsection Collection: copying Collections @table @b @item copyReplacing: targetObject withObject: newObject Copy replacing each object which is = to targetObject with newObject @*@* @item copyWith: newElement Answer a copy of the receiver to which newElement is added @*@* @item copyWithout: oldElement Answer a copy of the receiver to which all occurrences of oldElement are removed @*@* @end table @node Collection-enumerating the elements of a collection @subsection Collection: enumerating the elements of a collection @table @b @item allSatisfy: aBlock Search the receiver for an element for which aBlock returns false. Answer true if none does, false otherwise. @*@* @item 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 @*@* @item anySatisfy: aBlock Search the receiver for an element for which aBlock returns true. Answer true if some does, false otherwise. @*@* @item collect: aBlock Answer a new instance of a Collection containing all the results of evaluating aBlock passing each of the receiver's elements @*@* @item conform: aBlock Search the receiver for an element for which aBlock returns false. Answer true if none does, false otherwise. @*@* @item contains: aBlock Search the receiver for an element for which aBlock returns true. Answer true if some does, false otherwise. @*@* @item detect: aBlock Search the receiver for an element for which aBlock returns true. If some does, answer it. If none does, fail @*@* @item 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 @*@* @item do: aBlock Enumerate each object of the receiver, passing them to aBlock @*@* @item do: aBlock separatedBy: separatorBlock Enumerate each object of the receiver, passing them to aBlock. Between every two invocations of aBlock, invoke separatorBlock @*@* @item 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. @*@* @item 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 @*@* @item select: aBlock Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, answer true @*@* @end table @node Collection-printing @subsection Collection: printing @table @b @item inspect Print all the instance variables and objects in the receiver on the Transcript @*@* @item printOn: aStream Print a representation of the receiver on aStream @*@* @end table @node Collection-Removing from a collection @subsection Collection: Removing from a collection @table @b @item remove: oldObject Remove oldObject from the receiver. If absent, fail, else answer oldObject. @*@* @item remove: oldObject ifAbsent: anExceptionBlock Remove oldObject from the receiver. If absent, evaluate anExceptionBlock and answer the result, else answer oldObject. @*@* @item 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. @*@* @item removeAll: aCollection ifAbsent: aBlock Remove each object in aCollection, answer aCollection; if some element is absent, pass it to aBlock. @*@* @end table @node Collection-storing @subsection Collection: storing @table @b @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Collection-testing collections @subsection Collection: testing collections @table @b @item capacity Answer how many elements the receiver can hold before having to grow. @*@* @item includes: anObject Answer whether we include anObject @*@* @item isEmpty Answer whether we are (still) empty @*@* @item notEmpty Answer whether we include at least one object @*@* @item occurrencesOf: anObject Answer how many occurrences of anObject we include @*@* @item size Answer how many objects we include @*@* @end table @node CompiledBlock @section CompiledBlock @table @b @item Category: Language-Implementation I represent a block that has been compiled. @end table @menu * CompiledBlock class-instance creation:: (class) * CompiledBlock-accessing:: (instance) * CompiledBlock-basic:: (instance) * CompiledBlock-printing:: (instance) @end menu @node CompiledBlock class-instance creation @subsection CompiledBlock class: instance creation @table @b @item newMethod: numBytecodes header: anInteger method: outerMethod Answer a new CompiledMethod with room for the given bytes and the given header @*@* @item numArgs: args numTemps: temps bytecodes: bytecodes depth: depth literals: literalArray Answer an (almost) full fledged CompiledBlock. To make it complete, you must either set the new object's `method' variable, or put it into a BlockClosure and put the BlockClosure into a CompiledMethod's literals. The clean-ness of the block is automatically computed. @*@* @end table @node CompiledBlock-accessing @subsection CompiledBlock: accessing @table @b @item flags Answer the `cleanness' of the block. 0 = clean; 1 = access to receiver variables and/or self; 2-30 = access to variables that are 1-29 contexts away; 31 = return from method or push thisContext @*@* @item method Answer the CompiledMethod in which the receiver lies @*@* @item methodClass Answer the class in which the receiver is installed. @*@* @item methodClass: methodClass Set the receiver's class instance variable @*@* @item numArgs Answer the number of arguments passed to the receiver @*@* @item numLiterals Answer the number of literals for the receiver @*@* @item numTemps Answer the number of temporary variables used by the receiver @*@* @item selector Answer the selector through which the method is called @*@* @item selector: aSymbol Set the selector through which the method is called @*@* @item stackDepth Answer the number of stack slots needed for the receiver @*@* @end table @node CompiledBlock-basic @subsection CompiledBlock: basic @table @b @item = aMethod Answer whether the receiver and aMethod are equal @*@* @item methodCategory Answer the method category @*@* @item methodCategory: aCategory Set the method category to the given string @*@* @item methodSourceCode Answer the method source code (a FileSegment or String or nil) @*@* @item methodSourceFile Answer the file where the method source code is stored @*@* @item methodSourcePos Answer the location where the method source code is stored in the methodSourceFile @*@* @item methodSourceString Answer the method source code as a string @*@* @end table @node CompiledBlock-printing @subsection CompiledBlock: printing @table @b @item printOn: aStream Print the receiver's class and selector on aStream @*@* @end table @node CompiledCode @section CompiledCode @table @b @item Category: Language-Implementation I represent code that has been compiled. I am an abstract superclass for blocks and methods @end table @menu * CompiledCode class-instance creation:: (class) * CompiledCode-accessing:: (instance) * CompiledCode-basic:: (instance) * CompiledCode-copying:: (instance) * CompiledCode-debugging:: (instance) * CompiledCode-printing:: (instance) * CompiledCode-testing accesses:: (instance) @end menu @node CompiledCode class-instance creation @subsection CompiledCode class: instance creation @table @b @item newMethod: numBytecodes header: anInteger literals: literals Answer a new CompiledMethod with room for the given bytes and the given header @*@* @item newMethod: numBytecodes header: anInteger numLiterals: numLiterals Answer a new CompiledMethod with room for the given bytes and the given header @*@* @end table @node CompiledCode-accessing @subsection CompiledCode: accessing @table @b @item at: anIndex put: aBytecode Store aBytecode as the anIndex-th bytecode @*@* @item bytecodeAt: anIndex Answer the anIndex-th bytecode @*@* @item bytecodeAt: anIndex put: aBytecode Store aBytecode as the anIndex-th bytecode @*@* @item flags Private - Answer the optimization flags for the receiver @*@* @item literalAt: anIndex Answer the anIndex-th literal @*@* @item literalAt: anInteger put: aValue Store aValue as the anIndex-th literal @*@* @item literals Answer `literals'.@*@* @item methodClass Answer the class in which the receiver is installed. @*@* @item methodClass: methodClass Set the receiver's class instance variable @*@* @item numArgs Answer the number of arguments for the receiver @*@* @item numLiterals Answer the number of literals for the receiver @*@* @item numTemps Answer the number of temporaries for the receiver @*@* @item primitive Answer the primitive called by the receiver @*@* @item selector Answer the selector through which the method is called @*@* @item selector: aSymbol Set the selector through which the method is called @*@* @item stackDepth Answer the number of stack slots needed for the receiver @*@* @end table @node CompiledCode-basic @subsection CompiledCode: basic @table @b @item = aMethod Answer whether the receiver and aMethod are equal @*@* @item hash Answer an hash value for the receiver @*@* @item methodCategory Answer the method category @*@* @item methodCategory: aCategory Set the method category to the given string @*@* @item methodSourceCode Answer the method source code (a FileSegment or String or nil) @*@* @item methodSourceFile Answer the file where the method source code is stored @*@* @item methodSourcePos Answer the location where the method source code is stored in the methodSourceFile @*@* @item methodSourceString Answer the method source code as a string @*@* @end table @node CompiledCode-copying @subsection CompiledCode: copying @table @b @item deepCopy Answer a deep copy of the receiver @*@* @end table @node CompiledCode-debugging @subsection CompiledCode: debugging @table @b @item breakAtLine: lineNumber This method's functionality has not been implemented yet.@*@* @item breakpointAt: byteIndex Put a break-point at the given bytecode @*@* @item inspect Print the contents of the receiver in a verbose way. @*@* @item removeBreakpointAt: byteIndex Remove the break-point at the given bytecode (don't fail if none was set @*@* @end table @node CompiledCode-printing @subsection CompiledCode: printing @table @b @item printOn: aStream Print the receiver's class and selector on aStream @*@* @end table @node CompiledCode-testing accesses @subsection CompiledCode: testing accesses @table @b @item accesses: instVarIndex Answer whether the receiver access the instance variable with the given index @*@* @item containsLiteral: anObject Answer if the receiver contains a literal which is equal to anObject. @*@* @item hasBytecode: byte between: firstIndex and: lastIndex Answer whether the receiver includes the `byte' bytecode in any of the indices between firstIndex and lastIndex. @*@* @item jumpDestinationAt: anIndex Answer where the jump at bytecode index `anIndex' lands @*@* @item refersTo: anObject Answer whether the receiver refers to the given object @*@* @end table @node CompiledMethod @section CompiledMethod @table @b @item 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. @end table @menu * CompiledMethod class-cache flushing:: (class) * CompiledMethod class-instance creation:: (class) * CompiledMethod class-lean images:: (class) * CompiledMethod-accessing:: (instance) * CompiledMethod-basic:: (instance) * CompiledMethod-printing:: (instance) @end menu @node CompiledMethod class-cache flushing @subsection CompiledMethod class: cache flushing @table @b @item flushTranslatorCache Answer any kind of cache mantained by a just-in-time code translator in the virtual machine (if any). @*@* @end table @node CompiledMethod class-instance creation @subsection CompiledMethod class: instance creation @table @b @item 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. Also, the bytecodes are optimized and any embedded CompiledBlocks modified to refer to these literals and to the newly created CompiledMethod. @*@* @end table @node CompiledMethod class-lean images @subsection CompiledMethod class: lean images @table @b @item stripSourceCode Remove all the references to method source code from the system @*@* @end table @node CompiledMethod-accessing @subsection CompiledMethod: accessing @table @b @item flags Private - Answer the optimization flags for the receiver @*@* @item methodClass Answer the class in which the receiver is installed. @*@* @item methodClass: methodClass Set the receiver's class instance variable @*@* @item numArgs Answer the number of arguments for the receiver @*@* @item numTemps Answer the number of temporaries for the receiver @*@* @item primitive Answer the primitive called by the receiver @*@* @item selector Answer the selector through which the method is called @*@* @item selector: aSymbol Set the selector through which the method is called @*@* @item stackDepth Answer the number of stack slots needed for the receiver @*@* @item withNewMethodClass: class Answer either the receiver or a copy of it, with the method class set to class @*@* @item withNewMethodClass: class selector: selector Answer either the receiver or a copy of it, with the method class set to class @*@* @end table @node CompiledMethod-basic @subsection CompiledMethod: basic @table @b @item = aMethod Answer whether the receiver and aMethod are equal @*@* @item hash Answer an hash value for the receiver @*@* @item methodCategory Answer the method category @*@* @item methodCategory: aCategory Set the method category to the given string @*@* @item methodSourceCode Answer the method source code (a FileSegment or String or nil) @*@* @item methodSourceFile Answer the file where the method source code is stored @*@* @item methodSourcePos Answer the location where the method source code is stored in the methodSourceFile @*@* @item methodSourceString Answer the method source code as a string @*@* @end table @node CompiledMethod-printing @subsection CompiledMethod: printing @table @b @item storeOn: aStream Print code to create the receiver on aStream @*@* @end table @node ContextPart @section ContextPart @table @b @item 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. @end table @menu * ContextPart class-exception handling:: (class) * ContextPart-accessing:: (instance) * ContextPart-exception handling:: (instance) * ContextPart-printing:: (instance) @end menu @node ContextPart class-exception handling @subsection ContextPart class: exception handling @table @b @item backtrace Print a backtrace from the caller to the bottom of the stack on the Transcript @*@* @item backtraceOn: aStream Print a backtrace from the caller to the bottom of the stack on aStream @*@* @item lastUnwindPoint Private - Return the last context marked as an unwind point, or our en- vironment if the last unwind point belongs to another environment. @*@* @item 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. @*@* @item unwind Return execution to the last context marked as an unwind point, returning nil on that stack. @*@* @item unwind: returnValue Return execution to the last context marked as an unwind point, returning returnValue on that stack. @*@* @item unwindPoints Answer an OrderedCollection of contexts marked as unwind points. @*@* @end table @node ContextPart-accessing @subsection ContextPart: accessing @table @b @item client Answer the client of this context, that is, the object that sent the message that created this context. Fail if the receiver has no parent @*@* @item 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 @*@* @item home Answer the MethodContext to which the receiver refers @*@* @item initialIP Answer the value of the instruction pointer when execution starts in the current context @*@* @item ip Answer the current instruction pointer into the receiver @*@* @item ip: newIP Set the instruction pointer for the receiver @*@* @item isBlock Answer whether the receiver is a block context @*@* @item isEnvironment 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. Answer whether the receiver is that kind of context. @*@* @item 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 flags are different from those of the contexts created by the VM's prepareExecutionEnvironment function. @*@* @item method Return the CompiledMethod being executed @*@* @item methodClass Return the class in which the CompiledMethod being executed is defined @*@* @item numArgs Answer the number of arguments passed to the receiver @*@* @item numTemps Answer the number of temporaries used by the receiver @*@* @item parentContext Answer the context that called the receiver @*@* @item receiver Return the receiver (self) for the method being executed @*@* @item selector Return the selector for the method being executed @*@* @item 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 @*@* @item sp Answer the current stack pointer into the receiver @*@* @item sp: newSP Set the stack pointer for the receiver. Storing into the stack pointer is a potentially dangerous thing, so this code tests that sp is effectively a number. Also, since the newly accessible slots may have contained garbage, this method stores nil into any cells that become accessible as a result. @*@* @item validSize Answer how many elements in the receiver should be inspected @*@* @end table @node ContextPart-exception handling @subsection ContextPart: exception handling @table @b @item mark Add the receiver as a possible unwind point @*@* @item returnTo: aContext Set the context to which the receiver will return @*@* @item unmark Remove the receiver from the contexts to which an unwind operation might return @*@* @end table @node ContextPart-printing @subsection ContextPart: printing @table @b @item backtrace Print a backtrace from the receiver to the bottom of the stack on the Transcript. @*@* @item backtraceOn: aStream Print a backtrace from the caller to the bottom of the stack on aStream. @*@* @end table @node CPtr @section CPtr @table @b @item Category: Language-C interface @end table @menu * CPtr-accessing:: (instance) @end menu @node CPtr-accessing @subsection CPtr: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item sizeof Answer the receiver's size @*@* @end table @node CPtrCType @section CPtrCType @table @b @item Category: Language-C interface @end table @menu * CPtrCType class-instance creation:: (class) * CPtrCType-accessing:: (instance) @end menu @node CPtrCType class-instance creation @subsection CPtrCType class: instance creation @table @b @item elementType: aCType Answer a new instance of CPtrCType that maps pointers to the given CType @*@* @end table @node CPtrCType-accessing @subsection CPtrCType: accessing @table @b @item elementType Answer the type of the elements in the receiver's instances @*@* @item new: size Allocate space for `size' objects like those that the receiver points to, and with the type (class) identified by the receiver. It is the caller's responsibility to free the memory allocated for it. @*@* @end table @node CScalar @section CScalar @table @b @item Category: Language-C interface @end table @menu * CScalar class-instance creation:: (class) * CScalar-accessing:: (instance) @end menu @node CScalar class-instance creation @subsection CScalar class: instance creation @table @b @item type Answer a CType for the receiver - for example, CByteType if the receiver is CByte. @*@* @item 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 @*@* @end table @node CScalar-accessing @subsection CScalar: accessing @table @b @item value Answer the value the receiver is pointing to. The exact returned value depends on the receiver's class @*@* @item value: aValue Set the receiver to point to the value, aValue. The exact meaning of aValue depends on the receiver's class @*@* @end table @node CScalarCType @section CScalarCType @table @b @item Category: Language-C interface @end table @menu * CScalarCType-accessing:: (instance) * CScalarCType-storing:: (instance) @end menu @node CScalarCType-accessing @subsection CScalarCType: accessing @table @b @item 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. @*@* @end table @node CScalarCType-storing @subsection CScalarCType: storing @table @b @item storeOn: aStream Store Smalltalk code that compiles to the receiver @*@* @end table @node CShort @section CShort @table @b @item Category: Language-C interface @end table @menu * CShort class-accessing:: (class) * CShort-accessing:: (instance) @end menu @node CShort class-accessing @subsection CShort class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CShort-accessing @subsection CShort: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CSmalltalk @section CSmalltalk @table @b @item Category: Language-C interface @end table @menu * CSmalltalk class-accessing:: (class) * CSmalltalk-accessing:: (instance) @end menu @node CSmalltalk class-accessing @subsection CSmalltalk class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CSmalltalk-accessing @subsection CSmalltalk: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CString @section CString @table @b @item 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. @end table @menu * CString class-getting info:: (class) * CString-accessing:: (instance) * CString-pointer like behavior:: (instance) @end menu @node CString class-getting info @subsection CString class: getting info @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CString-accessing @subsection CString: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CString-pointer like behavior @subsection CString: pointer like behavior @table @b @item + anInteger Return another CString pointing at &receiver[anInteger] (or, if you prefer, what `receiver + anInteger' does in C). @*@* @item - 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) @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item decr Adjust the pointer by one byte down (i.e. --receiver) @*@* @item 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' @*@* @item 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. @*@* @item 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'. @*@* @item incr Adjust the pointer by one byte up (i.e. ++receiver) @*@* @item incrBy: anInteger Adjust the pointer by anInteger bytes up (i.e. receiver += anInteger) @*@* @item 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! @*@* @end table @node CStruct @section CStruct @table @b @item Category: Language-C interface @end table @menu * CStruct class-instance creation:: (class) * CStruct class-subclass creation:: (class) * CStruct-instance creation:: (instance) @end menu @node CStruct class-instance creation @subsection CStruct class: instance creation @table @b @item new Allocate a new instance of the receiver. To free the memory after GC, remember to call #addToBeFinalized. @*@* @item type Answer a CType for the receiver @*@* @end table @node CStruct class-subclass creation @subsection CStruct class: subclass creation @table @b @item compileSize: size align: alignment for: aClass Private - Compile sizeof and alignof methods @*@* @item computeAggregateType: type block: aBlock Private - Called by computeTypeString:block: for pointers/arrays. Format of type: (array int 3) or (ptr FooStruct) @*@* @item computeArrayType: type block: aBlock Private - Called by computeAggregateType:block: for arrays @*@* @item computePtrType: type block: aBlock Private - Called by computeAggregateType:block: for pointers @*@* @item 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). @*@* @item emitInspectTo: str for: name Private - Emit onto the given stream the code for adding the given selector to the CStruct's inspector. @*@* @item initialize Initialize the receiver's TypeMap @*@* @item 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 @*@* @end table @node CStruct-instance creation @subsection CStruct: instance creation @table @b @item inspect Inspect the contents of the receiver @*@* @item inspectSelectorList Answer a list of selectors whose return values should be inspected by #inspect. @*@* @end table @node CType @section CType @table @b @item 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 only instance variable, cObjectType, is used to hold onto the CObject subclass that gets created for a given CType. Used primarily in the C part of the interpreter because internally it cannot execute methods to get values, so it has a simple way to access instance variable which holds the desired subclass. 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. @end table @menu * CType class-C instance creation:: (class) * CType-accessing:: (instance) * CType-C instance creation:: (instance) * CType-storing:: (instance) @end menu @node CType class-C instance creation @subsection CType class: C instance creation @table @b @item cObjectType: aCObjectSubclass Create a new CType for the given subclass of CObject @*@* @end table @node CType-accessing @subsection CType: accessing @table @b @item alignof Answer the size of the receiver's instances @*@* @item arrayType: size Answer a CArrayCType which represents an array with the given size of CObjects whose type is in turn represented by the receiver @*@* @item cObjectType Answer the CObject subclass whose instance is created when new is sent to the receiver @*@* @item ptrType Answer a CPtrCType which represents a pointer to CObjects whose type is in turn represented by the receiver @*@* @item sizeof Answer the size of the receiver's instances @*@* @item 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' @*@* @end table @node CType-C instance creation @subsection CType: C instance creation @table @b @item address: cObjOrInt Create a new CObject with the type (class) identified by the receiver, pointing to the given address (identified by an Integer or CObject). @*@* @item 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. @*@* @end table @node CType-storing @subsection CType: storing @table @b @item storeOn: aStream Store Smalltalk code that compiles to the receiver @*@* @end table @node CUChar @section CUChar @table @b @item Category: Language-C interface @end table @menu * CUChar class-getting info:: (class) * CUChar-accessing:: (instance) @end menu @node CUChar class-getting info @subsection CUChar class: getting info @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CUChar-accessing @subsection CUChar: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CUInt @section CUInt @table @b @item Category: Language-C interface @end table @menu * CUInt class-accessing:: (class) * CUInt-accessing:: (instance) @end menu @node CUInt class-accessing @subsection CUInt class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CUInt-accessing @subsection CUInt: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CULong @section CULong @table @b @item Category: Language-C interface @end table @menu * CULong class-accessing:: (class) * CULong-accessing:: (instance) @end menu @node CULong class-accessing @subsection CULong class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CULong-accessing @subsection CULong: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node CUShort @section CUShort @table @b @item Category: Language-C interface @end table @menu * CUShort class-accessing:: (class) * CUShort-accessing:: (instance) @end menu @node CUShort class-accessing @subsection CUShort class: accessing @table @b @item alignof Answer the receiver's instances required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's instances scalar type @*@* @item sizeof Answer the receiver's instances size @*@* @end table @node CUShort-accessing @subsection CUShort: accessing @table @b @item alignof Answer the receiver's required aligment @*@* @item scalarIndex Private - Answer an index referring to the receiver's scalar type @*@* @item sizeof Answer the receiver's size @*@* @end table @node Date @section Date @table @b @item 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. @end table @menu * Date class-basic:: (class) * Date class-instance creation:: (class) * Date-basic:: (instance) * Date-date computations:: (instance) * Date-printing:: (instance) * Date-storing:: (instance) * Date-testing:: (instance) @end menu @node Date class-basic @subsection Date class: basic @table @b @item dayOfWeek: dayName Answer the index of the day of week corresponding to the given name @*@* @item daysInMonth: monthName forYear: yearInteger Answer the number of days in the given (named) month for the given year @*@* @item daysInYear: yearInteger Answer the number of days in the given year @*@* @item indexOfMonth: monthName Answer the index of the month corresponding to the given name @*@* @item initDayNameDict Initialize the DayNameDict to the names of the days @*@* @item initialize Initialize the receiver @*@* @item initMonthNameDict Initialize the MonthNameDict to the names of the months @*@* @item nameOfDay: dayIndex Answer the name of the day of week corresponding to the given index @*@* @item nameOfMonth: monthIndex Answer the name of the month corresponding to the given index @*@* @item shortNameOfMonth: monthIndex Answer the name of the month corresponding to the given index @*@* @end table @node Date class-instance creation @subsection Date class: instance creation @table @b @item dateAndTimeNow Answer an array containing the current date and time @*@* @item fromDays: dayCount Answer a Date denoting dayCount days past 1/1/1901 @*@* @item fromJulian: jd Answer a Date denoting the jd-th day in the astronomical Julian calendar. @*@* @item fromSeconds: time Answer a Date denoting the date time seconds past Jan 1st, 1901 @*@* @item newDay: day month: monthName year: yearInteger Answer a Date denoting the dayCount day of the given (named) month and year @*@* @item newDay: day monthIndex: monthIndex year: yearInteger Answer a Date denoting the dayCount day of the given (as a number) month and year @*@* @item newDay: dayCount year: yearInteger Answer a Date denoting the dayCount day of the yearInteger year @*@* @item today Answer a Date denoting the current date in local time @*@* @item utcDateAndTimeNow Answer an array containing the current date and time in Coordinated Universal Time (UTC) @*@* @item utcToday Answer a Date denoting the current date in Coordinated Universal Time (UTC) @*@* @end table @node Date-basic @subsection Date: basic @table @b @item addDays: dayCount Answer a new Date pointing dayCount past the receiver @*@* @item subtractDate: aDate Answer the number of days between aDate and the receiver (negative if the receiver is before aDate) @*@* @item subtractDays: dayCount Answer a new Date pointing dayCount before the receiver @*@* @end table @node Date-date computations @subsection Date: date computations @table @b @item asSeconds Answer the date as the number of seconds from 1/1/1901. @*@* @item day Answer the day represented by the receiver @*@* @item dayName Answer the day of week of the receiver as a Symbol @*@* @item dayOfWeek Answer the day of week of the receiver. 1 = Monday, 7 = Sunday @*@* @item dayOfYear Answer the days passed since 31/12 of last year; e.g. New Year's Day is 1 @*@* @item daysFromBaseDay Answer the days passed since 1/1/1901 @*@* @item daysInMonth Answer the days in the month represented by the receiver @*@* @item daysInYear Answer the days in the year represented by the receiver @*@* @item daysLeftInMonth Answer the days to the end of the month represented by the receiver @*@* @item daysLeftInYear Answer the days to the end of the year represented by the receiver @*@* @item firstDayOfMonth Answer a Date representing the first day of the month represented by the receiver @*@* @item lastDayOfMonth Answer a Date representing the last day of the month represented by the receiver @*@* @item month Answer the month represented by the receiver @*@* @item monthName Answer the name of the month represented by the receiver @*@* @item shortMonthName Answer the name of the month represented by the receiver @*@* @item year Answer the year represented by the receiver @*@* @end table @node Date-printing @subsection Date: printing @table @b @item printOn: aStream Print a representation for the receiver on aStream @*@* @end table @node Date-storing @subsection Date: storing @table @b @item storeOn: aStream Store on aStream Smalltalk code compiling to the receiver @*@* @end table @node Date-testing @subsection Date: testing @table @b @item < aDate Answer whether the receiver indicates a date preceding aDate @*@* @item = aDate Answer whether the receiver indicates the same date as aDate @*@* @item hash Answer an hash value for the receievr @*@* @end table @node Delay @section Delay @table @b @item 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 systems' 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. @end table @menu * Delay class-general inquiries:: (class) * Delay class-initialization:: (class) * Delay class-instance creation:: (class) * Delay-accessing:: (instance) * Delay-comparing:: (instance) * Delay-process delay:: (instance) @end menu @node Delay class-general inquiries @subsection Delay class: general inquiries @table @b @item millisecondClockValue Private - Answer the number of milliseconds since midnight @*@* @end table @node Delay class-initialization @subsection Delay class: initialization @table @b @item initialize Private - Initialize the receiver and the associated process @*@* @end table @node Delay class-instance creation @subsection Delay class: instance creation @table @b @item forMilliseconds: millisecondCount Answer a Delay waiting for millisecondCount milliseconds @*@* @item forSeconds: secondCount Answer a Delay waiting for secondCount seconds @*@* @item untilMilliseconds: millisecondCount Answer a Delay waiting for millisecondCount milliseconds after midnight @*@* @end table @node Delay-accessing @subsection Delay: accessing @table @b @item resumptionTime Answer the time when a process waiting on a Delay will resume @*@* @end table @node Delay-comparing @subsection Delay: comparing @table @b @item = aDelay Answer whether the receiver and aDelay denote the same delay @*@* @item hash Answer an hash value for the receiver @*@* @end table @node Delay-process delay @subsection Delay: process delay @table @b @item wait Wait until the amount of time represented by the instance of Delay elapses @*@* @end table @node DelayedAdaptor @section DelayedAdaptor @table @b @item 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. @end table @menu * DelayedAdaptor-accessing:: (instance) @end menu @node DelayedAdaptor-accessing @subsection DelayedAdaptor: accessing @table @b @item trigger Really set the value of the receiver. @*@* @item value Get the value of the receiver. @*@* @item value: anObject Set the value of the receiver - actually, the value is cached and is not set until the #trigger method is sent. @*@* @end table @node Dictionary @section Dictionary @table @b @item 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. @end table @menu * Dictionary class-instance creation:: (class) * Dictionary-accessing:: (instance) * Dictionary-awful ST-80 compatibility hacks:: (instance) * Dictionary-dictionary enumerating:: (instance) * Dictionary-dictionary removing:: (instance) * Dictionary-dictionary testing:: (instance) * Dictionary-polymorphism hacks:: (instance) * Dictionary-printing:: (instance) * Dictionary-storing:: (instance) * Dictionary-testing:: (instance) @end menu @node Dictionary class-instance creation @subsection Dictionary class: instance creation @table @b @item new Create a new dictionary with a default size @*@* @end table @node Dictionary-accessing @subsection Dictionary: accessing @table @b @item add: newObject Add the newObject association to the receiver @*@* @item associationAt: key Answer the key/value Association for the given key. Fail if the key is not found @*@* @item associationAt: key ifAbsent: aBlock Answer the key/value Association for the given key. Evaluate aBlock (answering the result) if the key is not found @*@* @item at: key Answer the value associated to the given key. Fail if the key is not found @*@* @item at: key ifAbsent: aBlock Answer the value associated to the given key, or the result of evaluating aBlock if the key is not found @*@* @item 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. @*@* @item at: aKey ifPresent: aBlock If aKey is absent, answer nil. Else, evaluate aBlock passing the associated value and answer the result of the invocation @*@* @item at: key put: value Store value as associated to the given key @*@* @item keyAtValue: value Answer the key associated to the given value. Evaluate exceptionBlock (answering the result) if the value is not found @*@* @item 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 @*@* @item keys Answer a kind of Set containing the keys of the receiver @*@* @item values Answer a Bag containing the values of the receiver @*@* @end table @node Dictionary-awful ST-80 compatibility hacks @subsection Dictionary: awful ST-80 compatibility hacks @table @b @item 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 @*@* @end table @node Dictionary-dictionary enumerating @subsection Dictionary: dictionary enumerating @table @b @item associationsDo: aBlock Pass each association in the dictionary to aBlock @*@* @item 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 @*@* @item do: aBlock Pass each value in the dictionary to aBlock @*@* @item keysAndValuesDo: aBlock Pass each key/value pair in the dictionary as two distinct parameters to aBlock @*@* @item keysDo: aBlock Pass each key in the dictionary to aBlock @*@* @item 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. @*@* @item 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. @*@* @end table @node Dictionary-dictionary removing @subsection Dictionary: dictionary removing @table @b @item remove: anObject This method should not be called for instances of this class.@*@* @item remove: anObject ifAbsent: aBlock This method should not be called for instances of this class.@*@* @item removeAllKeys: keys Remove all the keys in keys, without raising any errors @*@* @item removeAllKeys: keys ifAbsent: aBlock Remove all the keys in keys, passing the missing keys as parameters to aBlock as they're encountered @*@* @item removeAssociation: anAssociation Remove anAssociation's key from the dictionary @*@* @item removeKey: key Remove the passed key from the dictionary, fail if it is not found @*@* @item removeKey: key ifAbsent: aBlock Remove the passed key from the dictionary, answer the result of evaluating aBlock if it is not found @*@* @end table @node Dictionary-dictionary testing @subsection Dictionary: dictionary testing @table @b @item includes: anObject Answer whether the receiver contains anObject as one of its values @*@* @item includesAssociation: anAssociation Answer whether the receiver contains the key which is anAssociation's key and its value is anAssociation's value @*@* @item includesKey: key Answer whether the receiver contains the given key @*@* @item occurrencesOf: aValue Answer whether the number of occurrences of aValue as one of the receiver's values @*@* @end table @node Dictionary-polymorphism hacks @subsection Dictionary: polymorphism hacks @table @b @item withAllSuperspaces This method is needed by the compiler @*@* @end table @node Dictionary-printing @subsection Dictionary: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @end table @node Dictionary-storing @subsection Dictionary: storing @table @b @item storeOn: aStream Print Smalltalk code compiling to the receiver on aStream @*@* @end table @node Dictionary-testing @subsection Dictionary: testing @table @b @item = aDictionary Answer whether the receiver and aDictionary are equal @*@* @item hash Answer the hash value for the receiver @*@* @end table @node DirectedMessage @section DirectedMessage @table @b @item Category: Language-Implementation I represent a message send: I contain the receiver, selector and arguments for a message. @end table @menu * DirectedMessage class-creating instances:: (class) * DirectedMessage-accessing:: (instance) * DirectedMessage-basic:: (instance) @end menu @node DirectedMessage class-creating instances @subsection DirectedMessage class: creating instances @table @b @item selector: aSymbol arguments: anArray This method should not be called for instances of this class.@*@* @item selector: aSymbol arguments: anArray receiver: anObject Create a new instance of the receiver @*@* @end table @node DirectedMessage-accessing @subsection DirectedMessage: accessing @table @b @item receiver Answer the receiver @*@* @item receiver: anObject Change the receiver @*@* @end table @node DirectedMessage-basic @subsection DirectedMessage: basic @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @item send Send the message @*@* @end table @node Directory @section Directory @table @b @item Category: Streams-Files @end table @menu * Directory class-C functions:: (class) * Directory class-file name management:: (class) * Directory class-file operations:: (class) * Directory class-reading system defaults:: (class) * Directory-accessing:: (instance) * Directory-C functions:: (instance) * Directory-enumerating:: (instance) @end menu @node Directory class-C functions @subsection Directory class: C functions @table @b @item primCreate: dirName mode: mode C call-out to mkdir. Do not modify! @*@* @item primRemove: fileName C call-out to rmdir. Do not modify! @*@* @item primWorking: dirName C call-out to chdir. Do not modify! @*@* @item working C call-out to getCurDirName. Do not modify! @*@* @end table @node Directory class-file name management @subsection Directory class: file name management @table @b @item append: fileName to: directory Answer the name of a file named `fileName' which resides in a directory named `directory'. @*@* @item pathSeparator Answer (as a Character) the character used to separate directory names @*@* @item pathSeparatorString Answer (in a String) the character used to separate directory names @*@* @end table @node Directory class-file operations @subsection Directory class: file operations @table @b @item create: dirName Change the current working directory to dirName. @*@* @item working: dirName Change the current working directory to dirName. @*@* @end table @node Directory class-reading system defaults @subsection Directory class: reading system defaults @table @b @item home Answer the path to the user's home directory @*@* @item image Answer the path to GNU Smalltalk's image file @*@* @item kernel Answer the path to the GNU Smalltalk kernel's Smalltalk source files @*@* @item localKernel Answer the path in which local version of the GNU Smalltalk kernel's Smalltalk source files were searched @*@* @end table @node Directory-accessing @subsection Directory: accessing @table @b @item at: aName Answer a File object for a file named `aName' residing in the directory represented by the receiver. @*@* @item directoryAt: aName Answer a Directory object for a file named `aName' residing in the directory represented by the receiver. @*@* @item fullNameAt: aName Answer a String containing the full path to a file named `aName' which resides in the directory represented by the receiver. @*@* @item includes: aName Answer whether a file named `aName' exists in the directory represented by the receiver. @*@* @item nameAt: aName Answer a String containing the path to a file named `aName' which resides in the directory represented by the receiver. @*@* @end table @node Directory-C functions @subsection Directory: C functions @table @b @item extractDirentName: dirent C call-out to extractDirentName. Do not modify! @*@* @item readDir: dirObject C call-out to readdir. Do not modify! @*@* @item rewindDir: dirObject C call-out to rewinddir. Do not modify! @*@* @end table @node Directory-enumerating @subsection Directory: enumerating @table @b @item contents Answer an Array with the names of the files in the directory represented by the receiver. @*@* @item do: aBlock Evaluate aBlock once for each file in the directory represented by the receiver, passing its name. aBlock should not return. @*@* @item filesMatching: aPattern do: block Evaluate block on the File objects that match aPattern (according to String>>#match:) in the directory named by the receiver. @*@* @item namesMatching: aPattern do: block Evaluate block on the file names that match aPattern (according to String>>#match:) in the directory named by the receiver. @*@* @end table @node DLD @section DLD @table @b @item 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. @end table @menu * DLD class-C functions:: (class) * DLD class-Dynamic Linking:: (class) @end menu @node DLD class-C functions @subsection DLD class: C functions @table @b @item defineCFunc: aName as: aFuncAddr C call-out to defineCFunc. Do not modify! @*@* @item library: libHandle getFunc: aFuncString C call-out to dldGetFunc. Do not modify! @*@* @item linkFile: aFileName C call-out to dldLink. Do not modify! @*@* @end table @node DLD class-Dynamic Linking @subsection DLD class: Dynamic Linking @table @b @item addLibrary: library Add library to the search path of libraries to be used by DLD @*@* @item 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. @*@* @item defineExternFunc: aFuncName withSelectorArgs: selector forClass: aClass returning: aReturnType args: argsArray Obsolete - Mantained for compatibility. This method does NOT look for statically linked functions. @*@* @item initialize Private - Initialize the receiver's class variables @*@* @item libraryList Answer a copy of the search path of libraries to be used by DLD @*@* @item 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. @*@* @item reset Called on startup - Make DLD forget the handles of the libraries it used in the last session. @*@* @end table @node DumperProxy @section DumperProxy @table @b @item 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. @end table @menu * DumperProxy class-instance creation:: (class) * DumperProxy-saving and restoring:: (instance) @end menu @node DumperProxy class-instance creation @subsection DumperProxy class: instance creation @table @b @item loadFrom: anObjectDumper Reload a proxy stored in anObjectDumper and reconstruct the object @*@* @item 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 (unless you override #dumpTo:), because that would result in an infinite loop! @*@* @end table @node DumperProxy-saving and restoring @subsection DumperProxy: saving and restoring @table @b @item dumpTo: anObjectDumper Dump the proxy to anObjectDumper -- the #loadFrom: class method will reconstruct the original object. @*@* @item object Reconstruct the object stored in the proxy and answer it @*@* @end table @node Exception @section Exception @table @b @item 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. @end table @menu * Exception class-instance creation:: (class) * Exception-accessing:: (instance) * Exception-basic:: (instance) * Exception-enumerating:: (instance) * Exception-exception handling:: (instance) * Exception-instance creation:: (instance) @end menu @node Exception class-instance creation @subsection Exception class: instance creation @table @b @item new Create a new exception whose parent is ExAll @*@* @end table @node Exception-accessing @subsection Exception: accessing @table @b @item defaultHandler Answer the default handler for the receiver @*@* @item defaultHandler: aBlock Set the default handler of the receiver to aBlock. A Signal object will be passed to aBlock @*@* @item description Answer a description of the receiver @*@* @item description: aString Set the description of the receiver to aString @*@* @item isResumable Answer true if the receiver is resumable @*@* @item isResumable: aBoolean Set the resumable flag of the receiver to aBoolean @*@* @item messageText Answer a description of the receiver @*@* @item parent Answer the parent of the receiver @*@* @end table @node Exception-basic @subsection Exception: basic @table @b @item copy Answer a copy of the receiver @*@* @end table @node Exception-enumerating @subsection Exception: enumerating @table @b @item allExceptionsDo: aBlock Private - Evaluate aBlock for every exception in the receiver. As it contains just one exception, evaluate it just once, passing the receiver @*@* @item handles: exception Answer whether the receiver handles `exception'. @*@* @end table @node Exception-exception handling @subsection Exception: exception handling @table @b @item signal Raise the exception described by the receiver, passing no parameters @*@* @item signalWith: arg Raise the exception described by the receiver, passing the parameter arg @*@* @item signalWith: arg with: arg2 Raise the exception described by the receiver, passing the parameters arg and arg2 @*@* @item signalWithArguments: args Raise the exception described by the receiver, passing the parameters in args @*@* @end table @node Exception-instance creation @subsection Exception: instance creation @table @b @item newChild Answer a child exception of the receiver. Its properties are set to those of the receiver @*@* @end table @node ExceptionCollection @section ExceptionCollection @table @b @item 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 @end table @menu * ExceptionCollection class-instance creation:: (class) * ExceptionCollection-enumerating:: (instance) @end menu @node ExceptionCollection class-instance creation @subsection ExceptionCollection class: instance creation @table @b @item new Private - Answer a new, empty ExceptionCollection @*@* @end table @node ExceptionCollection-enumerating @subsection ExceptionCollection: enumerating @table @b @item allExceptionsDo: aBlock Private - Evaluate aBlock for every exception in the receiver. Answer the receiver @*@* @item handles: exception Answer whether the receiver handles `exception'. @*@* @end table @node ExceptionHandler @section ExceptionHandler @table @b @item 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 @end table @menu * ExceptionHandler class-instance creation:: (class) * ExceptionHandler-accessing:: (instance) @end menu @node ExceptionHandler class-instance creation @subsection ExceptionHandler class: instance creation @table @b @item onDoBlock: wdBlock exitBlock: eBlock handlerBlock: hBlock Answer an ExceptionHandler instance with the given values for its instance variables. @*@* @end table @node ExceptionHandler-accessing @subsection ExceptionHandler: accessing @table @b @item isDisabled Answer whether the receiver is disabled by a #valueWithUnwind. @*@* @item onDoBlock: wdBlock exitBlock: eBlock handlerBlock: hBlock Initialize the receiver's instance variables. @*@* @item signal: exc withArguments: args resume: aBoolean Signal the given exception with the given argument. aBoolean indicates the action (either resuming the receiver of #on:do:... or exiting it) upon leaving from the handler block. @*@* @end table @node False @section False @table @b @item Category: Language-Data types I always tell lies. I have a single instance in the system, which represents the value false. @end table @menu * False-basic:: (instance) * False-C hacks:: (instance) * False-printing:: (instance) @end menu @node False-basic @subsection False: basic @table @b @item & aBoolean We are false -- anded with anything, we always answer false @*@* @item and: aBlock We are false -- anded with anything, we always answer false @*@* @item eqv: aBoolean Answer whether the receiver and aBoolean represent the same boolean value @*@* @item ifFalse: falseBlock We are false -- evaluate the falseBlock @*@* @item ifFalse: falseBlock ifTrue: trueBlock We are false -- evaluate the falseBlock @*@* @item ifTrue: trueBlock We are false -- answer nil @*@* @item ifTrue: trueBlock ifFalse: falseBlock We are false -- evaluate the falseBlock @*@* @item not We are false -- answer true @*@* @item or: aBlock We are false -- ored with anything, we always answer the other operand, so evaluate aBlock @*@* @item xor: aBoolean Answer whether the receiver and aBoolean represent different boolean values @*@* @item | aBoolean We are false -- ored with anything, we always answer the other operand @*@* @end table @node False-C hacks @subsection False: C hacks @table @b @item asCBooleanValue Answer `0'.@*@* @end table @node False-printing @subsection False: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @end table @node File @section File @table @b @item Category: Streams-Files @end table @menu * File class-C functions:: (class) * File class-file name management:: (class) * File class-file operations:: (class) * File class-initialization:: (class) * File class-instance creation:: (class) * File class-reading system defaults:: (class) * File class-testing:: (class) * File-accessing:: (instance) * File-C functions:: (instance) * File-file name management:: (instance) * File-file operations:: (instance) * File-testing:: (instance) @end menu @node File class-C functions @subsection File class: C functions @table @b @item errno C call-out to errno. Do not modify! @*@* @item primRemove: fileName C call-out to unlink. Do not modify! @*@* @item primRename: oldFileName to: newFileName C call-out to rename. Do not modify! @*@* @item stringError: errno C call-out to strerror. Do not modify! @*@* @end table @node File class-file name management @subsection File class: file name management @table @b @item extensionFor: aString Answer the extension of a file named `aString' @*@* @item fullNameFor: aString Answer the full path to a file called `aString', resolving the `.' and `..' directory entries, and answer the result. Answer nil if the file is invalid (such as '/usr/../..') @*@* @item pathFor: aString Answer the path of the name of a file called `aString', and answer the result @*@* @item stripExtensionFrom: aString Remove the extension from the name of a file called `aString', and answer the result @*@* @item stripPathFrom: aString Remove the path from the name of a file called `aString', and answer the file name plus extension. @*@* @end table @node File class-file operations @subsection File class: file operations @table @b @item checkError Return whether an error had been reported or not. If there had been one, raise an exception too @*@* @item checkError: errno The error with the C code `errno' has been reported. If errno >= 1, raise an exception @*@* @item remove: fileName Remove the file with the given path name @*@* @item rename: oldFileName to: newFileName Rename the file with the given path name oldFileName to newFileName @*@* @end table @node File class-initialization @subsection File class: initialization @table @b @item initialize Initialize the receiver's class variables @*@* @end table @node File class-instance creation @subsection File class: instance creation @table @b @item 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 @*@* @end table @node File class-reading system defaults @subsection File class: reading system defaults @table @b @item image Answer the full path to the image being used. @*@* @end table @node File class-testing @subsection File class: testing @table @b @item exists: fileName Answer whether a file with the given name exists @*@* @item isReadable: fileName Answer whether a file with the given name exists and is readable @*@* @item isWriteable: fileName Answer whether a file with the given name exists and is writeable @*@* @end table @node File-accessing @subsection File: accessing @table @b @item 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). @*@* @item lastAccessTime Answer the last access time of the file identified by the receiver @*@* @item 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. @*@* @item 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). @*@* @item name Answer the name of the file identified by the receiver @*@* @item refresh Refresh the statistics for the receiver @*@* @item size Answer the size of the file identified by the receiver @*@* @end table @node File-C functions @subsection File: C functions @table @b @item closeDir: dirObject C call-out to closedir. Do not modify! @*@* @item openDir: dirName C call-out to opendir. Do not modify! @*@* @item primIsReadable: name C call-out to fileIsReadable. Do not modify! @*@* @item primIsWriteable: name C call-out to fileIsWriteable. Do not modify! @*@* @item statOn: fileName into: statStruct C call-out to stat. Do not modify! @*@* @end table @node File-file name management @subsection File: file name management @table @b @item extension Answer the extension of the receiver @*@* @item fullName Answer the full name of the receiver, resolving the `.' and `..' directory entries, and answer the result. Answer nil if the name is invalid (such as '/usr/../../badname') @*@* @item path Answer the path (if any) of the receiver @*@* @item stripExtension Answer the path (if any) and file name of the receiver @*@* @item stripPath Answer the file name and extension (if any) of the receiver @*@* @end table @node File-file operations @subsection File: file operations @table @b @item contents Open a read-only FileStream on the receiver, read its contents, close the stream and answer the contents @*@* @item open: mode Open the receiver in the given mode (as answered by FileStream's class constant methods) @*@* @item readStream Open a read-only FileStream on the receiver @*@* @item remove Remove the file identified by the receiver @*@* @item renameTo: newName Remove the file identified by the receiver @*@* @item writeStream Open a write-only FileStream on the receiver @*@* @end table @node File-testing @subsection File: testing @table @b @item exists Answer whether a file with the name contained in the receiver does exist. @*@* @item isDirectory Answer whether a file with the name contained in the receiver does exist and identifies a directory. @*@* @item isFile Answer whether a file with the name contained in the receiver does exist and does not identify a directory. @*@* @item isReadable Answer whether a file with the name contained in the receiver does exist and is readable @*@* @item isWriteable Answer whether a file with the name contained in the receiver does exist and is writeable @*@* @end table @node FileSegment @section FileSegment @table @b @item 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. @end table @menu * FileSegment class-basic:: (class) * FileSegment-basic:: (instance) * FileSegment-equality:: (instance) @end menu @node FileSegment class-basic @subsection FileSegment class: basic @table @b @item 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 @*@* @end table @node FileSegment-basic @subsection FileSegment: basic @table @b @item asString Answer a String containing the required segment of the file @*@* @item fileName Answer the name of the file containing the segment @*@* @item filePos Answer the position in the file where the segment starts @*@* @end table @node FileSegment-equality @subsection FileSegment: equality @table @b @item = aFileSegment Answer whether the receiver and aFileSegment are equal. @*@* @item hash Answer an hash value for the receiver. @*@* @end table @node FileStream @section FileStream @table @b @item 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). @end table @menu * FileStream class-basic:: (class) * FileStream class-file-in:: (class) * FileStream class-initialization:: (class) * FileStream-accessing:: (instance) * FileStream-basic:: (instance) * FileStream-built ins:: (instance) * FileStream-class type methods:: (instance) * FileStream-overriding inherited methods:: (instance) * FileStream-printing:: (instance) * FileStream-testing:: (instance) @end menu @node FileStream class-basic @subsection FileStream class: basic @table @b @item append Open for writing. The file is created if it does not exist. The stream is positioned at the end of the file. @*@* @item 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. @*@* @item new This method should not be called for instances of this class.@*@* @item 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 @*@* @item 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 @*@* @item 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 @*@* @item 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. @*@* @item 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 @*@* @item read Open text file for reading. The stream is positioned at the beginning of the file. @*@* @item readWrite Open for reading and writing. The stream is positioned at the beginning of the file. @*@* @item stderr Answer a FileStream that is attached the Smalltalk program's standard error file handle, which can be used for error messages and diagnostics issued by the program. @*@* @item stdin Answer a FileStream that is attached the Smalltalk program's standard input file handle, which is the normal source of input for the program. @*@* @item stdout Answer a FileStream that is attached the Smalltalk program's standard output file handle; this is used for normal output from the program. @*@* @item write Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file. @*@* @end table @node FileStream class-file-in @subsection FileStream class: file-in @table @b @item fileIn: aFileName File in the aFileName file. During a file in operation, global variables (starting with an uppercase letter) that are not declared yet don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value. @*@* @item 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. During a file in operation, global variables (starting with an uppercase letter) that are not declared don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value. @*@* @item fileIn: aFileName ifTrue: aBoolean Conditionally do a file in, only if the supplied boolean is true. During a file in operation, global variables (starting with an uppercase letter) that are not declared don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value. @*@* @item 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). @*@* @item generateMakefileOnto: aStream Generate a make file for the file-ins since record was last set to true. Store it on aStream @*@* @item 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. @*@* @item 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. During a file in operation, global variables (starting with an uppercase letter) that are not declared don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value. @*@* @item verbose: verboseFlag Set whether Smalltalk should output debugging messages when filing in @*@* @end table @node FileStream class-initialization @subsection FileStream class: initialization @table @b @item initialize Initialize the receiver's class variables @*@* @end table @node FileStream-accessing @subsection FileStream: accessing @table @b @item isPipe Return whether the file is a pipe or an actual disk file @*@* @item name Return the name of the file @*@* @end table @node FileStream-basic @subsection FileStream: basic @table @b @item close Close the file @*@* @item contents Answer the whole contents of the file @*@* @item copyFrom: start to: end Answer the contents of the file between the two given positions @*@* @item finalize Close the file if it is still open by the time the object becomes garbage. @*@* @item flush Flush the output buffer @*@* @item next Return the next character in the file, or nil at eof @*@* @item nextByte Return the next byte in the file, or nil at eof @*@* @item nextPut: aChar Store aChar on the file @*@* @item nextPutByte: anInteger Store aChar on the file @*@* @item nextPutByteArray: aByteArray Store aByteArray on the file @*@* @item peek Peek a character in the file, don't change the position @*@* @item peekFor: aCharacter Peek a character in the file, don't change the position @*@* @item position Return the position of the file pointer in the receiver @*@* @item position: bytePosition Set the position of the file pointer in the receiver @*@* @item reset Reset the stream to its beginning @*@* @item size Return the current size of the file, in bytes @*@* @end table @node FileStream-built ins @subsection FileStream: built ins @table @b @item fileIn File in the contents of the receiver. During a file in operation, global variables (starting with an uppercase letter) that are not declared don't yield an `unknown variable' error. Instead, they are defined as nil in the `Undeclared' dictionary (a global variable residing in Smalltalk). As soon as you add the variable to a namespace (for example by creating a class) the Association will be removed from Undeclared and reused in the namespace, so that the old references will automagically point to the new value. @*@* @item fileInLine: lineNum fileName: aString at: charPosInt Private - Much like a preprocessor #line directive; it is used by the Emacs Smalltalk mode. @*@* @item fileOp: ioFuncIndex Private - Used to limit the number of primitives used by FileStreams @*@* @item fileOp: ioFuncIndex ifFail: aBlock Private - Used to limit the number of primitives used by FileStreams. @*@* @item fileOp: ioFuncIndex with: arg1 Private - Used to limit the number of primitives used by FileStreams @*@* @item fileOp: ioFuncIndex with: arg1 ifFail: aBlock Private - Used to limit the number of primitives used by FileStreams. @*@* @item fileOp: ioFuncIndex with: arg1 with: arg2 Private - Used to limit the number of primitives used by FileStreams @*@* @item fileOp: ioFuncIndex with: arg1 with: arg2 ifFail: aBlock Private - Used to limit the number of primitives used by FileStreams. @*@* @end table @node FileStream-class type methods @subsection FileStream: class type methods @table @b @item isBinary We answer characters, so answer false @*@* @item isText We answer characters, so answer true @*@* @item species Answer `String'.@*@* @end table @node FileStream-overriding inherited methods @subsection FileStream: overriding inherited methods @table @b @item isEmpty Answer whether the receiver is empty @*@* @item next: anInteger return the next 'anInteger' characters from the stream, as a String. @*@* @item nextPutAll: aCollection Put all the characters in aCollection in the file @*@* @item nextPutAllFlush: aCollection Put all the characters in aCollection in the file, then flush the file buffers @*@* @item reverseContents Return the contents of the file from the last byte to the first @*@* @item setToEnd Reset the file pointer to the end of the file @*@* @item skip: anInteger Skip anInteger bytes in the file @*@* @end table @node FileStream-printing @subsection FileStream: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @end table @node FileStream-testing @subsection FileStream: testing @table @b @item atEnd Answer whether data has come to an end @*@* @end table @node Float @section Float @table @b @item 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. @end table @menu * Float class-basic:: (class) * Float class-byte-order dependancies:: (class) * Float class-converting:: (class) * Float-arithmetic:: (instance) * Float-built ins:: (instance) * Float-coercing:: (instance) * Float-printing:: (instance) * Float-storing:: (instance) * Float-testing:: (instance) * Float-testing functionality:: (instance) @end menu @node Float class-basic @subsection Float class: basic @table @b @item e Returns the value of e. Hope is that it is precise enough @*@* @item epsilon Return the smallest Float x for which is 1 + x ~= 1 @*@* @item 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. @*@* @item largest Return the largest normalized Float that is not infinite. @*@* @item ln10 Returns the value of ln 10. Hope is that it is precise enough @*@* @item log10Base2 Returns the value of log2 10. Hope is that it is precise enough @*@* @item mantissaBits Answer the number of bits in the mantissa. 1 + (2^-mantissaBits) = 1 @*@* @item nan Return a Float that represents a mathematically indeterminate value (e.g. Inf - Inf, Inf / Inf) @*@* @item 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. @*@* @item pi Returns the value of pi. Hope is that it is precise enough @*@* @item smallest Return the smallest normalized Float that is not infinite. @*@* @item smallestAbs Return the smallest normalized Float that is > 0 @*@* @end table @node Float class-byte-order dependancies @subsection Float class: byte-order dependancies @table @b @item exponentByte Answer the byte of the receiver that contains the exponent @*@* @item leastSignificantMantissaByte Answer the least significant byte in the receiver among those that contain the mantissa @*@* @end table @node Float class-converting @subsection Float class: converting @table @b @item coerce: aNumber Answer aNumber converted to a Float @*@* @end table @node Float-arithmetic @subsection Float: arithmetic @table @b @item // aNumber Return the integer quotient of dividing the receiver by aNumber with truncation towards negative infinity. @*@* @item \\ aNumber Return the remainder of dividing the receiver by aNumber with truncation towards negative infinity. @*@* @item integerPart Return the receiver's integer part @*@* @end table @node Float-built ins @subsection Float: built ins @table @b @item * arg Multiply the receiver and arg and answer another Number @*@* @item + arg Sum the receiver and arg and answer another Number @*@* @item - arg Subtract arg from the receiver and answer another Number @*@* @item / arg Divide the receiver by arg and answer another Float @*@* @item < arg Answer whether the receiver is less than arg @*@* @item <= arg Answer whether the receiver is less than or equal to arg @*@* @item = arg Answer whether the receiver is equal to arg @*@* @item > arg Answer whether the receiver is greater than arg @*@* @item >= arg Answer whether the receiver is greater than or equal to arg @*@* @item arcCos Answer the arc-cosine of the receiver @*@* @item arcSin Answer the arc-sine of the receiver @*@* @item arcTan Answer the arc-tangent of the receiver @*@* @item ceiling Answer the integer part of the receiver, truncated towards +infinity @*@* @item cos Answer the cosine of the receiver @*@* @item exp Answer 'e' (2.718281828459...) raised to the receiver @*@* @item exponent Answer the exponent of the receiver in mantissa*2^exponent representation ( |mantissa|<=1 ) @*@* @item floor Answer the integer part of the receiver, truncated towards -infinity @*@* @item fractionPart Answer the fractional part of the receiver @*@* @item hash Answer an hash value for the receiver @*@* @item ln Answer the logarithm of the receiver in base 'e' (2.718281828459...) @*@* @item primHash Private - Answer an hash value for the receiver @*@* @item raisedTo: aNumber Answer the receiver raised to its aNumber power @*@* @item sin Answer the sine of the receiver @*@* @item sqrt Answer the square root of the receiver @*@* @item tan Answer the tangent of the receiver @*@* @item timesTwoPower: arg Answer the receiver multiplied by 2^arg @*@* @item truncated Truncate the receiver towards zero and answer the result @*@* @item ~= arg Answer whether the receiver is not equal to arg @*@* @end table @node Float-coercing @subsection Float: coercing @table @b @item asExactFraction Convert the receiver into a fraction with optimal approximation, but with usually huge terms. @*@* @item asFloat Just defined for completeness. Return the receiver. @*@* @item asFraction Convert the receiver into a fraction with a good (but undefined) approximation @*@* @item coerce: aNumber Coerce aNumber to the receiver's class @*@* @item estimatedLog Answer an estimate of (self abs floorLog: 10) @*@* @item generality Answer the receiver's generality @*@* @item unity Coerce 1 to the receiver's class @*@* @item zero Coerce 0 to the receiver's class @*@* @end table @node Float-printing @subsection Float: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @end table @node Float-storing @subsection Float: storing @table @b @item storeOn: aStream Print a representation of the receiver on aStream @*@* @end table @node Float-testing @subsection Float: testing @table @b @item isInfinite Answer whether the receiver represents positive or negative infinity @*@* @item isNaN Answer whether the receiver represents a NaN @*@* @item negative Answer whether the receiver is negative @*@* @item positive Answer whether the receiver is positive @*@* @item sign Answer 1 if the receiver is greater than 0, -1 if less than 0, else 0. @*@* @item strictlyPositive Answer whether the receiver is > 0 @*@* @end table @node Float-testing functionality @subsection Float: testing functionality @table @b @item isFloat Answer `true'.@*@* @end table @node Fraction @section Fraction @table @b @item 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. @end table @menu * Fraction class-converting:: (class) * Fraction class-instance creation:: (class) * Fraction-accessing:: (instance) * Fraction-arithmetic:: (instance) * Fraction-coercing:: (instance) * Fraction-comparing:: (instance) * Fraction-converting:: (instance) * Fraction-optimized cases:: (instance) * Fraction-printing:: (instance) * Fraction-testing:: (instance) @end menu @node Fraction class-converting @subsection Fraction class: converting @table @b @item coerce: aNumber Answer aNumber converted to a Fraction @*@* @end table @node Fraction class-instance creation @subsection Fraction class: instance creation @table @b @item initialize Initialize the receiver's class variables @*@* @item numerator: nInteger denominator: dInteger Answer a new instance of fraction (nInteger/dInteger) @*@* @end table @node Fraction-accessing @subsection Fraction: accessing @table @b @item denominator Answer the receiver's denominator @*@* @item numerator Answer the receiver's numerator @*@* @end table @node Fraction-arithmetic @subsection Fraction: arithmetic @table @b @item * aNumber Multiply two numbers and answer the result. @*@* @item + aNumber Sum two numbers and answer the result. @*@* @item - aNumber Subtract aNumber from the receiver and answer the result. @*@* @item / aNumber Divide the receiver by aNumber and answer the result. @*@* @item // aNumber Return the integer quotient of dividing the receiver by aNumber with truncation towards negative infinity. @*@* @item \\ aNumber Return the remainder from dividing the receiver by aNumber, (using //). @*@* @item estimatedLog Answer an estimate of (self abs floorLog: 10) @*@* @end table @node Fraction-coercing @subsection Fraction: coercing @table @b @item coerce: aNumber Coerce aNumber to the receiver's class @*@* @item generality Return the receiver's generality @*@* @item truncated Truncate the receiver and return the truncated result @*@* @item unity Coerce 1 to the receiver's class @*@* @item zero Coerce 0 to the receiver's class @*@* @end table @node Fraction-comparing @subsection Fraction: comparing @table @b @item < arg Test if the receiver is less than arg. @*@* @item <= arg Test if the receiver is less than or equal to arg. @*@* @item = arg Test if the receiver equals arg. @*@* @item > arg Test if the receiver is more than arg. @*@* @item >= arg Test if the receiver is greater than or equal to arg. @*@* @item hash Answer an hash value for the receiver @*@* @end table @node Fraction-converting @subsection Fraction: converting @table @b @item asFloat Answer the receiver converted to a Float @*@* @item asFraction Answer the receiver converted to a Fraction @*@* @end table @node Fraction-optimized cases @subsection Fraction: optimized cases @table @b @item negated Return the receiver, with its sign changed. @*@* @item raisedToInteger: anInteger Return self raised to the anInteger-th power. @*@* @item reciprocal Return the reciprocal of the receiver. @*@* @item squared Return the square of the receiver. @*@* @end table @node Fraction-printing @subsection Fraction: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Fraction-testing @subsection Fraction: testing @table @b @item isRational Answer whether the receiver is rational - true @*@* @end table @node IdentityDictionary @section IdentityDictionary @table @b @item Category: Collections-Keyed I am similar to an IdentityDictionary, except that removal and rehashing operations inside my instances look atomic to the interpreter. @end table @menu @end menu @node IdentitySet @section IdentitySet @table @b @item Category: Collections-Unordered I am the typical set object; I can store any objects uniquely. I use the == operator to determine duplication of objects. @end table @menu @end menu @node Integer @section Integer @table @b @item 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. @end table @menu * Integer class-converting:: (class) * Integer class-getting limits:: (class) * Integer class-testing:: (class) * Integer-accessing:: (instance) * Integer-bit operators:: (instance) * Integer-Coercion methods (heh heh heh):: (instance) * Integer-converting:: (instance) * Integer-extension:: (instance) * Integer-Math methods:: (instance) * Integer-Misc math operators:: (instance) * Integer-Other iterators:: (instance) * Integer-printing:: (instance) * Integer-storing:: (instance) * Integer-testing functionality:: (instance) @end menu @node Integer class-converting @subsection Integer class: converting @table @b @item coerce: aNumber Answer aNumber converted to a kind of Integer @*@* @end table @node Integer class-getting limits @subsection Integer class: getting limits @table @b @item bits Answer the number of bits (excluding the sign) that can be represented directly in an object pointer @*@* @item largest Answer the largest integer represented directly in an object pointer @*@* @item smallest Answer the smallest integer represented directly in an object pointer @*@* @end table @node Integer class-testing @subsection Integer class: testing @table @b @item isIdentity Answer whether x = y implies x == y for instances of the receiver @*@* @end table @node Integer-accessing @subsection Integer: accessing @table @b @item denominator Answer `1'.@*@* @item numerator Answer the receiver.@*@* @end table @node Integer-bit operators @subsection Integer: bit operators @table @b @item allMask: anInteger True if all 1 bits in anInteger are 1 in the receiver @*@* @item anyMask: anInteger True if any 1 bits in anInteger are 1 in the receiver @*@* @item bitAt: index Answer the index-th bit of the receiver (LSB: index = 1 @*@* @item bitClear: aMask Answer an Integer equal to the receiver, except that all the bits that are set in aMask are cleared. @*@* @item bitInvert Return the 1's complement of the bits of the receiver @*@* @item clearBit: index Clear the index-th bit of the receiver and answer a new Integer @*@* @item highBit Return the index of the highest order 1 bit of the receiver @*@* @item isBitSet: index Answer whether the index-th bit of the receiver is set @*@* @item noMask: anInteger True if no 1 bits in anInteger are 1 in the receiver @*@* @item setBit: index Set the index-th bit of the receiver and answer a new Integer @*@* @end table @node Integer-Coercion methods (heh heh heh) @subsection Integer: Coercion methods (heh heh heh) @table @b @item asCharacter Return self as an ascii character @*@* @item ceiling Return the receiver - it's already truncated @*@* @item coerce: aNumber Coerce aNumber to the receiver's class @*@* @item floor Return the receiver - it's already truncated @*@* @item generality Return the receiver's generality @*@* @item rounded Return the receiver - it's already truncated @*@* @item truncated Return the receiver - it's already truncated @*@* @item unity Coerce 1 to the receiver's class @*@* @item zero Coerce 0 to the receiver's class @*@* @end table @node Integer-converting @subsection Integer: converting @table @b @item asFraction Return the receiver converted to a fraction @*@* @end table @node Integer-extension @subsection Integer: extension @table @b @item alignTo: anInteger Answer the receiver, truncated to the first higher or equal multiple of anInteger (which must be a power of two) @*@* @end table @node Integer-Math methods @subsection Integer: Math methods @table @b @item estimatedLog Answer an estimate of (self abs floorLog: 10) @*@* @item even Return whether the receiver is even @*@* @item factorial Return the receiver's factorial @*@* @item floorLog: radix return (self log: radix) floor. Optimized to answer an integer. @*@* @item gcd: anInteger Return the greatest common divisor (Euclid's algorithm) between the receiver and anInteger @*@* @item lcm: anInteger Return the least common multiple between the receiver and anInteger @*@* @item odd Return whether the receiver is odd @*@* @end table @node Integer-Misc math operators @subsection Integer: Misc math operators @table @b @item hash Answer an hash value for the receiver @*@* @end table @node Integer-Other iterators @subsection Integer: Other iterators @table @b @item 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. @*@* @end table @node Integer-printing @subsection Integer: printing @table @b @item printOn: aStream Print on aStream the base 10 representation of the receiver @*@* @item printOn: aStream base: b Print on aStream the base b representation of the receiver @*@* @item printString: baseInteger Return the base b representation of the receiver @*@* @item radix: baseInteger Return the base b representation of the receiver, with BBr in front of it @*@* @item storeOn: aStream base: b Print on aStream Smalltalk code compiling to the receiver, represented in base b @*@* @end table @node Integer-storing @subsection Integer: storing @table @b @item storeOn: aStream Print on aStream the base 10 representation of the receiver @*@* @end table @node Integer-testing functionality @subsection Integer: testing functionality @table @b @item isInteger Answer `true'.@*@* @item isRational Answer whether the receiver is rational - true @*@* @item isSmallInteger Answer `true'.@*@* @end table @node Interval @section Interval @table @b @item 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. @end table @menu * Interval class-instance creation:: (class) * Interval-basic:: (instance) * Interval-printing:: (instance) * Interval-storing:: (instance) * Interval-testing:: (instance) @end menu @node Interval class-instance creation @subsection Interval class: instance creation @table @b @item from: startInteger to: stopInteger Answer an Interval going from startInteger to the stopInteger, with a step of 1 @*@* @item from: startInteger to: stopInteger by: stepInteger Answer an Interval going from startInteger to the stopInteger, with a step of stepInteger @*@* @end table @node Interval-basic @subsection Interval: basic @table @b @item at: index Answer the index-th element of the receiver. @*@* @item at: index put: anObject This method should not be called for instances of this class.@*@* @item collect: aBlock Evaluate the receiver for each element in aBlock, collect in an array the result of the evaluations. @*@* @item do: aBlock Evaluate the receiver for each element in aBlock @*@* @item reverse Answer a copy of the receiver with all of its items reversed @*@* @item size Answer the number of elements in the receiver. @*@* @item species Answer `Array'.@*@* @end table @node Interval-printing @subsection Interval: printing @table @b @item printOn: aStream Print a representation for the receiver on aStream @*@* @end table @node Interval-storing @subsection Interval: storing @table @b @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Interval-testing @subsection Interval: testing @table @b @item = anInterval Answer whether anInterval is the same interval as the receiver @*@* @item hash Answer an hash value for the receiver @*@* @end table @node LargeInteger @section LargeInteger @table @b @item 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. @end table @menu * LargeInteger-arithmetic:: (instance) * LargeInteger-bit operations:: (instance) * LargeInteger-built-ins:: (instance) * LargeInteger-coercion:: (instance) * LargeInteger-disabled:: (instance) * LargeInteger-primitive operations:: (instance) * LargeInteger-testing:: (instance) @end menu @node LargeInteger-arithmetic @subsection LargeInteger: arithmetic @table @b @item * aNumber Multiply aNumber and the receiver, answer the result @*@* @item + aNumber Sum the receiver and aNumber, answer the result @*@* @item - aNumber Sum the receiver and aNumber, answer the result @*@* @item / aNumber Divide aNumber and the receiver, answer the result (an Integer or Fraction) @*@* @item // aNumber Divide aNumber and the receiver, answer the result truncated towards -infinity @*@* @item \\ aNumber Divide aNumber and the receiver, answer the remainder truncated towards -infinity @*@* @item estimatedLog Answer an estimate of (self abs floorLog: 10) @*@* @item negated Answer the receiver's negated @*@* @item quo: aNumber Divide aNumber and the receiver, answer the result truncated towards 0 @*@* @item rem: aNumber Divide aNumber and the receiver, answer the remainder truncated towards 0 @*@* @end table @node LargeInteger-bit operations @subsection LargeInteger: bit operations @table @b @item bitAnd: aNumber Answer the receiver ANDed with aNumber @*@* @item bitAt: aNumber Answer the aNumber-th bit in the receiver, where the LSB is 1 @*@* @item bitInvert Answer the receiver's 1's complement @*@* @item bitOr: aNumber Answer the receiver ORed with aNumber @*@* @item bitShift: aNumber Answer the receiver shifted by aNumber places @*@* @item bitXor: aNumber Answer the receiver XORed with aNumber @*@* @end table @node LargeInteger-built-ins @subsection LargeInteger: built-ins @table @b @item at: anIndex Answer the anIndex-th byte in the receiver's representation @*@* @item at: anIndex put: aNumber Answer the anIndex-th byte in the receiver's representation @*@* @item digitAt: anIndex Answer the anIndex-th base-256 digit in the receiver's representation @*@* @item digitAt: anIndex put: aNumber Answer the anIndex-th base-256 digit in the receiver's representation @*@* @item digitLength Answer the number of base-256 digits in the receiver @*@* @item hash Answer an hash value for the receiver @*@* @item 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 @*@* @item size Answer the number of indexed instance variable in the receiver @*@* @end table @node LargeInteger-coercion @subsection LargeInteger: coercion @table @b @item coerce: aNumber Truncate the number; if needed, convert it to LargeInteger representation. @*@* @item generality Answer the receiver's generality @*@* @item unity Coerce 1 to the receiver's class @*@* @item zero Coerce 0 to the receiver's class @*@* @end table @node LargeInteger-disabled @subsection LargeInteger: disabled @table @b @item asObject This method always fails. The number of OOPs is far less than the minimum number represented with a LargeInteger. @*@* @item asObjectNoFail Answer `nil'.@*@* @end table @node LargeInteger-primitive operations @subsection LargeInteger: primitive operations @table @b @item basicLeftShift: totalShift Private - Left shift the receiver by aNumber places @*@* @item basicRightShift: totalShift Private - Right shift the receiver by 'shift' places @*@* @item largeNegated Private - Same as negated, but always answer a LargeInteger @*@* @end table @node LargeInteger-testing @subsection LargeInteger: testing @table @b @item < aNumber Answer whether the receiver is smaller than aNumber @*@* @item <= aNumber Answer whether the receiver is smaller than aNumber or equal to it @*@* @item = aNumber Answer whether the receiver and aNumber identify the same number @*@* @item > aNumber Answer whether the receiver is greater than aNumber @*@* @item >= aNumber Answer whether the receiver is greater than aNumber or equal to it @*@* @item ~= aNumber Answer whether the receiver and aNumber identify the same number @*@* @end table @node LargeNegativeInteger @section LargeNegativeInteger @table @b @item 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 @end table @menu * LargeNegativeInteger-converting:: (instance) * LargeNegativeInteger-numeric testing:: (instance) * LargeNegativeInteger-reverting to LargePositiveInteger:: (instance) @end menu @node LargeNegativeInteger-converting @subsection LargeNegativeInteger: converting @table @b @item asFloat Answer the receiver converted to a Float @*@* @end table @node LargeNegativeInteger-numeric testing @subsection LargeNegativeInteger: numeric testing @table @b @item abs Answer the receiver's absolute value. @*@* @item negative Answer whether the receiver is < 0 @*@* @item positive Answer whether the receiver is >= 0 @*@* @item sign Answer the receiver's sign @*@* @item strictlyPositive Answer whether the receiver is > 0 @*@* @end table @node LargeNegativeInteger-reverting to LargePositiveInteger @subsection LargeNegativeInteger: reverting to LargePositiveInteger @table @b @item + aNumber Sum the receiver and aNumber, answer the result @*@* @item - aNumber Sum the receiver and aNumber, answer the result @*@* @item gcd: anInteger Return the greatest common divisor between the receiver and anInteger @*@* @item highBit Answer the receiver's highest bit's index @*@* @end table @node LargePositiveInteger @section LargePositiveInteger @table @b @item 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 @end table @menu * LargePositiveInteger-arithmetic:: (instance) * LargePositiveInteger-converting:: (instance) * LargePositiveInteger-helper byte-level methods:: (instance) * LargePositiveInteger-numeric testing:: (instance) * LargePositiveInteger-primitive operations:: (instance) @end menu @node LargePositiveInteger-arithmetic @subsection LargePositiveInteger: arithmetic @table @b @item + aNumber Sum the receiver and aNumber, answer the result @*@* @item - aNumber Subtract aNumber from the receiver, answer the result @*@* @item gcd: anInteger Calculate the GCD between the receiver and anInteger @*@* @item highBit Answer the receiver's highest bit's index @*@* @end table @node LargePositiveInteger-converting @subsection LargePositiveInteger: converting @table @b @item asFloat Answer the receiver converted to a Float @*@* @item reverseStringBase: radix on: str Return in a string the base radix representation of the receiver in reverse order @*@* @end table @node LargePositiveInteger-helper byte-level methods @subsection LargePositiveInteger: helper byte-level methods @table @b @item 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. @*@* @item bytes: byteArray1 from: j subtract: byteArray2 Private - Sutract the bytes in byteArray2 from those in byteArray1 @*@* @item bytes: bytes multiply: anInteger Private - Multiply the bytes in bytes by anInteger, which must be < 255. Put the result back in bytes. @*@* @item bytesLeftShift: aByteArray Private - Left shift by 1 place the bytes in aByteArray @*@* @item bytesLeftShift: aByteArray big: totalShift Private - Left shift the bytes in aByteArray by totalShift places @*@* @item bytesLeftShift: aByteArray n: shift Private - Left shift by shift places the bytes in aByteArray (shift <= 7) @*@* @item bytesRightShift: aByteArray big: totalShift Private - Right shift the bytes in aByteArray by totalShift places @*@* @item bytesRightShift: bytes n: aNumber Private - Right shift the bytes in `bytes' by 'aNumber' places (shift <= 7) @*@* @item bytesTrailingZeros: bytes Private - Answer the number of trailing zero bits in the receiver @*@* @item 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!!!) @*@* @end table @node LargePositiveInteger-numeric testing @subsection LargePositiveInteger: numeric testing @table @b @item abs Answer the receiver's absolute value @*@* @item negative Answer whether the receiver is < 0 @*@* @item positive Answer whether the receiver is >= 0 @*@* @item sign Answer the receiver's sign @*@* @item strictlyPositive Answer whether the receiver is > 0 @*@* @end table @node LargePositiveInteger-primitive operations @subsection LargePositiveInteger: primitive operations @table @b @item 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 @*@* @item isSmall Private - Answer whether the receiver is small enough to employ simple scalar algorithms for division and multiplication @*@* @item multiply: aNumber Private - Multiply the receiver by aNumber (unsigned multiply) @*@* @end table @node LargeZeroInteger @section LargeZeroInteger @table @b @item 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. @end table @menu * LargeZeroInteger-accessing:: (instance) * LargeZeroInteger-arithmetic:: (instance) * LargeZeroInteger-numeric testing:: (instance) * LargeZeroInteger-printing:: (instance) @end menu @node LargeZeroInteger-accessing @subsection LargeZeroInteger: accessing @table @b @item at: anIndex Answer `0'.@*@* @item hash Answer `0'.@*@* @item size Answer `0'.@*@* @end table @node LargeZeroInteger-arithmetic @subsection LargeZeroInteger: arithmetic @table @b @item * aNumber Multiply aNumber and the receiver, answer the result @*@* @item + aNumber Sum the receiver and aNumber, answer the result @*@* @item - aNumber Subtract aNumber from the receiver, answer the result @*@* @item / aNumber Divide aNumber and the receiver, answer the result (an Integer or Fraction) @*@* @item // aNumber Divide aNumber and the receiver, answer the result truncated towards -infinity @*@* @item \\ aNumber Divide aNumber and the receiver, answer the remainder truncated towards -infinity @*@* @item quo: aNumber Divide aNumber and the receiver, answer the result truncated towards 0 @*@* @item rem: aNumber Divide aNumber and the receiver, answer the remainder truncated towards 0 @*@* @end table @node LargeZeroInteger-numeric testing @subsection LargeZeroInteger: numeric testing @table @b @item sign Answer the receiver's sign @*@* @item strictlyPositive Answer whether the receiver is > 0 @*@* @end table @node LargeZeroInteger-printing @subsection LargeZeroInteger: printing @table @b @item reverseStringBase: radix on: str Return in a string the base radix representation of the receiver in reverse order @*@* @end table @node Link @section Link @table @b @item 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. @end table @menu * Link class-instance creation:: (class) * Link-basic:: (instance) * Link-iteration:: (instance) @end menu @node Link class-instance creation @subsection Link class: instance creation @table @b @item nextLink: aLink Create an instance with the given next link @*@* @end table @node Link-basic @subsection Link: basic @table @b @item nextLink Answer the next item in the list @*@* @item nextLink: aLink Set the next item in the list @*@* @end table @node Link-iteration @subsection Link: iteration @table @b @item at: index Retrieve a node (instance of Link) that is at a distance of `index' after the receiver. @*@* @item at: index put: object This method should not be called for instances of this class.@*@* @item do: aBlock Evaluate aBlock for each element in the list @*@* @item size Answer the number of elements in the list. Warning: this is O(n) @*@* @end table @node LinkedList @section LinkedList @table @b @item 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. @end table @menu * LinkedList-accessing:: (instance) * LinkedList-adding:: (instance) * LinkedList-enumerating:: (instance) * LinkedList-testing:: (instance) @end menu @node LinkedList-accessing @subsection LinkedList: accessing @table @b @item at: index Return the element that is index into the linked list. @*@* @item at: index put: object This method should not be called for instances of this class.@*@* @end table @node LinkedList-adding @subsection LinkedList: adding @table @b @item add: aLink Add aLink at the end of the list; return aLink. @*@* @item addFirst: aLink Add aLink at the head of the list; return aLink. @*@* @item addLast: aLink Add aLink at then end of the list; return aLink. @*@* @item remove: aLink ifAbsent: aBlock Remove aLink from the list and return it, or invoke aBlock if it's not found in the list. @*@* @item removeFirst Remove the first element from the list and return it, or error if the list is empty. @*@* @item removeLast Remove the final element from the list and return it, or error if the list is empty. @*@* @end table @node LinkedList-enumerating @subsection LinkedList: enumerating @table @b @item do: aBlock Enumerate each object in the list, passing it to aBlock (actual behavior might depend on the subclass of Link that is being used). @*@* @end table @node LinkedList-testing @subsection LinkedList: testing @table @b @item isEmpty Returns true if the list contains no members @*@* @item notEmpty Returns true if the list contains at least a member @*@* @item size Answer the number of elements in the list. Warning: this is O(n) @*@* @end table @node LookupKey @section LookupKey @table @b @item Category: Language-Data types I represent a key for looking up entries in a data structure. Subclasses of me, such as Association, typically represent dictionary entries. @end table @menu * LookupKey class-basic:: (class) * LookupKey-accessing:: (instance) * LookupKey-printing:: (instance) * LookupKey-storing:: (instance) * LookupKey-testing:: (instance) @end menu @node LookupKey class-basic @subsection LookupKey class: basic @table @b @item key: aKey Answer a new instance of the receiver with the given key and value @*@* @end table @node LookupKey-accessing @subsection LookupKey: accessing @table @b @item key Answer the receiver's key @*@* @item key: aKey Set the receiver's key to aKey @*@* @end table @node LookupKey-printing @subsection LookupKey: printing @table @b @item printOn: aStream Put on aStream a representation of the receiver @*@* @end table @node LookupKey-storing @subsection LookupKey: storing @table @b @item storeOn: aStream Put on aStream some Smalltalk code compiling to the receiver @*@* @end table @node LookupKey-testing @subsection LookupKey: testing @table @b @item < aLookupKey Answer whether the receiver's key is less than aLookupKey's @*@* @item = aLookupKey Answer whether the receiver's key and value are the same as aLookupKey's, or false if aLookupKey is not an instance of the receiver @*@* @item hash Answer an hash value for the receiver @*@* @end table @node LookupTable @section LookupTable @table @b @item Category: Collections-Keyed I am similar to Dictionary, except that my representation is different (more efficient, but not as friendly to the virtual machine). I use the object equality comparision message = to determine equivalence of indices. @end table @menu * LookupTable class-instance creation:: (class) * LookupTable-accessing:: (instance) * LookupTable-copying:: (instance) * LookupTable-enumerating:: (instance) * LookupTable-rehashing:: (instance) * LookupTable-removing:: (instance) * LookupTable-storing:: (instance) @end menu @node LookupTable class-instance creation @subsection LookupTable class: instance creation @table @b @item new Create a new LookupTable with a default size @*@* @end table @node LookupTable-accessing @subsection LookupTable: accessing @table @b @item add: anAssociation Add the anAssociation key to the receiver @*@* @item associationAt: key ifAbsent: aBlock Answer the key/value Association for the given key. Evaluate aBlock (answering the result) if the key is not found @*@* @item at: key ifAbsent: aBlock Answer the value associated to the given key, or the result of evaluating aBlock if the key is not found @*@* @item at: aKey ifPresent: aBlock If aKey is absent, answer nil. Else, evaluate aBlock passing the associated value and answer the result of the invocation @*@* @item at: key put: value Store value as associated to the given key @*@* @end table @node LookupTable-copying @subsection LookupTable: copying @table @b @item deepCopy Returns a deep copy of the receiver (the instance variables are copies of the receiver's instance variables) @*@* @end table @node LookupTable-enumerating @subsection LookupTable: enumerating @table @b @item associationsDo: aBlock Pass each association in the LookupTable to aBlock @*@* @item keysAndValuesDo: aBlock Pass each key/value pair in the LookupTable as two distinct parameters to aBlock @*@* @end table @node LookupTable-rehashing @subsection LookupTable: rehashing @table @b @item rehash Rehash the receiver @*@* @end table @node LookupTable-removing @subsection LookupTable: removing @table @b @item removeKey: key ifAbsent: aBlock Remove the passed key from the LookupTable, answer the result of evaluating aBlock if it is not found @*@* @end table @node LookupTable-storing @subsection LookupTable: storing @table @b @item storeOn: aStream Print Smalltalk code compiling to the receiver on aStream @*@* @end table @node Magnitude @section Magnitude @table @b @item 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 >. @end table @menu * Magnitude-basic:: (instance) * Magnitude-misc methods:: (instance) @end menu @node Magnitude-basic @subsection Magnitude: basic @table @b @item < aMagnitude Answer whether the receiver is less than aMagnitude @*@* @item <= aMagnitude Answer whether the receiver is less than or equal to aMagnitude @*@* @item = aMagnitude Answer whether the receiver is equal to aMagnitude @*@* @item > aMagnitude Answer whether the receiver is greater than aMagnitude @*@* @item >= aMagnitude Answer whether the receiver is greater than or equal to aMagnitude @*@* @end table @node Magnitude-misc methods @subsection Magnitude: misc methods @table @b @item between: min and: max Returns true if object is inclusively between min and max. @*@* @item max: aMagnitude Returns the greatest object between the receiver and aMagnitude @*@* @item min: aMagnitude Returns the least object between the receiver and aMagnitude @*@* @end table @node MappedCollection @section MappedCollection @table @b @item 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. @end table @menu * MappedCollection class-instance creation:: (class) * MappedCollection-basic:: (instance) @end menu @node MappedCollection class-instance creation @subsection MappedCollection class: instance creation @table @b @item collection: aCollection map: aMap Answer a new MappedCollection using the given domain (aCollection) and map @*@* @item new self shouldNotImplement @*@* @end table @node MappedCollection-basic @subsection MappedCollection: basic @table @b @item add: anObject This method should not be called for instances of this class.@*@* @item at: key Answer the object at the given key @*@* @item at: key put: value Store value at the given key @*@* @item collect: aBlock Answer a MappedCollection with a copy of the receiver's map and a domain obtained by passing each object through aBlock @*@* @item contents Answer a bag with the receiver's values @*@* @item do: aBlock Evaluate aBlock for each object @*@* @item domain Answer the domain @*@* @item map Answer the map @*@* @item reject: aBlock Answer the objects in the domain for which aBlock returns false @*@* @item select: aBlock Answer the objects in the domain for which aBlock returns true @*@* @item size Answer the receiver's size @*@* @end table @node Memory @section Memory @table @b @item 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,...). @end table @menu * Memory class-accessing:: (class) * Memory class-basic:: (class) @end menu @node Memory class-accessing @subsection Memory class: accessing @table @b @item at: anAddress Access the Smalltalk object (OOP) at the given address. @*@* @item at: anAddress put: aValue Store a pointer (OOP) to the Smalltalk object identified by `value' at the given address. @*@* @item charAt: anAddress Access the C char at the given address. The value is returned as a Smalltalk Character. @*@* @item 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. @*@* @item deref: anAddress Access the C int pointed by the given address @*@* @item doubleAt: anAddress Access the C double at the given address. @*@* @item doubleAt: anAddress put: aValue Store the Smalltalk Float object identified by `value', at the given address, writing it like a C double. @*@* @item floatAt: anAddress Access the C float at the given address. @*@* @item floatAt: anAddress put: aValue Store the Smalltalk Float object identified by `value', at the given address, writing it like a C float. @*@* @item intAt: anAddress Access the C int at the given address. @*@* @item intAt: anAddress put: aValue Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(int) bytes. @*@* @item longAt: anAddress Access the C long int at the given address. @*@* @item longAt: anAddress put: aValue Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(long) bytes. @*@* @item shortAt: anAddress Access the C short int at the given address. @*@* @item shortAt: anAddress put: aValue Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(short) bytes. @*@* @item stringAt: anAddress Access the string pointed by the C `char *' at the given given address. @*@* @item 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. @*@* @item unsignedCharAt: anAddress Access the C unsigned char at the given address. The value is returned as a Smalltalk Character. @*@* @item 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. @*@* @item unsignedIntAt: anAddress Access the C unsigned int at the given address. @*@* @item unsignedIntAt: anAddress put: aValue Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(int) bytes. @*@* @item unsignedLongAt: anAddress Access the C unsigned long int at the given address. @*@* @item unsignedLongAt: anAddress put: aValue Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(long) bytes. @*@* @item unsignedShortAt: anAddress Access the C unsigned short int at the given address. @*@* @item unsignedShortAt: anAddress put: aValue Store the Smalltalk Integer object identified by `value', at the given address, using sizeof(short) bytes. @*@* @end table @node Memory class-basic @subsection Memory class: basic @table @b @item addressOf: anObject Returns the address of the actual object that anObject references. The result might be invalidated after a garbage collection occurs. @*@* @item addressOfOOP: anObject Returns the address of the OOP (object table slot) for anObject. The result is still valid after a garbage collection occurs. @*@* @item type: aType at: anAddress Returns a particular type object from memory at anAddress @*@* @item type: aType at: anAddress put: aValue Sets the memory location anAddress to aValue @*@* @end table @node Message @section Message @table @b @item 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. @end table @menu * Message class-creating instances:: (class) * Message-accessing:: (instance) * Message-basic:: (instance) @end menu @node Message class-creating instances @subsection Message class: creating instances @table @b @item selector: aSymbol arguments: anArray Create a new Message with the given selector and arguments @*@* @end table @node Message-accessing @subsection Message: accessing @table @b @item argument Answer the first of the receiver's arguments @*@* @item arguments Answer the receiver's arguments @*@* @item arguments: anArray Set the receiver's arguments @*@* @item selector Answer the receiver's selector @*@* @item selector: aSymbol Set the receiver's selector @*@* @end table @node Message-basic @subsection Message: basic @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @item reinvokeFor: aReceiver Resend to aReceiver - present for compatibility @*@* @item sendTo: aReceiver Resend to aReceiver @*@* @end table @node Metaclass @section Metaclass @table @b @item 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. @end table @menu * Metaclass class-instance creation:: (class) * Metaclass-accessing:: (instance) * Metaclass-basic:: (instance) * Metaclass-delegation:: (instance) * Metaclass-filing:: (instance) * Metaclass-printing:: (instance) * Metaclass-testing functionality:: (instance) @end menu @node Metaclass class-instance creation @subsection Metaclass class: instance creation @table @b @item subclassOf: superMeta Answer a new metaclass representing a subclass of superMeta @*@* @end table @node Metaclass-accessing @subsection Metaclass: accessing @table @b @item instanceClass Answer the only instance of the metaclass @*@* @item primaryInstance Answer the only instance of the metaclass - present for compatibility @*@* @item soleInstance Answer the only instance of the metaclass - present for compatibility @*@* @end table @node Metaclass-basic @subsection Metaclass: basic @table @b @item instanceVariableNames: classInstVarNames Set the class-instance variables for the receiver to be those in classInstVarNames @*@* @item name: newName environment: aNamespace 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 @*@* @item newMeta: className environment: aNamespace 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 @*@* @end table @node Metaclass-delegation @subsection Metaclass: delegation @table @b @item addClassVarName: aString Add a class variable with the given name to the class pool dictionary @*@* @item addSharedPool: aDictionary Add the given shared pool to the list of the class' pool dictionaries @*@* @item allClassVarNames Answer the names of the variables in the receiver's class pool dictionary and in each of the superclasses' class pool dictionaries @*@* @item allSharedPools Return the names of the shared pools defined by the class and any of its superclasses @*@* @item category Answer the class category @*@* @item classPool Answer the class pool dictionary @*@* @item classVarNames Answer the names of the variables in the class pool dictionary @*@* @item comment Answer the class comment @*@* @item environment Answer the namespace in which the receiver is implemented @*@* @item name Answer the class name - it has none, actually @*@* @item removeClassVarName: aString Removes the class variable from the class, error if not present, or still in use. @*@* @item removeSharedPool: aDictionary Remove the given dictionary to the list of the class' pool dictionaries @*@* @item sharedPools Return the names of the shared pools defined by the class @*@* @end table @node Metaclass-filing @subsection Metaclass: filing @table @b @item fileOutOn: aFileStream File out complete class description: class definition, class and instance methods @*@* @end table @node Metaclass-printing @subsection Metaclass: printing @table @b @item nameIn: aNamespace Answer the class name when the class is referenced from aNamespace - a dummy one, since Behavior does not support names. @*@* @item printOn: aStream Print a represention of the receiver on aStream @*@* @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Metaclass-testing functionality @subsection Metaclass: testing functionality @table @b @item asClass Answer `instanceClass'.@*@* @item isMetaclass Answer `true'.@*@* @end table @node MethodContext @section MethodContext @table @b @item 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. @end table @menu * MethodContext-accessing:: (instance) * MethodContext-printing:: (instance) @end menu @node MethodContext-accessing @subsection MethodContext: accessing @table @b @item home Answer the MethodContext to which the receiver refers (i.e. the receiver itself) @*@* @item isBlock Answer whether the receiver is a block context @*@* @item isEnvironment 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. Answer whether the receiver is that kind of context. @*@* @item sender Return the context from which the receiver was sent @*@* @end table @node MethodContext-printing @subsection MethodContext: printing @table @b @item printOn: aStream Print a representation for the receiver on aStream @*@* @end table @node MethodDictionary @section MethodDictionary @table @b @item Category: Language-Implementation @end table @menu * MethodDictionary-adding:: (instance) * MethodDictionary-rehashing:: (instance) * MethodDictionary-removing:: (instance) @end menu @node MethodDictionary-adding @subsection MethodDictionary: adding @table @b @item at: key put: value Store value as associated to the given key @*@* @end table @node MethodDictionary-rehashing @subsection MethodDictionary: rehashing @table @b @item rehash Rehash the receiver @*@* @end table @node MethodDictionary-removing @subsection MethodDictionary: removing @table @b @item removeAssociation: anAssociation Remove anAssociation's key from the dictionary @*@* @item removeKey: anElement ifAbsent: aBlock Remove the passed key from the dictionary, answer the result of evaluating aBlock if it is not found @*@* @end table @node MethodInfo @section MethodInfo @table @b @item 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. @end table @menu * MethodInfo-accessing:: (instance) * MethodInfo-equality:: (instance) @end menu @node MethodInfo-accessing @subsection MethodInfo: accessing @table @b @item category Answer the method category @*@* @item category: aCategory Set the method category @*@* @item methodClass Answer the class in which the method is defined @*@* @item methodClass: aClass Set the class in which the method is defined @*@* @item selector Answer the selector through which the method is called @*@* @item selector: aSymbol Set the selector through which the method is called @*@* @item sourceCode Answer a FileSegment or String or nil containing the method source code @*@* @item sourceFile Answer the name of the file where the method source code is @*@* @item sourcePos Answer the starting position of the method source code in the sourceFile @*@* @item sourceString Answer a String containing the method source code @*@* @item stripSourceCode Remove the reference to the source code for the method @*@* @end table @node MethodInfo-equality @subsection MethodInfo: equality @table @b @item = aMethodInfo Compare the receiver and aMethodInfo, answer whether they're equal @*@* @item hash Answer an hash value for the receiver @*@* @end table @node Namespace @section Namespace @table @b @item Category: Language-Implementation I am a special form of dictionary. I provide special ways to access my keys, which typically begin with an uppercase letter. Classes hold on an instance of me; it is called their `environment'). My keys are (expected to be) symbols, so I use == to match searched keys to those in the dictionary -- this is done expecting it brings a bit more speed. @end table @menu * Namespace class-accessing:: (class) * Namespace class-disabling instance creation:: (class) * Namespace-accessing:: (instance) * Namespace-namespace hierarchy:: (instance) * Namespace-overrides for superspaces:: (instance) * Namespace-printing:: (instance) * Namespace-testing:: (instance) @end menu @node Namespace class-accessing @subsection Namespace class: accessing @table @b @item current Answer the current namespace @*@* @item current: aNamespace Set the current namespace to be aNamespace. @*@* @end table @node Namespace class-disabling instance creation @subsection Namespace class: disabling instance creation @table @b @item new Disabled - use #addSubspace: to create instances @*@* @item new: size Disabled - use #addSubspace: to create instances @*@* @end table @node Namespace-accessing @subsection Namespace: accessing @table @b @item inheritedKeys Answer a Set of all the keys in the receiver and its superspaces @*@* @end table @node Namespace-namespace hierarchy @subsection Namespace: namespace hierarchy @table @b @item siblings Answer all the other namespaces that inherit from the receiver's superspace. @*@* @item siblingsDo: aBlock Evaluate aBlock once for each of the other namespaces that inherit from the receiver's superspace, passing the namespace as a parameter. @*@* @end table @node Namespace-overrides for superspaces @subsection Namespace: overrides for superspaces @table @b @item associationAt: key ifAbsent: aBlock Return the key/value pair associated to the variable named as specified by `key'. If the key is not found search will be brought on in superspaces, finally evaluating aBlock if the variable cannot be found in any of the superspaces. @*@* @item associationsDo: aBlock Pass each association in the namespace to aBlock @*@* @item at: key ifAbsent: aBlock Return the value associated to the variable named as specified by `key'. If the key is not found search will be brought on in superspaces, finally evaluating aBlock if the variable cannot be found in any of the superspaces. @*@* @item at: key ifPresent: aBlock If aKey is absent from the receiver and all its superspaces, answer nil. Else, evaluate aBlock passing the associated value and answer the result of the invocation @*@* @item do: aBlock Pass each value in the namespace to aBlock @*@* @item includesKey: key Answer whether the receiver or any of its superspaces contain the given key @*@* @item keysAndValuesDo: aBlock Pass to aBlock each of the receiver's keys and values, in two separate parameters @*@* @item keysDo: aBlock Pass to aBlock each of the receiver's keys @*@* @item set: key to: newValue ifAbsent: aBlock Assign newValue to the variable named as specified by `key'. This method won't define a new variable; instead if the key is not found it will search in superspaces and evaluate aBlock if it is not found. Answer newValue. @*@* @item size Answer the number of keys in the receiver and each of its superspaces @*@* @end table @node Namespace-printing @subsection Namespace: printing @table @b @item name Answer the receiver's name @*@* @item storeOn: aStream Store Smalltalk code compiling to the receiver @*@* @end table @node Namespace-testing @subsection Namespace: testing @table @b @item isSmalltalk Answer `true'.@*@* @end table @node NullProxy @section NullProxy @table @b @item 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. @end table @menu * NullProxy class-instance creation:: (class) * NullProxy-accessing:: (instance) @end menu @node NullProxy class-instance creation @subsection NullProxy class: instance creation @table @b @item loadFrom: anObjectDumper Reload the object stored in anObjectDumper @*@* @item on: anObject Answer a proxy to be used to save anObject. @*@* @end table @node NullProxy-accessing @subsection NullProxy: accessing @table @b @item dumpTo: anObjectDumper Dump the object stored in the proxy to anObjectDumper @*@* @item object Reconstruct the object stored in the proxy and answer it @*@* @item 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 override #dumpTo: and #loadFrom: @*@* @end table @node NullValueHolder @section NullValueHolder @table @b @item 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. @end table @menu * NullValueHolder class-creating instances:: (class) * NullValueHolder-accessing:: (instance) @end menu @node NullValueHolder class-creating instances @subsection NullValueHolder class: creating instances @table @b @item new Not used -- use `ValueHolder null' instead @*@* @end table @node NullValueHolder-accessing @subsection NullValueHolder: accessing @table @b @item value Retrive the value of the receiver. Always answer nil @*@* @item value: anObject Set the value of the receiver. Do nothing, discard the value @*@* @end table @node Number @section Number @table @b @item 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. @end table @menu * Number class-converting:: (class) * Number class-testing:: (class) * Number-arithmetic:: (instance) * Number-converting:: (instance) * Number-copying:: (instance) * Number-Intervals & iterators:: (instance) * Number-misc math:: (instance) * Number-point creation:: (instance) * Number-testing:: (instance) * Number-truncation and round off:: (instance) @end menu @node Number class-converting @subsection Number class: converting @table @b @item coerce: aNumber Answer aNumber - whatever class it belongs to, it is good @*@* @item 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. @*@* @end table @node Number class-testing @subsection Number class: testing @table @b @item isImmediate Answer whether, if x is an instance of the receiver, x copy == x @*@* @end table @node Number-arithmetic @subsection Number: arithmetic @table @b @item * aNumber Subtract the receiver and aNumber, answer the result @*@* @item + aNumber Sum the receiver and aNumber, answer the result @*@* @item - aNumber Subtract aNumber from the receiver, answer the result @*@* @item / aNumber Divide the receiver by aNumber, answer the result (no loss of precision) @*@* @item // aNumber Divide the receiver by aNumber, answer the result truncated towards -infinity @*@* @item \\ aNumber Divide the receiver by aNumber truncating towards -infinity, answer the remainder @*@* @item quo: aNumber Return the integer quotient of dividing the receiver by aNumber with truncation towards zero. @*@* @item reciprocal Return the reciprocal of the receiver @*@* @item rem: aNumber Return the remainder of dividing the receiver by aNumber with truncation towards zero. @*@* @end table @node Number-converting @subsection Number: converting @table @b @item asFloat This method's functionality should be implemented by subclasses of Number@*@* @item asRectangle Answer an empty rectangle whose origin is (self asPoint) @*@* @item coerce: aNumber Answer aNumber - whatever class it belongs to, it is good @*@* @item degreesToRadians Convert the receiver to radians @*@* @item generality Answer the receiver's generality @*@* @item radiansToDegrees Convert the receiver from radians to degrees @*@* @item 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. @*@* @item unity Coerce 1 to the receiver's class. The default implementation works, but is inefficient @*@* @item zero Coerce 0 to the receiver's class. The default implementation works, but is inefficient @*@* @end table @node Number-copying @subsection Number: copying @table @b @item deepCopy Return the receiver - it's an immediate (immutable) object @*@* @item shallowCopy Return the receiver - it's an immediate (immutable) object @*@* @end table @node Number-Intervals & iterators @subsection Number: Intervals & iterators @table @b @item to: stop Return an interval going from the receiver to stop by 1 @*@* @item to: stop by: step Return an interval going from the receiver to stop with the given step @*@* @item 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. @*@* @item 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. @*@* @end table @node Number-misc math @subsection Number: misc math @table @b @item abs Answer the absolute value of the receiver @*@* @item arcCos return the arc cosine of the receiver @*@* @item arcSin return the arc sine of the receiver @*@* @item arcTan return the arc tangent of the receiver @*@* @item cos return the cosine of the receiver @*@* @item 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. @*@* @item exp return e raised to the receiver @*@* @item floorLog: radix return (self log: radix) floor. Optimized to answer an integer. @*@* @item ln return log base e of the receiver @*@* @item log return log base aNumber of the receiver @*@* @item log: aNumber return log base aNumber of the receiver @*@* @item negated Answer the negated of the receiver @*@* @item raisedTo: aNumber Return self raised to aNumber power @*@* @item raisedToInteger: anInteger Return self raised to the anInteger-th power @*@* @item sin return the sine of the receiver @*@* @item sqrt return the square root of the receiver @*@* @item squared Answer the square of the receiver @*@* @item tan return the tangent of the receiver @*@* @end table @node Number-point creation @subsection Number: point creation @table @b @item @@ y Answer a new point whose x is the receiver and whose y is y @*@* @item asPoint Answer a new point, self @@ self @*@* @end table @node Number-testing @subsection Number: testing @table @b @item even Returns true if self is divisible by 2 @*@* @item isNumber Answer `true'.@*@* @item isRational Answer whether the receiver is rational - false by default @*@* @item negative Answer whether the receiver is < 0 @*@* @item odd Returns true if self is not divisible by 2 @*@* @item positive Answer whether the receiver is >= 0 @*@* @item sign Returns the sign of the receiver. @*@* @item strictlyPositive Answer whether the receiver is > 0 @*@* @end table @node Number-truncation and round off @subsection Number: truncation and round off @table @b @item asInteger Answer the receiver, truncated towards zero @*@* @item floor Return the integer nearest the receiver toward negative infinity. @*@* @item rounded Returns the integer nearest the receiver @*@* @item roundTo: aNumber Answer the receiver, truncated to the nearest multiple of aNumber @*@* @item truncated Answer the receiver, truncated towards zero @*@* @item truncateTo: aNumber Answer the receiver, truncated towards zero to a multiple of aNumber @*@* @end table @node Object @section Object @table @b @item Category: Language-Implementation I am the root of the Smalltalk class system. All classes in the system are subclasses of me. @end table @menu * Object-built ins:: (instance) * Object-change and update:: (instance) * Object-class type methods:: (instance) * Object-copying:: (instance) * Object-debugging:: (instance) * Object-dependents access:: (instance) * Object-finalization:: (instance) * Object-printing:: (instance) * Object-Relational operators:: (instance) * Object-saving and loading:: (instance) * Object-storing:: (instance) * Object-syntax shortcuts:: (instance) * Object-testing functionality:: (instance) * Object-VM callbacks:: (instance) @end menu @node Object-built ins @subsection Object: built ins @table @b @item = 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 @*@* @item == arg Answer whether the receiver is the same object as arg. This is a very fast test and is called 'identity' @*@* @item addToBeFinalized Add the object to the list of objects to be finalized when there are no more references to them @*@* @item asOop Answer the object index associated to the receiver. The object index doesn't change when garbage collection is performed. @*@* @item at: anIndex Answer the index-th indexed instance variable of the receiver @*@* @item at: anIndex put: value Store value in the index-th indexed instance variable of the receiver @*@* @item basicAt: anIndex Answer the index-th indexed instance variable of the receiver. This method must not be overridden, override at: instead @*@* @item 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 @*@* @item basicPrint Print a basic representation of the receiver @*@* @item basicSize Answer the number of indexed instance variable in the receiver @*@* @item 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: . @*@* @item changeClassTo: aBehavior Mutate the class of the receiver to be aBehavior. Note: Tacitly assumes that the structure is the same for the original and new class!! @*@* @item checkIndexableBounds: index Private - Check the reason why an access to the given indexed instance variable failed @*@* @item class Answer the class to which the receiver belongs @*@* @item doesNotUnderstand: aMessage Called by the system when a selector was not found. message is a Message containing information on the receiver @*@* @item error: message Display a walkback for the receiver, with the given error message. Signal ExError @*@* @item halt Called to enter the debugger @*@* @item halt: message Display a walkback for the receiver, with the given error message. Signal ExHalt @*@* @item hash Answer an hash value for the receiver. This hash value is ok for objects that do not redefine ==. @*@* @item identityHash Answer an hash value for the receiver. This method must not be overridden @*@* @item instVarAt: index Answer the index-th instance variable of the receiver. This method must not be overridden. @*@* @item instVarAt: index put: value Store value in the index-th instance variable of the receiver. This method must not be overridden. @*@* @item isReadOnly Answer whether the object's indexed instance variables can be written @*@* @item makeReadOnly: aBoolean Set whether the object's indexed instance variables can be written @*@* @item 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 @*@* @item 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. @*@* @item nextInstance Private - answer another instance of the receiver's class, or nil if the entire object table has been walked @*@* @item notYetImplemented Called when a method defined by a class is not yet implemented, but is going to be @*@* @item 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 @*@* @item perform: selector with: arg1 Send the message named selector (a Symbol) to the receiver, passing arg1 to it. This method should not be overridden @*@* @item 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 @*@* @item 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 @*@* @item 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 @*@* @item primError: message This might start the debugger... Note that we use #basicPrint 'cause #printOn: might invoke an error. @*@* @item primitiveFailed Called when a VM primitive fails @*@* @item removeToBeFinalized Remove the object from the list of objects to be finalized when there are no more references to them @*@* @item shouldNotImplement Called when objects belonging to a class should not answer a selector defined by a superclass @*@* @item size Answer the number of indexed instance variable in the receiver @*@* @item 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 @*@* @item subclassResponsibility Called when a method defined by a class should be overridden in a subclass @*@* @item userInterrupt Display a walkback for the receiver, signalling ExUserBreak. @*@* @end table @node Object-change and update @subsection Object: change and update @table @b @item broadcast: aSymbol Send the unary message aSymbol to each of the receiver's dependents @*@* @item broadcast: aSymbol with: anObject Send the message aSymbol to each of the receiver's dependents, passing anObject @*@* @item broadcast: aSymbol with: arg1 with: arg2 Send the message aSymbol to each of the receiver's dependents, passing arg1 and arg2 as parameters @*@* @item broadcast: aSymbol withArguments: anArray Send the message aSymbol to each of the receiver's dependents, passing the parameters in anArray @*@* @item 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 @*@* @item changed Send update: for each of the receiver's dependents, passing them the receiver @*@* @item changed: aParameter Send update: for each of the receiver's dependents, passing them aParameter @*@* @item update: aParameter Default behavior is to do nothing. Called by #changed and #changed: @*@* @end table @node Object-class type methods @subsection Object: class type methods @table @b @item 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.). @*@* @item yourself Answer the receiver @*@* @end table @node Object-copying @subsection Object: copying @table @b @item copy Returns a shallow copy of the receiver (the instance variables are not copied). The shallow copy receives the message postCopy and the result of postCopy is passed back. @*@* @item deepCopy Returns a deep copy of the receiver (the instance variables are copies of the receiver's instance variables) @*@* @item 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 @*@* @item shallowCopy Returns a shallow copy of the receiver (the instance variables are not copied) @*@* @end table @node Object-debugging @subsection Object: debugging @table @b @item breakpoint: context return: return Called back by the system. Must return the value passed through the second parameter @*@* @item inspect Print all the instance variables of the receiver on the Transcript @*@* @item validSize Answer how many elements in the receiver should be inspected @*@* @end table @node Object-dependents access @subsection Object: dependents access @table @b @item addDependent: anObject Add anObject to the set of the receiver's dependents. Important: if an object has dependents, it won't be garbage collected. @*@* @item dependents Answer a collection of the receiver's dependents. @*@* @item release Remove all of the receiver's dependents from the set and allow the receiver to be garbage collected. @*@* @item 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. @*@* @end table @node Object-finalization @subsection Object: finalization @table @b @item finalize Do nothing by default @*@* @end table @node Object-printing @subsection Object: printing @table @b @item basicPrintNl Print a basic representation of the receiver, followed by a new line. @*@* @item display Print a represention of the receiver on the Transcript (stdout the GUI is not active). For most objects this is simply its #print representation, but for strings and characters, superfluous dollars or extra pair of quotes are stripped. @*@* @item displayNl Print a represention of the receiver, then put a new line on the Transcript (stdout the GUI is not active). For most objects this is simply its #printNl representation, but for strings and characters, superfluous dollars or extra pair of quotes are stripped. @*@* @item displayOn: aStream Print a represention of the receiver on aStream. For most objects this is simply its #printOn: representation, but for strings and characters, superfluous dollars or extra pair of quotes are stripped. @*@* @item displayString Answer a String representing the receiver. For most objects this is simply its #printString, but for strings and characters, superfluous dollars or extra pair of quotes are stripped. @*@* @item print Print a represention of the receiver on the Transcript (stdout the GUI is not active) @*@* @item printNl Print a represention of the receiver on stdout, put a new line the Transcript (stdout the GUI is not active) @*@* @item printOn: aStream Print a represention of the receiver on aStream @*@* @item printString Answer a String representing the receiver @*@* @end table @node Object-Relational operators @subsection Object: Relational operators @table @b @item ~= anObject Answer whether the receiver and anObject are not equal @*@* @item ~~ anObject Answer whether the receiver and anObject are not the same object @*@* @end table @node Object-saving and loading @subsection Object: saving and loading @table @b @item postLoad Called after loading an object; must restore it to the state before `preStore' was called. Do nothing by default @*@* @item preStore Called before storing an object; it must *change* it (it must not answer a new object) if necessary. Do nothing by default @*@* @end table @node Object-storing @subsection Object: storing @table @b @item store Put a String of Smalltalk code compiling to the receiver on the Transcript (stdout the GUI is not active) @*@* @item 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) @*@* @item storeOn: aStream Put Smalltalk code compiling to the receiver on aStream @*@* @item storeString Answer a String of Smalltalk code compiling to the receiver @*@* @end table @node Object-syntax shortcuts @subsection Object: syntax shortcuts @table @b @item -> anObject Creates a new instance of Association with the receiver being the key and the argument becoming the value @*@* @end table @node Object-testing functionality @subsection Object: testing functionality @table @b @item ifNil: nilBlock Evaluate nilBlock if the receiver is nil, else answer self @*@* @item ifNil: nilBlock ifNotNil: notNilBlock Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver. @*@* @item ifNotNil: notNilBlock Evaluate notNiilBlock if the receiver is not nil, passing the receiver. Else answer nil. @*@* @item ifNotNil: notNilBlock ifNotNil: nilBlock Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver. @*@* @item isArray Answer `false'.@*@* @item isCharacter Answer `false'.@*@* @item isCharacterArray Answer `false'.@*@* @item isClass Answer `false'.@*@* @item isFloat Answer `false'.@*@* @item isInteger Answer `false'.@*@* @item isKindOf: aClass Answer whether the receiver's class is aClass or a subclass of aClass @*@* @item isMemberOf: aClass Returns true if the receiver is an instance of the class 'aClass' @*@* @item isMeta Same as isMetaclass @*@* @item isMetaclass Answer `false'.@*@* @item isMetaClass Same as isMetaclass @*@* @item isNamespace Answer `false'.@*@* @item isNil Answer whether the receiver is nil @*@* @item isNumber Answer `false'.@*@* @item isSmallInteger Answer `false'.@*@* @item isString Answer `false'.@*@* @item isSymbol Answer `false'.@*@* @item notNil Answer whether the receiver is not nil @*@* @item respondsTo: aSymbol Returns true if the receiver understands the given selector @*@* @end table @node Object-VM callbacks @subsection Object: VM callbacks @table @b @item badReturnError Called back when a block performs a bad return @*@* @item mustBeBoolean Called by the system when ifTrue:*, ifFalse:*, and: or or: are sent to anything but a boolean @*@* @item noRunnableProcess Called back when all processes are suspended @*@* @end table @node ObjectDumper @section ObjectDumper @table @b @item 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 @end table @menu * ObjectDumper class-establishing proxy classes:: (class) * ObjectDumper class-instance creation:: (class) * ObjectDumper class-shortcuts:: (class) * ObjectDumper class-testing:: (class) * ObjectDumper-accessing:: (instance) * ObjectDumper-loading/dumping objects:: (instance) * ObjectDumper-stream interface:: (instance) @end menu @node ObjectDumper class-establishing proxy classes @subsection ObjectDumper class: establishing proxy classes @table @b @item disableProxyFor: aClass Disable proxies for instances of aClass and its descendants @*@* @item hasProxyFor: aClass Answer whether a proxy class has been registered for instances of aClass. @*@* @item proxyClassFor: anObject Answer the class of a valid proxy for an object, or nil if none could be found @*@* @item proxyFor: anObject Answer a valid proxy for an object, or the object itself if none could be found @*@* @item registerProxyClass: aProxyClass for: aClass Register the proxy class aProxyClass - descendent of DumperProxy - to be used for instances of aClass and its descendants @*@* @end table @node ObjectDumper class-instance creation @subsection ObjectDumper class: instance creation @table @b @item new This method should not be called for instances of this class.@*@* @item on: aFileStream Answer an ObjectDumper working on aFileStream. @*@* @end table @node ObjectDumper class-shortcuts @subsection ObjectDumper class: shortcuts @table @b @item dump: anObject to: aFileStream Dump anObject to aFileStream. Answer anObject @*@* @item loadFrom: aFileStream Load an object from aFileStream and answer it @*@* @end table @node ObjectDumper class-testing @subsection ObjectDumper class: testing @table @b @item example This is a real torture test: it outputs recursive objects, identical objects multiple times, classes, metaclasses, integers and characters! @*@* @end table @node ObjectDumper-accessing @subsection ObjectDumper: accessing @table @b @item stream Answer `stream'.@*@* @end table @node ObjectDumper-loading/dumping objects @subsection ObjectDumper: loading/dumping objects @table @b @item dump: anObject Dump anObject on the stream associated with the receiver. Answer anObject @*@* @item load Load an object from the stream associated with the receiver and answer it @*@* @end table @node ObjectDumper-stream interface @subsection ObjectDumper: stream interface @table @b @item atEnd Answer whether the underlying stream is at EOF @*@* @item next Load an object from the underlying stream @*@* @item nextPut: anObject Store an object on the underlying stream @*@* @end table @node OrderedCollection @section OrderedCollection @table @b @item 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:) @end table @menu * OrderedCollection class-instance creation:: (class) * OrderedCollection-accessing:: (instance) * OrderedCollection-adding:: (instance) * OrderedCollection-removing:: (instance) @end menu @node OrderedCollection class-instance creation @subsection OrderedCollection class: instance creation @table @b @item new Answer an OrderedCollection of default size @*@* @item new: anInteger Answer an OrderedCollection of size anInteger @*@* @end table @node OrderedCollection-accessing @subsection OrderedCollection: accessing @table @b @item after: oldObject Return the element after oldObject. Error if oldObject not found or if no following object is available @*@* @item at: anIndex Answer the anIndex-th item of the receiver @*@* @item at: anIndex put: anObject Store anObject at the anIndex-th item of the receiver, answer anObject @*@* @item before: oldObject Return the element after oldObject. Error if oldObject not found or if no following object is available @*@* @item size Return the number of objects in the receiver @*@* @end table @node OrderedCollection-adding @subsection OrderedCollection: adding @table @b @item add: anObject Add anObject in the receiver, answer it @*@* @item add: newObject after: oldObject Add newObject in the receiver just after oldObject, answer it. Fail if oldObject can't be found @*@* @item add: newObject afterIndex: i Add newObject in the receiver just after the i-th, answer it. Fail if i < 0 or i > self size @*@* @item add: newObject before: oldObject Add newObject in the receiver just before oldObject, answer it. Fail if oldObject can't be found @*@* @item 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 @*@* @item addAll: aCollection Add every item of aCollection to the receiver, answer it @*@* @item addAll: newCollection after: oldObject Add every item of newCollection to the receiver just after oldObject, answer it. Fail if oldObject is not found @*@* @item 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 @*@* @item addAll: newCollection before: oldObject Add every item of newCollection to the receiver just before oldObject, answer it. Fail if oldObject is not found @*@* @item 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 @*@* @item addAllFirst: aCollection Add every item of newCollection to the receiver right at the start of the receiver. Answer aCollection @*@* @item addAllLast: aCollection Add every item of newCollection to the receiver right at the end of the receiver. Answer aCollection @*@* @item addFirst: newObject Add newObject to the receiver right at the start of the receiver. Answer newObject @*@* @item addLast: newObject Add newObject to the receiver right at the end of the receiver. Answer newObject @*@* @end table @node OrderedCollection-removing @subsection OrderedCollection: removing @table @b @item remove: anObject ifAbsent: aBlock Remove anObject from the receiver. If it can't be found, answer the result of evaluating aBlock @*@* @item removeAtIndex: anIndex Remove the object at index anIndex from the receiver. Fail if the index is out of bounds @*@* @item removeFirst Remove an object from the start of the receiver. Fail if the receiver is empty @*@* @item removeLast Remove an object from the end of the receiver. Fail if the receiver is empty @*@* @end table @node PackageLoader @section PackageLoader @table @b @item 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. @end table @menu * PackageLoader class-accessing:: (class) * PackageLoader class-loading:: (class) * PackageLoader class-testing:: (class) @end menu @node PackageLoader class-accessing @subsection PackageLoader class: accessing @table @b @item 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. @*@* @item directoryFor: package Answer a complete path to the given package's file-in @*@* @item fileInsFor: package Answer a Set of Strings containing the filenames of the given package's file-ins (relative to the directory answered by #directoryFor:) @*@* @item ignoreCallouts Answer whether unavailable C callouts must generate errors or not. @*@* @item ignoreCallouts: aBoolean Set whether unavailable C callouts must generate errors or not. @*@* @item prerequisitesFor: package Answer a Set of Strings containing the prerequisites for the given package @*@* @item refreshDependencies Reload the `packages' file in the image directory @*@* @end table @node PackageLoader class-loading @subsection PackageLoader class: loading @table @b @item 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. @*@* @item fileInPackage: package File in the given package into GNU Smalltalk. @*@* @item fileInPackages: packagesList File in all the packages in packagesList into GNU Smalltalk. @*@* @end table @node PackageLoader class-testing @subsection PackageLoader class: testing @table @b @item canLoad: package Answer whether all the needed C call-outs are registered within GNU Smalltalk @*@* @end table @node PluggableAdaptor @section PluggableAdaptor @table @b @item 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. @end table @menu * PluggableAdaptor class-creating instances:: (class) * PluggableAdaptor-accessing:: (instance) @end menu @node PluggableAdaptor class-creating instances @subsection PluggableAdaptor class: creating instances @table @b @item getBlock: getBlock putBlock: putBlock Answer a PluggableAdaptor using the given blocks to implement #value and #value: @*@* @item 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: @*@* @item 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: @*@* @item 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 @*@* @item on: aDictionary key: aKey Same as #on:index:. Provided for clarity and completeness. @*@* @end table @node PluggableAdaptor-accessing @subsection PluggableAdaptor: accessing @table @b @item value Get the value of the receiver. @*@* @item value: anObject Set the value of the receiver. @*@* @end table @node Point @section Point @table @b @item 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. @end table @menu * Point class-instance creation:: (class) * Point-accessing:: (instance) * Point-arithmetic:: (instance) * Point-comparing:: (instance) * Point-converting:: (instance) * Point-point functions:: (instance) * Point-printing:: (instance) * Point-storing:: (instance) * Point-truncation and round off:: (instance) @end menu @node Point class-instance creation @subsection Point class: instance creation @table @b @item new Create a new point with both coordinates set to 0 @*@* @item x: xInteger y: yInteger Create a new point with the given coordinates @*@* @end table @node Point-accessing @subsection Point: accessing @table @b @item x Answer the x coordinate @*@* @item x: aNumber Set the x coordinate to aNumber @*@* @item x: anXNumber y: aYNumber Set the x and y coordinate to anXNumber and aYNumber, respectively @*@* @item y Answer the y coordinate @*@* @item y: aNumber Set the y coordinate to aNumber @*@* @end table @node Point-arithmetic @subsection Point: arithmetic @table @b @item * scale Multiply the receiver by scale, which can be a Number or a Point @*@* @item + delta Sum the receiver and delta, which can be a Number or a Point @*@* @item - delta Subtract delta, which can be a Number or a Point, from the receiver @*@* @item / scale Divide the receiver by scale, which can be a Number or a Point, with no loss of precision @*@* @item // scale Divide the receiver by scale, which can be a Number or a Point, with truncation towards -infinity @*@* @item abs Answer a new point whose coordinates are the absolute values of the receiver's @*@* @end table @node Point-comparing @subsection Point: comparing @table @b @item < aPoint Answer whether the receiver is higher and to the left of aPoint @*@* @item <= aPoint Answer whether aPoint is equal to the receiver, or the receiver is higher and to the left of aPoint @*@* @item = aPoint Answer whether the receiver is equal to aPoint @*@* @item > aPoint Answer whether the receiver is lower and to the right of aPoint @*@* @item >= aPoint Answer whether aPoint is equal to the receiver, or the receiver is lower and to the right of aPoint @*@* @item max: aPoint Answer self if it is lower and to the right of aPoint, aPoint otherwise @*@* @item min: aPoint Answer self if it is higher and to the left of aPoint, aPoint otherwise @*@* @end table @node Point-converting @subsection Point: converting @table @b @item asPoint Answer the receiver.@*@* @item asRectangle Answer an empty rectangle whose origin is self @*@* @item corner: aPoint Answer a Rectangle whose origin is the receiver and whose corner is aPoint @*@* @item extent: aPoint Answer a Rectangle whose origin is the receiver and whose extent is aPoint @*@* @item hash Answer an hash value for the receiver @*@* @end table @node Point-point functions @subsection Point: point functions @table @b @item 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 @*@* @item dist: aPoint Answer the distance between the receiver and aPoint @*@* @item dotProduct: aPoint Answer the dot product between the receiver and aPoint @*@* @item grid: aPoint Answer a new point whose coordinates are rounded towards the nearest multiple of aPoint @*@* @item normal Rotate the Point 90degrees clockwise and get the unit vector @*@* @item transpose Answer a new point whose coordinates are the receiver's coordinates exchanged (x becomes y, y becomes x) @*@* @item truncatedGrid: aPoint Answer a new point whose coordinates are rounded towards -infinity, to a multiple of grid (which must be a Point) @*@* @end table @node Point-printing @subsection Point: printing @table @b @item printOn: aStream Print a representation for the receiver on aStream @*@* @end table @node Point-storing @subsection Point: storing @table @b @item storeOn: aStream Print Smalltalk code compiling to the receiver on aStream @*@* @end table @node Point-truncation and round off @subsection Point: truncation and round off @table @b @item rounded Answer a new point whose coordinates are rounded to the nearest integer @*@* @item truncateTo: grid Answer a new point whose coordinates are rounded towards -infinity, to a multiple of grid (which must be a Number) @*@* @end table @node PositionableStream @section PositionableStream @table @b @item 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. @end table @menu * PositionableStream class-instance creation:: (class) * PositionableStream-accessing-reading:: (instance) * PositionableStream-class type methods:: (instance) * PositionableStream-positioning:: (instance) * PositionableStream-testing:: (instance) * PositionableStream-truncating:: (instance) @end menu @node PositionableStream class-instance creation @subsection PositionableStream class: instance creation @table @b @item on: aCollection Answer an instance of the receiver streaming on the whole contents of aCollection @*@* @item on: aCollection from: firstIndex to: lastIndex Answer an instance of the receiver streaming from the firstIndex-th item of aCollection to the lastIndex-th @*@* @end table @node PositionableStream-accessing-reading @subsection PositionableStream: accessing-reading @table @b @item contents Returns a collection of the same type that the stream accesses, up to and including the final element. @*@* @item copyFrom: start to: end Answer the collection on which the receiver is streaming, from the start-th item to the end-th @*@* @item next Answer the next item of the receiver @*@* @item peek Returns the next element of the stream without moving the pointer. Returns nil when at end of stream. @*@* @item 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. @*@* @item reverseContents Returns a collection of the same type that the stream accesses, up to and including the final element, but in reverse order. @*@* @end table @node PositionableStream-class type methods @subsection PositionableStream: class type methods @table @b @item species The collections returned by #upTo: etc. are the same kind as those returned by the collection with methods such as #select: @*@* @end table @node PositionableStream-positioning @subsection PositionableStream: positioning @table @b @item basicPosition: anInteger Move the stream pointer to the anInteger-th object @*@* @item position Answer the current value of the stream pointer @*@* @item position: anInteger Move the stream pointer to the anInteger-th object @*@* @item reset Move the stream back to its first element. For write-only streams, the stream is truncated there. @*@* @item setToEnd Move the current position to the end of the stream. @*@* @item size Answer the size of data on which we are streaming. @*@* @item skip: anInteger Move the current position by anInteger places, either forwards or backwards. @*@* @end table @node PositionableStream-testing @subsection PositionableStream: testing @table @b @item atEnd Answer whether the objects in the stream have reached an end @*@* @item basicAtEnd Answer whether the objects in the stream have reached an end. This method must NOT be overridden. @*@* @item isEmpty Answer whether the stream has no objects @*@* @end table @node PositionableStream-truncating @subsection PositionableStream: truncating @table @b @item truncate Truncate the receiver to the current position - only valid for writing streams @*@* @end table @node Process @section Process @table @b @item 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. @end table @menu * Process class-basic:: (class) * Process-accessing:: (instance) * Process-basic:: (instance) * Process-builtins:: (instance) * Process-printing:: (instance) @end menu @node Process class-basic @subsection Process class: basic @table @b @item on: aBlockContext at: aPriority Private - Create a process running aBlockContext at the given priority @*@* @end table @node Process-accessing @subsection Process: accessing @table @b @item name Answer `name'.@*@* @item name: aString Give the name aString to the process @*@* @item priority Answer the receiver's priority @*@* @item priority: anInteger Change the receiver's priority to anInteger @*@* @item 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 @*@* @end table @node Process-basic @subsection Process: basic @table @b @item 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. @*@* @item lowerPriority Lower a bit the priority of the receiver. A #lowerPriority will cancel a previous #raisePriority, and vice versa. @*@* @item raisePriority Raise a bit the priority of the receiver. A #lowerPriority will cancel a previous #raisePriority, and vice versa. @*@* @item 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 @*@* @item terminate Terminate the receiver - This is nothing more than prohibiting to resume the process, then suspending it. @*@* @end table @node Process-builtins @subsection Process: builtins @table @b @item resume Resume the receiver's execution @*@* @item yield Yield control from the receiver to other processes @*@* @end table @node Process-printing @subsection Process: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @end table @node ProcessorScheduler @section ProcessorScheduler @table @b @item Category: Language-Processes I provide methods that control the execution of processes. @end table @menu * ProcessorScheduler class-instance creation:: (class) * ProcessorScheduler-basic:: (instance) * ProcessorScheduler-idle tasks:: (instance) * ProcessorScheduler-priorities:: (instance) * ProcessorScheduler-timed invocation:: (instance) @end menu @node ProcessorScheduler class-instance creation @subsection ProcessorScheduler class: instance creation @table @b @item new Error---new instances of ProcessorScheduler should not be created. @*@* @end table @node ProcessorScheduler-basic @subsection ProcessorScheduler: basic @table @b @item activePriority Answer the active process' priority @*@* @item activeProcess Answer the active process @*@* @item changePriorityOf: aProcess to: aPriority Private - Move aProcess to the execution list for aPriority, answer the new execution list @*@* @item processesAt: aPriority Private - Answer a linked list of processes at the given priority @*@* @item terminateActive Private - Terminate the active process @*@* @item yield Let the active process yield control to other processes @*@* @end table @node ProcessorScheduler-idle tasks @subsection ProcessorScheduler: idle tasks @table @b @item idle Private - Call the next idle task @*@* @item idleAdd: aBlock Register aBlock to be executed when things are idle @*@* @end table @node ProcessorScheduler-priorities @subsection ProcessorScheduler: priorities @table @b @item highestPriority Answer the highest valid priority @*@* @item highIOPriority Answer the priority for system high-priority I/O processes, such as a process handling input from a network. @*@* @item lowestPriority Answer the lowest valid priority @*@* @item lowIOPriority Answer the priority for system low-priority I/O processes. Examples are the process handling input from the user (keyboard, pointing device, etc.) and the process distributing input from a network. @*@* @item priorityName: priority Private - Answer a name for the given process priority @*@* @item systemBackgroundPriority Answer the priority for system background-priority processes. Examples are an incremental garbage collector or status checker. @*@* @item timingPriority Answer the priority for system real-time processes. @*@* @item userBackgroundPriority Answer the priority for user background-priority processes @*@* @item userInterruptPriority Answer the priority for user interrupt-priority processes. Processes run at this level will preempt the window scheduler and should, therefore, not consume the processor forever. @*@* @item userSchedulingPriority Answer the priority for user standard-priority processes @*@* @end table @node ProcessorScheduler-timed invocation @subsection ProcessorScheduler: timed invocation @table @b @item isTimeoutProgrammed Private - Answer whether there is a pending call to #signal:atMilliseconds: @*@* @item signal: aSemaphore atMilliseconds: millis Private - signal 'aSemaphore' after 'millis' milliseconds have elapsed @*@* @item signal: aSemaphore onInterrupt: anIntegerSignalNumber Private - signal 'aSemaphore' when the given C signal occurs @*@* @end table @node Random @section Random @table @b @item Category: Streams My instances are generator streams that produce random numbers, which are floating point values between 0 and 1. @end table @menu * Random class-instance creation:: (class) * Random-basic:: (instance) * Random-testing:: (instance) @end menu @node Random class-instance creation @subsection Random class: instance creation @table @b @item new Create a new random number generator whose seed is given by the current time on the millisecond clock @*@* @item seed: aFloat Create a new random number generator whose seed is aFloat @*@* @end table @node Random-basic @subsection Random: basic @table @b @item atEnd This stream never ends. Always answer false @*@* @item next Return the next random number in the sequence @*@* @item nextPut: value This method should not be called for instances of this class.@*@* @end table @node Random-testing @subsection Random: testing @table @b @item chiSquare returns under Pentium II, NT 4.0, 93.0 @*@* @item chiSquare: n range: r Return the chi-square deduced from calculating n random numbers in the 0..r range @*@* @end table @node ReadStream @section ReadStream @table @b @item 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. @end table @menu * ReadStream class-instance creation:: (class) * ReadStream-accessing-reading:: (instance) @end menu @node ReadStream class-instance creation @subsection ReadStream class: instance creation @table @b @item on: aCollection Answer a new stream working on aCollection from its start. @*@* @end table @node ReadStream-accessing-reading @subsection ReadStream: accessing-reading @table @b @item reverseContents May be faster than generic stream reverseContents. @*@* @item size Answer the receiver's size. @*@* @end table @node ReadWriteStream @section ReadWriteStream @table @b @item 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. @end table @menu * ReadWriteStream class-instance creation:: (class) * ReadWriteStream-positioning:: (instance) @end menu @node ReadWriteStream class-instance creation @subsection ReadWriteStream class: instance creation @table @b @item on: aCollection Answer a new stream working on aCollection from its start. The stream starts at the front of aCollection @*@* @item with: aCollection Answer a new instance of the receiver which streams from the end of aCollection. @*@* @end table @node ReadWriteStream-positioning @subsection ReadWriteStream: positioning @table @b @item position: anInteger Unlike WriteStreams, ReadWriteStreams don't truncate the stream @*@* @item skip: anInteger Unlike WriteStreams, ReadWriteStreams don't truncate the stream @*@* @end table @node Rectangle @section Rectangle @table @b @item 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) @end table @menu * Rectangle class-instance creation:: (class) * Rectangle-accessing:: (instance) * Rectangle-copying:: (instance) * Rectangle-printing:: (instance) * Rectangle-rectangle functions:: (instance) * Rectangle-testing:: (instance) * Rectangle-transforming:: (instance) * Rectangle-truncation and round off:: (instance) @end menu @node Rectangle class-instance creation @subsection Rectangle class: instance creation @table @b @item left: leftNumber right: rightNumber top: topNumber bottom: bottomNumber Answer a rectangle with the given coordinates @*@* @item new Answer the (0 @@ 0 corner: 0 @@ 0) rectangle @*@* @item origin: originPoint corner: cornerPoint Answer a rectangle with the given corners @*@* @item origin: originPoint extent: extentPoint Answer a rectangle with the given origin and size @*@* @end table @node Rectangle-accessing @subsection Rectangle: accessing @table @b @item bottom Answer the corner's y of the receiver @*@* @item bottom: aNumber Set the corner's y of the receiver @*@* @item bottomCenter Answer the center of the receiver's bottom side @*@* @item bottomLeft Answer the bottom-left corner of the receiver @*@* @item bottomLeft: aPoint Answer the receiver with the bottom-left changed to aPoint @*@* @item bottomRight Answer the bottom-right corner of the receiver @*@* @item bottomRight: aPoint Change the bottom-right corner of the receiver @*@* @item center Answer the center of the receiver @*@* @item corner Answer the corner of the receiver @*@* @item corner: aPoint Set the corner of the receiver @*@* @item extent Answer the extent of the receiver @*@* @item extent: aPoint Change the size of the receiver, keeping the origin the same @*@* @item height Answer the height of the receiver @*@* @item height: aNumber Set the height of the receiver @*@* @item left Answer the x of the left edge of the receiver @*@* @item left: aValue Set the x of the left edge of the receiver @*@* @item left: l top: t right: r bottom: b Change all four the coordinates of the receiver's corners @*@* @item leftCenter Answer the center of the receiver's left side @*@* @item origin Answer the top-left corner of the receiver @*@* @item origin: aPoint Change the top-left corner of the receiver to aPoint @*@* @item origin: pnt1 corner: pnt2 Change both the origin (top-left corner) and the corner (bottom-right corner) of the receiver @*@* @item origin: pnt1 extent: pnt2 Change the top-left corner and the size of the receiver @*@* @item right Answer the x of the bottom-right corner of the receiver @*@* @item right: aNumber Change the x of the bottom-right corner of the receiver @*@* @item rightCenter Answer the center of the receiver's right side @*@* @item top Answer the y of the receiver's top-left corner @*@* @item top: aValue Change the y of the receiver's top-left corner @*@* @item topCenter Answer the center of the receiver's top side @*@* @item topLeft Answer the receiver's top-left corner @*@* @item topLeft: aPoint Change the receiver's top-left corner's coordinates to aPoint @*@* @item topRight Answer the receiver's top-right corner @*@* @item topRight: aPoint Change the receiver's top-right corner to aPoint @*@* @item width Answer the receiver's width @*@* @item width: aNumber Change the receiver's width to aNumber @*@* @end table @node Rectangle-copying @subsection Rectangle: copying @table @b @item copy Return a deep copy of the receiver for safety. @*@* @end table @node Rectangle-printing @subsection Rectangle: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Rectangle-rectangle functions @subsection Rectangle: rectangle functions @table @b @item amountToTranslateWithin: aRectangle Answer a Point so that if aRectangle is translated by that point, its origin lies within the receiver's. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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 @*@* @item intersect: aRectangle Returns the rectangle (if any) created by the overlap of rectangles A and B. @*@* @item merge: aRectangle Answer a new rectangle which is the smallest rectangle containing both the receiver and aRectangle. @*@* @item translatedToBeWithin: aRectangle Answer a copy of the receiver that does not extend beyond aRectangle. @*@* @end table @node Rectangle-testing @subsection Rectangle: testing @table @b @item = aRectangle Answer whether the receiver is equal to aRectangle @*@* @item contains: aRectangle Answer true if the receiver contains (see containsPoint:) both aRectangle's origin and aRectangle's corner @*@* @item 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 @*@* @item hash Answer an hash value for the receiver @*@* @item 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 @*@* @end table @node Rectangle-transforming @subsection Rectangle: transforming @table @b @item moveBy: aPoint Change the receiver so that the origin and corner are shifted by aPoint @*@* @item moveTo: aPoint Change the receiver so that the origin moves to aPoint and the size remains unchanged @*@* @item scaleBy: scale Answer a copy of the receiver in which the origin and corner are multiplied by scale @*@* @item translateBy: factor Answer a copy of the receiver in which the origin and corner are shifted by aPoint @*@* @end table @node Rectangle-truncation and round off @subsection Rectangle: truncation and round off @table @b @item rounded Answer a copy of the receiver with the coordinates rounded to the nearest integers @*@* @end table @node RootNamespace @section RootNamespace @table @b @item Category: Language-Implementation I am a special form of dictionary. I provide special ways to access my keys, which typically begin with an uppercase letter. Classes hold on an instance of me; it is called their `environment'). My keys are (expected to be) symbols, so I use == to match searched keys to those in the dictionary -- this is done expecting that it brings a bit more speed. @end table @menu * RootNamespace class-instance creation:: (class) * RootNamespace-accessing:: (instance) * RootNamespace-basic & copying:: (instance) * RootNamespace-copying:: (instance) * RootNamespace-forward declarations:: (instance) * RootNamespace-namespace hierarchy:: (instance) * RootNamespace-overrides for superspaces:: (instance) * RootNamespace-printing:: (instance) * RootNamespace-testing:: (instance) @end menu @node RootNamespace class-instance creation @subsection RootNamespace class: instance creation @table @b @item new Disabled - use #new to create instances @*@* @item new: spaceName Create a new root namespace with the given name, and add to Smalltalk a key that references it. @*@* @item primNew: parent name: spaceName Private - Create a new namespace with the given name and parent, and add to the parent a key that references it. @*@* @end table @node RootNamespace-accessing @subsection RootNamespace: accessing @table @b @item allAssociations Answer a Dictionary with all of the associations in the receiver and each of its superspaces (duplicate keys are associated to the associations that are deeper in the namespace hierarchy) @*@* @item allBehaviorsDo: aBlock Evaluate aBlock once for each class and metaclass in the namespace. @*@* @item allClassesDo: aBlock Evaluate aBlock once for each class in the namespace. @*@* @item allClassObjectsDo: aBlock Evaluate aBlock once for each class and metaclass in the namespace. @*@* @item allMetaclassesDo: aBlock Evaluate aBlock once for each metaclass in the namespace. @*@* @item 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. @*@* @item 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. @*@* @item define: aSymbol Define aSymbol as equal to nil inside the receiver. Fail if such a variable already exists (use #at:put: if you don't want to fail) @*@* @item doesNotUnderstand: aMessage Try to map unary selectors to read accesses to the Namespace, and one-argument keyword selectors to write accesses. Note that: a) this works only if the selector has an uppercase first letter; and b) `aNamespace Variable: value' is the same as `aNamespace set: #Variable to: value', not the same as `aNamespace at: #Variable put: value' --- the latter always refers to the current namespace, while the former won't define a new variable, instead searching in superspaces (and raising an error if the variable cannot be found). @*@* @item import: aSymbol from: aNamespace Add to the receiver the symbol aSymbol, associated to the same value as in aNamespace. Fail if aNamespace does not contain the given key. @*@* @end table @node RootNamespace-basic & copying @subsection RootNamespace: basic & copying @table @b @item = 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 @*@* @item identityHash Answer an hash value for the receiver. This is the same as the object's #identityHash. @*@* @end table @node RootNamespace-copying @subsection RootNamespace: copying @table @b @item copy Answer the receiver.@*@* @item deepCopy Answer the receiver.@*@* @item shallowCopy Answer the receiver.@*@* @end table @node RootNamespace-forward declarations @subsection RootNamespace: forward declarations @table @b @item at: key put: value Store value as associated to the given key. If any, recycle Associations temporarily stored by the compiler inside the `Undeclared' dictionary. @*@* @end table @node RootNamespace-namespace hierarchy @subsection RootNamespace: namespace hierarchy @table @b @item addSubspace: aSymbol Add aNamespace to the set of the receiver's subspaces @*@* @item allSubassociationsDo: aBlock Invokes aBlock once for every association in each of the receiver's subspaces. @*@* @item allSubspaces Answer the direct and indirect subspaces of the receiver in a Set @*@* @item allSubspacesDo: aBlock Invokes aBlock for all subspaces, both direct and indirect. @*@* @item allSuperspaces Answer all the receiver's superspaces in a collection @*@* @item allSuperspacesDo: aBlock Evaluate aBlock once for each of the receiver's superspaces @*@* @item includesClassNamed: aString Answer whether the receiver or any of its superspaces include the given class -- note that this method (unlike #includesKey:) does not require aString to be interned and (unlike #includesGlobalNamed:) only returns true if the global is a class object. @*@* @item includesGlobalNamed: aString Answer whether the receiver or any of its superspaces include the given key -- note that this method (unlike #includesKey:) does not require aString to be interned but (unlike #includesClassNamed:) returns true even if the global is not a class object. @*@* @item inheritsFrom: aNamespace Answer whether aNamespace is one of the receiver's direct and indirect superspaces @*@* @item selectSubspaces: aBlock Return a Set of subspaces of the receiver satisfying aBlock. @*@* @item selectSuperspaces: aBlock Return a Set of superspaces of the receiver satisfying aBlock. @*@* @item siblings Answer all the other root namespaces @*@* @item siblingsDo: aBlock Evaluate aBlock once for each of the other root namespaces, passing the namespace as a parameter. @*@* @item subspaces Answer the receiver's direct subspaces @*@* @item subspacesDo: aBlock Invokes aBlock for all direct subspaces. @*@* @item superspace Send #at:ifAbsent: to super because our implementation of #at:ifAbsent: sends this message (chicken and egg!) @*@* @item superspace: aNamespace Set the superspace of the receiver to be 'aNamespace'. Also adds the receiver as a subspace of it. @*@* @item withAllSubspaces Answer a Set containing the receiver together with its direct and indirect subspaces @*@* @item withAllSubspacesDo: aBlock Invokes aBlock for the receiver and all subclasses, both direct and indirect. @*@* @item withAllSuperspaces Answer the receiver and all of its superspaces in a collection @*@* @item withAllSuperspacesDo: aBlock Invokes aBlock for the receiver and all superspaces, both direct and indirect. @*@* @end table @node RootNamespace-overrides for superspaces @subsection RootNamespace: overrides for superspaces @table @b @item definedKeys Answer a kind of Set containing the keys of the receiver @*@* @item definesKey: key Answer whether the receiver defines the given key. `Defines' means that the receiver's superspaces, if any, are not considered. @*@* @item hereAt: key Return the value associated to the variable named as specified by `key' *in this namespace*. If the key is not found search will *not* be brought on in superspaces and the method will fail. @*@* @item hereAt: key ifAbsent: aBlock Return the value associated to the variable named as specified by `key' *in this namespace*. If the key is not found search will *not* be brought on in superspaces and aBlock will be immediately evaluated. @*@* @item inheritedKeys Answer a Set of all the keys in the receiver and its superspaces @*@* @item set: key to: newValue Assign newValue to the variable named as specified by `key'. This method won't define a new variable; instead if the key is not found it will search in superspaces and raising an error if the variable cannot be found in any of the superspaces. Answer newValue. @*@* @item set: key to: newValue ifAbsent: aBlock Assign newValue to the variable named as specified by `key'. This method won't define a new variable; instead if the key is not found it will search in superspaces and evaluate aBlock if it is not found. Answer newValue. @*@* @item values Answer a Bag containing the values of the receiver @*@* @end table @node RootNamespace-printing @subsection RootNamespace: printing @table @b @item defaultName Private - Answer the name to be used if the receiver is not attached to an association in the superspace @*@* @item name Answer the receiver's name @*@* @item printOn: aStream Print a representation of the receiver @*@* @item storeOn: aStream Store Smalltalk code compiling to the receiver @*@* @end table @node RootNamespace-testing @subsection RootNamespace: testing @table @b @item isNamespace Answer `true'.@*@* @item isSmalltalk Answer `false'.@*@* @item species Answer `IdentityDictionary'.@*@* @end table @node RunArray @section RunArray @table @b @item 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. @end table @menu * RunArray class-instance creation:: (class) * RunArray-accessing:: (instance) * RunArray-adding:: (instance) * RunArray-basic:: (instance) * RunArray-copying:: (instance) * RunArray-enumerating:: (instance) * RunArray-removing:: (instance) * RunArray-searching:: (instance) * RunArray-testing:: (instance) @end menu @node RunArray class-instance creation @subsection RunArray class: instance creation @table @b @item new Answer an empty RunArray @*@* @item new: aSize Answer a RunArray with space for aSize runs @*@* @end table @node RunArray-accessing @subsection RunArray: accessing @table @b @item at: anIndex Answer the element at index anIndex @*@* @item at: anIndex put: anObject Replace the element at index anIndex with anObject and answer anObject @*@* @end table @node RunArray-adding @subsection RunArray: adding @table @b @item add: anObject afterIndex: anIndex Add anObject after the element at index anIndex @*@* @item 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 @*@* @item 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 @*@* @item 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 @*@* @item addFirst: anObject Add anObject at the beginning of the receiver. Watch out: this operation can cause serious performance pitfalls @*@* @item addLast: anObject Add anObject at the end of the receiver @*@* @end table @node RunArray-basic @subsection RunArray: basic @table @b @item first Answer the first element in the receiver @*@* @item last Answer the last element of the receiver @*@* @item size Answer the number of elements in the receiver @*@* @end table @node RunArray-copying @subsection RunArray: copying @table @b @item deepCopy Answer a copy of the receiver containing copies of the receiver's elements (#copy is used to obtain them) @*@* @item shallowCopy Answer a copy of the receiver. The elements are not copied @*@* @end table @node RunArray-enumerating @subsection RunArray: enumerating @table @b @item do: aBlock Enumerate all the objects in the receiver, passing each one to aBlock @*@* @item 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 @*@* @end table @node RunArray-removing @subsection RunArray: removing @table @b @item removeAtIndex: anIndex Remove the object at index anIndex from the receiver and answer the removed object @*@* @item removeFirst Remove the first object from the receiver and answer the removed object @*@* @item removeLast Remove the last object from the receiver and answer the removed object @*@* @end table @node RunArray-searching @subsection RunArray: searching @table @b @item 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 @*@* @end table @node RunArray-testing @subsection RunArray: testing @table @b @item = anObject Answer true if the receiver is equal to anObject @*@* @item hash Answer an hash value for the receiver @*@* @end table @node Semaphore @section Semaphore @table @b @item 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. @end table @menu * Semaphore class-instance creation:: (class) * Semaphore-builtins:: (instance) * Semaphore-mutual exclusion:: (instance) @end menu @node Semaphore class-instance creation @subsection Semaphore class: instance creation @table @b @item forMutualExclusion Answer a new semaphore with a signal on it. These semaphores are a useful shortcut when you use semaphores as critical sections. @*@* @item new Answer a new semaphore @*@* @end table @node Semaphore-builtins @subsection Semaphore: builtins @table @b @item signal Signal the receiver, resuming a waiting process' if there is one @*@* @item wait Wait for the receiver to be signalled, suspending the executing process if it is not yet @*@* @end table @node Semaphore-mutual exclusion @subsection Semaphore: mutual exclusion @table @b @item 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!!! @*@* @end table @node SequenceableCollection @section SequenceableCollection @table @b @item Category: Collections-Sequenceable My instances represent collections of objects that are ordered. I provide some access and manipulation methods. @end table @menu * SequenceableCollection class-instance creation:: (class) * SequenceableCollection-basic:: (instance) * SequenceableCollection-copying SequenceableCollections:: (instance) * SequenceableCollection-enumerating:: (instance) * SequenceableCollection-replacing items:: (instance) * SequenceableCollection-testing:: (instance) @end menu @node SequenceableCollection class-instance creation @subsection SequenceableCollection class: instance creation @table @b @item streamContents: aBlock Create a ReadWriteStream on an empty instance of the receiver; pass the stream to aBlock, then retrieve its contents and answer them. @*@* @end table @node SequenceableCollection-basic @subsection SequenceableCollection: basic @table @b @item after: oldObject Return the element after oldObject. Error if oldObject not found or if no following object is available @*@* @item atAll: aCollection put: anObject Put anObject at every index contained in aCollection @*@* @item atAllPut: anObject Put anObject at every index in the receiver @*@* @item before: oldObject Return the element before oldObject. Error if oldObject not found or if no preceding object is available @*@* @item first Answer the first item in the receiver @*@* @item indexOf: anElement Answer the index of the first occurrence of anElement in the receiver. Answer 0 if no item is found @*@* @item 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 @*@* @item indexOf: anElement startingAt: anIndex Answer the first index > anIndex which contains anElement. Answer 0 if no item is found @*@* @item 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 @*@* @item indexOfSubCollection: aSubCollection Answer the first index > anIndex at which starts a sequence of items matching aSubCollection. Answer 0 if no such sequence is found. @*@* @item 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. @*@* @item 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. @*@* @item 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 @*@* @item last Answer the last item in the receiver @*@* @end table @node SequenceableCollection-copying SequenceableCollections @subsection SequenceableCollection: copying SequenceableCollections @table @b @item , aSequenceableCollection Append aSequenceableCollection at the end of the receiver (using #add:), and answer a new collection @*@* @item copyFrom: start Answer a new collection containing all the items in the receiver from the start-th. @*@* @item copyFrom: start to: stop Answer a new collection containing all the items in the receiver from the start-th and to the stop-th @*@* @item copyReplaceAll: oldSubCollection with: newSubCollection Answer a new collection in which all the sequences matching oldSubCollection are replaced with newSubCollection @*@* @item 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'. @*@* @item 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'. @*@* @end table @node SequenceableCollection-enumerating @subsection SequenceableCollection: enumerating @table @b @item 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 @*@* @item do: aBlock Evaluate aBlock for all the elements in the sequenceable collection @*@* @item do: aBlock separatedBy: sepBlock Evaluate aBlock for all the elements in the sequenceable collection. Between each element, evaluate sepBlock without parameters. @*@* @item doWithIndex: aBlock Evaluate aBlock for all the elements in the sequenceable collection, passing the index of each element as the second parameter @*@* @item findFirst: aBlock Returns the index of the first element of the sequenceable collection for which aBlock returns true, or 0 if none @*@* @item findLast: aBlock Returns the index of the last element of the sequenceable collection for which aBlock returns true, or 0 if none does @*@* @item from: startIndex to: stopIndex do: aBlock Evaluate aBlock for all the elements in the sequenceable collection whose indices are in the range index to stopIndex @*@* @item from: startIndex to: stopIndex doWithIndex: aBlock Evaluate aBlock for all the elements in the sequenceable collection whose indices are in the range index to stopIndex, passing the index of each element as the second parameter @*@* @item readStream Answer a ReadStream streaming on the receiver @*@* @item readWriteStream Answer a ReadWriteStream which streams on the receiver @*@* @item reverse Answer the receivers' contents in reverse order @*@* @item reverseDo: aBlock Evaluate aBlock for all elements in the sequenceable collection, from the last to the first. @*@* @item with: aSequenceableCollection collect: aBlock Evaluate aBlock for each pair of elements took respectively from the re- ceiver and from aSequenceableCollection; answer a collection of the same kind of the receiver, made with the block's return values. Fail if the receiver has not the same size as aSequenceableCollection. @*@* @item 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. @*@* @item writeStream Answer a WriteStream streaming on the receiver @*@* @end table @node SequenceableCollection-replacing items @subsection SequenceableCollection: replacing items @table @b @item replaceFrom: start to: stop with: replacementCollection Replace the items from start to stop with replacementCollection's items from 1 to stop-start+1 @*@* @item 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 @*@* @item replaceFrom: anIndex to: stopIndex withObject: replacementObject Replace every item from start to stop with replacementObject. @*@* @end table @node SequenceableCollection-testing @subsection SequenceableCollection: testing @table @b @item = aCollection Answer whether the receiver's items match those in aCollection @*@* @item hash Answer an hash value for the receiver @*@* @item inspect Print all the instance variables and context of the receiver on the Transcript @*@* @end table @node Set @section Set @table @b @item Category: Collections-Unordered I am the typical set object; I can store any objects uniquely. I use the = operator to determine duplication of objects. @end table @menu * Set class-instance creation:: (class) * Set-accessing:: (instance) * Set-awful ST-80 compatibility hacks:: (instance) * Set-builtins:: (instance) * Set-copying:: (instance) * Set-enumerating the elements of a collection:: (instance) * Set-rehashing:: (instance) * Set-Removing from a collection:: (instance) * Set-storing:: (instance) * Set-testing collections:: (instance) @end menu @node Set class-instance creation @subsection Set class: instance creation @table @b @item new Answer a new instance of the receiver with a default size @*@* @item new: anInteger Answer a new instance of the receiver with the given size @*@* @end table @node Set-accessing @subsection Set: accessing @table @b @item 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 @*@* @item at: index This method should not be called for instances of this class.@*@* @item at: index put: value This method should not be called for instances of this class.@*@* @end table @node Set-awful ST-80 compatibility hacks @subsection Set: awful ST-80 compatibility hacks @table @b @item 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 @*@* @end table @node Set-builtins @subsection Set: builtins @table @b @item primAt: anIndex Private - Answer the anIndex-th item of the hash table for the receiver. Using this instead of basicAt: allows for easier changes in the representation @*@* @item primAt: anIndex put: value Private - Store value in the anIndex-th item of the hash table for the receiver. Using this instead of basicAt:put: allows for easier changes in the representation @*@* @item primSize Private - Answer the size of the hash table for the receiver. Using this instead of basicSize allows for easier changes in the representation @*@* @end table @node Set-copying @subsection Set: copying @table @b @item deepCopy Returns a deep copy of the receiver (the instance variables are copies of the receiver's instance variables) @*@* @item shallowCopy Returns a shallow copy of the receiver (the instance variables are not copied) @*@* @end table @node Set-enumerating the elements of a collection @subsection Set: enumerating the elements of a collection @table @b @item do: aBlock Enumerate all the non-nil members of the set @*@* @end table @node Set-rehashing @subsection Set: rehashing @table @b @item rehash Rehash the receiver @*@* @end table @node Set-Removing from a collection @subsection Set: Removing from a collection @table @b @item remove: oldObject ifAbsent: anExceptionBlock Remove oldObject to the set. If it is found, answer oldObject. Otherwise, evaluate anExceptionBlock and return its value. @*@* @end table @node Set-storing @subsection Set: storing @table @b @item storeOn: aStream Store on aStream some Smalltalk code which compiles to the receiver @*@* @end table @node Set-testing collections @subsection Set: testing collections @table @b @item = aSet Returns true if the two sets have the same membership, false if not @*@* @item capacity Answer how many elements the receiver can hold before having to grow. @*@* @item 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. @*@* @item includes: anObject Answer whether the receiver contains an instance of anObject. @*@* @item isEmpty Answer whether the receiver is empty. @*@* @item 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). @*@* @item size Answer the receiver's size @*@* @end table @node SharedQueue @section SharedQueue @table @b @item 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. @end table @menu * SharedQueue class-instance creation:: (class) * SharedQueue-accessing:: (instance) @end menu @node SharedQueue class-instance creation @subsection SharedQueue class: instance creation @table @b @item new Create a new instance of the receiver @*@* @end table @node SharedQueue-accessing @subsection SharedQueue: accessing @table @b @item next Wait for an object to be on the queue, then remove it and answer it @*@* @item nextPut: value Put value on the queue and answer it @*@* @end table @node Signal @section Signal @table @b @item 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. @end table @menu * Signal-accessing:: (instance) * Signal-exception handling:: (instance) @end menu @node Signal-accessing @subsection Signal: accessing @table @b @item argument Answer the first argument of the receiver @*@* @item argumentCount Answer how many arguments the receiver has @*@* @item arguments Answer the arguments of the receiver @*@* @item description Answer the description of the raised exception @*@* @item exception Answer the exception that was raised @*@* @item messageText Answer the description of the raised exception @*@* @end table @node Signal-exception handling @subsection Signal: exception handling @table @b @item defaultAction Execute the default handler for the raised exception @*@* @item isNested Answer whether the current exception handler is within the scope of another handler for the same exception. @*@* @item 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. @*@* @item 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. @*@* @item resignalAs: replacementException Reinstate all handlers and execute the handler for `replacementException'; control does not return to the currently active exception handler. The new Signal object that is created has the same arguments as the receiver (this might or not be correct -- if it isn't you can use an idiom such as `sig retryUsing: [ replacementException signal ]) @*@* @item 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 @*@* @item 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 @*@* @item retry Re-execute the receiver of the #on:do: message. All handlers are reinstated: watch out, this can easily cause an infinite loop. @*@* @item retryUsing: aBlock Execute aBlock reinstating all handlers, and return its result from the #signal method. @*@* @item return Exit the #on:do: snippet, answering anObject to its caller @*@* @item return: anObject Exit the #on:do: snippet, answering anObject to its caller @*@* @end table @node SmallInteger @section SmallInteger @table @b @item Category: Language-Data types @end table @menu * SmallInteger-built ins:: (instance) * SmallInteger-builtins:: (instance) @end menu @node SmallInteger-built ins @subsection SmallInteger: built ins @table @b @item * arg Multiply the receiver and arg and answer another Number @*@* @item + arg Sum the receiver and arg and answer another Number @*@* @item - arg Subtract arg from the receiver and answer another Number @*@* @item / arg Divide the receiver by arg and answer another Integer or Fraction @*@* @item // arg Dividing receiver by arg (with truncation towards -infinity) and answer the result @*@* @item < arg Answer whether the receiver is less than arg @*@* @item <= arg Answer whether the receiver is less than or equal to arg @*@* @item = arg Answer whether the receiver is equal to arg @*@* @item == arg Answer whether the receiver is the same object as arg @*@* @item > arg Answer whether the receiver is greater than arg @*@* @item >= arg Answer whether the receiver is greater than or equal to arg @*@* @item \\ arg Calculate the remainder of dividing receiver by arg (with truncation towards -infinity) and answer it @*@* @item asFloat Convert the receiver to a Float, answer the result @*@* @item asObject Answer the object whose index is in the receiver, fail if no object found at that index @*@* @item asObjectNoFail Answer the object whose index is in the receiver, or nil if no object is found at that index @*@* @item bitAnd: arg Do a bitwise AND between the receiver and arg, answer the result @*@* @item bitOr: arg Do a bitwise OR between the receiver and arg, answer the result @*@* @item 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 @*@* @item bitXor: arg Do a bitwise XOR between the receiver and arg, answer the result @*@* @item quo: arg Dividing receiver by arg (with truncation towards zero) and answer the result @*@* @item ~= arg Answer whether the receiver is not equal to arg @*@* @item ~~ arg Answer whether the receiver is not the same object as arg @*@* @end table @node SmallInteger-builtins @subsection SmallInteger: builtins @table @b @item at: anIndex Answer the index-th indexed instance variable of the receiver. This method always fails. @*@* @item at: anIndex put: value Store value in the index-th indexed instance variable of the receiver This method always fails. @*@* @item basicAt: anIndex Answer the index-th indexed instance variable of the receiver. This method always fails. @*@* @item basicAt: anIndex put: value Store value in the index-th indexed instance variable of the receiver This method always fails. @*@* @end table @node SortedCollection @section SortedCollection @table @b @item 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. @end table @menu * SortedCollection class-hacking:: (class) * SortedCollection class-instance creation:: (class) * SortedCollection-basic:: (instance) * SortedCollection-copying:: (instance) * SortedCollection-instance protocol:: (instance) * SortedCollection-saving and loading:: (instance) * SortedCollection-searching:: (instance) @end menu @node SortedCollection class-hacking @subsection SortedCollection class: hacking @table @b @item defaultSortBlock Answer a default sort block for the receiver. @*@* @end table @node SortedCollection class-instance creation @subsection SortedCollection class: instance creation @table @b @item new Answer a new collection with a default size and sort block @*@* @item new: aSize Answer a new collection with a default sort block and the given size @*@* @item sortBlock: aSortBlock Answer a new collection with a default size and the given sort block @*@* @end table @node SortedCollection-basic @subsection SortedCollection: basic @table @b @item add: anObject Add anObject into the collection at the proper place @*@* @item add: anObject afterIndex: i This method should not be called for instances of this class.@*@* @item addAll: aCollection Add all the elements in aCollection to the receiver in their proper places @*@* @item addAll: aCollection afterIndex: i This method should not be called for instances of this class.@*@* @item addAllFirst: aCollection This method should not be called for instances of this class.@*@* @item addAllLast: aCollection This method should not be called for instances of this class.@*@* @item addFirst: anObject This method should not be called for instances of this class.@*@* @item addLast: anObject This method should not be called for instances of this class.@*@* @item at: index put: anObject This method should not be called for instances of this class.@*@* @item reverse Answer an OrderedCollection containing the data in the receiver in reverse ordering @*@* @end table @node SortedCollection-copying @subsection SortedCollection: copying @table @b @item copyEmpty: newSize Answer an empty copy of the receiver, with the same sort block as the receiver @*@* @end table @node SortedCollection-instance protocol @subsection SortedCollection: instance protocol @table @b @item sortBlock Answer the receiver's sort criteria @*@* @item sortBlock: aSortBlock Change the sort criteria for a sorted collection, resort the elements of the collection, and return it. @*@* @end table @node SortedCollection-saving and loading @subsection SortedCollection: saving and loading @table @b @item postLoad Restore the default sortBlock if it is nil @*@* @item preStore Store the default sortBlock as nil @*@* @end table @node SortedCollection-searching @subsection SortedCollection: searching @table @b @item includes: anObject Private - Answer whether the receiver includes an item which is equal to anObject @*@* @item 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 @*@* @item occurrencesOf: anObject Answer how many occurrences of anObject can be found in the receiver @*@* @end table @node Stream @section Stream @table @b @item 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. @end table @menu * Stream-accessing-reading:: (instance) * Stream-accessing-writing:: (instance) * Stream-basic:: (instance) * Stream-character writing:: (instance) * Stream-enumerating:: (instance) * Stream-filing out:: (instance) * Stream-PositionableStream methods:: (instance) * Stream-printing:: (instance) * Stream-providing consistent protocols:: (instance) * Stream-storing:: (instance) * Stream-testing:: (instance) @end menu @node Stream-accessing-reading @subsection Stream: accessing-reading @table @b @item contents Answer the whole contents of the receiver, from the next object to the last @*@* @item next Return the next object in the receiver @*@* @item next: anInteger Return the next anInteger objects in the receiver @*@* @item nextMatchFor: anObject Answer whether the next object is equal to anObject. Even if it does not, anObject is lost @*@* @item splitAt: anObject Answer an OrderedCollection of parts of the receiver. A new (possibly empty) part starts at the start of the receiver, or after every occurrence of an object which is equal to anObject (as compared by #=). @*@* @end table @node Stream-accessing-writing @subsection Stream: accessing-writing @table @b @item next: anInteger put: anObject Write anInteger copies of anObject to the receiver @*@* @item nextPut: anObject Write anObject to the receiver @*@* @item nextPutAll: aCollection Write all the objects in aCollection to the receiver @*@* @end table @node Stream-basic @subsection Stream: basic @table @b @item species Answer `Array'.@*@* @end table @node Stream-character writing @subsection Stream: character writing @table @b @item cr Store a cr on the receiver @*@* @item crTab Store a cr and a tab on the receiver @*@* @item nl Store a new line on the receiver @*@* @item nlTab Store a new line and a tab on the receiver @*@* @item space Store a space on the receiver @*@* @item tab Store a tab on the receiver @*@* @end table @node Stream-enumerating @subsection Stream: enumerating @table @b @item do: aBlock Evaluate aBlock once for every object in the receiver @*@* @end table @node Stream-filing out @subsection Stream: filing out @table @b @item 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 @*@* @end table @node Stream-PositionableStream methods @subsection Stream: PositionableStream methods @table @b @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item upToEnd Answer every item in the collection on which the receiver is streaming, from the next one to the last @*@* @end table @node Stream-printing @subsection Stream: printing @table @b @item 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 @*@* @end table @node Stream-providing consistent protocols @subsection Stream: providing consistent protocols @table @b @item close Do nothing. This is provided for consistency with file streams @*@* @end table @node Stream-storing @subsection Stream: storing @table @b @item 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 @*@* @end table @node Stream-testing @subsection Stream: testing @table @b @item atEnd Answer whether the stream has got to an end @*@* @end table @node String @section String @table @b @item Category: Language-Data types My instances represent ASCII string data types. Being a very common case, they are particularly optimized. @end table @menu * String class-basic:: (class) * String class-instance creation:: (class) * String-built ins:: (instance) * String-converting:: (instance) * String-storing:: (instance) * String-testing functionality:: (instance) * String-useful functionality:: (instance) @end menu @node String class-basic @subsection String class: basic @table @b @item , aString Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection @*@* @end table @node String class-instance creation @subsection String class: instance creation @table @b @item fromCData: aCObject size: anInteger Answer a String containing anInteger bytes starting at the location pointed to by aCObject @*@* @end table @node String-built ins @subsection String: built ins @table @b @item asCData: aCType Convert the receiver to a CObject with the given type @*@* @item at: index Answer the index-th character of the receiver. @*@* @item at: index put: value Change the index-th character of the receiver. @*@* @item 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 @*@* @item 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 @*@* @item hash Answer an hash value for the receiver @*@* @item 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 @*@* @item 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 @*@* @item 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 @*@* @item size Answer the size of the receiver @*@* @end table @node String-converting @subsection String: converting @table @b @item asByteArray Return the receiver, converted to a ByteArray of ASCII values @*@* @item asString But I already am a String! Really! @*@* @item asSymbol Returns the symbol corresponding to the receiver @*@* @end table @node String-storing @subsection String: storing @table @b @item storeOn: aStream Print Smalltalk code compiling to the receiver on aStream @*@* @end table @node String-testing functionality @subsection String: testing functionality @table @b @item isString Answer `true'.@*@* @end table @node String-useful functionality @subsection String: useful functionality @table @b @item linesDo: aBlock Send 'aBlock' a substring of the receiver for each newline delimited line in the receiver @*@* @end table @node Symbol @section Symbol @table @b @item 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. @end table @menu * Symbol class-built ins:: (class) * Symbol class-instance creation:: (class) * Symbol-basic:: (instance) * Symbol-built ins:: (instance) * Symbol-converting:: (instance) * Symbol-misc:: (instance) * Symbol-storing:: (instance) * Symbol-testing functionality:: (instance) @end menu @node Symbol class-built ins @subsection Symbol class: built ins @table @b @item intern: aString Private - Same as 'aString asSymbol' @*@* @end table @node Symbol class-instance creation @subsection Symbol class: instance creation @table @b @item hasInterned: aString ifTrue: aBlock If aString has not been interned yet, answer nil. Else, pass the interned version to aBlock and answer the result. 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. @*@* @item internCharacter: aCharacter Answer the one-character symbol associated to the given character. @*@* @item 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. @*@* @item new This method should not be called for instances of this class.@*@* @item new: size This method should not be called for instances of this class.@*@* @item with: element1 Answer a collection whose only element is element1 @*@* @item with: element1 with: element2 Answer a collection whose only elements are the parameters in the order they were passed @*@* @item with: element1 with: element2 with: element3 Answer a collection whose only elements are the parameters in the order they were passed @*@* @item with: element1 with: element2 with: element3 with: element4 Answer a collection whose only elements are the parameters in the order they were passed @*@* @end table @node Symbol-basic @subsection Symbol: basic @table @b @item deepCopy Returns a deep copy of the receiver. As Symbols are identity objects, we actually return the receiver itself. @*@* @item numArgs Answer the number of arguments supported by the receiver, which is supposed to be a valid message name (#+, #not, #printOn:, #ifTrue:ifFalse:, etc.) @*@* @item shallowCopy Returns a deep copy of the receiver. As Symbols are identity objects, we actually return the receiver itself. @*@* @end table @node Symbol-built ins @subsection Symbol: built ins @table @b @item = aSymbol Answer whether the receiver and aSymbol are the same object @*@* @item hash Answer an hash value for the receiver. Symbols are optimized for speed @*@* @end table @node Symbol-converting @subsection Symbol: converting @table @b @item asString Answer a String with the same characters as the receiver @*@* @item asSymbol But we are already a Symbol, and furthermore, Symbols are identity objects! So answer the receiver. @*@* @end table @node Symbol-misc @subsection Symbol: misc @table @b @item species Answer `String'.@*@* @end table @node Symbol-storing @subsection Symbol: storing @table @b @item displayOn: aStream Print a represention of the receiver on aStream. For most objects this is simply its #printOn: representation, but for strings and characters, superfluous dollars or extra pair of quotes are stripped. @*@* @item displayString Answer a String representing the receiver. For most objects this is simply its #printString, but for strings and characters, superfluous dollars or extra pair of quotes are stripped. @*@* @item printOn: aStream Store Smalltalk code compiling to the receiver on aStream @*@* @end table @node Symbol-testing functionality @subsection Symbol: testing functionality @table @b @item isString Answer `false'.@*@* @item isSymbol Answer `true'.@*@* @end table @node SymLink @section SymLink @table @b @item 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. @end table @menu * SymLink-accessing:: (instance) * SymLink-iteration:: (instance) * SymLink-printing:: (instance) @end menu @node SymLink-accessing @subsection SymLink: accessing @table @b @item symbol Answer `symbol'.@*@* @end table @node SymLink-iteration @subsection SymLink: iteration @table @b @item do: aBlock Evaluate aBlock for each symbol in the list @*@* @end table @node SymLink-printing @subsection SymLink: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream. @*@* @end table @node SystemDictionary @section SystemDictionary @table @b @item Category: Language-Implementation I am a special namespace. 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. @end table @menu * SystemDictionary-basic:: (instance) * SystemDictionary-builtins:: (instance) * SystemDictionary-C functions:: (instance) * SystemDictionary-initialization:: (instance) * SystemDictionary-miscellaneous:: (instance) * SystemDictionary-printing:: (instance) * SystemDictionary-special accessing:: (instance) @end menu @node SystemDictionary-basic @subsection SystemDictionary: basic @table @b @item halt Interrupt interpreter @*@* @item initializeGlobals Initialize the globals @*@* @end table @node SystemDictionary-builtins @subsection SystemDictionary: builtins @table @b @item byteCodeCounter Answer the number of bytecodes executed by the VM @*@* @item compact Force a full garbage collection @*@* @item debug for DBX. Set breakpoint in debug() and invoke this primitive near where you want to stop @*@* @item declarationTrace Answer whether compiled bytecodes are printed on stdout @*@* @item declarationTrace: aBoolean Set whether compiled bytecodes are printed on stdout @*@* @item enableGC: aBoolean Enable GC of Smalltalk objects referenced in callins/callouts @*@* @item executionTrace Answer whether executed bytecodes are printed on stdout @*@* @item executionTrace: aBoolean Set whether executed bytecodes are printed on stdout @*@* @item gcMessage Answer whether messages indicating that garbage collection is taking place are printed on stdout @*@* @item gcMessage: aBoolean Set whether messages indicating that garbage collection is taking place are printed on stdout @*@* @item getTraceFlag: anIndex Private - Returns a boolean value which is one of the interpreter's tracing flags @*@* @item 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 @*@* @item 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 @*@* @item growTo: numBytes Grow the amount of memory used by the system grows to numBytes. @*@* @item monitor: aBoolean Start or stop profiling the VM's execution (if GNU Smalltalk was compiled with support for monitor(2), of course). @*@* @item 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' @*@* @item quitPrimitive Quit the Smalltalk environment. Whether files are closed and other similar cleanup occurs depends on the platform @*@* @item 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 @*@* @item resetStatistics Reset the statistics about the VM which #printStatistics can print. @*@* @item setTraceFlag: anIndex to: aBoolean Private - Sets the value of one of the interpreter's tracing flags (indicated by 'anIndex') to the value aBoolean. @*@* @item snapshot: aString Save an image on the aString file @*@* @item spaceGrowRate Answer the rate with which the amount of memory used by the system grows @*@* @item spaceGrowRate: rate Set the rate with which the amount of memory used by the system grows @*@* @item verboseTrace Answer whether execution tracing prints the object on the stack top @*@* @item verboseTrace: aBoolean Set whether execution tracing prints the object on the stack top @*@* @end table @node SystemDictionary-C functions @subsection SystemDictionary: C functions @table @b @item getArgc C call-out to getArgc. Do not modify! @*@* @item getArgv: index C call-out to getArgv. Do not modify! @*@* @item getenv: aString C call-out to getenv. Do not modify! @*@* @item putenv: aString C call-out to putenv. Do not modify! @*@* @item system: aString C call-out to system. Do not modify! @*@* @end table @node SystemDictionary-initialization @subsection SystemDictionary: initialization @table @b @item 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 @*@* @item doInits Called after the system has loaded the image, this will invoke any init blocks that have been installed. @*@* @end table @node SystemDictionary-miscellaneous @subsection SystemDictionary: miscellaneous @table @b @item arguments Return the command line arguments after the -a switch @*@* @item backtrace Print a backtrace on the Transcript. @*@* @item snapshot Save a snapshot on the image file that was loaded on startup @*@* @end table @node SystemDictionary-printing @subsection SystemDictionary: printing @table @b @item defaultName Answer `'Smalltalk''.@*@* @item name Answer the receiver's name @*@* @item storeOn: aStream Store Smalltalk code compiling to the receiver @*@* @end table @node SystemDictionary-special accessing @subsection SystemDictionary: special accessing @table @b @item addFeature: aFeature Add the aFeature feature to the Features set @*@* @item dependenciesAt: anObject Answer the dependants of anObject (or nil if there's no key for anObject in the Dependencies IdentityDictionary) @*@* @item hasFeatures: features Returns true if the feature or features in 'features' is one of the implementation dependent features present @*@* @item removeFeature: aFeature Remove the aFeature feature to the Features set @*@* @item version Answer the current version of the GNU Smalltalk environment @*@* @end table @node TextCollector @section TextCollector @table @b @item Category: Streams I am a thread-safe class that maps between standard Stream protocol and a single message to another object (its selector is pluggable and should roughly correspond to #nextPutAll:). I am, in fact, the class that implements the global Transcript object. @end table @menu * TextCollector class-accessing:: (class) * TextCollector-accessing:: (instance) * TextCollector-printing:: (instance) * TextCollector-set up:: (instance) * TextCollector-storing:: (instance) @end menu @node TextCollector class-accessing @subsection TextCollector class: accessing @table @b @item message: receiverToSelectorAssociation Answer a new instance of the receiver, that uses the message identified by anAssociation to perform write operations. anAssociation's key is the receiver, while its value is the selector. @*@* @item new This method should not be called for instances of this class.@*@* @end table @node TextCollector-accessing @subsection TextCollector: accessing @table @b @item cr Emit a new-line (carriage return) to the Transcript @*@* @item next: anInteger put: anObject Write anInteger copies of anObject to the Transcript @*@* @item nextPut: aCharacter Emit aCharacter to the Transcript @*@* @item nextPutAll: aString Write aString to the Transcript @*@* @item show: aString Write aString to the Transcript @*@* @item showCr: aString Write aString to the Transcript, followed by a new-line character @*@* @item showOnNewLine: aString Write aString to the Transcript, preceded by a new-line character @*@* @end table @node TextCollector-printing @subsection TextCollector: printing @table @b @item print: anObject Print anObject's representation to the Transcript @*@* @item printOn: aStream Print a representation of the receiver onto aStream @*@* @end table @node TextCollector-set up @subsection TextCollector: set up @table @b @item message Answer an association representing the message to be sent to perform write operations. The key is the receiver, the value is the selector @*@* @item message: receiverToSelectorAssociation 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 @*@* @end table @node TextCollector-storing @subsection TextCollector: storing @table @b @item store: anObject Print Smalltalk code which evaluates to anObject on the Transcript @*@* @item storeOn: aStream Print Smalltalk code which evaluates to the receiver onto aStream @*@* @end table @node Time @section Time @table @b @item 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. @end table @menu * Time class-basic:: (class) * Time class-basic (UTC):: (class) * Time class-builtins:: (class) * Time class-initialization:: (class) * Time-accessing:: (instance) * Time-arithmetic:: (instance) * Time-comparing:: (instance) @end menu @node Time class-basic @subsection Time class: basic @table @b @item fromSeconds: secondCount Answer a Time representing secondCount seconds past midnight @*@* @item millisecondClock Answer the number of milliseconds since startup @*@* @item millisecondClockValue Answer the number of milliseconds since startup @*@* @item millisecondsPerDay Answer the number of milliseconds in a day @*@* @item millisecondsToRun: timedBlock Answer the number of milliseconds which timedBlock took to run @*@* @item new Answer a Time representing midnight @*@* @item now Answer a time representing the current time of day @*@* @item secondClock Answer the number of seconds since the midnight of 1/1/1901 @*@* @end table @node Time class-basic (UTC) @subsection Time class: basic (UTC) @table @b @item utcNow Answer a time representing the current time of day in Coordinated Universal Time (UTC) @*@* @item utcSecondClock Answer the number of seconds since the midnight of 1/1/1901 (unlike #secondClock, the reference time is here expressed as UTC, that is as Coordinated Universal Time). @*@* @end table @node Time class-builtins @subsection Time class: builtins @table @b @item primMillisecondClock Returns the number of milliseconds since midnight. @*@* @item primSecondClock Returns the number of seconds to/from 1/1/2000. @*@* @item timezone Answer a String associated with the current timezone (either standard or daylight-saving) on this operating system. For example, the answer could be `EST' to indicate Eastern Standard Time; the answer can be empty and can't be assumed to be a three-character code such as `EST'. @*@* @item timezoneBias Specifies the current bias, in minutes, for local time translation for the current time. The bias is the difference, in seconds, between Coordinated Universal Time (UTC) and local time; a positive bias indicates that the local timezone is to the east of Greenwich (e.g. Europe, Asia), while a negative bias indicates that it is to the west (e.g. America) @*@* @end table @node Time class-initialization @subsection Time class: initialization @table @b @item initialize (99 * 365 + 25) * 86400 secs/day. @*@* @item onStartup Private - Called on startup @*@* @end table @node Time-accessing @subsection Time: accessing @table @b @item asSeconds Answer `seconds'.@*@* @item hours Answer the number of hours in the receiver @*@* @item minutes Answer the number of minutes in the receiver @*@* @item seconds Answer the number of seconds in the receiver @*@* @end table @node Time-arithmetic @subsection Time: arithmetic @table @b @item addTime: timeAmount Answer a new Time that is timeAmount seconds after the receiver @*@* @item printOn: aStream Print a representation of the receiver on aStream @*@* @item subtractTime: timeAmount Answer a new Time that is timeAmount seconds before the receiver @*@* @end table @node Time-comparing @subsection Time: comparing @table @b @item < aTime Answer whether the receiver is less than aTime @*@* @item = aTime Answer whether the receiver is equal to aTime @*@* @item hash Answer an hash value for the receiver @*@* @end table @node TokenStream @section TokenStream @table @b @item 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. @end table @menu * TokenStream class-instance creation:: (class) * TokenStream-basic:: (instance) * TokenStream-write methods:: (instance) @end menu @node TokenStream class-instance creation @subsection TokenStream class: instance creation @table @b @item on: aString Answer a TokenStream working on aString @*@* @item onStream: aStream Answer a TokenStream working on the collection on which aStream is in turn streaming. @*@* @end table @node TokenStream-basic @subsection TokenStream: basic @table @b @item atEnd Answer whether the input stream has no more tokens. @*@* @item next Answer a new whitespace-separated token from the input stream @*@* @end table @node TokenStream-write methods @subsection TokenStream: write methods @table @b @item nextPut: anObject This method should not be called for instances of this class.@*@* @end table @node TrappableEvent @section TrappableEvent @table @b @item 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. @end table @menu * TrappableEvent-enumerating:: (instance) * TrappableEvent-instance creation:: (instance) @end menu @node TrappableEvent-enumerating @subsection TrappableEvent: enumerating @table @b @item allExceptionsDo: aBlock Execute aBlock, passing it an Exception for every exception in the receiver. @*@* @item handles: exception Answer whether the receiver handles `exception'. @*@* @end table @node TrappableEvent-instance creation @subsection TrappableEvent: instance creation @table @b @item , aTrappableEvent Answer an ExceptionCollection containing all the exceptions in the receiver and all the exceptions in aTrappableEvent @*@* @end table @node True @section True @table @b @item Category: Language-Data types I represent truth and justice in the world. My motto is "semper veritatis". @end table @menu * True-basic:: (instance) * True-C hacks:: (instance) * True-printing:: (instance) @end menu @node True-basic @subsection True: basic @table @b @item & aBoolean We are true -- anded with anything, we always answer the other operand @*@* @item and: aBlock We are true -- anded with anything, we always answer the other operand, so evaluate aBlock @*@* @item eqv: aBoolean Answer whether the receiver and aBoolean represent the same boolean value @*@* @item ifFalse: falseBlock We are true -- answer nil @*@* @item ifFalse: falseBlock ifTrue: trueBlock We are true -- evaluate trueBlock @*@* @item ifTrue: trueBlock We are true -- evaluate trueBlock @*@* @item ifTrue: trueBlock ifFalse: falseBlock We are true -- evaluate trueBlock @*@* @item not We are true -- answer false @*@* @item or: aBlock We are true -- ored with anything, we always answer true @*@* @item xor: aBoolean Answer whether the receiver and aBoolean represent different boolean values @*@* @item | aBoolean We are true -- ored with anything, we always answer true @*@* @end table @node True-C hacks @subsection True: C hacks @table @b @item asCBooleanValue Answer `1'.@*@* @end table @node True-printing @subsection True: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream @*@* @end table @node UndefinedObject @section UndefinedObject @table @b @item Category: Language-Implementation I have the questionable distinction of being a class with only one instance, which is the object "nil". @end table @menu * UndefinedObject-class creation:: (instance) * UndefinedObject-class creation - alternative:: (instance) * UndefinedObject-dependents access:: (instance) * UndefinedObject-printing:: (instance) * UndefinedObject-storing:: (instance) * UndefinedObject-testing:: (instance) @end menu @node UndefinedObject-class creation @subsection UndefinedObject: class creation @table @b @item metaclassFor: classNameString Create a Metaclass object for the given class name. The metaclass is a subclass of Class @*@* @item removeSubclass: aClass Ignored -- necessary to support disjoint class hierarchies @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @item 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. @*@* @end table @node UndefinedObject-class creation - alternative @subsection UndefinedObject: class creation - alternative @table @b @item subclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item subclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableByteSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableByteSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableWordSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @item variableWordSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk @*@* @end table @node UndefinedObject-dependents access @subsection UndefinedObject: dependents access @table @b @item addDependent: ignored Refer to the comment in Object|dependents. @*@* @item release Nil release is a no-op @*@* @end table @node UndefinedObject-printing @subsection UndefinedObject: printing @table @b @item printOn: aStream Print a representation of the receiver on aStream. @*@* @end table @node UndefinedObject-storing @subsection UndefinedObject: storing @table @b @item storeOn: aStream Store Smalltalk code compiling to the receiver on aStream. @*@* @end table @node UndefinedObject-testing @subsection UndefinedObject: testing @table @b @item ifNil: nilBlock Evaluate nilBlock if the receiver is nil, else answer nil @*@* @item ifNil: nilBlock ifNotNil: notNilBlock Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver. @*@* @item ifNotNil: notNilBlock Evaluate notNilBlock if the receiver is not nil, passing the receiver. Else answer nil @*@* @item ifNotNil: notNilBlock ifNotNil: nilBlock Evaluate nilBlock if the receiver is nil, else evaluate notNilBlock, passing the receiver. @*@* @item isNil Answer whether the receiver is the undefined object nil. Always answer true. @*@* @item notNil Answer whether the receiver is not the undefined object nil. Always answer false. @*@* @end table @node ValueAdaptor @section ValueAdaptor @table @b @item Category: Language-Data types My subclasses are used to access data from different objects with a consistent protocol. However, I'm an abstract class. @end table @menu * ValueAdaptor class-creating instances:: (class) * ValueAdaptor-accessing:: (instance) * ValueAdaptor-basic:: (instance) @end menu @node ValueAdaptor class-creating instances @subsection ValueAdaptor class: creating instances @table @b @item new We don't know enough of subclasses to have a shared implementation of new @*@* @end table @node ValueAdaptor-accessing @subsection ValueAdaptor: accessing @table @b @item value Retrive the value of the receiver. Must be implemented by ValueAdaptor's subclasses @*@* @item value: anObject Set the value of the receiver. Must be implemented by ValueAdaptor's subclasses @*@* @end table @node ValueAdaptor-basic @subsection ValueAdaptor: basic @table @b @item printOn: aStream Print a representation of the receiver @*@* @end table @node ValueHolder @section ValueHolder @table @b @item 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. @end table @menu * ValueHolder class-creating instances:: (class) * ValueHolder-accessing:: (instance) @end menu @node ValueHolder class-creating instances @subsection ValueHolder class: creating instances @table @b @item new Create a ValueHolder whose starting value is nil @*@* @item null Answer the sole instance of NullValueHolder @*@* @item with: anObject Create a ValueHolder whose starting value is anObject @*@* @end table @node ValueHolder-accessing @subsection ValueHolder: accessing @table @b @item value Get the value of the receiver. @*@* @item value: anObject Set the value of the receiver. @*@* @end table @node WeakArray @section WeakArray @table @b @item Category: Collections-Weak I am similar to a plain array, but my items are stored in a weak object, so I track which of them are garbage collected. @end table @menu * WeakArray class-instance creation:: (class) * WeakArray-accessing:: (instance) * WeakArray-conversion:: (instance) * WeakArray-loading:: (instance) @end menu @node WeakArray class-instance creation @subsection WeakArray class: instance creation @table @b @item new: size Private - Initialize the values array; plus, make it weak and create the ByteArray used to track garbage collected values @*@* @end table @node WeakArray-accessing @subsection WeakArray: accessing @table @b @item aliveObjectsDo: aBlock Evaluate aBlock for all the elements in the array, excluding the garbage collected ones. Note: a finalized object stays alive until the next collection (the collector has no means to see whether it was resuscitated by the finalizer), so an object being alive does not mean that it is usable. @*@* @item at: index Answer the index-th item of the receiver, or nil if it has been garbage collected. @*@* @item at: index put: object Store the value associated to the given index; plus, store in nilValues whether the object is nil. nil objects whose associated item of nilValues is 1 were touched by the garbage collector. @*@* @item atAll: indices put: object Put object at every index contained in the indices collection @*@* @item atAllPut: object Put object at every index in the receiver @*@* @item clearGCFlag: index Clear the `object has been garbage collected' flag for the item at the given index @*@* @item do: aBlock Evaluate aBlock for all the elements in the array, including the garbage collected ones (pass nil for those). @*@* @item isAlive: index Answer whether the item at the given index is still alive or has been garbage collected. Note: a finalized object stays alive until the next collection (the collector has no means to see whether it was resuscitated by the finalizer), so an object being alive does not mean that it is usable. @*@* @item size Answer the number of items in the receiver @*@* @end table @node WeakArray-conversion @subsection WeakArray: conversion @table @b @item asArray Answer a non-weak version of the receiver @*@* @item deepCopy Returns a deep copy of the receiver (the instance variables are copies of the receiver's instance variables) @*@* @item shallowCopy Returns a shallow copy of the receiver (the instance variables are not copied) @*@* @item species Answer Array; this method is used in the #copyEmpty: message, which in turn is used by all collection-returning methods (collect:, select:, reject:, etc.). @*@* @end table @node WeakArray-loading @subsection WeakArray: loading @table @b @item postLoad Called after loading an object; must restore it to the state before `preStore' was called. Make it weak again @*@* @end table @node WeakIdentitySet @section WeakIdentitySet @table @b @item Category: Collections-Weak I am similar to a plain identity set, but my keys are stored in a weak array; I track which of them are garbage collected and, as soon as I encounter one of them, I swiftly remove all the garbage collected keys @end table @menu @end menu @node WeakKeyIdentityDictionary @section WeakKeyIdentityDictionary @table @b @item Category: Collections-Weak I am similar to a plain identity dictionary, but my keys are stored in a weak array; I track which of them are garbage collected and, as soon as I encounter one of them, I swiftly remove all the associations for the garbage collected keys @end table @menu @end menu @node WeakKeyLookupTable @section WeakKeyLookupTable @table @b @item Category: Collections-Weak I am similar to a plain LookupTable, but my keys are stored in a weak array; I track which of them are garbage collected and, as soon as I encounter one of them, I swiftly remove all the associations for the garbage collected keys @end table @menu * WeakKeyLookupTable class-instance creation:: (class) * WeakKeyLookupTable-rehashing:: (instance) @end menu @node WeakKeyLookupTable class-instance creation @subsection WeakKeyLookupTable class: instance creation @table @b @item new: anInteger Answer a new instance of the receiver with the given size @*@* @end table @node WeakKeyLookupTable-rehashing @subsection WeakKeyLookupTable: rehashing @table @b @item rehash Rehash the receiver @*@* @end table @node WeakSet @section WeakSet @table @b @item Category: Collections-Weak I am similar to a plain set, but my items are stored in a weak array; I track which of them are garbage collected and, as soon as I encounter one of them, I swiftly remove all. @end table @menu * WeakSet class-instance creation:: (class) * WeakSet-rehashing:: (instance) @end menu @node WeakSet class-instance creation @subsection WeakSet class: instance creation @table @b @item new: anInteger Answer a new instance of the receiver with the given size @*@* @end table @node WeakSet-rehashing @subsection WeakSet: rehashing @table @b @item rehash Rehash the receiver @*@* @end table @node WeakValueIdentityDictionary @section WeakValueIdentityDictionary @table @b @item Category: Collections-Weak I am similar to a plain identity dictionary, but my values are stored in a weak array; I track which of the values are garbage collected and, as soon as one of them is accessed, I swiftly remove the associations for the garbage collected values @end table @menu @end menu @node WeakValueLookupTable @section WeakValueLookupTable @table @b @item Category: Collections-Weak I am similar to a plain LookupTable, but my values are stored in a weak array; I track which of the values are garbage collected and, as soon as one of them is accessed, I swiftly remove the associations for the garbage collected values @end table @menu * WeakValueLookupTable-hacks:: (instance) * WeakValueLookupTable-rehashing:: (instance) @end menu @node WeakValueLookupTable-hacks @subsection WeakValueLookupTable: hacks @table @b @item at: key ifAbsent: aBlock Answer the value associated to the given key, or the result of evaluating aBlock if the key is not found @*@* @item at: key ifPresent: aBlock If aKey is absent, answer nil. Else, evaluate aBlock passing the associated value and answer the result of the invocation @*@* @item includesKey: key Answer whether the receiver contains the given key. @*@* @end table @node WeakValueLookupTable-rehashing @subsection WeakValueLookupTable: rehashing @table @b @item rehash Rehash the receiver @*@* @end table @node WordMemory @section WordMemory @table @b @item 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. @end table @menu * WordMemory class-accessing:: (class) @end menu @node WordMemory class-accessing @subsection WordMemory class: accessing @table @b @item at: address Access a 32-bit word at the given address @*@* @item at: address put: value Store value as a 32-bit word at the given address @*@* @item bigEndian Answer whether we're running on a big- or little-endian system. @*@* @end table @node WriteStream @section WriteStream @table @b @item Category: Streams-Collection I am the class of writeable streams. I only allow write operations to my instances; reading is strictly forbidden. @end table @menu * WriteStream class-instance creation:: (class) * WriteStream-accessing:: (instance) * WriteStream-accessing-writing:: (instance) * WriteStream-positioning:: (instance) @end menu @node WriteStream class-instance creation @subsection WriteStream class: instance creation @table @b @item on: aCollection Answer a new instance of the receiver which streams on aCollection. Every item of aCollection is discarded. @*@* @item with: aCollection Answer a new instance of the receiver which streams from the end of aCollection. @*@* @item 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. @*@* @end table @node WriteStream-accessing @subsection WriteStream: accessing @table @b @item size Answer how many objects have been written @*@* @end table @node WriteStream-accessing-writing @subsection WriteStream: accessing-writing @table @b @item nextPut: anObject Store anObject as the next item in the receiver. Grow the collection if necessary @*@* @end table @node WriteStream-positioning @subsection WriteStream: positioning @table @b @item emptyStream Extension - Reset the stream @*@* @item position: anInteger Skip to the anInteger-th item backwards in the stream. Fail if anInteger>self position. The stream is truncated after the pointer @*@* @item skip: anInteger Skip (anInteger negated) items backwards in the stream. Fail if anInteger>0. The stream is truncated after the pointer @*@* @end table @end ifclear