Preprocessor (Luna-Sourcecode)
The preprocessor is a part of the compiler, which prepares the source code for the compile and assemble process. There are two preprocessors in the luna-compiler. One for the Luna-Source and one for the Assembler-Source.
The following parts will be processed by the preprocessor:
- dissolve arithmetic and logic expressions with constants.
- conditional in-/exclusion of sourcecode parts.
- inclusion of external sourcecode and data files
- replacing of defines/macros in the sourcecode.
- processing of inline functions.
Preprocessor functions in the luna sourcecode
Directives
- #Define - Defines/Aliases.
- #Undef - Remove a Define.
- #pragma, #pragmaSave, #pragmaRestore, #pragmaDefault - control compiler-internal processes
- #If-#else-#endif - conditional compilation.
- #select-#case-#default-#endselect - conditional compilation.
- #macro - Macros
- #Include - includes sourcecode.
- #IncludeData - includes binary data into the flasch.
- #Library - Import a external library.
- #cdecl, #odecl, #idecl - parameter definition for implicit calls.
- #error - Put a error message (interrupts the compile process).
- #warning - Put a warning message.
- #message - Put a info message (without line number and origin).
Functions
- Defined() - check wether there is a constant or a symbol defined.
- byte1() - 1. Byte of a 32-Bit-value
- byte2() - 2. Byte of a 32-Bit-value
- byte3() - 3. Byte of a 32-Bit-value
- byte4() - 4. Byte of a 32-Bit-value
- byte() - Typecasting into an 8-Bit-Integer.
- word() - Typecasting into a 16-Bit-Integer.
- integer() - Typecasting into a signed 16-Bit-Integer.
- long() - Typecasting into a 32-Bit-Integer.
- longint() - Typecasting into a signed 32-Bit-Integer.
- single() - Typecasting into a signed 32-Bit-Float.
- float() - Typecasting into a signed 32-Bit-Float.
- odd() - check wether the value is odd.
- even() - check wether the value is even.
- chr() - conversion into binary string (byte).
- mkb() - conversion into binary string (byte).
- mki() - conversion into binary string (integer).
- mkw() - conversion into binary string (word).
- mkl() - conversion into binary string (long).
- mks() - conversion into binary string (single).
- strfill() - fill string with string.
- hex() - conversion into hexadecimal notation.
- str() - conversion into decimal notation.
- bin() - conversion into binary notation.
- asc() - conversion of the first character of a string into its numeric equivalent.
- min() - arithmetic function.
- max() - arithmetic function.
- format() - formatted, numeric decimal notation.