BLIST

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

Note: BLIST cannot be used with old source compacted programs.

Syntax

BLIST file-specifier item-list {(options}

Syntax Elements

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

item-list Lists the item(s) you want displayed. Omit if supplied by an immediately-preceding list-generating command.

Options

A Indents comment lines beginning with an asterisk (*) to the middle of the page when listed (BLIST does not recognize REM comments).

B Sets the number of blanks per indent level (default = 3; maximum = 5). When you specify the B option, the prompt INDENT VALUE:  is displayed. Type the number of blanks per logic level indentation.

C Keeps all comment line indents on the left margin. That means that there are six blanks between the line number column and the code including comment lines. 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 listing's 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 point (!) is encountered at the beginning of a source code line.

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

M Prints DataBasic line numbers for INCLUDEd and $CHAINed items (without expand). 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 with logical indenting. Logical formatting can then be seen when you edit the program with the EDITOR. The new format does not affect compilation.

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

Z Cancels indentation for comment lines. Must be used with the C option. The Z option has no effect used by itself.

n{-m} Begins output with line n {through line m}. 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.

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 STOP, RETURN and program END statements, to allow labeled statements to be "outdented." This makes it much easier to modify the program and to locate labels quickly.

Logical Structures

The L option performs logical indenting of CASE and multi-line IF statements, and of LOOP and FOR-NEXT structures. This makes it easier to follow the flow of the program.

BLIST also flags any logical structure's ending statement that does not match the beginning statement. 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 flags the invalid ending statement.

The L option 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

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

In the following examples, programs T1, T2 and T3 are assumed to 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 1

:BLIST BP FILE1 (N

Displays FILE1 on the terminal without stopping at each page.

Example 2

:BLIST BP FILE3 (FU

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

Example 3

:BLIST BP TEST1 (P,100-150

Outputs lines 100 through 150 to the printer.

Example 4

The program 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

After you execute the following command:

:BLIST BP TESTPROG (A

the program now looks like this:

 001       Q = 1
 002       PRINT Q, * Prints the value of Q
 003       FOR I = 1 TO 10
 004          PRINT I*Q
 005       NEXT I
 006                                            * Executes loop 10 times
 007    END

Go to top button