compile Command

The compile BASIC program invokes the BASIC compiler and translates the specified source code into executable object code with case-insensitivity.

Syntax

compile file.reference itemlist* {(options}

Synonym(s)

compile.1

Parameter(s)

options

a

Displays object code generated by the BASIC compiler.

b

Turns on array bounds checking when used with the o option level 1-9. Without this option in effect, situations such as array subscripts out of range, which result in a fatal BASIC debugger abort, ignores the condition, possibly resulting in a monitor halt. This option is not necessary when using the o option level 0 (the default), or when not using the o option at all.

c

Compresses the object by suppressing the end-of-line (EOL) opcodes from the object code item. This option is designed to be used with debugged and cataloged programs. Because the EOL opcodes are used to count lines for error messages, any run-time error message in a program compiled with the c option indicates the error is on line 0. Additionally, the c option removes the ability to single-step with the BASIC debugger.

d

Prevents the run-time d option from entering the debugger.

e

Lists only error lines encountered during the compilation of the program. The listing indicates line number in the source code item, the source line itself, and a description of the error associated with the line.

f

When used with the o option, generates floating point arithmetic.

g

For UNIX: Not supported

For Windows: Produces object code that is stored as an MS-DOS file with the extension .D3F.

h

By default, the BASIC compiler attempts to create native code that can be shared by all users. This option forces the module to be loaded locally, and is typically for modules that are being used by only one or two people at any given time. This option is only supported when used with the o option.

i

Lists lines from any included program as part of the listing. If used with the l option, the source program listing, the included lines are indicated by a plus sign after the line number.

k

For Windows: Not supported

For UNIX: When used without the h option, forces shared code to remain loaded until the machine is shut down. This option should be used for those programs that are used by the majority of users on the system. It reduces memory usage and load time.

l

Generates a line-by-line listing of the source program during compilation. Error lines with associated error messages are indicated. When the l option is used, the asterisk does not display. Each line of the listing takes place at the asterisk.

m

Generates a program map of the descriptor table and correlates source code lines to generated object code frames. Each variable in the program is listed along with its decimal offset.

n

No pause (nopage) option suppresses pause at end of page on terminal display.

o

Produces a FlashBASIC optimized code.

NOTE—If any module in a program is compiled with the o option, then all modules in that program must also have been compiled with the o option.

p

Routes all output generated by the compilation, except the cross-reference listing, to the printer, via the spooler.

q

Prevents messages from scrolling past on terminal

s

Suppresses generation of a symbol table. The symbol table is used exclusively by the BASIC/FlashBASIC debugger for reference; therefore, it needs to be kept only if the user uses the debugger.

x

Creates a cross-reference of all the labels and variables used in the BASIC program and stores this information in the bsym file, which must exist before using. The x option first clears data in the bsym file, then creates an item for every variable and label used in the program, using the variable or label name as the item-ID.

After creating the cross-reference items, attribute one contains the line numbers where the variable or label is referenced; each line number is a value. The line number where a label is defined, or where the value of the variable is changed is preceded by an asterisk. If the variable names and labels are in both uppercase and lowercase, the D-pointer for the bsym file-defining item should not have the s option.

w

Optimizes without source when used with the o option. This allows optimizing programs without source code.

NOTE— The normal dictionary object statistics are not updated when this option is used.

y

Allows multiple FlashBASIC or BASIC compiles concurrently. Normally, each BASIC or FlashBASIC compile attempts to set BASIC lock 49 to keep multiple compiles from dramatically slowing down the machine. The y option avoids this logic.

Case-insensitivity means that the variables TOTAL, Total, and total all represent the same symbol. A case-sensitive state would treat these as three separate variables.

Each line of the source program is scanned for syntax errors during compilation, even after an error has been detected.

A period displays for every 10 lines of code.

If an error is encountered, the line with the error and the error message displays; no object code is produced.

If the o option is used, FlashBASIC is invoked after the first stage of compilation is complete. When all stages are completed, and if no errors are found, the compiled form is saved and can be executed using the run command. The program may also be cataloged with the catalog command.

The itemlist* consists of one or more source program names, separated by spaces. If a name is not specified, or if the asterisk is used, all programs in the file are compiled.

Programs can be created and modified using the Update Processor. Additionally, programs can be compiled when exiting the Update Processor by using either the CTRL+XC command, which compiles and catalogs the program, or the CTRL+XR command, which compiles and runs the program. Any other editor can also be used.

For UNIX: The default options can be stored in attribute 6 of the compile item in your master dictionary. For example, putting an o in this attribute makes all compiles in that account produce FlashBASIC code.

WARNING

Compilation with the (o flag may take a long time to compile and tends to use a great deal of the machine’s resources. This problem can be especially acute when using an optimization level greater than one. It is recommended to do large FlashBASIC compiles at off-peak hours.

An error encountered deep within nested logic can produce several screens of erroneous error messages. The actual error is the first message listed.

Example(s)

Compiles the term-type program and sends the listing to the printer.

compile dm,bp, term-type (lp

Creates a BASIC native object module which can be run from D3 as if it were an interpreted BASIC program. The c option is used primarily to reduce object size and compile time, both of which can be significantly greater when using BASIC.

compile bp j (oc

Creates FlashBASIC code for all the FlashBASIC object pointers in bp.old. There is no need to have the source present.

select dict bp.old

[404] 114 items selected from 114 items.

compile bp.old (ow

ct

md

compile

001

VR

 

002

3]9

 

003

F

 

004

dm,bp,

:ccompile

005

 

 

006

o

 

Notice that an o was placed in attribute 6. This command, when invoked, flashes compile programs.

See Also

BASIC, BASIC/FlashBASIC Debugger, c/acct, c/bytes, c/date, c/fid, c/flash, c/options, c/port, c/release, c/size, c/time, c/user, compile-catalog Command, compile-run Command, edit Command, Error Logging, Performance Tips