BlackBerry Forums Support Community               

View Poll Results: Did you find this post usefule
Very Useful 3 75.00%
Useful 0 0%
Somewhat Useful 1 25.00%
Not Useful 0 0%
Voters: 4. You may not vote on this poll

Closed Thread
 
LinkBack Thread Tools
Old 02-23-2009, 08:03 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2008
Model: none
Carrier: sprint
Posts: 24
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up 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
Attached Files
File Type: zip rapc.zip (7.2 KB, 102 views)
Offline  
Old 06-22-2009, 05:51 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2008
Model: none
Carrier: sprint
Posts: 24
Post Thanks: 0
Thanked 0 Times in 0 Posts
Smile Updated version. Now using Java.

I am happy to hear form those who found my utility useful.
I have now decided to update/change this fix.
Last version, was written in C++, and updated the rapc.exe file.
The problem was, that it worked when you compiled using the IDE, as it called rapc.exe, but if you compiled using ANT, it wouldn't work, as bb-ant-tools calls rapc.jar directly without calling rapc.exe.
Therefore I have rewritten the utility in Java, and now it updates rapc.jar
The instructions are the same, just instead of renaming rapc.exe to rapc_original.exe, you now rename rapc.jar to rapc_original.jar. Then you copy the included rapc.jar to the bin folder.
If you have already installed the previous version, then you should undo the changes to rapc.exe, by deleteing rapc.exe, and renaming rapc_original.exe to rapc.exe.
The rapc_defines.ini file remains the same. See the instructions in the previous post.
Attached Files
File Type: zip rapc_java.zip (6.5 KB, 67 views)
Offline  
Old 06-22-2009, 08:58 PM   #3 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Just a dumb question, but what was wrong with the RAPC preprocessor in the first place?
Offline  
Old 06-22-2009, 09:20 PM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2008
Model: none
Carrier: sprint
Posts: 24
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wirelessly posted

We ARE using rapc preprocessor. We are just adding the ability that every version of the compiler should add some defines that identify the compiler version.
That way, the same code can be used in multiple versions, by using some if...else... preprocessor directives. I believe I explained it better in the first post.
Lionscribe
Offline  
Old 09-14-2009, 02:11 PM   #5 (permalink)
New Member
 
Join Date: Sep 2009
Model: Storm
PIN: N/A
Carrier: Verizon
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Awesome

This utility is freaking great! Thanks a lot for posting this, it's helped us out a lot.

I was just wondering if there is any way possible to get Eclipse to recognize this as well? I'm currently using the JDE for 4.1 and the Eclipse plug-in for 4.7 and wanted to be able to switch between the 2 environments. (I'd like to stay away from the 4.7 JDE if at all possible).
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.