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

Functions

  • Defined() - check wether there is a constant or a symbol defined.
  • lo8() resp. low() - Low-Byte of a 16-Bit-value
  • hi8() resp. high() - High-Byte of a 16-Bit-value
  • 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.