COMPILE

From Lianjapedia
Jump to: navigation, search

COMPILE ... commands

Purpose

Compile one or more program files

Syntax

COMPILE <filename>| (<expC>) [NOTALK]

See Also

CERROR(), DO, SET PROCEDURE

Description

The COMPILE command translates the source code of the specified program files into object code, and creates a file containing that object code. The object files created by the COMPILE program have the same basename as the program file, but a file extension that ends with an "o". In most cases, the execute-only object code in these files runs much faster than the program files. The gain in speed is dependent on the number and size of the DO WHILE, DO CASE and IF constructs within the program.

Unless the full filename is specified in the <filename> argument, the COMPILE program looks for a file in the current directory and path (see SET PATH) with a .prg extension. COMPILE accepts any file or combination of files that contain source code. You may specify an expression that returns a file name or group of file names, as COMPILE will use all files matching the specified file pattern. The <filename> can be substituted with a <expC>, enclosed in round brackets, which returns a valid filename.

You cannot modify or de-compile an object file; you can only modify the source file. The DO command compares the time and date stamp of a source file with the time and date stamp of its associated object file. If the object file is older than the source file, then DO will recompile the source file before executing it.

If the NOTALK keyword is included, compilation messages are not displayed.

Example

compile *.prg