Solution: JDE Preprocessor Defines
Please Login to Remove!
If you have been reading the forums lately, you will see that there is a demand for adding preprocesser defines in the JDE, so that the same file can be used in multiple OS versions.
RIM added defines in the 4.7 JDE, and in reality it was there earlier, but the problem is that the defines are in the JDP file, so you cannot use the same JDP file for the seperarte compiles. The best would be if the compiler would add its own define, as is in most other compilers.
Well, I have figured out a way to do this and I am hereby posting my solution.
I have created a replacement rapc.exe file, which calls the original rapc.exe file, with the added defines. The defines are defined in a seperate text file, within each compilers folder.
The following are the instructions:
In each 'bin' folder in the Blackberry JDE compiler, do the following;
1. Rename the file "rapc.exe" to "rapc_original.exe". Do not delete it or rename it differently, as it is used internally!
2. Copy the included "rapc.exe" & "rapc_defines.ini" files to the folder.
3. Edit the "rapc_defines.ini" to reflect the current version.
Well that's it.
Now to use the preprocessor, just add the line
//#preprocess
as the first line in any file you want to preprocess.
Then any line which is compile dependant use the following synthax:
//#ifdef OS_COMPILE_ATLEAST_4_20
obj = new Class4.2 type
//#else
obj = new Class4.0 type
//#endif
I have included the source code (c++), and I hope you will improve on it.
I hope I have been clear, and I am waiting for your comments,
Lionscribe
|