BLIST

Lists DataBasic source code in an enhanced format with logical indenting.

Syntax

BLIST file-specifier {item-list} {(options}

Syntax elements

file-specifier The name of the file containing the item to be listed.

item-list A space-separated list of the items containing the source code you want displayed. Omit if supplied by an immediately-preceding list-generating command.

Options

A Indents comments to the centre of the page.

B Prompts for the width of each indent level (0 to 5 characters). If an invalid width is entered or the B option is omitted, the default value (3 characters) is used.

C Ignore the code structure when indenting comment lines. All comment lines are indented by the same amount (6 spaces).

If used with the Z option, comment lines are not indented.

D Outputs the listing double-spaced.

E Expands INCLUDEd and $CHAINed sections into the listing. Always used with option M.

F Includes the name of the source file in the heading.

I Indents to the middle of the page, any comments beginning at the end of a normal statement line.

K Suppresses printing a line of asterisks (*) when an exclamation mark (!) is encountered at the beginning of a source code line.

L Prints a period (.) at each level of indenting. Refer to Logical Structures.

M Includes line numbers both from the source item and taking into account any included and/or chained items. The code from these items is not output unless the E option is also specified. For more details, refer to INCLUDE and $CHAIN Statements.

N No page. Listing scrolls on the screen without paging.

P Sends output to the printer assigned to your port. The default is to send the output to the terminal.

S Suppresses the listing. Usually paired with the U option.

U Updates the source code; without this option, the code remains unchanged. The changes do not affect compilation.

V Prompts for the width of the label area (0 to 6 characters). If an invalid width is entered or the V option is omitted, the default value (6 characters) is used.

W Ignores the case of keywords. For use with programs that have been compiled with the COMPILE TCL command.

X Display a 'level number' for each INCLUDE statement. Refer to INCLUDE and $CHAIN Statements.

Z Do not indent comment lines. Must be used with the C option; the Z option has no effect used by itself.

startLine{-endLine}
Displays lines startLine to endLine (or the end of the item if endLine is omitted). This option lets you restrict the program listing to certain lines and still retain the correct logical indenting.

Related characters in the source code include:

! When used as the first nonblank character of a line, causes a row of asterisks (*) to be printed as the output line (this can be suppressed using the K option).

!! When used as the first two characters of a line, causes a page eject after printing the line.

Operation

Logical Structures

BLIST logically indents CASE and multi-line IF statements, and LOOP and FOR-NEXT structures. This makes it easier to follow the flow of the program.

Logical ending statements that do not match the beginning statement are highlighted. For instance, if a structure begins with a FOR statement, it must end with a NEXT statement. If it ends with any other statement (such as END or REPEAT), BLIST highlights the invalid ending statement.

When used with the L option, BLIST prints a dot at each level of indenting, as in the following example:

IF A = 2 THEN
. FOR I = 1 TO 10
. . PRINT I
. NEXT I
END

Comments

Options that affect the indenting of comments (A, C, I and Z) apply only to those beginning with asterisks (*). REM is treated as a normal statement and its indentation is determined by the structure of the code.

Line numbers

BLIST numbers all statement lines. The line numbers correspond to the line numbers supplied by the EDITOR when editing the source code. BLIST also indents all lines except PROGRAM, SUBROUTINE, FUNCTION, STOP, RETURN and program END statements, to allow labelled statements to be "outdented." This makes it much easier to modify the program and to locate labels quickly.

INCLUDE and $CHAIN statements

When DataBasic compiles programs that have INCLUDE and/or $CHAIN statements, the line numbers output in error messages and by the debugger will differ from those in the source code. The M option lets you see both the EDITOR line numbers and the DataBasic line numbers. The first column gives the attribute numbers corresponding to the source code item. The second column gives the line numbers DataBasic uses when compiling and running the program.

If you specify the E option in conjunction with the M option, any INCLUDEd items are expanded in the listing. The same two columns are displayed.

If you use the X option with the E option, a number corresponding to the current level of the INCLUDE statement is displayed in the third column.

BLIST, INCLUDE and $CHAIN do not work with compacted source code.

Examples

Example 1

In the following, items T1, T2 and T3 in file BP contain the following statements:

T1

T2

T3

PRINT "LEVEL 1"
INCLUDE T2 FROM BP
END
PRINT "LEVEL 2"
INCLUDE T3 FROM BP
PRINT "LEVEL 3"

The TCL command BLIST BP T1 (MEX displays the following:

Edit  Bsc
 001  001           PRINT "LEVEL 1"
 002  002   0       *INCLUDE T2 FROM TEST,PAUL
      003   1       PRINT "LEVEL 2"
      004   1       *INCLUDE T3 FROM TEST,PAUL
      005   2       PRINT "LEVEL 3"
 003  006        END
 004  007

Example 2

:BLIST BP ITEM1 (N

Displays ITEM1 from file BP on the terminal without stopping at each page.

Example 3

:BLIST BP ITEM3 (FU

Displays the file-name (BP) in the heading and updates the source program with spaces to reflect logical indenting.

Example 4

:BLIST BP TEST1 (P,100-150

Outputs lines 100 through 150 to the printer.

Example 5

The item TESTPROG contains the following code:

Q = 1
PRINT Q; * Prints the value of Q
FOR I = 1 TO 10
PRINT I*Q
NEXT I
* Executes loop 10 times
END

When you execute the following command:

:BLIST BP TESTPROG (A

the comments are indented to the centre of the screen:

   1       Q = 1
2 PRINT Q; * Prints the value of Q
3 FOR I = 1 TO 10
4 PRINT I*Q
5 NEXT I
6 * Executes loop 10 times
7 END