Compiler Directive: Insert
A compiler directive is a non-executable statement that tells the compiler to perform a certain operation. In SiMPLE, compiler directives are similar to keywords in that they always begin with an upper-case letter.
As its name implies, Insert allows you to temporarily insert blocks of pre-defined text anywhere in your source listing file (just as if you had copied and pasted them into there by hand).
The Insert compiler directive is now somewhat obsolete, having been replaced in favor of the Append compiler directive. But it is still available for anyone who wishes to use it.
The general form for using Insert is:
Insert path
where path specifies the path to the text file which is to be inserted.There is no limit to the number of Insert statements that a program can have.
Using SiMPLE's Global Library
Can't decide where to store your text inserts? Just use SiMPLE's Global library. The path to the library is: \SiMPLE\LIBRARY\ (Or you can use the "$" character as a shorthand representation for "\SiMPLE\LIBRARY\")
An Example
As an almost trivial example of using
Insert,
let's first create the following text file (which we will name "LETTERS.TXT") in the
Global library:
Display "DEF"
Display "GHI"
Next, create and run the following separate program:
Display "ABC"
Insert $LETTERS.TXT
Display "JKL"
You will see that the end result is the same as if you had written:
Display "ABC"
Display "DEF"
Display "GHI"
Display "JKL"
all as a single listing.
Note: The entire path name is case insensitive, and it is not necessary to include the ".TXT" extension when specifying the name of the text file. If an extension is not specified, it is assumed to be ".TXT". However, the name that you choose must be no more than eight alpha-numeric characters in length (not counting the extension). No spaces are allowed anywhere in the name.
Some Final Words...
An Insert does not actually modify your copy of the source listing. The inserted text is brought in just long enough to compile your program, and then your listing is restored to its original form.
It is also important to understand that Inserts can not be cascaded. This means that the Insert compiler directive can appear only in the text file that contains the listing for the main program (and not in any of the text files that are being inserted).
Suggestion: If you plan to make heavy use of the
Insert
compiler directive, you might want to keep your "insertable" files separate from your
"appendable" files in the Global library.
To do so, just create a new separate folder (let's name it "Inserts")
in the Global library. Then, to conveniently
Insert
a file (such as "myinsert.txt") from that folder, you could specify:
Insert $Inserts\myinsert
[
Webmaster |
FAQ's |
Home Page |
Contact Us ]