Preprocessor
- Source: https://www.freebasic.net/wiki/wikka.php?wakka=ProPgPreprocessor
- Last revised: 2021-09-22
The Preprocessor performs some processing on source code before the next step of compilation.
The preprocessor is a program that parses a text file and makes it submit to certain transformations.
These transformations can be the inclusion of a file, the deletion of a text block or the replacement of a text block.
The preprocessor performs these operations through specific commands that it reads in the file being scanned.
It is automatically called by the compiler, before compilation, to process the files to compile.
Preprocessor commands
All preprocessor commands begin at the beginning of the line with the pound sign ("#").
See 'Preprocessor commands' to get all commands that control the preprocessor.
The main types of commands are the followings:
- File inclusion:
- Text replacement:
- Compilation constants and conditional compilation:
- Macros:
- Other commands:
Example
Example with #include and #define:
start GeSHi
#include "vbcompat.bi"
#define TEMPLATE "hh:mm:ss yyyy/mm/dd"
Dim As String * Len(TEMPLATE) hour_date
hour_date = Format(Now, TEMPLATE)
Print hour_date, "(" & TEMPLATE & ")"
Sleepend GeSHi
See also
Back to DocToc