I add a number of facilities to basic Behaviors:
Named instance variables
Category organization for methods
The notion of a name of this class (implemented as subclass responsibility)
The maintenance of a ChangeSet, and logging changes on a file
Most of the mechanism for fileOut.
I am an abstract class, in particular, my facilities are intended for inheritance by two subclasses, Class and Metaclass.
The slots 'organization' and 'methodDict' should ONLY be accessed by message in order for things to work during ImageSegment>>discoverActiveClasses (q.v.).
Compile the argument, code, as source code in the context of the
receiver and install the result in the receiver's method dictionary under
the classification indicated by the second argument, heading. nil is to be
notified if an error occurs. The argument code is either a string or an
object that converts to a string or a PositionableStream on an object that
converts to a string.
Intercept this message in order to remember system changes.
5/15/96 sw: modified so that if the class does not wish its methods logged in the changes file, then they also won't be accumulated in the current change set.
7/12/96 sw: use wantsChangeSetLogging to determine whether to put in change set
Compile the code and classify the resulting method in the given category, leaving no trail in the system log, nor in any change set, nor in the 'recent submissions' list. This should only be used when you know for sure that the compilation will succeed.
compile the given code programmatically. In the current theory, we always do this unlogged as well, and do not accumulate the change in the current change set
Install the method associated with the first argument, sel, a message
selector, found in the method dictionary of the second argument, class,
as one of the receiver's methods. Classify the message under -As yet not
classified-.
Install the method associated with the first arugment, sel, a message
selector, found in the method dictionary of the second argument, class,
as one of the receiver's methods. Classify the message under the third
argument, cat.
Install all the methods found in the method dictionary of the second
argument, class, as the receiver's methods. Classify the messages under
-As yet not classified-.
Install all the methods found in the method dictionary of the second
argument, class, as the receiver's methods. Classify the messages under
the third argument, cat.
Specify that the categories of messages for the receiver include all of
those found in the class, aClass. Install each of the messages found in
these categories into the method dictionary of the receiver, classified
under the appropriate categories.
Specify that one of the categories of messages for the receiver is the
third argument, newCat. Copy each message found in the category cat in
class aClass into this new category.
Store the comment, aString or Text or RemoteString, associated with the class we are orgainzing. Empty string gets stored only if had a non-empty one before.
Store the comment, aString or Text or RemoteString, associated with the class we are organizing. Empty string gets stored only if had a non-empty one before.
File a description of the receiver's category, aString, onto aFileStream. If
moveSource, is true, then set the method source pointer to the new file position.
Note when this method is called with moveSource=true, it is condensing the
.sources file, and should only write one preamble per method category.
File a description of the messages of this class that have been
changed (i.e., are entered into the argument, aSet) onto aFileStream. If
moveSource, is true, then set the method source pointer to the new file position.
Note when this method is called with moveSource=true, it is condensing the
.changes file, and should only write a preamble for every method.
File a description of the receiver on aFileStream. If the boolean
argument, moveSource, is true, then set the trailing bytes to the position
of aFileStream and to fileIndex in order to indicate where to find the
source code.
Used in the process of condensing changes, this message requests that
the source code of all methods of the receiver that have been changed
should be moved to newFile.
Print a method category preamble. This must have a category name.
It may have an author/date stamp, and it may have a prior source link.
If it has a prior source link, it MUST have a stamp, even if it is empty.
Copy the source code for the method associated with selector onto the fileStream. If moveSource true, then also set the source code pointer of the method.
During fileIn, !Rectangle reorganize! allows Rectangle to seize control and treat the next chunk as its organization. See the transfer of control where ReadWriteStream fileIn calls scanFrom:
A ClassBuilder has finished the compilation of the receiver.
This message is a notification for a class that needs to do some
cleanup / reinitialization after it has been recompiled.
Recreate any existing instances of the argument, oldClass, as instances of the receiver, which is a newly changed class. Permute variables as necessary. Return the array of old instances (none of which should be pointed to legally by anyone but the array).
Recreate any existing instances of the argument, oldClass, as instances of
the receiver, which is a newly changed class. Permute variables as
necessary. Return the array of old instances (none of which should be
pointed to legally by anyone but the array).
1/16/96 sw: moved here from Browser so that it could be used from a variety of places.
7/30/96 sw: call chooseInstVarThenDo: to get the inst var choice
Put up a menu of all the instance variables in the receiver, presented in alphabetical order, and when the user chooses one, evaluate aBlock with the chosen variable as its parameter.
Put up a menu of all the instance variables in the receiver, and when
the user chooses one, evaluate aBlock with the chosen variable as its
parameter. If the list is 6 or larger, then offer an alphabetical
formulation as an alternative. triggered by a 'show alphabetically' item
at the top of the list.
text-replace any part of a method. Used for class and pool variables. Don't touch the header. Not guaranteed to work if name appears in odd circumstances
Stache a copy of the methodDict in the organization slot (hack!),
and set the methodDict to nil. This will induce an MD fault on any message send.
See: ClassDescription>>recoverFromMDFault
and ImageSegment>>discoverActiveClasses.
Answer a list of all the selectors of named tile scripts. Initially, only Player reimplements, but if we switch to a scheme in which every class can have uniclass subclasses, this would kick in elsewhere
Remove the message whose selector is aSymbol from the method dictionary of the receiver, if it is there. Answer nil otherwise. Do not log the action either to the current change set or to the changes log
Remove the organization of this class by message categories.
This is typically done to save space in small systems. Classes and methods
created or filed in subsequently will, nonetheless, be organized
Create a new instance of the receiver based on the given old instance.
The supplied map contains a mapping of the old instVar names into
the receiver's instVars