Editing and Listing the Source Code

The source code of the program is written and edited by the programmer as an item in the program file.

The only restriction to the name of the program is that it not be the same as the name of the file (e.g., item BP in file BP). Such a program will not compile: if it did, the data file pointer in the file dictionary would be overwritten when the program was compiled, and all source code would be lost.

The source code can be created and edited with the Editor or with DocuMentor, a full screen editor. See the Editor User Reference Guide section for more information about the Editor.

Listing the Program with BLIST

The BLIST command produces a formatted listing of the source code item.

Format

BLIST filename progname-list [(options)]

Parameter(s)

filename

Name of a file that contains mvBASIC programs

progname-list

Contains the item-IDs of the programs to be printed.

Description

An asterisk (*) specifies all programs in the file. BLIST, unlike most other commands, sends output to the printer by default. Use the T option to BLIST to force output to the terminal screen. To send a program MENU to the screen, type:

>BLIST BP MENU (T)

The screen is cleared and the text of MENU is printed:

DD MMM YYYY       BASIC PROGRAM NAME:   MENU                   PAGE    1

0001      LOOP

0002        PRINT "Q FOR QUIT, C FOR CREATE A NEW ENTRY, "

0003        PRINT "E FOR EDIT A ENTRY, D FOR DELETE AN ENTRY"

0004          PRINT

0005          PRINT "ENTER A CHARACTER (Q,C,E OR D)":

0006          INPUT ANSWER,1_

0007        ON INDEX("QCED",ANSWER,1) GOSUB 100,200,300,400

0008     REPEAT

0009     STOP

0010     SUBROUTINES

0011 100 *** SUBROUTINE FOR QUITTING ***

0012     PRINT "--EOJ"

0013     STOP

0014     RETURN

0015 200 *** SUBROUTINE FOR CREATING A NEW ENTRY ***

0016     PRINT "CREATING A NEW ENTRY..."

            .

            .

   

            .

The program line numbers are shown, and the text prints with an indent of 5 spaces. The text between THEN or ELSE clauses and corresponding END statements are indented another 3 spaces, as is the text between program loops. Note that alphanumeric statement labels are also indented, although numeric statement labels are not.

The D option to BLIST specifies that the lines should be double-spaced. In addition, a range of lines in the program can be specified.

The default indents used by BLIST are changed by editing line 4 of the Verb Definition item in the Master Dictionary.

See Also

Creating mvBASIC Programs

Creating the Program File

Compiling the Program

Running the Program

Cataloging the Program

A Sample Program