docs: add section about compiler directives
This commit is contained in:
parent
0c88ed8bf3
commit
ead5758efd
1 changed files with 64 additions and 0 deletions
|
|
@ -135,3 +135,67 @@ var c:char;
|
|||
...
|
||||
|
||||
```
|
||||
|
||||
## Compiler Directives
|
||||
|
||||
Tridora-Pascal understands a small number of compiler directives which are introduced as usual with a comment and a dollar-sign. Both comment styles can be used.
|
||||
All directives use a single, case-sensitive letter.
|
||||
|
||||
### Include (_I_)
|
||||
The _Include_ directive reads another source file at compile time. Includes can be nested (that is, an included file can include other files). After the directive letter _I_,
|
||||
a string must be specified that indicates the file name.
|
||||
|
||||
Example:
|
||||
```
|
||||
program includetest;
|
||||
|
||||
{$I 'morestuff.pas'}
|
||||
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
The compiler looks for the file first on the default volume, then on the _SYSTEM_ volume. The file name must be enclosed in single quotes.
|
||||
|
||||
If the file name contains a _+_ character, the string 'tdr' is inserted after that _+_ character. This is used for compiling the cross-compiler.
|
||||
FPC will use the original filename, Tridora Pascal will use the name with 'tdr' inserted.
|
||||
|
||||
### Set Heap Size (_H_)
|
||||
Sets the heap size for the compiled program. After the directive letter _H_, an integer must be specified that represents the heap size
|
||||
in kilobytes. The default value is 256.
|
||||
|
||||
The directive must appear before the _program_ keyword to have an effect.
|
||||
|
||||
Example:
|
||||
```
|
||||
{$H 800}
|
||||
program bigHeap;
|
||||
|
||||
...
|
||||
|
||||
```
|
||||
### Set Stack Size (_S_)
|
||||
Sets the stack size for the compiled program. After the directive letter _S_, an integer must be specified that represents the stack size
|
||||
in kilobytes. The default value is 16.
|
||||
|
||||
The directive must appear before the _program_ keyword to have an effect.
|
||||
|
||||
Example:
|
||||
```
|
||||
{$S 128}
|
||||
program deepRecursion;
|
||||
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
### Ignore Rest of Line (_!_)
|
||||
This directive is a hack to make the Tridora compiler ignore directives meant for other compilers. Used for compiling the cross-compiler.
|
||||
|
||||
This directive uses the character _!_. After this directive, the rest of the line is not parsed. The closing comment is still required.
|
||||
|
||||
Example:
|
||||
```
|
||||
{$!}uses math,crt;
|
||||
```
|
||||
In this example, the line is ignored by the Tridora compiler but FPC will parse it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue