DECLARATIONS Command

The DECLARATIONS command causes a specified set of declarations to be isolated and listed along with optional information. The options available fall into three categories:

Those that select the set of declarations

Those that specify the output to be produced for each selected declaration

Those that specify the order and destination of the output

The identifier specified in the most recently entered LOCATE, REFERENCE, EXPAND, or SUMMARY command is called the work identifier. INTERACTIVEXREF remembers the work identifier from command to command and can use it as a default identifier in certain commands. To avoid confusion, the DECLARATIONS command nullifies the work identifier.

If no other options are specified as part of the DECLARATIONS command, the defaults are as follows:

All declarations are included.

The header line is given. The information contained in the header line includes the name, the compiler class, the environment where declared, the stack location, the sequence number where declared, and the aliases.

The output is ordered alphabetically by identifier name and is sent to the terminal.

Syntax

── DECLARATIONS ─┬──────────────────────────────────┬──────────────────►
                 └─<identifier>─┬───────────────────┤
                                ├─ - ──<identifier>─┤
                                └─ : ── LITERAL ────┘
►─<declaration specification>──────────────────────────────────────────┤

<declaration specification>

  ┌◄────────────────────────────────────────────────────────────┐
──┴─┬─/1\─ : ── ANY ──────────────────────────────────────────┬─┴──────┤
    ├─/1\─ : ── DECLARED ──<range specification>──────────────┤
    ├─/1\─ : ─┬─ USED ───┬─┬──────────────────────────────────┤
    │         └─ UNUSED ─┘ └─<range specification>────────────┤
    ├─/1\─ : ── ALSOUSED ──<range specification>──────────────┤
    ├─/1\─ : ── ONLYUSED ──<range specification>──────────────┤
    │                          ┌◄───────────────────┐         │
    ├─/1\─ : ── CLASS ─┬─────┬─┴─<alpha identifier>─┴─────────┤
    │                  └─ ─ ─┘                                │
    ├─/1\─ : ── KEYWORD ─┬─────┬─<alpha identifier>───────────┤
    │                    └─ ─ ─┘                              │
    ├─/1\─ : ── LEVELS ──<hex integer>─┬──────────────────────┤
    │                                  └─<hex integer>────────┤
    ├─/1\─ : ── DISPLACEMENTS ──<hex integer>─┬───────────────┤
    │                                         └─<hex integer>─┤
    ├─/1\─ : ── IDSONLY ─┬────────────────────────────────────┤
    │                    └─<integer>──────────────────────────┤
    ├─/1\─ : ──<reference>────────────────────────────────────┤
    ├─/1\─ : ──<expand>───────────────────────────────────────┤
    ├─/1\─ : ── SUMMARY ──────────────────────────────────────┤
    ├─/1\─ : ── SHORT ────────────────────────────────────────┤
    ├─/1\─ : ──<sort>─────────────────────────────────────────┤
    ├─/1\─ : ── TEXT ─┬───────────────────────────────────────┤
    │                 └─<number>──────────────────────────────┤
    ├─/1\─ : ── PRINTER ──────────────────────────────────────┤
    ├─/1\─ : ── REMOTE ───────────────────────────────────────┤
    └─/1\─ : ── FILE ──<file name>────────────────────────────┘

<reference>

── REFERENCE ──────────────────────────────────────────────────────────►
►─┬─────────────────────────────────────────────────────────┬──────────┤
  │ ┌◄────────────────────────────────────────────────────┐ │
  └─┴─┬─/1\─ . ── CHANGED ──────────────────────────────┬─┴─┘
      ├─/1\─ . ── ALIASES ──────────────────────────────┤
      ├─/1\─ . ── TEXT ─┬───────────────────────────────┤
      │                 └─<integer>─────────────────────┤
      ├─/1\─┬─ . ── ENVIRONMENTS ─┬──────────┬─┬────────┤
      │     │                     └─<number>─┘ └─ ONLY ─┤
      │     └─ . ── GLOBALENVIRONMENTS ─┬───────────────┤
      │                                 └─ ONLY ────────┤
      └─/1\─ . ── RANGE ──<range specification>─────────┘

<expand>

── EXPAND ─┬────────────────────────────┬──────────────────────────────┤
           │ ┌◄───────────────────────┐ │
           └─┴─┬─/1\─ . ── FULL ────┬─┴─┘
               ├─/1\─ . ── BLOCKED ─┤
               └─/1\─ . ──<integer>─┘

<sort>

         ┌◄────────────────────────┐
── SORT ─┴─┬─/1\─ SEQNUMBER ─────┬─┴───────────────────────────────────┤
           ├─/1\─ ADDRESSCOUPLE ─┤
           └─/1\─ ALPHABETICAL ──┘

Explanation

Options that control the selection of the set of declarations are defined as follows:

DECLARATIONS

Gives declaration information on all identifiers.

<identifier>

Gives declaration information for the specified identifier.

<identifier> – <identifier>

Gives declaration information for all the identifiers that are alphabetically between the specified pair of identifiers. The identifier pair must be ordered alphabetically.

<identifier>: LITERAL

Gives declaration information for all identifiers that contain the specified identifier as a substring. A specified single-byte identifier only matches single-byte identifiers, and a specified double-byte identifier only matches double-byte identifiers.

ANY

Gives declaration information only for the first declaration meeting all other qualifications.

DECLARED <range specification>

Gives declaration information for all identifiers declared within the specified range.

USED

Gives declaration information for all identifiers that are referenced somewhere in the program. If a range is specified, this option restricts the set to identifiers referenced within that range.

UNUSED

Gives declaration information for identifiers that are declared but never referenced in the program. If a range is specified, the set is restricted to identifiers that are not referenced within the specified range.

ALSOUSED <range specifications>

Restricts declaration information to identifiers that also have references in this specified range.

ONLYUSED <range specification>

Gives declaration information for identifiers referenced within the specified range and not referenced elsewhere.

CLASS <alpha identifier>

Gives declaration information for all identifiers with the specified compiler class or group of compiler classes. The compiler class must appear exactly as it appears in a header line—for example, BOOLEAN ARRAY, INTEGER, FORMAL NAME REAL. Only one compiler class can be specified for each CLASS option; however, the compiler class can contain more than one alpha identifier—for example, REAL PROCEDURE. CLASS can be specified as often as desired; thus, a group of classes can be specified.

CLASS – <alpha identifier>

Gives declaration information for all identifiers in all the compiler classes except those specified in the alpha identifier list.

KEYWORD <alpha identifier>

Gives declaration information for the identifiers in the group of compiler classes that contain the specified alpha identifier. For example, KEY BOOLEAN causes classes such as BOOLEAN, BOOLEAN ARRAY, and BOOLEAN PROCEDURE to be included. KEYWORD and CLASS can be specified as often as desired to generate the desired group of classes.

KEYWORD – <alpha identifier>

Gives declaration information for the identifiers in the group of compiler classes that do not contain the specified alpha identifier. For example, KEY – BOOLEAN includes exactly the opposite of the classes included by KEY BOOLEAN.

LEVELS <hex integer>

Gives declaration information for the identifiers that have stack cells with the specified lexicographical levels.

DISPLACEMENTS <hex integer>

Gives declaration information for the identifiers that have stack cells with the specified displacements.

Options that specify the output to be produced for each selected declaration are described as follows:

IDSONLY

Displays only identifier names and omits the other header information. The output is displayed in ascending alphanumeric order with a default field width of 20. The field width can be altered by specifying <integer> as the new field width.

REFERENCE

Displays references to the selected declaration. This option can itself be modified by any of the options listed under the REFERENCE command except PRINTER or REMOTE, with the same effects. For an explanation of these options, refer to “REFERENCE Command” later in this section.

EXPAND

Writes out the text of the selected declaration if the identifier is an item such as a DEFINE, ARRAY, or FILE statement that has text associated with its declaration.

If this option is modified by FULL, the text is completely expanded before it is displayed. If a full expansion of a DEFINE statement is requested, it is performed in the context of its first use.

If this option is modified by BLOCKED, the output is indented at the BEGIN statement, and statements are placed on separate lines. Only the first or the final expansion can be obtained.

The integer value specifies an approximate limit on the lines of text printed for each declaration. The default limit is 10.

SUMMARY

Lists a summary of the number and kinds of references to the selected declaration.

SHORT

Suppresses listing of the aliases of the selected declaration. Currently, only NEWP keeps track of aliases. SHORT has no effect for other languages.

TEXT <number>

Causes the text of each selected declaration to be printed or displayed. If you choose the <number> option, <number>-1 lines of text are printed or displayed around each declaration.

Options that specify the order and destination of output are described as follows:

SORT

Controls the order in which the selected declarations are printed:

When SORT is followed by SEQNUMBER, the output is sorted by sequence number where each declaration was declared.

When SORT is followed by ADDRESSCOUPLE, the output is sorted first on the address couple—the lexicographical level and the displacement of stack cell—of each declaration, and then on the sequence number where each was declared.

When SORT is followed by ALPHABETICAL, the output is sorted first alphabetically, and then in order of occurrence. Any double-byte identifiers are sorted according to binary value and appear before single-byte identifiers in the output. This output is the same output that would be produced if SORT were not specified.

When SORT is followed by more than one item, multiple sets of output are produced.

PRINTER

Sends output to the line printer by way of a file internally named LINE.

REMOTE

Sends output to the terminal. This option can be used when PRINTER has been specified so that output is sent to the terminal as well as to the printer.

FILE <file name>

Causes all referenced text lines from the symbol file to be output to a disk file with the specified file name. This file cannot already exist. The file name is created with the same FILETYPE value as the file loaded by the SYMBOL command. Refer to the “SYMBOL Command” in this section. If no symbol file is loaded, an error message is given at the terminal. The FILE option is valid only when used with the REFERENCE option.

Examples

The following examples use the example INTERACTIVEXREF program contained at the end of this section.

The following command requests information about all the declarations of the identifier B. The output is listed following the command.

DECLARATIONS B
B  ::  REAL @ (2,2)  ::  DECLARED @ 00001200
B OF TWO  ::  INTEGER @ (3,2)  ::  DECLARED @ 00003300

The following command requests information about all of the declarations for identifiers that are alphabetically between B and MEAN inclusive:

DECLARATIONS B - MEAN
B  ::  REAL @ (2,2)  ::  DECLARED @ 00001200
B OF TWO  ::  INTEGER @ (3,2)  ::  DECLARED @ 00003300
B.0000 ::PROCEDURE @ (1,2)::DECLARED @ 00001100 ENDS @ 00006000
C  ::  REAL @ (2,3)  ::  DECLARED @ 00001200
C OF THREE OF TWO :: INTEGER @ (4,2) :: DECLARED @ 00003700
EQUATION  ::  DEFINE  ::  DECLARED @ 00002000
FOURR  ::  DEFINE  ::  DECLARED @ 00001900
I  ::  INTEGER @ (2,6)  ::  DECLARED @ 00001300
MEAN  ::  REAL @ (2,4)  ::  DECLARED @ 00001200

The following command lists information about declarations of identifier B under the compiler class of INTEGER:

DECLARATIONS B: KEYWORD INTEGER
B OF TWO  ::  INTEGER @ (3,2)  ::  DECLARED @ 00003300

The following command lists information for references to the identifier MEAN where its value can change:

DECLARATIONS MEAN: REF. CHANGED. TEXT
MEAN  ::  REAL @ (2,4)  ::  DECLARED @ 00001200
  *00002400     MEAN:=2;
  *00002600        MEAN:= MEAN * B;
  *00003900       MEAN:= MEAN + C;
  *00004200     MEAN:= MEAN / 3;

The following command lists information about all identifiers that are global to procedure TWO but are used within procedure TWO:

DECLARATIONS: DECLARED -TWO: USED TWO
C  ::  REAL @ (2,3)  ::  DECLARED @ 00001200
I  ::  INTEGER @ (2,6)  ::  DECLARED @ 00001300
MEAN  ::  REAL @ (2,4)  ::  DECLARED @ 00001200
ONEE  ::  DEFINE  ::  DECLARED @ 00001500
R  ::  REAL ARRAY @ (2,7)  ::  DECLARED @ 00001400
TWOO  ::  DEFINE  ::  DECLARED @ 00001600

The following command lists information about all identifiers that have stack cells within lexicographical level 2:

DECLARATIONS: LEVELS 2
B  ::  REAL @ (2,2)  ::  DECLARED @ 00001200
C  ::  REAL @ (2,3)  ::  DECLARED @ 00001200
I  ::  INTEGER @ (2,6)  ::  DECLARED @ 00001300
MEAN  ::  REAL @ (2,4)  ::  DECLARED @ 00001200
ONE  ::  PROCEDURE @ (2,8)  ::  DECLARED @ 00002200    ENDS @ 00002900
R  ::  REAL ARRAY @ (2,7)  ::  DECLARED @ 00001400
STRG  ::  REAL @ (2,5)  ::  DECLARED @ 00001200
TWO  ::  PROCEDURE @ (2,9)  ::  DECLARED @ 00003100    ENDS @ 00005000
%