back

Getting started

Contents

Introduction

This document will give you some short information, on how to start & stop the system. You will also learn how to leave the system once you entered the debugger or if the system seems not to respond anymore. Also, you will get a short introduction of how to enter text, use the scrollbars and how to edit text.

Starting Smalltalk/X

To start Smalltalk/X, type "smalltalk" at the Unix prompt:
    % smalltalk
    
    installing autoloaded classes ...
    installing patches ...
    starting Transcript ...
    starting main-menu ...
When started, Smalltalk/X will read and evaluate a script-file called "smalltalk.rc", which consists of regular smalltalk expressions in fileOut-format (i.e. smalltalk expressions separated by an exclamation mark '!').

Smalltalk looks for this file FIRST in your current directory, THEN in some standard places (usually "/usr/local/lib/smalltalk/smalltalk.rc").

The expressions in this script will set up some default behavior (for example fonts to use) and finally start both a Transcript-window and a Launcher-menu.

The Transcript will play the role of a smalltalk console where relevant system information is shown. The Launcher allows startup of other useful tools, these are described in more detail later.

You can of course modify the startup script according your personal preferences and add your own tools there.
More info on these script files and startup actions is found in the documents "installation" and especially in "configuration & customization".

Stopping Smalltalk/X

To leave the smalltalk system, use the exit function from the Launcher (single mouse click on exit). The Launcher will show a box asking if you would like to save the current state of the smalltalk system.

If you choose save & exit, the whole state will be saved in a so-called snapshot-file; this allows you to later restart smalltalk and continue where you left it.

Choosing exit will NOT create a snapshot. If you changed your mind and you do not want to leave smalltalk, press the cancel button.

Restarting Smalltalk/X

When Smalltalk/X is restarted, it will look for a file called "st.img" and, if present, load the state found in this file.

If you saved your snapshot under another name, use the following command line when restarting smalltalk:

    smalltalk -i nameOfImage.img
If you want to start Smalltalk/X from scratch, ignoring any snapshot image, use the ignore flag, as in:
    smalltalk -I

Leaving the Debugger

Whenever some error occurs in smalltalk, a debugview is popped up, showing where the error occurred and how the system got there (called a backtrace or walkback).
The debuggers actions are controlled by a set of buttons, and a popup menu in the walkback view for the less frequently used functions.

The possible button actions are:

There are many other button and menu functions in the debugger. Read "using the debugger" for more information.

Entering the Debugger

The debugger can be entered either on request (for example: halt sent to any object), via a breakpoint or if an error such as division by zero, array bounds check etc. occurs.

You can also type CTRL-C in any view to force the corresponding view process being interrupted and a debugger opened on it.

Finally, pressing CTRL-C in the terminal (xterm-) window where smalltalk was started, will force a hard-interrupt, which interrupts any running process - even the scheduler or event dispatcher process.
(On some systems, this key is labelled INTR or DEL. See the Unix manual page on the stty command for details.)

Leaving the low-level emergency debugger

Whenever a serious error occurs within the debugger itself (just imagine, you have changed the Scrollbar class which is used indirectly in the DebugView), you will find yourself in a line by line debugger called the MiniDebugger, which allows some limited debugging without using the graphical user interface.

The system considers errors occuring in a debugger as serious (i.e. recursive errors in the graphical debugger).

If all of the above fails, you should exit smalltalk.

In rare cases (other smalltalk processes are running), the MiniDebugger may seem to not react to your input.
If this happens, press the interrupt key (as described above) and try again. The interrupt will reenter the MiniDebugger in an exclusive input mode and stop any scheduling of other processes.

PopUp menus

Many views offer functions via a PopUpMenu. This menu is activated by pressing the middle (or, if you own a 2-button mouse, the right) mouse button in the view. (Therefore, it is sometimes referred to as middleButtonMenu).

The menus entries are view and sometimes context dependent. Typically, they offer operations on the contents or the current selection.

Scrolling Text

The scrollbars shown beside the actual text work as usual, however, they provide the following special behavior: (see more on text positioning in the section on keyboard commands).

Selecting Text

Text is selected using the left-mouse button:
  1. press the button over the first character to be selected,
  2. while-being pressed, move the mouse-pointer to the end position
  3. release the mouse-button.
The current selection will be highlighted. Pressing the left mouse button again makes the system forget the old selection and start a new one, except when you press the SHIFT key while pressing the button.
In this case, the current selection will be expanded. You can expand a selection at any time, even if you leave and reenter the view containing the selection. It is therefore possible, to scroll the view (using the scrollbar) or perform any other function (page-up or page-down), required to make the desired end-position visible. A selection can be expanded in both directions, any number of times.

It is also possible to move the mouse-pointer out-of the view, while the mouse button is being pressed. The view will then start to automatically scroll. The farther away you move the pointer from the views border, the faster will it scroll. This is the easiest way of selecting text: just let it scroll by and stop when the end-position arrives.

Double click will select wordwise, while triple click will select linewise.
If you keep the button pressed and start to move, after a double click it will select whole words; moving after a triple click will select whole lines.
A quadruple click selects the whole text.

There are also two convenient keyboard shortcuts for selecting:

Editing Text

All views showing text allow you to perform the usual functions via a pop-up-menu, which is activated with the middle mouse button. For some of them, keyboard shortcuts are available (actually there are more functions available via the keyboard than there are on the menu). Currently, the following keyboard functions are available:

command key functions (*):

Some keyboards (for example on sun-workstations) provide function keys labelled copy, cut, paste and so on. These keys will also perform the expected functions.

control-key functions, these allow more cursor positioning:

other functions which affect the cursor position: The following keyboard command is available in views showing code:

Please read "configuration & customization" on how to add/change function keys settings.
Finally, see the keyPress:x:y: methods in the TextView class and its subclasses. You can easily modify these to add more functions.

Sorry:
currently there is no "undo" function, however no change in the text will have any permanent effect, unless you accept the new text.

Evaluating Smalltalk expressions

Most views showing code and especially workspaces allow you to select some text and immediately evaluate this as a smalltalk expression (remember the old Basic-interpreters ? :-).

The middle-button-menu function doIt will do this, by parsing the selected text and silently evaluating the corresponding smalltalk expressions.
For example, open a workspace and type:

    Transcript showCr:(100 factorial)
or:
    Workspace open
select the text and evaluate it using doIt.

Unless the expression does some printing itself (as in the first example), the result of the evaluation is not shown anywhere.
To see the result of such an evaluation, use the middle-button-menu function printIt.
Just like doIt, this will evaluate the expression, in addition, it will insert a printed representation of the result at the current textcursor position.
See the difference between doIt and printIt when executing:

    100 factorial

Finally, inspectIt will open an inspector on the result, where you can have a look at the resulting object in more detail.
Try to inspect the result of:

    Array new:10
Each has a convenient keyboard shortcut:
Notice that these keyboard shortcuts are defined in the startup scripts (usually in "display.rc). Read "configuration & customization" and have a look at the startup files.

Loading existing code / using the FileBrowser

Files containing smalltalk code (in fileOut-format) can be loaded into the system either by evaluating:
    Smalltalk fileIn:filename
using doIt in a workspace, or, more comfortable, using the FileBrowser.
To load a file using the FileBrowser, select the file and apply the middlebutton menus fileIn function in the upper (filelist) panel.
Watch the Transcript for what is going on.

Smalltalk/X understands both ParcPlace's Smalltalk-80 and Digitalks Smalltalk/V formats.

To see the contents of the file, double-click on it in the list. Also directories are changed in this way.

More info on the FileBrowser is found in the document "using the FileBrowser".

Learning Smalltalk

If you are new to smalltalk, start by learning how to use the non graphical basic classes. For a rough overview of what is there, read "basic classes overview".

Getting more used to the system, try creating views. Start by reusing existing widgets and combine them into more complex ones. There are many widgets ready for reuse - you better look whats there, before hurrying to program your own ones.

Read and understand the coding examples found in the directories "doc/coding" and "clients/Demos".

Notes:

(*) The command key is labelled different on some keyboards; try ALT, CMD, META or similar.

Copyright ) Claus Gittinger Development & Consulting, all rights reserved

(cg@ssw.de)