|fileOut||Saves all classes in the currently selected class category into one source file named classCategory.st|
|fileOut each||Saves all classes but puts each class into a separate file called className.st|
|printOut||Sends a printed representation of all classes selected to the printer including the method source code|
|printOut protocol||Sends a protocol-only representation of all classes in the category to the printer without the method's source code|
|spawn||Starts a class category browser without a class category list on the currently selected class category|
|spawn class||Starts a full class browser which allows you to edit all code for the selected class in one view|
|update||Re-scans all classes in the system and updates the lists shown|
|find class...||Pops up a dialog box to enter the name of a class you wish to search for and have displayed|
|new class category...||Displays a dialog for the creation of a new class category.|
|rename...||Renames a category and changes the category attribute of all classes in the currently selected class category|
|remove||Removes all classes and subclasses in the current class category|
The class list pop-up menu appears when you press the menu mouse button with the pointer in the class list view. The functions available from this menu are shown in Figure 34.5 and are explained in Table 34.3.
|fileOut||Saves the source code of the currently selected class in a file named className.st.|
|printOut||Sends the source code of the currently selected class to the printer.|
|printOut protocol||Sends a protocol description of the currently selected class to the printer. The output will contain the class description, class comment, and the classes protocol and method comments.|
|spawn||Starts a class browser on the currently selected class.|
|spawn hierarchy||Starts a browser on all subclasses of the currently selected class.|
|hierarchy||Shows the hierarchy of the currently selected class in the code view.|
|definition||Shows the class definition in the code view and allows you to change the class definition.|
|comment||Shows the class comment in the code view and allows you to edit it.|
|class instvars||Shows the class-instance-variables for the selected class and allows you to edit them.|
|variable search||Provides a search facility to find different variable references and all methods referencing the searched-for variable.|
|new class||Allows you to create a new class using as a template the currently selected class.|
|new subclass||Same as new class but it will create a subclass of the currently selected class.|
|rename||Changes the name of the currently selected class.|
|remove||Removes the currently selected class and all of its subclasses.|
The method category pop-up menu appears when you press the menu mouse button while the pointer is in the method category view. The functions available from this menu are shown in Figure 34.6 and explained in Table 34.4.
|fileOut||Saves the source code of the currently selected method category in a file named className-category.st|
|printOut||Sends the source code of the currently selected method category to the printer|
|spawn||Starts a method category browser on the currently selected method category of the currently selected class|
|spawn category||Starts a browser on all methods of the class which have the same category as the currently selected one|
|find method here...||Searches for the method that implements a specified selector|
|find method...||Searches in the class hierarchy for the first class implementing the selector you specify in the dialog box|
|new category...||Enables you to add a new category to the list|
|copy category...||Enables you to copy all methods in a class category to the currently selected class|
|create access methods||Creates methods to access instance variables|
|rename...||Renames the currently selected method category|
|remove||Removes all methods in the currently selected class that are members of the currently selected method category|
The method list pop-up menu appears when you press the menu mouse button while the pointer is in the method list view. The functions available from this menu are shown in Figure 34.7 and explained in Table 34.5.
|fileOut||Saves the currently selected method in a file named className-selector.st|
|printOut||Sends the source code of the currently selected method to the printer|
|spawn||Starts a browser for editing this method|
|senders...||Starts a new browser on all methods sending a specific message|
|implementors...||Starts a new browser on all methods implementing a specific message|
|globals...||Starts a new browser on all methods that are accessing a global that is either a global variable or a symbol, as well as all methods sending a corresponding message|
|local senders...||Same as senders but limits the search to the current class and its subclasses|
|local implementors...||Same as implementors... but limits the search to the current class and its subclasses|
|new method||Enables you to create a new method from a template in the code view|
|change category...||Enables you to change the category of the selected method|
|remove||Removes the currently selected method|
When you add or remove instance variables to or from a system class description and accept (that is, save the changes), the system creates a new class instead of changing the old one. The original class still exists to give existing instances of
the class a valid class even though it is no longer accessible by name. After the change, you can no longer edit the old class.
It is recommended that you don't change the definition of system classes but only private ones. It is safer to use the copy category function to copy an existing class and its methods to a new class and modify the new class. This is especially important for classes which are used by the system itself since changes can lead to problems in the operation of the ST/X environment.
The code view is the lower half of the System Browser. It is here that you can modify the class or instance definitions as well as methods. The pop-up menu for this area is the edit menu that appears in every text editing view in ST/X. The functions in
this menu are discussed in the "Editing in Browsers" section of this chapter.
When the Class Hierarchy Browser is selected, a dialog box appears which asks for the name of class. If you enter a valid class, the Class Hierarchy Browser appears for that class. This is the same as the System Browser except there is no class category
list since this is for one specific class. The pop-up menus for each of the four subviews are the same as in the System Browser.
When the Implementors option is selected, a dialog box appears which asks for a selector. A selector is the name of the type of operation a message requests of its receiver.
If you enter a valid selector, an Implementors view will be displayed. This view is similar to the one shown in Figure 34.8.
The Implementors view contains a list of the methods that implement the method specified by the selector. The pop-up menu for the top half of the Implementor view is the same as the pop-up menu for the method list subview which was discussed in the
"System Browser" section of this chapter.
When the Senders option is selected, a dialog box appears that asks for a selector. If you enter a valid selector, then a Senders view will be displayed. This view is similar to the one shown in Figure 34.9.
The Senders view contains a list of the methods that send the selected message. The pop-up menu for the top half of the Senders view is the same as the pop-up menu for the method list subview which was discussed in the "System Browser"
Each time you make a change to either the class hierarchy or to a method, ST/X writes a record to a changes file. The Changes Browser enables you to inspect and manipulate the changes file. There are two subviews in the Changes Browser; the change list
and the contents view. The change list gives a list of all changes in chronological order. A sample Changes Browser is shown in Figure 34.10.
To display a change, select one of the changes from the change list. The change browser then displays the contents of the change in the contents view.
The pop-up menu for the change list has the functions described in Table 34.6.
|apply change||Applies the currently selected change.|
|apply to end||Applies all the changes from the currently selected change to the end of the changes file.|
|apply all changes||Applies all the changes in the file.|
|delete||Deletes the currently selected change from the list.|
|delete to end||Deletes all changes from the currently selected change to the end of the file.|
|delete changes for||Deletes all changes affecting the same class as the currently selected this class change to the end of the changes file.|
|delete all changes||Deletes all changes in the file for the same class as the currently for this class selected change.|
|update||Rereads the changes file.|
|compress||Compresses the change list and removes multiple changes of a method and leaves the most recent change compared to current.|
|compare with||Compares a method's source code in a change with the current current version version of the method and outputs a message in the Transcript view.|
|make change a patch||Appends the change to the end of the patches file which will be run and automatically applied at ST/X startup.|
|save change a file||Saves any changes made to the current file.|
|update sourcefile||This function is not currently implemented.from change|
|writeback changefile||Writes the change list back to the changefile changes file. All delete/compress operations performed in the Change Browser will not affect the changes file unless this operation is performed.|
The Change Browser can be used to recover from a system crash by re-applying all changes that were made after the last snapshot entry.
To control the size of the changes file, it is a good idea to apply a compress periodically. This will remove all old changes for a method leaving the newest one.
When you select the Directory Browser option, a browser with five subviews is displayed. The top half of the browser displays the current directory and all subdirectories and files contained in it. If you select a directory, it is expanded in the next
section to the right across the top half of the browser. If you select a file, the contents of the file are displayed in the lower half of the Browser. The pop-up menu for the directory area has only two functions:
The content view has the same edit menu as all the other text editors and is discussed in the "Editing in Browsers" section in this chapter. A typical Directory Browser is shown in Figure 34.11.
The Workspace option displays a view from which you can enter and compile Smalltalk code. The Workspace is usually used as a testing area or scratch pad when coding. You can use it to test your Smalltalk code before building it into the code library
using the System Browser code view.
The File Browser gives you the ability to inspect and manipulate files and directories. The File Browser is shown in Figure 34.12.
It consists of four subviews that are described in Table 34.7.
|path-label field||Shows the name of the current directory|
|file pattern field||Allows a search pattern to be entered for choosing files for the file list|
|file list||Shows a list of file and directory names|
|contents view||Shows the contents of a selected file|
To inspect the contents of a file, double-click the left mouse button on the name of the file in the file list. To change directories, double-click on the directory name. Directory names are always shown in the file list.
You can use the file pattern field to display the list of files matching the specified pattern. The default is *, which shows all files. The search pattern can be changed by moving the pointer to the field, editing the pattern, and then pressing enter
or choosing accept from the file pattern pop-up menu.
As in the other browsers we have discussed, each subview has a pop-up menu that is activated by the menu mouse button. The path-label pop-up menu is shown in Figure 34.13.
The functions available in this menu are described in Table 34.8.
|copy path||Copies the current pathname into the cut and paste buffer|
|change directory...||Opens a dialog box to enter the name of the directory you wish to change to|
|change to home directory||Changes the file list to your home directory|
The file list pop-up menu is shown in Figure 34.14.
The functions available in this menu are described in Table 34.9.
|spawn||Starts another file browser on the current directory or the directory selected in the file list.|
|get contents||Shows the contents of the currently selected file in the contents view.|
|show info||Displays a view with type, size, access, and owner information for the currently selected file or directory.|
|show full info||Displays the same as above with more details such as the last access, last modification date, and time.|
|fileIn||Loads the selected file into the system by reading and evaluating Smalltalk expressions from it.|
|update||Rereads the directory and updates the file list.|
|execute unix command_||Allows execution of any UNIX command through a pop-up box.|
|remove||Removes the selected file(s) or directory(s).|
|rename...||Renames the selected file.|
|display long list||Shows file information in the file list. This option toggles with display short list which is the default.|
|show all files||Displays all the files including hidden files. This option toggles with hide hidden files which is the default.|
|create directory...||Creates a new directory.|
|create file...||Creates a new file.|
The Projects option of the Launcher menu enables you to create a new project or select a previously created project. When the new project function is selected, a new project is automatically created for you and the new project object appears on your
screen. If you select the select project function, a dialog box appears with a list of existing projects from which to choose. Simply select a project and it will be loaded in to the environment.
The Utilities option provides thirteen tools that assist you in programming in the ST/X environment. Table 34.10 gives you a brief description of each tool.
|Transcript||Opens the Transcript view.|
|Window tree||Displays a graphical tree representation of the window hierarchy of all windows that are active or in wait state at the time it was requested.|
|Class tree||Displays a graphical tree representation of the class hierarchy of the system.|
|Event monitor||Displays a view that monitors events.|
|Process monitor||Displays a view that gives information about all currently active or waiting processes. This information changes as the state of the processes change.|
|Memory monitor||Displays a graph that tells you the present memory usage and changes as the memory usage changes.|
|Memory usage||Displays a table of the classes and the number of instances of each, average size, bytes, and percentage of memory used by each.|
|collect Garbage||Runs a Generation Scavenge algorithm to collect short term objects and destroy them. If an object survives long enough, it is moved to an area of memory where it remains until the user requests its collection.|
|collect Garbage &||Same as Collect Garbage but also compresses|
|compress||to recover space.|
|full screen hardcopy||Takes a picture of the screen and asks you for a name of a file with a .tiff extension in which to save the image.|
|screen area hardcopy||Same as Fullscreen hardcopy but for only a specific area of the screen.|
|view hardcopy||Same as Fullscreen hardcopy but for one specific view only.|
|ScreenSaver||Enables you to choose from one of three different screen savers to use in the ST/X environment.|
The Goodies option of the Launcher menu provides a pull-right menu of six different tools that are useful at any time, not just when you program in Smalltalk. The Goodies are described in Table 34.11.
|Clock||Displays an analog clock in a square with a toggle for the second hand.|
|Round Clock||Same as the clock but it's round and remains visible when it is minimized.|
|Directory View||Displays a pictorial representation of files and directories. A folder represents a directory and a document is a file.|
|Mail Tool||A tool for managing electronic mail.|
|News Tool||A repository for news, information and documents.|
|Draw Tool||A fairly comprehensive tool for drawing diagrams, charts, pictures, and so on.|
Contained in the pull-right menu of this option are games for your enjoyment and example applications that may be useful. The Games & Demos option menu is shown in Figure 34.15.
All views that show text allow the usual editing functions of that text through a pop-up menu. The functions available in this menu are described in Table 34.12.
|again||Repeats the last edit.|
|copy||Copies the selected text.|
|cut||Cuts the selected text out of the file.|
|paste||Pastes the text that was copied or cut prior to choosing the paste option to the current position of the pointer.|
|doIt||Evaluates the highlighted text.|
|printIt||Prints a representation of the result of the evaluation at the current cursor position.|
|inspectIt||Invokes the Inspector view on the result.|
|accept||Once you have completed editing, you must use this option to save the changes to the file; otherwise, the changes will not be written to the file.|
|search...||Enables you to search for a specific string.|
|goto...||Enables you to move to a specific location in the file.|
|font...||Enables you to change the font of the file.|
|indent...||Enables you to change the indenting of the file.|
|save as...||Enables you to save the file under a different name.|
|Prints the file.|
To select or highlight text, press the left mouse button over the first character and move the mouse (while pressing the mouse button) to the end of the text you wish to select and then release the mouse button. If you press the left mouse
button again, the highlighting is removed and you can select something else.
To scroll through the text, use the scroll bars on the left of the view. By clicking the mouse below or above the thumb, the text scrolls one page for every click. If you press the Shift key at the same time as you click, the text scrolls to the
position of the pointer in the scroll bar. This is useful for scrolling rapidly through long documents.
The Inspector enables you to inspect an object. It consists of two subviews, one showing the names of the object's instance variables and the other showing the value of the selected instance variable. You can start an inspector by using the inspectIt
function on the edit menu or by sending one of the following messages to an object:
The basicInspect command will open a general inspector that shows instance variables as they are physically present in the object. The inspect command is redefined in some classes to open an inspector showing the logical contents of the object.
The Debugger is displayed whenever an error occurs in your Smalltalk code. It shows you where the error occurred and how the system got there. The Debugger runs in one of three modes: normal, modal, and inspecting.
When in normal mode and an error occurs in a process, which is not the event handler process, the debugger will start up on top of the erroneous process. This blocks all interaction with the affected process and its views. Other views are still active
and respond as usual.
When an error occurs in the Smalltalk event handler process, the debugger starts in modal mode. While a modal debugger is active you cannot interact with any other view.
The inspecting mode can be entered from the ProcessMonitor by the pop-up menu and allows inspection of the state of other processes. But since the debugged process may continue to run, it is only possible to inspect a snapshot of the affected process.
The Debugger contains four subviews:
The Debugger is shown in Figure 34.16.
The functions that are common to each view appear as a set of buttons below the context walkback list. These functions are described in Table 34.13.
|terminate||Terminates the erroneous process|
|abort||Aborts the current activity if possible|
|return||Continues execution as if the selected context returned|
|restart||Continues execution by restarting the selected context|
|step (single step)||Lets the process continue execution until the next send is executed in the currently selected context|
|send (single send)||Lets the process continue execution for one message send|
The walkback subview has a pop-up menu with the functions described in Table 34.14.
|exit smalltalk||Leaves ST/X without saving an image|
|show more||Shows 50 more contexts of the walk-back|
|breakpoints||Not yet available|
|trace on/off||Not yet available|
|trace step||Not yet available|
A miniDebugger is entered if an error occurs within the Debugger itself. This is a line-by-line debugger that allows limited debugging without the use of a graphical user interface. It is controlled by entering commands in the Xterm window where
ST/X was started. If you type ? at the miniDebugger prompt, you will get a list of commands that are available for use in this stripped down debugger.
This chapter introduced you to the Smalltalk environment that is provided by the Smalltalk/X application. If you are interested in learning how to program using Smalltalk and do not have access to one of the commercial versions of Smalltalk, then Smalltalk/X is perfect for you. Not only does Smalltalk/X come with all the tools and programming aids that were talked about in this chapter, but it also comes with many examples and some fairly complete documentation that will make learning Smalltalk easier for you.