Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Mobile Tools for Java (MTJ) » Boolean clauses in preprocessor directives
Boolean clauses in preprocessor directives [message #481281] Thu, 20 August 2009 10:49 Go to next message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
I am trying to use the preprocessor like the C preprocessor, but I fail.

I've read that boolean clauses ( && and || ) can be used, but this does not work:

//#ifdef DEFINED_VALUE && (DEFINED_VALUE == 2)
//#else
//#endif



How can I make it work?

Thank you.

[Updated on: Thu, 20 August 2009 11:03]

Report message to a moderator

Re: Boolean clauses in preprocessor directives [message #481286 is a reply to message #481281] Thu, 20 August 2009 11:05 Go to previous messageGo to next message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
I think i found a workaround.

//#if (DEFINED_VALUE) && (DEFINED_VALUE == 2)
//#else
//#endif



The code above seems to work. Is that the correct way of doing it?
Re: Boolean clauses in preprocessor directive s [message #481293 is a reply to message #481286] Thu, 20 August 2009 12:00 Go to previous messageGo to next message
Diego Madruga Sandin is currently offline Diego Madruga SandinFriend
Messages: 116
Registered: July 2009
Senior Member
Hi David,

You can check this on our documentation
http://help.eclipse.org/galileo/topic/org.eclipse.mtj.doc.us er/html/tasks/preprocessProject.html
about preprocessing or you can use the one on the Antenna Preprocessor
page: http://antenna.sourceforge.net/wtkpreprocess.php

Cheers
Diego
Re: Boolean clauses in preprocessor directive s [message #481301 is a reply to message #481293] Thu, 20 August 2009 12:42 Go to previous messageGo to next message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
Yes, I've already read the documentation, and not only it seems that #ifdef, #ifndef does not accept added complexity, but moreover one cannot define a variable to have a value.

Why cannot I have
#define VALUE "true"


when I can do it throught the project properties?


About the ant preprocessor... I don't know if it can be used "silently" like MTJ does. If it is possible, then I'll take a look.


Thanks for you answer.
Re: Boolean clauses in preprocessor directives [message #481313 is a reply to message #481301] Thu, 20 August 2009 13:11 Go to previous messageGo to next message
Diego Madruga Sandin is currently offline Diego Madruga SandinFriend
Messages: 116
Registered: July 2009
Senior Member
Hi David,

MTJ uses antenna preprocessor behind the scenes. So, every thing that goes
with antenna preprocessor backend v3 should be supported by MTJ.

About )#define VALUE "true") if I'm not mistaken, the correct syntax is

#define VALUE=true

Cheers,
Diego
Re: Boolean clauses in preprocessor directives [message #481362 is a reply to message #481313] Thu, 20 August 2009 15:58 Go to previous messageGo to next message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
Yes Diego, you're right about the #define issue. I got that solution before reading your message but forgot to post it here.

Thanks for the response anyway, and thanks for the information about the ant task.
Re: Boolean clauses in preprocessor directive s [message #576061 is a reply to message #481286] Thu, 20 August 2009 12:00 Go to previous messageGo to next message
Diego Madruga Sandin is currently offline Diego Madruga SandinFriend
Messages: 116
Registered: July 2009
Senior Member
Hi David,

You can check this on our documentation
http://help.eclipse.org/galileo/topic/org.eclipse.mtj.doc.us er/html/tasks/preprocessProject.html
about preprocessing or you can use the one on the Antenna Preprocessor
page: http://antenna.sourceforge.net/wtkpreprocess.php

Cheers
Diego
Re: Boolean clauses in preprocessor directive s [message #576088 is a reply to message #481293] Thu, 20 August 2009 12:42 Go to previous messageGo to next message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
Yes, I've already read the documentation, and not only it seems that #ifdef, #ifndef does not accept added complexity, but moreover one cannot define a variable to have a value.

Why cannot I have

#define VALUE "true"

when I can do it throught the project properties?


About the ant preprocessor... I don't know if it can be used "silently" like MTJ does. If it is possible, then I'll take a look.


Thanks for you answer.
Re: Boolean clauses in preprocessor directives [message #576108 is a reply to message #576088] Thu, 20 August 2009 13:11 Go to previous messageGo to next message
Diego Madruga Sandin is currently offline Diego Madruga SandinFriend
Messages: 116
Registered: July 2009
Senior Member
Hi David,

MTJ uses antenna preprocessor behind the scenes. So, every thing that goes
with antenna preprocessor backend v3 should be supported by MTJ.

About )#define VALUE "true") if I'm not mistaken, the correct syntax is

#define VALUE=true

Cheers,
Diego
Re: Boolean clauses in preprocessor directives [message #576130 is a reply to message #481313] Thu, 20 August 2009 15:58 Go to previous message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
Yes Diego, you're right about the #define issue. I got that solution before reading your message but forgot to post it here.

Thanks for the response anyway, and thanks for the information about the ant task.
Previous Topic:Boolean clauses in preprocessor directives
Next Topic:Bug in MTJ preprocessor documentation
Goto Forum:
  


Current Time: Tue Mar 19 05:25:48 GMT 2024

Powered by FUDForum. Page generated in 0.02785 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top