1. PreProcessor & EXE-Compiler

<< Click to Display Table of Contents >>

Navigation:  2. Components > 1. PreProcessor & EXE-Compiler >

1. PreProcessor & EXE-Compiler

#INC: - Preprocessor-File Include  

Previous Top Next


Preprocessor-Directives

 

#INC

Preprocessor File-Include

 

 

Intention

 

This Preprocessor-Directive will insert Code from a file  at the Place where it occurs.

It can occur many times in the Skript and can even be used recursively.

 

#INC: is a preprocessor command, to include code-lines or complete files into your Scripts.
These can be your personal MACROS or variable definitions into your script. The inclusion of the file will be done immediately and on the lowest level.

The rest of the script will not see any difference between, if the file was included or if it had been pasted. It will be like the file plus the inclusions is one large file.

 

Normally, if you want to call a "SubScript" you would call JNF. at runtime. In that case you can use system local variables and the systen local stack. #INC is very different from that. It just mixes the the files into one file before they really get processed.

 

Assume that you have several MACRO packages that you want to load into your script, using #INC:. You can even nest as many #INC:'s to unlimited depth on your own risk.

 

What if each of the packages calls a main-package with your own, general definition?

How can you prevent, that a file with Macro-Definition (or any other) is included several times?

 

This can be done unsing the #ONCE ... #OEND Option. This way you can be sure that any package with definition is just loaded once.

 

If you want to run your files as compiled Stand-Alone executable, make sure that all needed scriptfiles are being included into the executable package. For this you will need the compile-time command '#INC:. It looks similar but is something else!

 

Important note:

Do not intermix the Preprocessor-File-Include #INC: with the Compile time command '#INC:. The later will include files int othe executable package. While looking similar, these are two very different animal. The difference is the small " ' " comment operator. If its missing, we have the preprocessor-file include. If the comment-sign is there, its a compile.time command!

 

To learn more about the compile time command '#INC: see

2.1.8 '#INC: - Include Files and Folders into the Executable

 

Hint: Use this command together with the 2.1.A #LIB: - User-Library Path command. You can #INC: directly from the User-Library.

       Also note that all ".mrt"-files that are included with the #INC: directive can be encrypted using the '#CRY: - directive.

 

 

 

 

Syntax:

 

#INC:P1

 

P1 - Filename including path to the file. If you want to run the script as Standalone "EXE" File, you should copy the file to the project folder, that is the folder where the script itself is.

 

 

Example:

 

For this example we need two files.The Main file, we want to execute/compile. And the Macro file that we want to include.

 

' Main-File

 

DBM.1

#INC:Macros.mrt

: §§VAL=5

' Here we check only the lower bound

%Check_Bounds §§VAL|6

PRT. First Result is §§VAL

MBX. Ready

ENR.

 

 

' This is the additional file,

' which is included.

'

' The Macro checks parameter 1 against

' parameter 2 as Lower Bound.

' if parameter 3 is available, parameter 1 will be

' checked against parameter 3 as upper bound

'

: %Check_Bounds 2

IVV.§§§01<§§§02

 : §§§01=§§§02

EIF.

#IF PARAMS>2

IVV.§§§01>§§§03

 : §§§01=§§§03

EIF.

#ELS

PRT.Nur ein Parameter

#EIF

PRT.Hallo

END%

 

 

 

Remarks:

 

All Commands starting with a "#" are Preprocessing Commands. These commands are used by the built-in preprocessor to change the code before execution.

These commands will not be available in the code at runtime. These commands have no access to Variables and Runtime Resources. These commands will influence the code before it is actually starting.

When compiling an executable, the editor tries to include the filename after #INC: automatically into the package. If no path is given, "?path\" is assumed to be the location of the script file. Therefore its best practice to have the include-files in the same folder as the Main script file.

 

 

Limitations:

-

 

 

See also:

 

  : - MACRO-Definitions

#ONCE / # OEND

  2.1.A #LIB: - User-Library Path

2.1.8 '#INC: - Include Files and Folders into the Executable

! Smarty's Preprocessor

1.1 #INC: - Pre-Processor File-Include

1.2 #ONCE / # OEND - Multiple Include Protection

1.8 : - MACRO-Definitions

1.4 #IF ... #EIF - Decisions in Macros