A CoolBasic preprocessor.
- C-like macro flags and conditional compilation
- recursive macro expansion
- useless debugging features (
#pragma dumbdebug
)
Requires Python 3.x to run, 3.3 recommended.
- Install Python.
- Extract the hacked editor & compilation scripts to your CoolBasic directory.
- Clone this repository to IDE/cbpp, so cbpp.py can be located at IDE/cbpp/cbpp.py.
- Add your python executable location to IDE/pythonpath (the file needs to be created). The file has to contain just one line: the full name of the python exe, e.g. C:\Python33\python.exe.
You can now compile your source code as usual from the CoolBasic editor.
#define BANANA
#ifdef BANANA
print "banaani lienee määritelty"
#endif
#ifndef BANANA
print "no fruit"
#else
print "yummy"
#endif
#define SQUARE(_a) (_a * _a)
print "5^2 = " + SQUARE(5)
Please note that the macro parameter names shouldn't occur in the macro expansion, in other words, this is illegal:
#define TUPLAT(luku) (luku+luku)
luku = 10
luku2 = TUPLAT(luku) // stupid preprocessor gets stuck in an infinite loop
This software is released under the MIT License, see COPYING for details.