Prism 6.0 User's Guide

Using the Command Window

The command window is the area at the bottom of the main Prism window in which you type commands and receive Prism output.

The command window consists of two boxes: the command line, at the bottom, and the history region, above it. Figure 2-4 shows a command window, with a command on the command line and messages in the history region.

Figure 2-4 Command Window With History Region

Graphic

The command window is a separate pane within the main Prism window. You can resize this window (using the resize box at the top right of the window) and scroll through it. If you don't intend to issue commands in the command window, you may want to make this window smaller, so that you can display more code in the source window. If you use the command window frequently, you may want to make it bigger. If you change the size of the window, the new size is saved when you leave Prism.

Use the set $history command, as described below, to specify the maximum number of lines that Prism is to retain in the history region; the default is 10,000. For example,

set $history = 2000

reduces the number of lines to 2000.

Prism uses up memory in maintaining a large history region. A smaller history region, therefore, may improve performance and prevent Prism from running out of memory.

Using the Command Line

You type commands on the command line at the bottom of the command window. You can type in this box whenever it is highlighted and an I-shaped cursor, called an I-beam, appears in it. See Table 2-2 for a list of keystrokes you can use in editing the command line. Press Return to issue the command. Type Control-c to interrupt execution of a command (or choose the Interrupt selection from the Execute menu).

You can issue multiple commands on the Prism command line; separate them with a semicolon (;). One exception: If a command takes a file name as an argument, you cannot follow it with a semicolon, because Prism can't tell if the semicolon is part of the file name.

Prism keeps the commands that you issue in a buffer. Type Control-p to display the previous command in this buffer. Type Control-n to display the next command in the buffer. You can then edit the command and issue it in the usual way.

During long-running commands (for example, when you have issued the run command to start a program executing), you may still be able to execute other commands. If you issue a command that requires that the current command complete execution, you receive a warning message and Prism waits for the command to complete.

Using the History Region

Commands that you issue on the command line are echoed in the history region, above the command line. Prism's response appears beneath the echoed command. Prism also displays other messages in this area, as well as command output that you specify to go to the command window. Use the scroll bar at the right of this box to move through the display.

You can select text in the history region, using one of these methods:

You can then paste the selected text into other text areas within Prism by clicking the middle mouse button.

To re-execute a command, triple-click on a line in the history region to select it, then click the middle mouse button with the mouse pointer still in the history region. If you middle-click with the mouse pointer on the command line, the selected text appears on the command line but is not executed. This gives you a way to edit the text before executing it.

Redirecting Output

You can redirect the output of most Prism commands to a file by including an "at" sign (@) followed by the name of the file on the command line. For example,

where @ where.output

puts the output of a where command (a stack trace) into the file where.output, in your current working directory within Prism.

You can also redirect output of a command to a window by using the syntax on window, where window can be:

list on ded

displays the output of the list command in a dedicated window. (Some commands that have equivalent menu selections display their output in the standard window for the menu selection.)

You can also make up your own name for the window; the name appears in the title of the window. This is useful if you want a particular label for a window. For example, if you were doing a stack trace at line 22, you could issue this command:

where on line22

to label the window with the location of the stack trace.

The commands whose output you cannot redirect are run, edit, make, and sh.


Note -

Although the run command cannot be redirected using on or @, run can be redirected using > and other shell redirections.


Logging Commands and Output

You can specify on the Prism command line the name of a file to which commands and output are to be logged. You can also do this from within Prism, by issuing the log command.

Use the log command to log Prism commands and output to a file. The log file will be located in the current directory. This can be helpful in saving a record of a Prism session. For example,

log @ prism.log

logs output to the file prism.log. Use @@ instead of @ to append the log to an already existing file. Issue the command

log off

to turn off logging.

You can use the log command along with the source command to replay a session in Prism; see the next section. If you want to do this, you must edit the log file to remove Prism output.

Executing Commands From a File

As mentioned in " Specifying Input and Output Files", you can specify on the Prism command line the name of a file from which commands are to be read in and executed. You can also do this from within Prism by issuing the source command.

Using the source command lets you rerun a session you saved via the log command. You might also use source if, for example, your program has a long argument list that you don't want to retype constantly.

For example,

source prism.cmds

reads in the commands in the file prism.cmds. They are executed as if you had actually typed them in the command window. When reading the file, Prism interprets lines beginning with a pound sign (#) as comments.

The .prisminit file is a special file of commands; if it exists, Prism executes this file automatically when it starts up. See " Initializing Prism" for more information.