Previewing program code

From m204wiki
Jump to navigation Jump to search

If you work with User Language programs that require an appreciably long time to download for debugging, due to their size alone or to a slow network connection or high network traffic, you may prefer to use a Debugger feature that lets you inspect a small "chunk" of the beginning of the program to decide whether to download the entire program for debugging or just to run it.

The Source Preview feature lets you download a program's initial 100 lines (at minimum). After inspection of this code chunk, you can download the entire program as usual or you can simply run the program without downloading it.

Enabling Source Preview

To enable the Source Preview feature (which is disabled by default):

  1. In the Client, select Preferences from the File menu (or use the CTRL-P keyboard shortcut).
  2. In the Preferences dialog box, in the Execution Options section, select the Source Preview checkbox (it is clear by default).
    preferences22fFrag
  3. The Minimum value (to the right of the Source Preview checkbox) is the default for the minimum length a source program must be in order to be previewed. No programs less than 1000 lines may be previewed. Modify this setting (increments of 1000; maximum of 100,000) if you want previewing available only for longer programs.
  4. The Size value (to the right of Minimum) is the default for the size of the preview code chunks. Modify this setting (increments of 100; maximum of 10,000) if you want larger chunks.
  5. Click the Done button to save your settings and enable the feature.

Operating in preview mode

When Source Preview is enabled and you encounter a program with a number of lines greater than or equal to the Source Preview Minimum setting, the following happens:

  1. As many as Source Preview Size lines of the program are sent to the Client Source Code page.
  2. The Status bar confirms that you are in preview mode and informs whether the source program compiles. It displays either Preview: good compile or Preview: bad compile. Even if the program does not compile, you will still have the option to download and view the entire program and its embedded compilation error messages.
  3. You inspect the preview and decide whether to download the entire program for debugging or to skip the debugging of the program. Or, if the program did not compile, you decide whether to download and view the entire program or to skip it.
  • To download the entire program for debugging:
Select the Debug Previewed Source option from the Execution menu, or use a button or hot key you mapped to the skipPreview command, or click the Client's Step button or perform a Source Code text search.
  • To download the entire program to view compilation error messages:
Select the Debug Previewed Source option from the Execution menu, or use a button or hot key you mapped to the debugPreview command.
  • To skip the program:
Click the Client's Run button, or select the Skip Previewed Source option from the Execution menu, or use a button or hot key you mapped to the skipPreview command.