$include directive

The $include directive inserts FlashBASIC or BASIC code from a separate item (known as an include item) to be compiled as part of the object module of the current program or subroutine. The original source program is not altered.

Syntax

 $include {file.ref} item-ID

Synonym(s)

 include
 $insert
 insert

Parameter(s)

file.ref Specifies the file that contains the item that contains the FlashBASIC or BASIC code to be inserted for compiling.
item-ID Specifies the item that contains the FlashBASIC or BASIC code to be inserted for compiling.

Description

The $include directive is typically used to include an item consisting of common or equate statements, format strings, and executable statements from a single source into several programs.

When the FlashBASIC or BASIC compiler encounters an $include directive, it opens the file specified by file.ref, reads the item, and compiles it into the current program.

Include items contain FlashBASIC or BASIC statements, but need not be a complete FlashBASIC or BASIC program, and it is not necessary to compile them. If an include item is modified, however, all FlashBASIC or BASIC programs that include it must be recompiled.

If file.ref is omitted, the current file is assumed.

There is no limit to the number of $include directives in a program, but only five levels of nesting are allowed.

Note: When statements are included, the corresponding source lines are not visible from the FlashBASIC or BASIC Debugger.

Example(s)

 bp standard.equates.inc
 001 equ stx to char(1)
 002 equ form.feed to char(12)
 003 equ bell to char(7)
 004 equ am to char(254), vm to char(253), svm to char(252)
 005 dim customer.item(25)
 006 open ’customer’ to customer.file else stop 201,’customer’
 007 equ last.name to customer.item(1)
 008 equ first.name to customer.item(2)
 009 equ title to customer.item(3)
  
 bp prog
 001 $include standard.equates.inc
 002 read item1 from customer.file,"01234" else print bell