|
BASIC |
|
|
The BASIC verb runs the QMBasic compiler.
Format
BASIC {file.name} {record.name...} {options}
where
When using a select list or an asterisk to compile all programs, the default action of the BASIC command is to ignore records with a .H or .SCR suffix. This omits include records that use the conventional .H suffix (header files) or .SCR suffix (screen definitions). The $BASIC.IGNORE record described below allows developers to change the rules of which, if any, records are skipped when using a select list.
Unless the KEEP.OLD.OBJECT mode of the OPTION command is active, any old version of the object code is deleted before the compilation commences. This ensures that developers who accidentally miss a compiler error message will not continue testing with the previous version in the incorrect belief that it is the new version.
The following options are accepted by the BASIC verb
The compiler output file, named as the source file but with a .OUT suffix, will be created automatically if it does not already exist.
@SYSTEM.RETURN.CODE is set to the number of programs successfully compiled. It will contain a negative error code in the event of a fatal error.
Compiling a program signals an event to all QM processes to reload the object code. See the QMBasic CALL statement for full details.
The $BASIC.OPTIONS VOC Record
Compiler options that you wish to use every time you run the QMBasic compiler can be placed in an X-type VOC record named $BASIC.OPTIONS. To apply these defaults only to programs stored in a specific file, place the $BASIC.OPTIONS record in that file. The compiler looks first in the source file and then, if no record has been found, in the VOC.
The first line of the record holds the type code X. The second and subsequent lines of this record should contain compiler option keywords from the list below. The keywords allowed are:
Unrecognised keywords in this record are ignored.
The $BASIC.IGNORE VOC Record
The default action of the BASIC command when using a select list or an asterisk to compile all programs is to ignore source records with a suffix of .H or .SCR. The $BASIC.IGNORE record allows developers to set their own rules controlling which, if any, records will be ignored. As with the $BASIC.OPTIONS record, the $BASIC.IGNORE record may be in the VOC or in the program file.
The first line of the record holds the type code X. The second and subsequent lines of this record contain pattern matching templates that are applied in turn to the source record id. If any of the templates match the source record id, the record is ignored. The default action of the BASIC command is equivalent to having a $BASIC.IGNORE record that contains: 1: X 2: ...'.H' 3: ...'.SCR'
Any record with an id that does not match any of the templates will be compiled. To compile all records, regardless of their name, create a $BASIC.IGNORE record that contains just the type code: 1: X
Examples
BASIC PROGRAMS PROG1 LISTING
This command compiles the program in record PROG1 of the PROGRAMS file. A listing record is produced.
SELECT BP BASIC CHANGED
This sequence of commands compiles all programs in the BP file which have been updated since they were last compiled. Note that the compiler will omit all records with names ending with .H or .SRC, the two standard suffix codes for include records.
See also: |