United States |
|
|
||
C.1.3.6 Sample Debugging SessionExample C-6 shows the Compaq C program POWER.C to be used in the sample debugging session shown in Example C-7.
Although this program contains no errors, Example C-7 shows some simple debugger commands that can be used to evaluate its execution. The callout numbers in this sample debugging session are keyed to the notes that follow.
Key to Example C-7:
C.2 OpenVMS Text Processing UtilityThe OpenVMS Text Processing Utility (TPU) (provided with the OpenVMS operating system) is a high-performance, programmable utility. TPU provides a number of special features, such as multiple buffers and windows, definable keys and key sequences, a procedural language, and a callable interface. TPU serves as a base on which to layer other text processing applications, for example, text editors. The Extensible VAX Editor (EVE) is the editor provided with TPU. To invoke EVE, enter the following command at the DCL prompt:
To exit from EVE, press the Do key to get the Command: prompt. If you want to save modifications to your file, enter the EXIT command. If you do not want to save the file or any modification to the file, enter the QUIT command.
For information on TPU and EVE, see the Guide to VMS Text Processing.
The Compaq Language-Sensitive Editor (LSE) and the Compaq Source Code Analyzer (SCA) must be purchased separately from the OpenVMS operating system. LSE is a text editor intended specifically for software development. SCA is an interactive tool for program analysis. These products are closely integrated; generally, SCA is invoked through LSE. LSE provides additional editing features that make SCA program analysis more efficient. In addition, LSE and SCA, in conjunction with the Compaq C compiler, provide a set of new enhancements supporting source code design and review. In addition to text editing features, LSE provides the following software development features:
SCA performs the following types of program analysis:
LSE and SCA together, in conjunction with Compaq language compilers, provide the following software design features:
The following sections provide entry, exit, and language-specific
information on the combined use of LSE and SCA. For more information on
LSE and SCA, see the Guide to Language-Sensitive Editor for VMS Systems and the Guide to Source Code Analyzer for VMS Systems. For more
information on CMS, see the Guide to Code Management System for VMS Systems.
SCA stores data generated by the Compaq C compiler in an SCA library. The data in an SCA library contains information about all symbols, modules, and files encountered during a specific compilation of the source. You must prepare this library before you enter LSE to invoke SCA. This preparation involves the following steps:
C.3.2 Starting and Terminating an LSE or an SCA SessionTo invoke LSE, enter the following command at the DCL prompt:
To end an LSE session, press Ctrl/Z to get the LSE> prompt. If you want to save modifications to your file, enter the EXIT command. If you do not want to save the file or any modification to the file, enter the QUIT command. To invoke SCA from the LSE prompt, enter the SCA command that you want to execute using the following syntax:
To invoke SCA from the DCL command line for the execution of a single command, use the following syntax:
If you have several SCA commands to invoke, you might want to first invoke the SCA subsystem and then enter SCA commands:
Typing EXIT (or pressing Ctrl/Z) ends an SCA subsystem session and
returns you to the DCL level.
The LSE language-sensitive features simplify the tasks of developing and maintaining software systems. These features include language-specific placeholders and tokens, aliases, comment and indentation control, and templates for subroutine libraries. You can use LSE as a traditional text editor. In addition, you can use the power of LSE's tokens and placeholders to step through each program construct and supply text for those constructs that need it. Placeholders are markers in the source code that indicate where you can provide program text. These placeholders help you to supply the appropriate syntax in a given context. You do not need to type placeholders; they are inserted for you by LSE. Placeholders are surrounded by brackets or braces and at (@) signs. Placeholders are either optional or required. Required placeholders, indicated by braces ({}), represent places in the source code where you must provide program text. Optional placeholders, indicated by brackets ([]), represent places in the source code where you can either provide additional constructs or erase the placeholder. You can move forward or backward from placeholder to placeholder. In addition, you can delete or expand placeholders as needed. Tokens typically represent keywords in Compaq C. When expanded, tokens provide additional language constructs. You can type tokens directly into the buffer. You use tokens in situations, such as modifying an existing program, where you want to add additional language constructs and there are no placeholders. For example, typing IF and entering the EXPAND command causes a template for an IF construct to appear on your screen. You can also use tokens to bypass long menus in situations where expanding a placeholder, such as {@statement@}, will result in a lengthy menu. You can use tokens to insert text when editing an existing file by typing the name for a function or keyword and entering the EXPAND command. LSE provides commands for manipulating tokens and placeholders. Table C-1 shows these commands and their default key bindings.
To display a list of all the defined tokens provided by Compaq C, enter the following LSE command:
To display a list of all the defined placeholders provided by Compaq C, enter the following LSE command:
To put either list into a separate file, first enter the appropriate SHOW command to put the list into the $SHOW buffer. Then enter the following commands:
To obtain a hard copy of the list, use the PRINT command at DCL level to print the file you created.
To obtain information about a particular token or placeholder, specify
a token name or placeholder name after the SHOW TOKEN or SHOW
PLACEHOLDER command.
To compile your source code and to review compilation errors without leaving the editing session, use the LSE commands COMPILE and REVIEW. The COMPILE command issues a DCL command in a subprocess to invoke the Compaq C compiler. The compiler then generates a file of compile-time diagnostic information that LSE uses to review compilation errors. The diagnostic information is generated with the /DIAGNOSTICS qualifier that LSE appends to the compilation command. For example, if you enter the COMPILE command while in the buffer USER.C, the following DCL command is executed:
LSE supports all the Compaq C compiler's command qualifiers as well as user-supplied command procedures. The REVIEW command displays any diagnostic messages that result from a compilation. LSE displays the compilation errors in one window and the corresponding source code in a second window. This multiwindow capability allows you to review your errors while examining the associated source code. To compile a Compaq C program that contains placeholders and design comments, include the following qualifiers to the COMPILE command:
The /ANALYSIS_DATA qualifier generates a data analysis file containing source code analysis information. This information is provided to the SCA library.
The /DESIGN qualifier instructs the compiler to recognize placeholders
and design comments as valid program elements. If the /ANALYSIS_DATA
qualifier is also specified, the compiler includes information on
placeholders and design comments in the data analysis file.
The following examples show the expansions of Compaq C tokens and placeholders. The intent is to show the formats and guidelines that LSE provides, not to fully expand all tokens and placeholders. An arrow (->) indicates where in the example an action occurred. To invoke LSE and the Compaq C language, use the following syntax:
When you use the editor to create a new Compaq C program, the initial string {@compilation unit@} appears at the top of the screen:
Use Ctrl/E to expand this initial string. The following is displayed:
C.3.5.2 Preprocessor LinesErase the [@#module@] , [@module level comments@] , [@include files@] , and [@macro definitions@] . The cursor is then positioned on [@preprocessor directive@] . Expand [@preprocessor directive@] to duplicate it and display a menu. Then select the #include option:
The following display results:
After selecting the #include option, another menu appears that lists the types of #include statements. Select the option #include {@module name@} . Your display now looks like this:
Type the value stdio over the placeholder {@module name@} . Experiment with the LSE editor to expand other placeholders, such as [@data type or declaration@] , [@function definition@] , and so on.
|
|