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
 
Thread Tools
Old 02-23-2009, 08:03 PM   #1
lionscribe
Knows Where the Search Button Is
 
Join Date: Feb 2008
Model: none
Carrier: sprint
Posts: 24
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, 04:51 PM   #2
lionscribe
Knows Where the Search Button Is
 
Join Date: Feb 2008
Model: none
Carrier: sprint
Posts: 24
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, 07:58 PM   #3
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Just a dumb question, but what was wrong with the RAPC preprocessor in the first place?
Offline  
Old 06-22-2009, 08:20 PM   #4
lionscribe
Knows Where the Search Button Is
 
Join Date: Feb 2008
Model: none
Carrier: sprint
Posts: 24
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, 01:11 PM   #5
aluo
New Member
 
Join Date: Sep 2009
Model: Storm
PIN: N/A
Carrier: Verizon
Posts: 1
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Unifi Talk UVP Touch VOIP IP Phone Unlocked picture

Unifi Talk UVP Touch VOIP IP Phone Unlocked

$139.99



Vtech ErisTerminal VSP861 Touchscreen Color Desktop - Voice-Over-IP VOIP Phone picture

Vtech ErisTerminal VSP861 Touchscreen Color Desktop - Voice-Over-IP VOIP Phone

$14.99



Cisco CP-8811-K9 Unified Office IP VoIP PoE Business Phone w/ Stand & Handset picture

Cisco CP-8811-K9 Unified Office IP VoIP PoE Business Phone w/ Stand & Handset

$14.99



"NEW" RingCentral Polycom VVX 311 6-Line VoIP IP SIP Business Media Phone

$12.95



Allworx Verge 9312 Voip IP Color Display Phone 8113120 Gigabit & Backlit picture

Allworx Verge 9312 Voip IP Color Display Phone 8113120 Gigabit & Backlit

$199.00



VoIP-GSM Topex VoiBridge picture

VoIP-GSM Topex VoiBridge

$250.00







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