Prism 6.0 User's Guide

Using the Source Window

The source window displays the source code for the executable program loaded into Prism. (Chapter 3, Loading and Executing a Program describes how to load a program into Prism, and how to display the different source files that make up the program.) When you execute the program, and execution then stops for any reason, the source window updates to show the code being executed at the stopping place. The Source File: field at the top of the source window lists the file name of the file displayed in the window.

The source window is a separate pane within the main Prism window. You can resize it by dragging the small resize box at the lower right of the window. If you change its size, the new size is saved when you leave Prism.

You cannot edit the source code displayed in the source window. To edit source code within Prism, you must call up an editor; see Chapter 8, Editing and Compiling Programs.

Moving Through the Source Code

As mentioned above, you can move through a source file displayed in the source window by using the scroll bar on the right side of the window. You can also use the up and down arrow keys to scroll a line at a time, or press the Control key along with the arrow key to move half a page at a time. To return to the current execution point, type Control-x in the source window.

To search for a text string in the current source file, issue the /string or ?string command in the command window. The /string command searches forward in the file for the string that you specify and repositions the file at the first occurrence it finds. The ?string command searches backward in the file for the string that you specify.

You can display different files by choosing the File or Func selection from the File menu; see " Choosing the Current File and Function". You can also move between files. Prism keeps a list of the files you have displayed. With the mouse pointer in the source window, do this to move through the list:

Selecting Text

You can select text in the source window by dragging over it with the mouse; the text is then highlighted. Or double-click with the mouse pointer pointing to a word to select just that word. Left-click anywhere in the source window to "deselect" selected text.

Right-click in the source window to display a menu that includes actions to perform on the selected text, see Figure 2-1. For example, select Print to display a visualizer containing the value(s) of the selected variable or expression at the current point of execution. (See Chapter 5, Visualizing Data, for a discussion of visualizers and printing.) To close the pop-up menu, right-click anywhere else in the main Prism window.

Figure 2-1 Pop-up Menu in Source Window

Graphic

You can display the definition of a function by pressing the Shift key while selecting the name of the function in the source window. This is equivalent to choosing the Func selection from the File menu and selecting the name of the function from the list; see Chapter 3, Loading and Executing a Program. Do not include the arguments to the function, just the function name.

Splitting the Source Window

You can split the source window to simultaneously display the source code and assembly code of the loaded program. Follow these steps to split the source window:

To split the source window:

  1. Load a program.

  2. Right-click in the source window to display the pop-up menu.

  3. Click on the "Show source pane" selection in the pop-up menu.

    This displays another menu.

  4. Choose the "Show .s source" selection from the menu.

    This causes the assembly code for your program to be displayed in the bottom pane of the window, as shown in Figure 2-2.

Figure 2-2 Split Source Window

Graphic

To return to a single source window, right-click in the pane you want to get rid of, and choose "Hide this source pane" from the popup menu.