GNU Smalltalk Library Reference ******************************* This document describes the class libraries that are distributed together with the GNU Smalltalk programming language. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". 1 Base classes ************** 1.1 AbstractNamespace ===================== Defined in namespace Smalltalk Superclass: BindingDictionary Category: Language-Implementation I am a special form of dictionary. Classes hold on an instance of me; it is called their `environment'. 1.1.1 AbstractNamespace class: instance creation ------------------------------------------------ new Disabled - use #new to create instances 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. 1.1.2 AbstractNamespace: accessing ---------------------------------- 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) allBehaviorsDo: aBlock Evaluate aBlock once for each class and metaclass in the namespace. allClassObjectsDo: aBlock Evaluate aBlock once for each class and metaclass in the namespace. allClassesDo: aBlock Evaluate aBlock once for each class in the namespace. allMetaclassesDo: aBlock Evaluate aBlock once for each metaclass in the namespace. classAt: aKey Answer the value corrisponding to aKey if it is a class. Fail if either aKey is not found or it is associated to something different from a class. classAt: aKey ifAbsent: aBlock Answer the value corrisponding to aKey if it is a class. Evaluate aBlock and answer its result if either aKey is not found or it is associated to something different from a class. 1.1.3 AbstractNamespace: basic & copying ---------------------------------------- = 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 hash Answer an hash value for the receiver. This is the same as the object's #identityHash. 1.1.4 AbstractNamespace: copying -------------------------------- copyEmpty: newSize Answer an empty copy of the receiver whose size is newSize whileCurrentDo: aBlock Evaluate aBlock with the current namespace set to the receiver. Answer the result of the evaluation. 1.1.5 AbstractNamespace: namespace hierarchy -------------------------------------------- addSubspace: aSymbol Create a namespace named aSymbol, add it to the receiver's subspaces, and answer it. allSubassociationsDo: aBlock Invokes aBlock once for every association in each of the receiver's subspaces. allSubspaces Answer the direct and indirect subspaces of the receiver in a Set allSubspacesDo: aBlock Invokes aBlock for all subspaces, both direct and indirect. allSuperspaces Answer all the receiver's superspaces in a collection allSuperspacesDo: aBlock Evaluate aBlock once for each of the receiver's superspaces 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. 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. inheritsFrom: aNamespace Answer whether aNamespace is one of the receiver's direct and indirect superspaces removeSubspace: aSymbol Remove my subspace named aSymbol from the hierarchy. selectSubspaces: aBlock Return a Set of subspaces of the receiver satisfying aBlock. selectSuperspaces: aBlock Return a Set of superspaces of the receiver satisfying aBlock. siblings Answer all the other children of the same namespace as the receiver. siblingsDo: aBlock Evaluate aBlock once for each of the other root namespaces, passing the namespace as a parameter. subspaces Answer the receiver's direct subspaces subspacesDo: aBlock Invokes aBlock for all direct subspaces. superspace Answer the receiver's superspace. superspace: aNamespace Set the superspace of the receiver to be 'aNamespace'. Also adds the receiver as a subspace of it. withAllSubspaces Answer a Set containing the receiver together with its direct and indirect subspaces withAllSubspacesDo: aBlock Invokes aBlock for the receiver and all subclasses, both direct and indirect. withAllSuperspaces Answer the receiver and all of its superspaces in a collection withAllSuperspacesDo: aBlock Invokes aBlock for the receiver and all superspaces, both direct and indirect. 1.1.6 AbstractNamespace: overrides for superspaces -------------------------------------------------- definedKeys Answer a kind of Set containing the keys of the receiver definesKey: key Answer whether the receiver defines the given key. `Defines' means that the receiver's superspaces, if any, are not considered. 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 carried on in superspaces and the method will fail. 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 carried on in superspaces and aBlock will be immediately evaluated. inheritedKeys Answer a Set of all the keys in the receiver and its superspaces 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. 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. values Answer a Bag containing the values of the receiver 1.1.7 AbstractNamespace: printing --------------------------------- name Answer the receiver's name name: aSymbol Change the receiver's name to aSymbol nameIn: aNamespace Answer Smalltalk code compiling to the receiver when the current namespace is aNamespace printOn: aStream Print a representation of the receiver storeOn: aStream Store Smalltalk code compiling to the receiver 1.1.8 AbstractNamespace: testing -------------------------------- isNamespace Answer `true'. isSmalltalk Answer `false'. 1.2 AlternativeObjectProxy ========================== Defined in namespace Smalltalk Superclass: DumperProxy Category: Streams-Files I am a proxy that uses the same ObjectDumper to store an object which is not the object to be dumped, but from which the dumped object can be reconstructed. I am an abstract class, using me would result in infinite loops because by default I try to store the same object again and again. See the method comments for more information 1.2.1 AlternativeObjectProxy class: instance creation ----------------------------------------------------- acceptUsageForClass: aClass The receiver was asked to be used as a proxy for the class aClass. Answer whether the registration is fine. By default, answer true except if AlternativeObjectProxy itself is being used. on: anObject Answer a proxy to be used to save anObject. IMPORTANT: this method MUST be overridden so that the overridden version sends #on: to super passing an object that is NOT the same as anObject (alternatively, you can override #dumpTo:, which is what NullProxy does), because that would result in an infinite loop! This also means that AlternativeObjectProxy must never be used directly - only as a superclass. 1.2.2 AlternativeObjectProxy: accessing --------------------------------------- object Reconstruct the object stored in the proxy and answer it. A subclass will usually override this object: theObject Set the object to be dumped to theObject. This should not be overridden. primObject Reconstruct the object stored in the proxy and answer it. This method must not be overridden 1.3 ArithmeticError =================== Defined in namespace Smalltalk Superclass: Halt Category: Language-Exceptions An ArithmeticError exception is raised by numeric classes when a program tries to do something wrong, such as extracting the square root of a negative number. 1.3.1 ArithmeticError: description ---------------------------------- description Answer a textual description of the exception. 1.4 Array ========= Defined in namespace Smalltalk Superclass: ArrayedCollection 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. 1.4.1 Array class: instance creation ------------------------------------ from: anArray Answer anArray, which is expected to be an array specified with a brace-syntax expression per my inherited protocol. 1.4.2 Array: mutating objects ----------------------------- multiBecome: anArray Transform every object in the receiver in each corresponding object in anArray. anArray and the receiver must have the same size 1.4.3 Array: printing --------------------- isLiteralObject Answer whether the receiver is expressible as a Smalltalk literal. printOn: aStream Print a representation for the receiver on aStream storeLiteralOn: aStream Store a Smalltalk literal compiling to the receiver on aStream storeOn: aStream Store Smalltalk code compiling to the receiver on aStream 1.4.4 Array: testing -------------------- isArray Answer `true'. 1.5 ArrayedCollection ===================== Defined in namespace Smalltalk Superclass: SequenceableCollection 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. 1.5.1 ArrayedCollection class: instance creation ------------------------------------------------ join: aCollection Where aCollection is a collection of SequenceableCollections, answer a new instance with all the elements therein, in order. join: aCollection separatedBy: sepCollection Where aCollection is a collection of SequenceableCollections, answer a new instance with all the elements therein, in order, each separated by an occurrence of sepCollection. new: size withAll: anObject Answer a collection with the given size, whose elements are all set to anObject streamContents: aBlock Create a ReadWriteStream on an empty instance of the receiver; pass the stream to aBlock, then retrieve its contents and answer them. with: element1 Answer a collection whose only element is element1 with: element1 with: element2 Answer a collection whose only elements are the parameters in the order they were passed with: element1 with: element2 with: element3 Answer a collection whose only elements are the parameters in the order they were passed with: element1 with: element2 with: element3 with: element4 Answer a collection whose only elements are the parameters in the order they were passed with: element1 with: element2 with: element3 with: element4 with: element5 Answer a collection whose only elements are the parameters in the order they were passed withAll: aCollection Answer a collection whose elements are the same as those in aCollection 1.5.2 ArrayedCollection: basic ------------------------------ , aSequenceableCollection Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by all the elements in aSequenceableCollection add: value This method should not be called for instances of this class. atAll: keyCollection Answer a collection of the same kind returned by #collect:, that only includes the values at the given indices. Fail if any of the values in keyCollection is out of bounds for the receiver. copyFrom: start to: stop Answer a new collection containing all the items in the receiver from the start-th and to the stop-th copyWith: anElement Answer a new instance of an ArrayedCollection containing all the elements in the receiver, followed by the single item anElement copyWithout: oldElement Answer a copy of the receiver to which all occurrences of oldElement are removed 1.5.3 ArrayedCollection: built ins ---------------------------------- size Answer the size of the receiver 1.5.4 ArrayedCollection: copying Collections -------------------------------------------- copyReplaceAll: oldSubCollection with: newSubCollection Answer a new collection in which all the sequences matching oldSubCollection are replaced with newSubCollection copyReplaceFrom: start to: stop with: replacementCollection Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index `start' to index `stop'. If start < stop, these are replaced by the contents of the replacementCollection. Instead, If start = (stop + 1), like in `copyReplaceFrom: 4 to: 3 with: anArray', then every element of the receiver will be present in the answered copy; the operation will be an append if stop is equal to the size of the receiver or, if it is not, an insert before index `start'. copyReplaceFrom: start to: stop withObject: anObject Answer a new collection of the same class as the receiver that contains the same elements as the receiver, in the same order, except for elements from index `start' to index `stop'. If start < stop, these are replaced by stop-start+1 copies of 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'. reverse Answer the receivers' contents in reverse order 1.5.5 ArrayedCollection: enumerating the elements of a collection ----------------------------------------------------------------- collect: aBlock Answer a new instance of an ArrayedCollection containing all the results of evaluating aBlock passing each of the receiver's elements reject: aBlock Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer false select: aBlock Answer a new instance of an ArrayedCollection containing all the elements in the receiver which, when passed to aBlock, answer true 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. 1.5.6 ArrayedCollection: storing -------------------------------- storeOn: aStream Store Smalltalk code compiling to the receiver on aStream 1.5.7 ArrayedCollection: streams -------------------------------- writeStream Answer a WriteStream streaming on the receiver 1.6 Association =============== Defined in namespace Smalltalk Superclass: LookupKey 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. 1.6.1 Association class: basic ------------------------------ key: aKey value: aValue Answer a new association with the given key and value 1.6.2 Association: accessing ---------------------------- environment Answer nil. This is present to achieve polymorphism with instances of VariableBinding. environment: aNamespace Do nothing. This is present to achieve polymorphism with instances of VariableBinding. key: aKey value: aValue Set the association's key to aKey, and its value to aValue value Answer the association's value value: aValue Set the association's value to aValue 1.6.3 Association: finalization ------------------------------- mourn Finalize the receiver 1.6.4 Association: printing --------------------------- printOn: aStream Put on aStream a representation of the receiver 1.6.5 Association: storing -------------------------- storeOn: aStream Put on aStream some Smalltalk code compiling to the receiver 1.6.6 Association: testing -------------------------- = anAssociation Answer whether the association's key and value are the same as anAssociation's, or false if anAssociation is not an Association. As a special case, identical values are considered equal even if #= returns false (as is the case for NaN floating-point values). hash Answer an hash value for the receiver 1.7 Autoload ============ Defined in namespace Smalltalk Superclass: none Category: Examples-Useful tools I am not a part of the normal Smalltalk kernel class system. I provide the ability to do late ("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) or to its metaclass (such as #methodsFor: to extend it with class-side methods). 1.7.1 Autoload class: instance creation --------------------------------------- class: nameSymbol from: fileNameString Make Smalltalk automatically load the class named nameSymbol from fileNameString when needed class: nameSymbol in: aNamespace from: fileNameString Make Smalltalk automatically load the class named nameSymbol and residing in aNamespace from fileNameString when needed 1.7.2 Autoload: accessing ------------------------- class We need it to access the metaclass instance, because that's what will load the file. doesNotUnderstand: aMessage Load the class and resend the message to it 1.8 Bag ======= Defined in namespace Smalltalk Superclass: Collection 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. 1.8.1 Bag class: basic ---------------------- new Answer a new instance of the receiver new: size Answer a new instance of the receiver, with space for size distinct objects 1.8.2 Bag: adding ----------------- add: newObject Add an occurrence of newObject to the receiver. Answer newObject. Fail if newObject is nil. add: newObject withOccurrences: anInteger If anInteger > 0, add anInteger occurrences of newObject to the receiver. If anInteger < 0, remove them. Answer newObject. Fail if newObject is nil. 1.8.3 Bag: enumerating the elements of a collection --------------------------------------------------- asSet Answer a set with the elements of the receiver do: aBlock Evaluate the block for all members in the collection. 1.8.4 Bag: extracting items --------------------------- sortedByCount Answer a collection of counts with elements, sorted by decreasing count. 1.8.5 Bag: printing ------------------- printOn: aStream Put on aStream a representation of the receiver 1.8.6 Bag: removing ------------------- remove: oldObject ifAbsent: anExceptionBlock Remove oldObject from the collection and return it. If can't be found, answer instead the result of evaluationg anExceptionBlock 1.8.7 Bag: storing ------------------ storeOn: aStream Put on aStream some Smalltalk code compiling to the receiver 1.8.8 Bag: testing collections ------------------------------ = aBag Answer whether the receiver and aBag contain the same objects hash Answer an hash value for the receiver includes: anObject Answer whether we include anObject occurrencesOf: anObject Answer the number of occurrences of anObject found in the receiver size Answer the total number of objects found in the receiver 1.9 Behavior ============ Defined in namespace Smalltalk Superclass: Object 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. 1.9.1 Behavior: accessing class hierarchy ----------------------------------------- allSubclasses Answer the direct and indirect subclasses of the receiver in a Set allSuperclasses Answer all the receiver's superclasses in a collection subclasses Answer the direct subclasses of the receiver in a Set superclass Answer the receiver's superclass (if any, otherwise answer nil) withAllSubclasses Answer a Set containing the receiver together with its direct and indirect subclasses withAllSuperclasses Answer the receiver and all of its superclasses in a collection 1.9.2 Behavior: accessing instances and variables ------------------------------------------------- allClassVarNames Return all the class variables understood by the receiver allInstVarNames Answer the names of every instance variables the receiver contained in the receiver's instances allInstances Returns a set of all instances of the receiver allSharedPools Return the names of the shared pools defined by the class and any of its superclasses classPool Answer the class pool dictionary. Since Behavior does not support classes with class variables, we answer an empty one; adding variables to it results in an error. classVarNames Answer all the class variables for instances of the receiver instVarNames Answer an Array containing the instance variables defined by the receiver instanceCount Return a count of all the instances of the receiver sharedPools Return the names of the shared pools defined by the class subclassInstVarNames Answer the names of the instance variables the receiver inherited from its superclass 1.9.3 Behavior: accessing the methodDictionary ---------------------------------------------- >> selector Return the compiled method associated with selector, from the local method dictionary. Error if not found. allSelectors Answer a Set of all the selectors understood by the receiver compiledMethodAt: selector Return the compiled method associated with selector, from the local method dictionary. Error if not found. compiledMethodAt: selector ifAbsent: aBlock Return the compiled method associated with selector, from the local method dictionary. Evaluate aBlock if not found. lookupSelector: aSelector Return the compiled method associated with selector, from the local method dictionary or one of a superclass; return nil if not found. parseTreeFor: selector Answer the parse tree for the given selector, or nil if there was an error. Requires the Parser package to be loaded. selectorAt: method Return selector for the given CompiledMethod selectors Answer a Set of the receiver's selectors sourceCodeAt: selector Answer source code (if available) for the given selector. sourceMethodAt: selector This is too dependent on the original implementation 1.9.4 Behavior: built ins ------------------------- basicNewInFixedSpace Create a new instance of a class with no indexed instance variables. The instance is guaranteed not to move across garbage collections. Like #basicNew, this method should not be overridden. basicNewInFixedSpace: numInstanceVariables Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables. The instance is guaranteed not to move across garbage collections. Like #basicNew:, this method should not be overridden. flushCache Invalidate the method cache kept by the virtual machine. This message should not need to be called by user programs. methodsFor: category ifTrue: condition Compile the following code inside the receiver, with the given category, if condition is true; else ignore it primCompile: code Compile the code, a string or readable stream, with no category. Fail if the code does not obey Smalltalk syntax. Answer the generated CompiledMethod if it does. Do not send this in user code; use #compile: or related methods instead. primCompile: code ifError: aBlock As with #primCompile:, but evaluate aBlock (passing the file name, line number and description of the error) if the code does not obey Smalltalk syntax. Do not send this in user code; use #compile:ifError: or related methods instead. someInstance Private - Answer the first instance of the receiver in the object table 1.9.5 Behavior: builtin ----------------------- basicNew Create a new instance of a class with no indexed instance variables; this method must not be overridden. basicNew: numInstanceVariables Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables; this method must not be overridden. new Create a new instance of a class with no indexed instance variables new: numInstanceVariables Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables. 1.9.6 Behavior: compilation (alternative) ----------------------------------------- methods Don't use this, it's only present to file in from Smalltalk/V methodsFor Don't use this, it's only present to file in from Dolphin Smalltalk methodsFor: category ifFeatures: features Start compiling methods in the receiver if this implementation of Smalltalk has the given features, else skip the section methodsFor: category stamp: notUsed Don't use this, it's only present to file in from Squeak privateMethods Don't use this, it's only present to file in from IBM Smalltalk publicMethods Don't use this, it's only present to file in from IBM Smalltalk 1.9.7 Behavior: compiling methods --------------------------------- methodsFor: aCategoryString Calling this method prepares the parser to receive methods to be compiled and installed in the receiver's method dictionary. The methods are put in the category identified by the parameter. 1.9.8 Behavior: creating a class hierarchy ------------------------------------------ addSubclass: aClass Add aClass asone of the receiver's subclasses. removeSubclass: aClass Remove aClass from the list of the receiver's subclasses superclass: aClass Set the receiver's superclass. 1.9.9 Behavior: enumerating --------------------------- allInstancesDo: aBlock Invokes aBlock for all instances of the receiver allSubclassesDo: aBlock Invokes aBlock for all subclasses, both direct and indirect. allSubinstancesDo: aBlock Invokes aBlock for all instances of each of the receiver's subclasses. allSuperclassesDo: aBlock Invokes aBlock for all superclasses, both direct and indirect. selectSubclasses: aBlock Return a Set of subclasses of the receiver satisfying aBlock. selectSuperclasses: aBlock Return a Set of superclasses of the receiver satisfying aBlock. subclassesDo: aBlock Invokes aBlock for all direct subclasses. withAllSubclassesDo: aBlock Invokes aBlock for the receiver and all subclasses, both direct and indirect. withAllSuperclassesDo: aBlock Invokes aBlock for the receiver and all superclasses, both direct and indirect. 1.9.10 Behavior: evaluating --------------------------- evalString: aString to: anObject Answer the stack top at the end of the evaluation of the code in aString. The code is executed as part of anObject evalString: aString to: anObject ifError: aBlock Answer the stack top at the end of the evaluation of the code in aString. If aString cannot be parsed, evaluate aBlock (see compile:ifError:). The code is executed as part of anObject evaluate: code Evaluate Smalltalk expression in 'code' and return result. evaluate: code ifError: block Evaluate 'code'. If a parsing error is detected, invoke 'block' evaluate: code notifying: requestor Evaluate Smalltalk expression in 'code'. If a parsing error is encountered, send #error: to requestor evaluate: code to: anObject Evaluate Smalltalk expression as part of anObject's method definition evaluate: code to: anObject ifError: block Evaluate Smalltalk expression as part of anObject's method definition. This method is used to support Inspector expression evaluation. If a parsing error is encountered, invoke error block, 'block' 1.9.11 Behavior: instance creation ---------------------------------- newInFixedSpace Create a new instance of a class without indexed instance variables. The instance is guaranteed not to move across garbage collections. If a subclass overrides #new, the changes will apply to this method too. newInFixedSpace: numInstanceVariables Create a new instance of a class with indexed instance variables. The instance has numInstanceVariables indexed instance variables. The instance is guaranteed not to move across garbage collections. If a subclass overrides #new:, the changes will apply to this method too. 1.9.12 Behavior: instance variables ----------------------------------- addInstVarName: aString Add the given instance variable to instance of the receiver instanceVariableNames: instVarNames Set the instance variables for the receiver to be those in instVarNames removeInstVarName: aString Remove the given instance variable from the receiver and recompile all of the receiver's subclasses 1.9.13 Behavior: method dictionary ---------------------------------- addSelector: selector withMethod: compiledMethod Add the given compiledMethod to the method dictionary, giving it the passed selector. Answer compiledMethod compile: code Compile method source. If there are parsing errors, answer nil. Else, return a CompiledMethod result of compilation compile: code ifError: block Compile method source. If there are parsing errors, invoke exception block, 'block' passing file name, line number and error. Return a CompiledMethod result of compilation to compile: code notifying: requestor Compile method source. If there are parsing errors, send #error: to the requestor object, else return a CompiledMethod result of compilation compileAll Recompile all selectors in the receiver. Ignore errors. compileAll: aNotifier Recompile all selectors in the receiver. Notify aNotifier by sen- ding #error: messages if something goes wrong. compileAllSubclasses Recompile all selector of all subclasses. Notify aNotifier by sen- ding #error: messages if something goes wrong. compileAllSubclasses: aNotifier Recompile all selector of all subclasses. Notify aNotifier by sen- ding #error: messages if something goes wrong. createGetMethod: what Create a method accessing the variable `what'. createGetMethod: what default: value Create a method accessing the variable `what', with a default value of `value', using lazy initialization createSetMethod: what Create a method which sets the variable `what'. decompile: selector Decompile the bytecodes for the given selector. defineAsyncCFunc: cFuncNameString withSelectorArgs: selectorAndArgs args: argsArray Please lookup the part on the C interface in the manual. This method is deprecated, you should use the asyncCCall:args: attribute. defineCFunc: cFuncNameString withSelectorArgs: selectorAndArgs returning: returnTypeSymbol args: argsArray Please lookup the part on the C interface in the manual. This method is deprecated, you should use the cCall:returning:args: attribute. edit: selector Open Emacs to edit the method with the passed selector, then compile it methodDictionary Answer the receiver's method dictionary. Don't modify the method dictionary unless you exactly know what you're doing methodDictionary: aDictionary Set the receiver's method dictionary to aDictionary recompile: selector Recompile the given selector, answer nil if something goes wrong or the new CompiledMethod if everything's ok. to recompile: selector notifying: aNotifier Recompile the given selector. If there are parsing errors, send #error: to the aNotifier object, else return a CompiledMethod result of compilation removeSelector: selector Remove the given selector from the method dictionary, answer the CompiledMethod attached to that selector removeSelector: selector ifAbsent: aBlock Remove the given selector from the method dictionary, answer the CompiledMethod attached to that selector. If the selector cannot be found, answer the result of evaluating aBlock. selectorsAndMethodsDo: aBlock Evaluate aBlock, passing for each evaluation a selector that's defined in the receiver and the corresponding method. 1.9.14 Behavior: parsing class declarations ------------------------------------------- parseInstanceVariableString: variableString Not commented. parseVariableString: aString Not commented. 1.9.15 Behavior: pluggable behavior (not yet implemented) --------------------------------------------------------- compilerClass Answer the class that can be used to compile parse trees, or nil if there is none (as is the case now). Not used for methods if parserClass answers nil, and for doits if evaluatorClass answers nil. debuggerClass Answer which class is to be used to debug a chain of contexts which includes the receiver. nil means 'do not debug'; other classes are sent #debuggingPriority and the one with the highest priority is picked. decompilerClass Answer the class that can be used to decompile methods, or nil if there is none (as is the case now). evaluatorClass Answer the class that can be used to evaluate doits, or nil if there is none (as is the case now). parserClass Answer the class that can be used to parse methods, or nil if there is none (as is the case now). 1.9.16 Behavior: printing hierarchy ----------------------------------- hierarchyIndent Answer the indent to be used by #printHierarchy - 4 by default printHierarchy Print my entire subclass hierarchy on the terminal. printSubclasses: level using: aBlock I print my name, and then all my subclasses, each indented according to its position in the hierarchy. I pass aBlock a class name and a level 1.9.17 Behavior: still unclassified ----------------------------------- parseNodeAt: selector Not commented. updateInstanceVars: variableArray shape: shape Update instance variables and instance spec of the class and all its subclasses. variableArray lists the new variables, including inherited ones. 1.9.18 Behavior: support for lightweight classes ------------------------------------------------ article Answer an article (`a' or `an') which is ok for the receiver's name asClass Answer the first superclass that is a full-fledged Class object environment Answer the namespace that this class belongs to - the same as the superclass, since Behavior does not support namespaces yet. 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. nameIn: aNamespace Answer the class name when the class is referenced from aNamespace - a dummy one, since Behavior does not support names. printOn: aStream in: aNamespace Answer the class name when the class is referenced from aNamespace - a dummy one, since Behavior does not support names. securityPolicy Not commented. securityPolicy: aSecurityPolicy This method should not be called for instances of this class. 1.9.19 Behavior: testing functionality -------------------------------------- isBehavior Answer `true'. 1.9.20 Behavior: testing the class hierarchy -------------------------------------------- includesBehavior: aClass Returns true if aClass is the receiver or a superclass of the receiver. inheritsFrom: aClass Returns true if aClass is a superclass of the receiver kindOfSubclass Return a string indicating the type of class the receiver is shape Not commented. #ushort shape: shape Give the provided shape to the receiver's instances. The shape can be nil, or one of #byte #int8 #character #short #word #ushort #int #uint #int64 #uint64 #utf32 #float #double or #pointer. In addition, the special value #inherit means to use the shape of the superclass; note however that this is a static setting, and subclasses that used #inherit are not mutated when the superclass adopts a different shape. shapes Not commented. 1.9.21 Behavior: testing the form of the instances -------------------------------------------------- instSize Answer how many fixed instance variables are reserved to each of the receiver's instances isBits Not commented. isFixed Answer whether the receiver's instances have no indexed instance variables isIdentity Answer whether x = y implies x == y for instances of the receiver isImmediate Answer whether, if x is an instance of the receiver, x copy == x isPointers Answer whether the instance variables of the receiver's instances are objects isVariable Answer whether the receiver's instances have indexed instance variables 1.9.22 Behavior: testing the method dictionary ---------------------------------------------- canUnderstand: selector Returns true if the instances of the receiver understand the given selector hasMethods Return whether the receiver has any methods defined includesSelector: selector Returns true if the local method dictionary contains the given selector scopeHas: name ifTrue: aBlock If methods understood by the receiver's instances have access to a symbol named 'name', evaluate aBlock whichClassIncludesSelector: selector Answer which class in the receiver's hierarchy contains the implementation of selector used by instances of the class (nil if none does) whichSelectorsAccess: instVarName Answer a Set of selectors which access the given instance variable whichSelectorsAssign: instVarName Answer a Set of selectors which read the given instance variable whichSelectorsRead: instVarName Answer a Set of selectors which read the given instance variable whichSelectorsReferTo: anObject Returns a Set of selectors that refer to anObject whichSelectorsReferToByteCode: aByteCode Return the collection of selectors in the class which reference the byte code, aByteCode 1.10 BindingDictionary ====================== Defined in namespace Smalltalk Superclass: Dictionary Category: Language-Implementation I am a special form of dictionary that provides special ways to access my keys, which typically begin with an uppercase letter; also, my associations are actually VariableBinding instances. 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. 1.10.1 BindingDictionary: accessing ----------------------------------- 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) 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). environment Answer the environment to which the receiver is connected. This can be the class for a dictionary that holds class variables, or the super-namespace. In general it is used to compute the receiver's name. environment: anObject Set the environment to which the receiver is connected. This can be the class for a dictionary that holds class variables, or the super-namespace. In general it is used to compute the receiver's name. 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. name Answer the receiver's name, which by default is the same as the name of the receiver's environment. nameIn: aNamespace Answer the receiver's name when referred to from aNamespace; by default the computation is deferred to the receiver's environment. 1.10.2 BindingDictionary: copying --------------------------------- copy Answer the receiver. copyEmpty: newSize Answer an empty copy of the receiver whose size is newSize copyEmptyForCollect Answer an empty copy of the receiver which is filled in to compute the result of #collect: copyEmptyForCollect: size Answer an empty copy of the receiver which is filled in to compute the result of #collect: deepCopy Answer the receiver. shallowCopy Answer the receiver. 1.10.3 BindingDictionary: forward declarations ---------------------------------------------- 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. 1.10.4 BindingDictionary: printing ---------------------------------- printOn: aStream in: aNamespace Print the receiver's name when referred to from aNamespace; by default the computation is deferred to the receiver's environment. 1.10.5 BindingDictionary: testing --------------------------------- species Answer `IdentityDictionary'. 1.11 BlockClosure ================= Defined in namespace Smalltalk Superclass: Object 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. 1.11.1 BlockClosure class: instance creation -------------------------------------------- block: aCompiledBlock Answer a BlockClosure that activates the passed CompiledBlock. block: aCompiledBlock receiver: anObject Answer a BlockClosure that activates the passed CompiledBlock with the given receiver. block: aCompiledBlock receiver: anObject outerContext: aContext Answer a BlockClosure that activates the passed CompiledBlock with the given receiver. exceptionHandlerResetBlock Not commented. exceptionHandlerSearchBlock Not commented. 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. 1.11.2 BlockClosure class: testing ---------------------------------- isImmediate Answer whether, if x is an instance of the receiver, x copy == x 1.11.3 BlockClosure: accessing ------------------------------ argumentCount Answer the number of arguments passed to the receiver block Answer the CompiledBlock which contains the receiver's bytecodes block: aCompiledBlock Set the CompiledBlock which contains the receiver's bytecodes finalIP Answer the last instruction that can be executed by the receiver 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. initialIP Answer the initial instruction pointer into the receiver. method Answer the CompiledMethod in which the receiver lies numArgs Answer the number of arguments passed to the receiver numTemps Answer the number of temporary variables used by the receiver outerContext Answer the method/block context which is the immediate outer of the receiver outerContext: containingContext Set the method/block context which is the immediate outer of the receiver 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...) receiver: anObject Set the object that is used as `self' when executing the receiver stackDepth Answer the number of stack slots needed for the receiver 1.11.4 BlockClosure: built ins ------------------------------ value Evaluate the receiver passing no parameters value: arg1 Evaluate the receiver passing arg1 as the only parameter value: arg1 value: arg2 Evaluate the receiver passing arg1 and arg2 as the parameters value: arg1 value: arg2 value: arg3 Evaluate the receiver passing arg1, arg2 and arg3 as the parameters valueWithArguments: argumentsArray Evaluate the receiver passing argArray's elements as the parameters 1.11.5 BlockClosure: control structures --------------------------------------- repeat Evaluate the receiver 'forever' (actually until a return is executed or the process is terminated). whileFalse Evaluate the receiver until it returns true whileFalse: aBlock Evaluate the receiver. If it returns false, evaluate aBlock and re- start whileTrue Evaluate the receiver until it returns false whileTrue: aBlock Evaluate the receiver. If it returns true, evaluate aBlock and re- start 1.11.6 BlockClosure: exception handling --------------------------------------- ifError: aBlock Evaluate the receiver; when #error: is called, pass to aBlock the receiver and the parameter, and answer the result of evaluating aBlock. If another exception is raised, it is passed to an outer handler; if no exception is raised, the result of evaluating the receiver is returned. on: anException do: aBlock Evaluate the receiver; when anException is signaled, evaluate aBlock passing a Signal describing the exception. Answer either the result of evaluating the receiver or the parameter of a Signal>>#return: on: e1 do: b1 on: e2 do: b2 Evaluate the receiver; when e1 or e2 are signaled, evaluate respectively b1 or b2, passing a Signal describing the exception. Answer either the result of evaluating the receiver or the argument of a Signal>>#return: on: e1 do: b1 on: e2 do: b2 on: e3 do: b3 Evaluate the receiver; when e1, e2 or e3 are signaled, evaluate respectively b1, b2 or b3, passing a Signal describing the exception. Answer either the result of evaluating the receiver or the parameter of a Signal>>#return: on: e1 do: b1 on: e2 do: b2 on: e3 do: b3 on: e4 do: b4 Evaluate the receiver; when e1, e2, e3 or e4 are signaled, evaluate respectively b1, b2, b3 or b4, passing a Signal describing the exception. Answer either the result of evaluating the receiver or the parameter of a Signal>>#return: on: e1 do: b1 on: e2 do: b2 on: e3 do: b3 on: e4 do: b4 on: e5 do: b5 Evaluate the receiver; when e1, e2, e3, e4 or e5 are signaled, evaluate respectively b1, b2, b3, b4 or b5, passing a Signal describing the exception. Answer either the result of evaluating the receiver or the parameter of a Signal>>#return: 1.11.7 BlockClosure: multiple process ------------------------------------- fork Create a new process executing the receiver and start it forkAt: priority Create a new process executing the receiver with given priority and start it forkWithoutPreemption Evaluate the receiver in a process that cannot be preempted. If the receiver expect a parameter, pass the current process (can be useful for queuing interrupts from within the uninterruptible process). newProcess Create a new process executing the receiver in suspended state. The priority is the same as for the calling process. The receiver must not contain returns newProcessWith: anArray Create a new process executing the receiver with the passed arguments, and leave it in suspended state. The priority is the same as for the calling process. The receiver must not contain returns valueWithoutInterrupts Evaluate aBlock and delay all interrupts that are requested to the active process during its execution to after aBlock returns. valueWithoutPreemption Evaluate the receiver with external interrupts disabled. This effectively disables preemption as long as the block does not explicitly yield control, wait on semaphores, and the like. 1.11.8 BlockClosure: overriding ------------------------------- copy Answer the receiver. deepCopy Not commented. 1.11.9 BlockClosure: testing ---------------------------- hasMethodReturn Answer whether the block contains a method return 1.11.10 BlockClosure: unwind protection --------------------------------------- ensure: aBlock Evaluate the receiver; when any exception is signaled exit returning the result of evaluating aBlock; if no exception is raised, return the result of evaluating aBlock when the receiver has ended ifCurtailed: aBlock Evaluate the receiver; if its execution triggers an unwind which truncates the execution of the block (`curtails' the block), evaluate aBlock. The three cases which can curtail the execution of the receiver are: a non-local return in the receiver, a non-local return in a block evaluated by the receiver which returns past the receiver itself, and an exception raised and not resumed during the execution of the receiver. 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 (as a rule of thumb, use it only when the corresponding C code uses the _gst_prepare_execution_environment and _gst_finish_execution_environment functions). You should usually rely on #ensure: and #on:do:. 1.12 BlockContext ================= Defined in namespace Smalltalk Superclass: ContextPart 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. 1.12.1 BlockContext: accessing ------------------------------ caller Answer the context that called the receiver home Answer the MethodContext to which the receiver refers, or nil if it has been optimized away isBlock Answer whether the receiver is a block context block isDisabled Answers false, because contexts that are skipped when doing a return are always MethodContexts. BlockContexts are removed from the chain whenever a non-local return is done, while MethodContexts need to stay there in case there is a non-local return from the #ensure: block. 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). isUnwind Answers whether the context must continue execution even after a non-local return (a return from the enclosing method of a block, or a call to the #continue: method of ContextPart). Such contexts are created only by #ensure: and are always MethodContexts. nthOuterContext: n Answer the n-th outer block/method context for the receiver outerContext Answer the outer block/method context for the receiver 1.12.2 BlockContext: debugging ------------------------------ isInternalExceptionHandlingContext Answer whether the receiver is a context that should be hidden to the user when presenting a backtrace. Such contexts are never blocks, but check the rest of the chain. 1.12.3 BlockContext: printing ----------------------------- printOn: aStream Print a representation for the receiver on aStream 1.13 Boolean ============ Defined in namespace Smalltalk Superclass: Object 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. 1.13.1 Boolean class: testing ----------------------------- isIdentity Answer whether x = y implies x == y for instances of the receiver isImmediate Answer whether, if x is an instance of the receiver, x copy == x 1.13.2 Boolean: basic --------------------- & aBoolean This method's functionality should be implemented by subclasses of Boolean and: aBlock This method's functionality should be implemented by subclasses of Boolean eqv: aBoolean This method's functionality should be implemented by subclasses of Boolean ifFalse: falseBlock This method's functionality should be implemented by subclasses of Boolean ifFalse: falseBlock ifTrue: trueBlock This method's functionality should be implemented by subclasses of Boolean ifTrue: trueBlock This method's functionality should be implemented by subclasses of Boolean ifTrue: trueBlock ifFalse: falseBlock This method's functionality should be implemented by subclasses of Boolean not This method's functionality should be implemented by subclasses of Boolean or: aBlock This method's functionality should be implemented by subclasses of Boolean xor: aBoolean This method's functionality should be implemented by subclasses of Boolean | aBoolean This method's functionality should be implemented by subclasses of Boolean 1.13.3 Boolean: C hacks ----------------------- asCBooleanValue This method's functionality should be implemented by subclasses of Boolean 1.13.4 Boolean: overriding -------------------------- deepCopy Answer the receiver. shallowCopy Answer the receiver. 1.13.5 Boolean: storing ----------------------- isLiteralObject Answer whether the receiver is expressible as a Smalltalk literal. storeLiteralOn: aStream Store on aStream some Smalltalk code which compiles to the receiver storeOn: aStream Store on aStream some Smalltalk code which compiles to the receiver 1.14 ByteArray ============== Defined in namespace Smalltalk Superclass: ArrayedCollection Category: Collections-Sequenceable 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. 1.14.1 ByteArray class: instance creation ----------------------------------------- fromCData: aCObject size: anInteger Answer a ByteArray containing anInteger bytes starting at the location pointed to by aCObject 1.14.2 ByteArray: built ins --------------------------- asCData: aCType Convert the receiver to a CObject with the given type byteAt: index Answer the index-th indexed instance variable of the receiver byteAt: index put: value Store the `value' byte in the index-th indexed instance variable of the receiver hash Answer an hash value for the receiver primReplaceFrom: start to: stop with: aByteArray startingAt: srcIndex Private - Replace the characters from start to stop with the ASCII codes contained in aString (which, actually, can be any variable byte class), starting at the srcIndex location of aString replaceFrom: start to: stop with: aByteArray startingAt: replaceStart Replace the characters from start to stop with the bytes contained in aByteArray (which, actually, can be any variable byte class), starting at the replaceStart location of aByteArray replaceFrom: start to: stop withString: aString startingAt: replaceStart 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 replaceStart location of aString 1.14.3 ByteArray: converting ---------------------------- asString Answer a String whose character's ASCII codes are the receiver's contents asUnicodeString Answer a UnicodeString whose character's codes are the receiver's contents. This is not implemented unless you load the I18N package. 1.14.4 ByteArray: more advanced accessing ----------------------------------------- charAt: index Access the C char at the given index in the receiver. The value is returned as a Smalltalk Character. Indices are 1-based just like for other Smalltalk access. charAt: index put: value Store as a C char the Smalltalk Character or Integer object identified by `value', at the given index in the receiver, using sizeof(char) bytes - i.e. 1 byte. Indices are 1-based just like for other Smalltalk access. doubleAt: index Access the C double at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. doubleAt: index put: value Store the Smalltalk Float object identified by `value', at the given index in the receiver, writing it like a C double. Indices are 1-based just like for other Smalltalk access. floatAt: index Access the C float at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. floatAt: index put: value Store the Smalltalk Float object identified by `value', at the given index in the receiver, writing it like a C float. Indices are 1-based just like for other Smalltalk access. intAt: index Access the C int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. intAt: index put: value Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(int) bytes. Indices are 1-based just like for other Smalltalk access. longAt: index Access the C long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. longAt: index put: value Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(long) bytes. Indices are 1-based just like for other Smalltalk access. longDoubleAt: index Access the C long double at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. longDoubleAt: 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. objectAt: index Access the Smalltalk object (OOP) at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. objectAt: index put: value Store a pointer (OOP) to the Smalltalk object identified by `value', at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. shortAt: index Access the C short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. shortAt: index put: value Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(short) bytes. Indices are 1-based just like for other Smalltalk access. stringAt: index Access the string pointed by the C `char *' at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. stringAt: index put: value Store the Smalltalk String object identified by `value', at the given index in the receiver, writing it like a *FRESHLY ALLOCATED* C string. It is the caller's responsibility to free it if necessary. Indices are 1-based just like for other Smalltalk access. ucharAt: 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. ucharAt: 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. uintAt: index Access the C unsigned int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. uintAt: 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. ulongAt: index Access the C unsigned long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. ulongAt: 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. unsignedCharAt: index Access the C unsigned char at the given index in the receiver. The value is returned as a Smalltalk Character. Indices are 1-based just like for other Smalltalk access. unsignedCharAt: index put: value Store as a C char the Smalltalk Character or Integer object identified by `value', at the given index in the receiver, using sizeof(char) bytes - i.e. 1 byte. Indices are 1-based just like for other Smalltalk access. unsignedIntAt: index Access the C unsigned int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. unsignedIntAt: index put: value Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(int) bytes. Indices are 1-based just like for other Smalltalk access. unsignedLongAt: index Access the C unsigned long int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. unsignedLongAt: index put: value Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(long) bytes. Indices are 1-based just like for other Smalltalk access. unsignedShortAt: index Access the C unsigned short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. unsignedShortAt: index put: value Store the Smalltalk Integer object identified by `value', at the given index in the receiver, using sizeof(short) bytes. Indices are 1-based just like for other Smalltalk access. ushortAt: index Access the C unsigned short int at the given index in the receiver. Indices are 1-based just like for other Smalltalk access. ushortAt: 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. 1.14.5 ByteArray: storing ------------------------- isLiteralObject Answer whether the receiver is expressible as a Smalltalk literal. storeLiteralOn: aStream Put a Smalltalk literal evaluating to the receiver on aStream. storeOn: aStream Put Smalltalk code evaluating to the receiver on aStream. 1.15 ByteStream =============== Defined in namespace Smalltalk Superclass: ReadWriteStream Category: Streams-Collections My instances are read/write streams specially crafted for ByteArrays. They are able to write binary data to them. 1.15.1 ByteStream: basic ------------------------ next Return the next *character* in the ByteArray nextByte Return the next byte in the byte array nextByteArray: numBytes Return the next numBytes bytes in the byte array nextDouble Return the next 64-bit float in the byte array nextFloat Return the next 32-bit float in the byte array nextLong Return the next 4 bytes in the byte array, interpreted as a 32 bit signed int nextLongLong Return the next 8 bytes in the byte array, interpreted as a 64 bit signed int nextPut: aChar Store aChar on the byte array nextPutByte: anInteger Store anInteger (range: -128..255) on the byte array nextPutByteArray: aByteArray Store aByteArray on the byte array nextPutDouble: aDouble Store aDouble as a 64-bit float in the byte array nextPutFloat: aFloat Return the next 32-bit float in the byte array nextPutInt64: anInteger Store anInteger (range: -2^63..2^64-1) on the byte array as 4 bytes nextPutLong: anInteger Store anInteger (range: -2^31..2^32-1) on the byte array as 4 bytes nextPutShort: anInteger Store anInteger (range: -32768..65535) on the byte array as 2 bytes nextShort Return the next 2 bytes in the byte array, interpreted as a 16 bit signed int nextSignedByte Return the next byte in the byte array, interpreted as a 8 bit signed number nextUint64 Return the next 8 bytes in the byte array, interpreted as a 64 bit unsigned int nextUlong Return the next 4 bytes in the byte array, interpreted as a 32 bit unsigned int nextUshort Return the next 2 bytes in the byte array, interpreted as a 16 bit unsigned int 1.16 CAggregate =============== Defined in namespace Smalltalk Superclass: CObject Category: Language-C interface 1.16.1 CAggregate class: accessing ---------------------------------- alignof Answer the receiver's instances required aligment sizeof Answer the receiver's instances size 1.16.2 CAggregate: accessing ---------------------------- elementType Answer the type over which the receiver is constructed. 1.17 CallinProcess ================== Defined in namespace Smalltalk Superclass: Process Category: Language-Processes I represent a unit of computation for which external C code requested execution, so I must store the returned value once my computation terminates and I must not survive across image saves (since those who invoked me no longer exist). I am otherwise equivalent to a Process. 1.18 CArray =========== Defined in namespace Smalltalk Superclass: CAggregate Category: Language-C interface 1.18.1 CArray: accessing ------------------------ alignof Answer the receiver's required aligment sizeof Answer the receiver's size 1.19 CArrayCType ================ Defined in namespace Smalltalk Superclass: CPtrCType Category: Language-C interface 1.19.1 CArrayCType class: instance creation ------------------------------------------- elementType: aCType This method should not be called for instances of this class. 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). from: type Private - Called by CType>>from: for arrays 1.19.2 CArrayCType: accessing ----------------------------- alignof Answer the alignment of the receiver's instances numberOfElements Answer the number of elements in the receiver's instances sizeof Answer the size of the receiver's instances 1.19.3 CArrayCType: storing --------------------------- storeOn: aStream Not commented. 1.20 CBoolean ============= Defined in namespace Smalltalk Superclass: CByte Category: Language-C interface I return true if a byte is not zero, false otherwise. 1.20.1 CBoolean: accessing -------------------------- value Get the receiver's value - answer true if it is != 0, false if it is 0. value: aBoolean Set the receiver's value - it's the same as for CBytes, but we get a Boolean, not a Character 1.21 CByte ========== Defined in namespace Smalltalk Superclass: CUChar Category: Language-C interface You know what a byte is, don't you?!? 1.21.1 CByte class: conversion ------------------------------ cObjStoredType Nothing special in the default case - answer a CType for the receiver type Answer a CType for the receiver 1.21.2 CByte: accessing ----------------------- cObjStoredType Nothing special in the default case - answer the receiver's CType value Answer the value the receiver is pointing to. The returned value is a SmallInteger value: aValue Set the receiver to point to the value, aValue (a SmallInteger). 1.22 CChar ========== Defined in namespace Smalltalk Superclass: CScalar Category: Language-C interface 1.22.1 CChar class: accessing ----------------------------- alignof Answer the receiver's instances required aligment cObjStoredType Private - Answer an index referring to the receiver's instances scalar type sizeof Answer the receiver's instances size 1.22.2 CChar: accessing ----------------------- alignof Answer the receiver's required aligment cObjStoredType Private - Answer an index referring to the receiver's scalar type sizeof Answer the receiver's size 1.22.3 CChar: conversion ------------------------ asByteArray: size Convert size bytes pointed to by the receiver to a String asString Convert the data pointed to by the receiver, up to the first NULL byte, to a String asString: size Convert size bytes pointed to by the receiver to a String 1.23 CCompound ============== Defined in namespace Smalltalk Superclass: CObject Category: Language-C interface 1.23.1 CCompound class: instance creation ----------------------------------------- new Allocate a new instance of the receiver. To free the memory after GC, remember to call #addToBeFinalized. 1.23.2 CCompound class: subclass creation ----------------------------------------- alignof Answer 1, the alignment of an empty struct classPragmas Return the pragmas that are written in the file-out of this class. compileSize: size align: alignment Private - Compile sizeof and alignof methods declaration Return the description of the fields in the receiver class. declaration: array This method's functionality should be implemented by subclasses of CCompound declaration: array inject: startOffset into: aBlock Compile methods that implement the declaration in array. To compute the offset after each field, the value of the old offset plus the new field's size is passed to aBlock, together with the new field's alignment requirements. emitInspectTo: str for: name Private - Emit onto the given stream the code for adding the given selector to the CCompound's inspector. newStruct: structName declaration: array The old way to create a CStruct. Superseded by #subclass:declaration:... sizeof Answer 0, the size of an empty struct subclass: structName declaration: array classVariableNames: cvn poolDictionaries: pd category: category Create a new class with the given name that contains code to implement the given C struct. All the parameters except `array' are the same as for a standard class creation message; see documentation for more information 1.23.3 CCompound: instance creation ----------------------------------- inspect Inspect the contents of the receiver inspectSelectorList Answer a list of selectors whose return values should be inspected by #inspect. 1.24 CDouble ============ Defined in namespace Smalltalk Superclass: CScalar Category: Language-C interface 1.24.1 CDouble class: accessing ------------------------------- alignof Answer the receiver's instances required aligment cObjStoredType Private - Answer an index referring to the receiver's instances scalar type sizeof Answer the receiver's instances size 1.24.2 CDouble: accessing ------------------------- alignof Answer the receiver's required aligment cObjStoredType Private - Answer an index referring to the receiver's scalar type sizeof Answer the receiver's size 1.25 CFloat =========== Defined in namespace Smalltalk Superclass: CScalar Category: Language-C interface 1.25.1 CFloat class: accessing ------------------------------ alignof Answer the receiver's instances required aligment cObjStoredType Private - Answer an index referring to the receiver's instances scalar type sizeof Answer the receiver's instances size 1.25.2 CFloat: accessing ------------------------ alignof Answer the receiver's required aligment cObjStoredType Private - Answer an index referring to the receiver's scalar type sizeof Answer the receiver's size 1.26 CFunctionDescriptor ======================== Defined in namespace Smalltalk Superclass: Object 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. 1.26.1 CFunctionDescriptor class: instance creation --------------------------------------------------- for: funcNameString returning: returnTypeSymbol withArgs: argsArray Private - Answer a CFunctionDescriptor 1.26.2 CFunctionDescriptor class: testing ----------------------------------------- addressOf: function Answer whether a function is registered (on the C side) with the given name or is dynamically loadable. isFunction: function Answer whether a function is registered (on the C side) with the given name. 1.26.3 CFunctionDescriptor: accessing ------------------------------------- address Answer the address (CObject) of the function represented by the receiver address: aCObject Set to aCObject the address of the function represented by the receiver isValid Answer whether the function represented by the receiver is actually a registered one name Answer the name of the function (on the C side) represented by the receiver 1.26.4 CFunctionDescriptor: calling ----------------------------------- asyncCall Perform the call-out for the function represented by the receiver. The arguments (and the receiver if one of the arguments has type #self or #selfSmalltalk) are taken from the parent context. Asynchronous call-outs don't return a value, but if the function calls back into Smalltalk the process that started the call-out is not suspended. asyncCallNoRetryFrom: aContext Perform the call-out for the function represented by the receiver. The arguments (and the receiver if one of the arguments has type #self or #selfSmalltalk) are taken from the base of the stack of aContext. Asynchronous call-outs don't return a value, but if the function calls back into Smalltalk the process that started the call-out is not suspended. Unlike #asyncCallFrom:, this method does not attempt to find functions in shared objects. callInto: aValueHolder Perform the call-out for the function represented by the receiver. The arguments (and the receiver if one of the arguments has type #self or #selfSmalltalk) are taken from the parent context, and the the result is stored into aValueHolder. aValueHolder is also returned. callNoRetryFrom: aContext into: aValueHolder Perform the call-out for the function represented by the receiver. The arguments (and the receiver if one of the arguments has type #self or #selfSmalltalk) are taken from the base of the stack of aContext, and the result is stored into aValueHolder. aValueHolder is also returned. Unlike #callFrom:into:, this method does not attempt to find functions in shared objects. 1.26.5 CFunctionDescriptor: printing ------------------------------------ printOn: aStream Print a representation of the receiver onto aStream 1.27 Character ============== Defined in namespace Smalltalk Superclass: Magnitude 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. Character is always used (mostly for performance reasons) when referring to characters whose code point is between 0 and 127. Above 127, instead, more care is needed: Character refers to bytes that are used as part of encoding of a character, while UnicodeCharacter refers to the character itself. 1.27.1 Character class: built ins --------------------------------- asciiValue: anInteger Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..127. codePoint: anInteger Returns the character object, possibly an UnicodeCharacter, corresponding to anInteger. Error if anInteger is not an integer, or not in 0..16r10FFFF. value: anInteger Returns the character object corresponding to anInteger. Error if anInteger is not an integer, or not in 0..255. 1.27.2 Character class: constants --------------------------------- backspace Returns the character 'backspace' bell Returns the character 'bel' cr Returns the character 'cr' eof Returns the character 'eof', also known as 'sub' eot Returns the character 'eot', also known as 'Ctrl-D' esc Returns the character 'esc' lf Returns the character 'lf', also known as 'nl' newPage Returns the character 'newPage', also known as 'ff' nl Returns the character 'nl', also known as 'lf' nul Returns the character 'nul' space Returns the character 'space' tab Returns the character 'tab' 1.27.3 Character class: initializing lookup tables -------------------------------------------------- initialize Initialize the lookup table which is used to make case and digit-to-char conversions faster. Indices in Table are ASCII values incremented by one. Indices 1-256 classify chars (0 = nothing special, 2 = separator, 48 = digit, 55 = uppercase, 3 = lowercase), indices 257-512 map to lowercase chars, indices 513-768 map to uppercase chars. 1.27.4 Character class: instance creation ----------------------------------------- digitValue: anInteger Returns a character that corresponds to anInteger. 0-9 map to $0-$9, 10-35 map to $A-$Z 1.27.5 Character class: testing ------------------------------- isImmediate Answer whether, if x is an instance of the receiver, x copy == x 1.27.6 Character: built ins --------------------------- = char Boolean return value; true if the characters are equal asInteger Returns the integer value corresponding to self. #codePoint, #asciiValue, #value, and #asInteger are synonyms. asciiValue Returns the integer value corresponding to self. #codePoint, #asciiValue, #value, and #asInteger are synonyms. codePoint Returns the integer value corresponding to self. #codePoint, #asciiValue, #value, and #asInteger are synonyms. value Returns the integer value corresponding to self. #codePoint, #asciiValue, #value, and #asInteger are synonyms. 1.27.7 Character: coercion methods ---------------------------------- asLowercase Returns self as a lowercase character if it's an uppercase letter, otherwise returns the character unchanged. asString Returns the character self as a string. Only valid if the character is between 0 and 255. asSymbol Returns the character self as a symbol. asUnicodeString Returns the character self as a Unicode string. asUppercase Returns self as a uppercase character if it's an lowercase letter, otherwise returns the character unchanged. 1.27.8 Character: comparing --------------------------- < aCharacter Compare the character's ASCII value. Answer whether the receiver's is the least. <= aCharacter Compare the character's ASCII value. Answer whether the receiver's is the least or their equal. > aCharacter Compare the character's ASCII value. Answer whether the receiver's is the greatest. >= aCharacter Compare the character's ASCII value. Answer whether the receiver's is the greatest or their equal. 1.27.9 Character: converting ---------------------------- asCharacter Return the receiver, since it is already a character. digitValue Returns the value of self interpreted as a digit. Here, 'digit' means either 0-9, or A-Z, which maps to 10-35. 1.27.10 Character: printing --------------------------- displayOn: aStream Print a representation of the receiver on aStream. Unlike #printOn:, this method strips the leading dollar. printOn: aStream Print a representation of the receiver on aStream storeLiteralOn: aStream Store on aStream some Smalltalk code which compiles to the receiver 1.27.11 Character: storing -------------------------- isLiteralObject Answer whether the receiver is expressible as a Smalltalk literal. storeOn: aStream Store Smalltalk code compiling to the receiver on aStream 1.27.12 Character: testing -------------------------- isAlphaNumeric True if self is a letter or a digit isDigit True if self is a 0-9 digit isDigit: radix Answer whether the receiver is a valid character in the given radix. isLetter True if self is an upper- or lowercase letter isLowercase True if self is a lowercase letter isPathSeparator Returns true if self is a path separator ($/ or $\ under Windows, $/ only under Unix systems including Mac OS X). isPunctuation Returns true if self is one of '.,:;!?' isSeparator Returns true if self is a space, cr, tab, nl, or newPage isUppercase True if self is uppercase isVowel Returns true if self is a, e, i, o, or u; case insensitive 1.27.13 Character: testing functionality ---------------------------------------- isCharacter Answer True. We're definitely characters 1.28 CharacterArray =================== Defined in namespace Smalltalk Superclass: ArrayedCollection Category: Collections-Text My instances represent a generic textual (string) data type. I provide accessing and manipulation methods for strings. 1.28.1 CharacterArray class: basic ---------------------------------- fromString: aCharacterArray Make up an instance of the receiver containing the same characters as aCharacterArray, and answer it. lineDelimiter Answer a CharacterArray which one can use as a line delimiter. This is meant to be used on subclasses of CharacterArray. 1.28.2 CharacterArray class: multibyte encodings ------------------------------------------------ isUnicode Answer whether the receiver stores bytes (i.e. an encoded form) or characters (if true is returned). 1.28.3 CharacterArray: built ins -------------------------------- valueAt: index Answer the ascii value of index-th character variable of the receiver valueAt: index put: value Store (Character value: value) in the index-th indexed instance variable of the receiver 1.28.4 CharacterArray: comparing -------------------------------- < aCharacterArray Return true if the receiver is less than aCharacterArray, ignoring case differences. <= 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. = aString Answer whether the receiver's items match those in aCollection > aCharacterArray Return true if the receiver is greater than aCharacterArray, ignoring case differences. >= 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. 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. match: aCharacterArray Answer whether aCharacterArray matches the pattern contained in the receiver. # in the receiver means 'match any character', * in receiver means 'match any sequence of characters'. match: aCharacterArray ignoreCase: aBoolean Answer whether aCharacterArray matches the pattern contained in the receiver. # in the receiver means 'match any character', * in receiver means 'match any sequence of characters'. The case of alphabetic characters is ignored if aBoolean is true. sameAs: aCharacterArray Returns true if the receiver is the same CharacterArray as aCharacterArray, ignoring case differences. startsWith: aCharacterArray Returns true if the receiver starts with the same characters as aCharacterArray. 1.28.5 CharacterArray: converting --------------------------------- asByteArray Return the receiver, converted to a ByteArray of ASCII values asClassPoolKey Return the receiver, ready to be put in a class pool dictionary asGlobalKey Return the receiver, ready to be put in the Smalltalk dictionary asInteger Parse an Integer number from the receiver until the input character is invalid and answer the result at this point asLowercase Returns a copy of self as a lowercase CharacterArray asNumber Parse a Number from the receiver until the input character is invalid and answer the result at this point asPoolKey Return the receiver, ready to be put in a pool dictionary asString But I already am a String! Really! asSymbol Returns the symbol corresponding to the CharacterArray asUnicodeString Answer a UnicodeString whose character's codes are the receiver's contents This is not implemented unless you load the I18N package. asUppercase Returns a copy of self as an uppercase CharacterArray fileName But I don't HAVE a file name! filePos But I don't HAVE a file position! isNumeric Answer whether the receiver denotes a number trimSeparators Return a copy of the reciever without any spaces on front or back. The implementation is protected against the `all blanks' case. 1.28.6 CharacterArray: multibyte encodings ------------------------------------------ encoding Answer the encoding used by the receiver. isUnicode Answer whether the receiver stores bytes (i.e. an encoded form) or characters (if true is returned). numberOfCharacters Answer the number of Unicode characters in the receiver. This is not implemented unless you load the I18N package. 1.28.7 CharacterArray: string processing ---------------------------------------- % anArray Answer the receiver with every %n (1<=n<=9) replaced by the n-th element of anArray. The replaced elements are `displayed' (i.e. their displayString is used). In addition, the special pattern %n is replaced with one of the two strings depending on the n-th element of anArray being true or false. bindWith: s1 Answer the receiver with every %1 replaced by the displayString of s1 bindWith: s1 with: s2 Answer the receiver with every %1 or %2 replaced by s1 or s2, respectively. s1 and s2 are `displayed' (i.e. their displayString is used) upon replacement. bindWith: s1 with: s2 with: s3 Answer the receiver with every %1, %2 or %3 replaced by s1, s2 or s3, respectively. s1, s2 and s3 are `displayed' (i.e. their displayString is used) upon replacement. 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. s1, s2, s3 and s4 are `displayed' (i.e. their displayString is used) upon replacement. bindWithArguments: anArray Answer the receiver with every %n (1<=n<=9) replaced by the n-th element of anArray. The replaced elements are `displayed' (i.e. their displayString is used). In addition, the special pattern %n is replaced with one of the two strings depending on the n-th element of anArray being true or false. contractTo: smallSize Either return myself, or a copy shortened to smallSize characters by inserting an ellipsis (three dots: ...) lines Answer an Array of Strings each representing one line in the receiver. linesDo: aBlock Evaluate aBlock once for every newline delimited line in the receiver, passing the line to the block. subStrings Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every sequence of white space characters subStrings: aCharacter Answer an OrderedCollection of substrings of the receiver. A new substring start at the start of the receiver, or after every sequence of characters matching aCharacter 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. This message is preserved for backwards compatibility; the ANSI standard mandates `subStrings', with an uppercase s. 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. This message is preserved for backwards compatibility; the ANSI standard mandates `subStrings:', with an uppercase s. 1.28.8 CharacterArray: testing functionality -------------------------------------------- isCharacterArray Answer `true'. 1.29 CInt ========= Defined in namespace Smalltalk Superclass: CScalar Category: Language-C interface 1.29.1 CInt class: accessing ---------------------------- alignof Answer the receiver's required aligment cObjStoredType Private - Answer an index referring to the receiver's instances scalar type sizeof Answer the receiver's size 1.29.2 CInt: accessing ---------------------- alignof Answer the receiver's instances required aligment cObjStoredType Private - Answer an index referring to the receiver's scalar type sizeof Answer the receiver's instances size 1.30 Class ========== Defined in namespace Smalltalk Superclass: ClassDescription 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. 1.30.1 Class class: initialize ------------------------------ initialize Perform the special initialization of root classes. 1.30.2 Class: accessing instances and variables ----------------------------------------------- addClassVarName: aString Add a class variable with the given name to the class pool dictionary. addClassVarName: aString value: valueBlock Add a class variable with the given name to the class pool dictionary, and evaluate valueBlock as its initializer. addSharedPool: aDictionary Add the given shared pool to the list of the class' pool dictionaries allClassVarNames Answer the names of the variables in the receiver's class pool dictionary and in each of the superclasses' class pool dictionaries bindingFor: aString Answer the variable binding for the class variable with the given name category Answer the class category category: aString Change the class category to aString classPool Answer the class pool dictionary classPragmas Return the pragmas that are written in the file-out of this class. classVarNames Answer the names of the variables in the class pool dictionary comment Answer the class comment comment: aString Change the class name environment Answer `environment'. environment: aNamespace Set the receiver's environment to aNamespace and recompile everything initialize redefined in children (?) initializeAsRootClass Perform special initialization reserved to root classes. name Answer the class name removeClassVarName: aString Removes the class variable from the class, error if not present, or still in use. removeSharedPool: aDictionary Remove the given dictionary to the list of the class' pool dictionaries sharedPools Return the names of the shared pools defined by the class superclass: aClass Not commented. 1.30.3 Class: instance creation ------------------------------- 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. subclass: classNameString Define a subclass of the receiver with the given name. If the class is already defined, don't modify its instance or class variables but still, if necessary, recompile everything needed. 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. #short variable: shape subclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a variable subclass of the receiver with the given name, shape, instance variables, class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed. The shape can be one of #byte #int8 #character #short #ushort #int #uint #int64 #uint64 #utf32 #float #double or #pointer. variableByteSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a byte variable subclass of the receiver with the given name, instance variables (must be "), class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed. variableSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a variable pointer subclass of the receiver with the given name, instance variables, class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed. variableWordSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames category: categoryNameString Define a word variable subclass of the receiver with the given name, instance variables (must be "), class variables, pool dictionaries and category. If the class is already defined, if necessary, recompile everything needed. 1.30.4 Class: instance creation - alternative --------------------------------------------- categoriesFor: method are: categories Don't use this, it is only present to file in from IBM Smalltalk subclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk subclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk variableByteSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk variableByteSubclass: classNameString classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk variableLongSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk variableLongSubclass: classNameString classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk variableSubclass: classNameString classInstanceVariableNames: stringClassInstVarNames instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk variableSubclass: classNameString instanceVariableNames: stringInstVarNames classVariableNames: stringOfClassVarNames poolDictionaries: stringOfPoolNames Don't use this, it is only present to file in from IBM Smalltalk 1.30.5 Class: pragmas --------------------- pragmaHandlerFor: aSymbol Not commented. registerHandler: aBlock forPragma: pragma Not commented. 1.30.6 Class: printing ---------------------- article Answer an article (`a' or `an') which is ok for the receiver's name printOn: aStream Print a representation of the receiver on aStream storeOn: aStream Store Smalltalk code compiling to the receiver on aStream 1.30.7 Class: saving and loading -------------------------------- binaryRepresentationVersion Answer a number >= 0 which represents the current version of the object's representation. The default implementation answers zero. convertFromVersion: version withFixedVariables: fixed indexedVariables: indexed for: anObjectDumper This method is called if a VersionableObjectProxy is attached to a class. It receives the version number that was stored for the object (or nil if the object did not use a VersionableObjectProxy), the fixed instance variables, the indexed instance variables, and the ObjectDumper that has read the object. The default implementation ignores the version and simply fills in an instance of the receiver with the given fixed and indexed instance variables (nil if the class instances are of fixed size). If instance variables were removed from the class, extras are ignored; if the class is now fixed and used to be indexed, indexed is not used. nonVersionedInstSize Answer the number of instance variables that the class used to have when objects were stored without using a VersionableObjectProxy. The default implementation answers the current instSize. 1.30.8 Class: security ---------------------- check: aPermission Not commented. policy Answer `securityPolicy'. policy: aSecurityPolicy Not commented. 1.30.9 Class: still unclassified -------------------------------- fileOutDeclarationOn: aFileStream Not commented. fileOutOn: aFileStream Not commented. 1.30.10 Class: testing ---------------------- = aClass Returns true if the two class objects are to be considered equal. 1.30.11 Class: testing functionality ------------------------------------ asClass Answer the receiver. isClass Answer `true'. 1.31 ClassDescription ===================== Defined in namespace Smalltalk Superclass: Behavior 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. 1.31.1 ClassDescription: compiling ---------------------------------- compile: code classified: categoryName Compile code in the receiver, assigning the method to the given category. Answer the newly created CompiledMethod, or nil if an error was found. compile: code classified: categoryName ifError: block Compile method source and install in method category, categoryName. If there are parsing errors, invoke exception block, 'block' (see compile:ifError:). Return the method compile: code classified: categoryName notifying: requestor Compile method source and install in method category, categoryName. If there are parsing errors, send an error message to requestor 1.31.2 ClassDescription: conversion ----------------------------------- asClass This method's functionality should be implemented by subclasses of ClassDescription asMetaclass Answer the metaclass associated to the receiver binding Answer a VariableBinding object whose value is the receiver 1.31.3 ClassDescription: copying -------------------------------- copy: selector from: aClass Copy the given selector from aClass, assigning it the same category copy: selector from: aClass classified: categoryName Copy the given selector from aClass, assigning it the given category copyAll: arrayOfSelectors from: class Copy all the selectors in arrayOfSelectors from class, assigning them the same category they have in class copyAll: arrayOfSelectors from: class classified: categoryName Copy all the selectors in arrayOfSelectors from aClass, assigning them the given category copyAllCategoriesFrom: aClass Copy all the selectors in aClass, assigning them the original category copyCategory: categoryName from: aClass Copy all the selectors in from aClass that belong to the given category copyCategory: categoryName from: aClass classified: newCategoryName Copy all the selectors in from aClass that belong to the given category, reclassifying them as belonging to the given category 1.31.4 ClassDescription: filing ------------------------------- fileOut: fileName Open the given file and to file out a complete class description to it. Requires package Parser. fileOutCategory: categoryName to: fileName File out all the methods belonging to the method category, categoryName, to the fileName file. Requires package Parser. fileOutOn: aFileStream File out complete class description: class definition, class and instance methods. Requires package Parser. fileOutSelector: selector to: fileName File out the given selector to fileName. Requires package Parser. 1.31.5 ClassDescription: organization of messages and classes ------------------------------------------------------------- classify: aSelector under: aString Put the method identified by the selector aSelector under the category given by aString. createGetMethod: what Create a method accessing the variable `what'. createGetMethod: what default: value Create a method accessing the variable `what', with a default value of `value', using lazy initialization createSetMethod: what Create a method which sets the variable `what'. defineAsyncCFunc: cFuncNameString withSelectorArgs: selectorAndArgs args: argsArray See documentation. This function is deprecated, you should use the special syntax instead. defineCFunc: cFuncNameString withSelectorArgs: selectorAndArgs returning: returnTypeSymbol args: argsArray See documentation. This function is deprecated, you should use the special syntax instead. removeCategory: aString Remove from the receiver every method belonging to the given category whichCategoryIncludesSelector: selector Answer the category for the given selector, or nil if the selector is not found 1.31.6 ClassDescription: parsing class declarations --------------------------------------------------- addSharedPool: aDictionary Add the given shared pool to the list of the class' pool dictionaries import: aDictionary Add the given shared pool to the list of the class' pool dictionaries 1.31.7 ClassDescription: printing --------------------------------- classVariableString This method's functionality should be implemented by subclasses of ClassDescription instanceVariableString Answer a string containing the name of the receiver's instance variables. nameIn: aNamespace Answer the class name when the class is referenced from aNamespace printOn: aStream in: aNamespace Print on aStream the class name when the class is referenced from aNamespace sharedVariableString This method's functionality should be implemented by subclasses of ClassDescription 1.31.8 ClassDescription: still unclassified ------------------------------------------- fileOutCategory: category toStream: aFileStream File out all the methods belonging to the method category, category, to aFileStream. Requires package Parser. fileOutSelector: aSymbol toStream: aFileStream File out all the methods belonging to the method category, category, to aFileStream. Requires package Parser. 1.32 CLong ========== Defined in namespace Smalltalk Superclass: CScalar Category: Language-C interface 1.32.1 CLong class: accessing ----------------------------- alignof Answer the receiver's instances required aligment cObjStoredType Private - Answer an index referring to the receiver's instances scalar type sizeof Answer the receiver's instances size 1.32.2 CLong: accessing ----------------------- alignof Answer the receiver's required aligment cObjStoredType Private - Answer an index referring to the receiver's scalar type sizeof Answer the receiver's size 1.33 CLongDouble ================ Defined in namespace Smalltalk Superclass: CScalar Category: Language-C interface 1.33.1 CLongDouble class: accessing ----------------------------------- alignof Answer the receiver's instances required aligment cObjStoredType Private - Answer an index referring to the receiver's instances scalar type sizeof Answer the receiver's instances size 1.33.2 CLongDouble: accessing ----------------------------- alignof Answer the receiver's required aligment cObjStoredType Private - Answer an index referring to the receiver's scalar type sizeof Answer the receiver's size 1.34 CObject ============ Defined in namespace Smalltalk Superclass: Object 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. 1.34.1 CObject class: conversion -------------------------------- type Nothing special in the default case - answer a CType for the receiver 1.34.2 CObject class: instance creation --------------------------------------- address: anInteger Answer a new object pointing to the passed address, anInteger alloc: nBytes Allocate nBytes bytes and return an instance of the receiver alloc: nBytes type: cTypeObject Allocate nBytes bytes and return a CObject of the given type new Answer a new object pointing to NULL. new: nBytes Allocate nBytes bytes and return an instance of the receiver 1.34.3 CObject class: subclassing --------------------------------- subclass: aSymbol Create a subclass with the given name. 1.34.4 CObject: accessing ------------------------- address Answer the address the receiver is pointing to. address: anInteger Set the receiver to point to the passed address, anInteger printOn: aStream Print a representation of the receiver type: aCType Set the receiver's type to aCType. 1.34.5 CObject: C data access ----------------------------- at: byteOffset put: aValue type: aType Store aValue as data of the given type from byteOffset bytes after the pointer stored in the receiver at: byteOffset type: aType Answer some data of the given type from byteOffset bytes after the pointer stored in the receiver free Free the receiver's pointer and set it to null. Big trouble hits you if the receiver doesn't point to the base of a malloc-ed area. 1.34.6 CObject: conversion -------------------------- castTo: aType Answer another CObject, pointing to the same address as the receiver, but belonging to the aType CType. narrow This method is called on CObjects returned by a C call-out whose return type is specified as a CType; it mostly allows one to change the class of the returned CObject. By default it does nothing, and that's why it is not called when #cObject is used to specify the return type. type Answer a CType for the receiver 1.34.7 CObject: finalization ---------------------------- finalize To make the VM call this, use #addToBeFinalized. It frees automatically any memory pointed to by the CObject. It is not automatically enabled because big trouble hits you if you use #free and the receiver doesn't point to the base of a malloc-ed area. 1.34.8 CObject: pointer-like behavior ------------------------------------- + anInteger Return another instance of the receiver's class which points at &receiver[anInteger] (or, if you prefer, what `receiver + anInteger' does in C). - 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) addressAt: anIndex Return a new CObject of the element type, corresponding to an object that is anIndex places past the receiver (remember that CObjects represent pointers and that C pointers behave like arrays). anIndex is zero-based, just like with all other C-style accessing. at: anIndex Dereference a pointer that is anIndex places past the receiver (remember that CObjects represent pointers and that C pointers behave like arrays). anIndex is zero-based, just like with all other C-style accessing. at: anIndex put: aValue Store anIndex places past the receiver the passed Smalltalk object or CObject `aValue'; if it is a CObject is dereferenced: that is, this method is equivalent either to cobj[anIndex]=aValue or cobj[anIndex]=*aValue. anIndex is zero-based, just like with all other C-style accessing. In both cases, aValue should be of the element type or of the corresponding Smalltalk type (that is, a String is ok for an array of CStrings) to avoid typing problems which however will not be signaled because C is untyped. decr Adjust the pointer by sizeof(dereferencedType) bytes down (i.e. -receiver) decrBy: anInteger Adjust the pointer by anInteger elements down (i.e. receiver -= anInteger) incr Adjust the pointer by sizeof(dereferencedType) bytes up (i.e. ++receiver) incrBy: anInteger Adjust the pointer by anInteger elements up (i.e. receiver += anInteger) 1.35 Collection =============== Defined in namespace Smalltalk Superclass: Object 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. 1.35.1 Collection class: instance creation ------------------------------------------ from: anArray Convert anArray to an instance of the receiver. anArray is structured such that the instance can be conveniently and fully specified using brace-syntax, possibly by imposing some additional structure on anArray. join: aCollection Answer a collection formed by treating each element in aCollection as a `withAll:' argument collection to be added to a new instance. with: anObject Answer a collection whose only element is anObject with: firstObject with: secondObject Answer a collection whose only elements are the parameters in the order they were passed with: firstObject with: secondObject with: thirdObject Answer a collection whose only elements are the parameters in the order they were passed with: firstObject with: secondObject with: thirdObject with: fourthObject Answer a collection whose only elements are the parameters in the order they were passed with: firstObject with: secondObject with: thirdObject with: fourthObject with: fifthObject Answer a collection whose only elements are the parameters in the order they were passed withAll: aCollection Answer a collection whose elements are all those in aCollection 1.35.2 Collection class: multibyte encodings -------------------------------------------- isUnicode Answer true; the receiver is able to store arbitrary Unicode characters. 1.35.3 Collection: adding ------------------------- add: newObject Add newObject to the receiver, answer it addAll: aCollection Adds all the elements of 'aCollection' to the receiver, answer aCollection 1.35.4 Collection: converting ----------------------------- asArray Answer an Array containing all the elements in the receiver asBag Answer a Bag containing all the elements in the receiver asByteArray Answer a ByteArray containing all the elements in the receiver asOrderedCollection Answer an OrderedCollection containing all the elements in the receiver order asRunArray Answer the receiver converted to a RunArray. If the receiver is not ordered the order of the elements in the RunArray might not be the #do: order. asSet Answer a Set containing all the elements in the receiver with no duplicates asSortedCollection Answer a SortedCollection containing all the elements in the receiver with the default sort block - [ :a :b | a <= b ] asSortedCollection: aBlock Answer a SortedCollection whose elements are the elements of the receiver, sorted according to the sort block aBlock asString Answer a String containing all the elements in the receiver asUnicodeString Answer a UnicodeString containing all the elements in the receiver 1.35.5 Collection: copying Collections -------------------------------------- copyReplacing: targetObject withObject: newObject Copy replacing each object which is = to targetObject with newObject copyWith: newElement Answer a copy of the receiver to which newElement is added copyWithout: oldElement Answer a copy of the receiver to which all occurrences of oldElement are removed 1.35.6 Collection: enumeration ------------------------------ allSatisfy: aBlock Search the receiver for an element for which aBlock returns false. Answer true if none does, false otherwise. anyOne Answer an unspecified element of the collection. anySatisfy: aBlock Search the receiver for an element for which aBlock returns true. Answer true if some does, false otherwise. beConsistent This method is private, but it is quite interesting so it is documented. It ensures that a collection is in a consistent state before attempting to iterate on it; its presence reduces the number of overrides needed by collections who try to amortize their execution times. The default implementation does nothing, so it is optimized out by the virtual machine and so it loses very little on the performance side. Note that descendants of Collection have to call it explicitly since #do: is abstract in Collection. collect: aBlock Answer a new instance of a Collection containing all the results of evaluating aBlock passing each of the receiver's elements conform: aBlock Search the receiver for an element for which aBlock returns false. Answer true if none does, false otherwise. contains: aBlock Search the receiver for an element for which aBlock returns true. Answer true if some does, false otherwise. detect: aBlock Search the receiver for an element for which aBlock returns true. If some does, answer it. If none does, fail detect: aBlock ifNone: exceptionBlock Search the receiver for an element for which aBlock returns true. If some does, answer it. If none does, answer the result of evaluating aBlock do: aBlock Enumerate each object of the receiver, passing them to aBlock do: aBlock separatedBy: separatorBlock Enumerate each object of the receiver, passing them to aBlock. Between every two invocations of aBlock, invoke separatorBlock fold: binaryBlock First, pass to binaryBlock the first and second elements of the receiver; for each subsequent element, pass the result of the previous evaluation and an element. Answer the result of the last invocation, or the first element if the collection has size 1. Fail if the collection is empty. inject: thisValue into: binaryBlock First, pass to binaryBlock 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. readStream Answer a stream that gives elements of the receiver reject: aBlock Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, don't answer true select: aBlock Answer a new instance of a Collection containing all the elements in the receiver which, when passed to aBlock, answer true 1.35.7 Collection: finalization ------------------------------- mourn: anObject Private - anObject has been found to have a weak key, remove it and possibly finalize the key. 1.35.8 Collection: printing --------------------------- inspect Print all the instance variables and objects in the receiver on the Transcript printOn: aStream Print a representation of the receiver on aStream 1.35.9 Collection: removing --------------------------- empty Remove everything from the receiver. remove: oldObject Remove oldObject from the receiver. If absent, fail, else answer oldObject. remove: oldObject ifAbsent: anExceptionBlock Remove oldObject from the receiver. If absent, evaluate anExceptionBlock and answer the result, else answer oldObject. removeAll: aCollection Remove each object in aCollection, answer aCollection, fail if some of them is absent. Warning: this could leave the collection in a semi-updated state. removeAll: aCollection ifAbsent: aBlock Remove each object in aCollection, answer aCollection; if some element is absent, pass it to aBlock. removeAllSuchThat: aBlock Remove from the receiver all objects for which aBlock returns true. 1.35.10 Collection: storing --------------------------- storeOn: aStream Store Smalltalk code compiling to the receiver on aStream 1.35.11 Collection: testing collections --------------------------------------- capacity Answer how many elements the receiver can hold before having to grow. identityIncludes: anObject Answer whether we include the anObject object includes: anObject Answer whether we include anObject isEmpty Answer whether we are (still) empty isSequenceable Answer whether the receiver can be accessed by a numeric index with #at:/#at:put:. notEmpty Answer whether we include at least one object occurrencesOf: anObject Answer how many occurrences of anObject we include size Answer how many objects we include 1.36 CompiledBlock ================== Defined in namespace Smalltalk Superclass: CompiledCode Category: Language-Implementation I represent a block that has been compiled. 1.36.1 CompiledBlock class: instance creation --------------------------------------------- new: numBytecodes header: anInteger method: outerMethod Answer a new instance of the receiver with room for the given number of bytecodes and the given header. 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. 1.36.2 CompiledBlock: accessing ------------------------------- 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 method Answer the CompiledMethod in which the receiver lies methodClass Answer the class in which the receiver is installed. methodClass: methodClass Set the receiver's class instance variable numArgs Answer the number of arguments passed to the receiver numLiterals Answer the number of literals for the receiver numTemps Answer the number of temporary variables used by the receiver selector Answer the selector through which the method is called selector: aSymbol Set the selector through which the method is called stackDepth Answer the number of stack slots needed for the receiver 1.36.3 CompiledBlock: basic --------------------------- = aMethod Answer whether the receiver and aMethod are equal methodCategory Answer the method category methodCategory: aCategory Set the method category to the given string methodSourceCode Answer the method source code (a FileSegment or String or nil) methodSourceFile Answer the file where the method source code is stored methodSourcePos Answer the location where the method source code is stored in the methodSourceFile methodSourceString Answer the method source code as a string 1.36.4 CompiledBlock: printing ------------------------------ printOn: aStream Print the receiver's class and selector on aStream 1.36.5 CompiledBlock: saving and loading ---------------------------------------- to binaryRepresentationObject This method is implemented to allow for a PluggableProxy to be used with CompiledBlocks. Answer a DirectedMessage which sends #blockAt: to the CompiledMethod containing the receiver. 1.37 CompiledCode ================= Defined in namespace Smalltalk Superclass: ArrayedCollection Category: Language-Implementation I represent code that has been compiled. I am an abstract superclass for blocks and methods 1.37.1 CompiledCode class: cache flushing ----------------------------------------- flushTranslatorCache Answer any kind of cache mantained by a just-in-time code translator in the virtual machine (if any). Do nothing for now. 1.37.2 CompiledCode class: instance creation -------------------------------------------- new: numBytecodes header: anInteger literals: literals Answer a new instance of the receiver with room for the given number of bytecodes and the given header new: numBytecodes header: anInteger numLiterals: numLiterals Answer a new instance of the receiver with room for the given number of bytecodes and the given header 1.37.3 CompiledCode class: tables --------------------------------- bytecodeInfoTable Return a ByteArray which defines some properties of the bytecodes. For each bytecode, 4 bytes are reserved. The fourth byte is a flag byte: bit 7 means that the argument is a line number to be used in creating the bytecode->line number map. The first three have a meaning only for those bytecodes that represent a combination of operations: the combination can be BC1 ARG BC2 OPERAND if the fourth byte's bit 0 = 0 or BC1 OPERAND BC2 ARG if the fourth byte's bit 0 = 1 where BC1 is the first byte, BC2 is the second, ARG is the third and OPERAND is the bytecode argument as it appears in the bytecode stream. specialSelectors This method should not be called for instances of this class. specialSelectorsNumArgs Not commented. 1.37.4 CompiledCode: accessin