HP OpenVMS Systems

C++ Programming Language
Content starts here

Compaq C++
Using Compaq C++ for OpenVMS VAX

Previous Contents Index

Appendix B
Programming Tools

This appendix provides information on tools that you can use to develop and refine your Compaq C++ programs. Some ship with the OpenVMS operating system but others require separate purchase.

B.1 DEC Language-Sensitive Editor

The DEC Language-Sensitive Editor (LSE) is a text editor intended specifically for software development. LSE includes the following features:

  • Formatted language constructs, or templates, for most DEC programming languages. These templates include keywords and required punctuation, and use placeholders to indicate where to insert optional or required code.
  • Commands for compiling, reviewing, and correcting compilation errors from within the editor.
  • Integration with DEC Code Management System (CMS). You can enter CMS commands from within the editor to coordinate the progress of program development on OpenVMS systems. For more information on CMS, see the Guide to DEC Code Management System.

B.1.1 Starting and Terminating an LSE Session

To invoke LSE and associate a buffer with Compaq C++, use the following syntax:

lsedit [/qualifier...]filename.cxx

To invoke LSE without associating the editing buffer with a programming language, enter the following command at the DCL prompt:

$ lsedit file-spec

To end an LSE session, press Ctrl/Z to get the LSE> prompt. Then, enter the exit command if you want to save the current file modification, or enter the quit command if you want to discard the current file modification.

B.1.2 LSE Placeholders and Tokens

The language-sensitive features of LSE simplify the tasks of writing and maintaining program code. Among these features are placeholders and tokens.

Placeholders are markers in the source code that indicate where a program element is expected. Placeholders are worded to denote the appropriate syntax in a given context. You do not need to type placeholders; LSE inserts them, surrounded by brackets ([]) or braces ({}) and at signs (@). Braces indicate where source code is required in the program's context; brackets indicate that you have the option of supplying additional constructs or erasing the placeholder.

Tokens are LSE words that, when expanded, provide additional language constructs. You can type tokens directly into the buffer. You use tokens in situations such as modifying an existing program to add program elements where no placeholders exist. For example, if you type while and then enter the expand command, a template for a while construct appears in your buffer in place of the characters you typed. You also can use tokens as a shortcut in situations where expanding a placeholder would entail a complicated sequence of actions.

LSE has commands for manipulating tokens and placeholders, as follows:

Command Default Key Binding Description
expand Ctrl/E Expands a placeholder
unexpand PF1-Ctrl/E Reverses the effect of the most recent placeholder expansion
goto placeholder/forward Ctrl/N Moves the cursor forward to the next placeholder
goto placeholder/reverse Ctrl/P Moves the cursor backward to the previous placeholder
erase placeholder/forward Ctrl/K Erases a placeholder
unerase placeholder PF1-Ctrl/K Restores the most recently erased placeholder
<downarrow symbol> Down arrow Moves the selection indicator downward through a screen menu
<uparrow symbol> up arrow Moves the selection indicator upward through a screen menu
  • Enter
  • Return
Selects a menu option

To display a list of all the predefined tokens supplied with Compaq C++, enter the following LSE command:

LSE> show token

To display a list of all the predefined placeholders supplied with Compaq C++, enter the following LSE command:

LSE> show placeholder

For information about a particular token or placeholder, specify the name of the token or placeholder after the show token or show placeholder command.

To create a list of either tokens or placeholders, first execute the appropriate show command to put the list in the $show buffer. Then, enter the following commands:

LSE> go buffer $show
LSE> write file-spec

When you exit LSE, you can use the DCL print command to print a copy of the file you wrote.

B.1.3 Compiling and Reviewing Source Code from an LSE Session

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 any 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 editing the buffer user.cxx , LSE executes the following DCL command:

$ cxx user.cxx/diagnostics=user.dia

LSE supports all the command qualifiers available with the Compaq C++ compiler.

The review command displays any diagnostic messages that result from a compilation. LSE displays the compilation errors in one window and corresponding source code in a second window. This lets you view the error messages while examining the associated code.

B.1.4 DEC Source Code Analyzer (SCA)

Although Compaq C++ does not support the DEC Source Code Analyzer (SCA) through the LSE /analysis_data command line qualifier, users can generate a .ana file that contains information on all the tokens within a C++ program. For example, users can do the following:

SCA> find some_variable_name

To use the SCA analyze command with C++ files so that in turn you can execute find commands on your C++ code from LSE or SCA, do the following:

  • At the command line, issue the SCA command:

    $ SCA
  • Set your SCA library with the set library command. For example:

    SCA> set library projdisk:[user.any_existing_sca_lib]
  • Issue the analyze command on your .cxx file:

    SCA> analyze testprog.cxx

    This command places the file testprog.ana in your current working directory.
  • Load the resulting .ana file:

    SCA> load testprog.ana

Previous Next Contents Index