After reading this thread i finally sat down and thought about how to get preprocessing with the least amount of work.
I ended up using OllyDbg on BCC and eventually patched it to pass any bmx file through a preprocessor before compilation, and it works!
The beauty of this hack, is that all the other tools are oblivious to its existence, so they should work without modification.
And it wasn't much work once i figured out how, BRL could probably do it cleaner though. ;)
I made this for Windows btw. The code itself should work on the other platforms, but the patch is windows specific as its all i have access to.
If anyone is feeling adventuress, heres how to try it out:
Before you mess with your blitz install, please take a backup of the entire bin directory just in case.
Since this is a binary patch it only works on BCC v1.28.
Download the patch bcc_ppc_patch.delta3
(you need xdelta3 to apply the patch.)
Then copy the file to "C:\Program Files\BlitzMax\bin"
How to apply the patch. Open a new console window and enter this:
Then you need to set a system wide environment variable with your preferred preprocessor.
The executable must be in a folder on the path.
To disable preprocessing delete the environment variable.
Note that a temporary file ppc.out is created in the working directory, it can safely be deleted when the compilation is done.
Heres how i use M4 as my preprocessor. I had to use a batch file, as m4 doesn't seem to have an output switch:
bccppc.cmd
And finally a test blitz source to check if M4 is working properly:
Have fun! =)
I ended up using OllyDbg on BCC and eventually patched it to pass any bmx file through a preprocessor before compilation, and it works!
The beauty of this hack, is that all the other tools are oblivious to its existence, so they should work without modification.
And it wasn't much work once i figured out how, BRL could probably do it cleaner though. ;)
I made this for Windows btw. The code itself should work on the other platforms, but the patch is windows specific as its all i have access to.
If anyone is feeling adventuress, heres how to try it out:
Before you mess with your blitz install, please take a backup of the entire bin directory just in case.
Since this is a binary patch it only works on BCC v1.28.
Download the patch bcc_ppc_patch.delta3
(you need xdelta3 to apply the patch.)
Then copy the file to "C:\Program Files\BlitzMax\bin"
How to apply the patch. Open a new console window and enter this:
cd "C:\Program Files\BlitzMax\bin" ren bcc.exe bcc.exe.backup xdelta3 -d -s bcc.exe.backup bcc_ppc_patch.delta3 bcc.exe
Then you need to set a system wide environment variable with your preferred preprocessor.
BCC_MODE = program "%s" "%s"The first %s is the INPUT, the second is the OUTPUT (they are replaced later by bcc).
The executable must be in a folder on the path.
To disable preprocessing delete the environment variable.
Note that a temporary file ppc.out is created in the working directory, it can safely be deleted when the compilation is done.
Heres how i use M4 as my preprocessor. I had to use a batch file, as m4 doesn't seem to have an output switch:
bccppc.cmd
@echo off m4 %1 > %2 rem or if you prefer gcc rem gcc -E -P -C -x c -nostdinc %1 > %2
BCC_MODE = bccppc.cmd "%s" "%s"
And finally a test blitz source to check if M4 is working properly:
define( MESSAGE, "Hello World!") Framework BRL.StandardIO Print MESSAGE
Have fun! =)