====== Preprocessing ====== Many programming languages feature a preprocessor that processes macros, allows conditional compilation based on certain criteria, etc. XC=BASIC doesn't have a preprocessor, but you can use a third-party (generic) preprocessor as part of your toolchain. This guide guide advises using [[https://logological.org/gpp|GPP, a general-purpose preprocessor]]. ===== Using GPP with XC=BASIC ===== To run GPP before the input is passed to XC=BASIC, you can use piping: gpp -n source.bas | xcbasic3 /dev/stdin result.prg What it does is call GPP first, then pass its output to XC=BASIC that does the rest. ===== Examples ===== The simplest example is defining a macro and creating a conditional block: REM #define TARGET c64 REM #ifeq TARGET plus4 CONST BGCOLOR = $FF15 REM #else CONST BGCOLOR = $D021 REM #endif POKE BGCOLOR, 0 To make code more readable and not to confuse your syntax highlighter, is it advised that you put preprocessor metacommands in XC=BASIC comments, like in the example above.