Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Mobile Tools for Java (MTJ) » Preprocessor question: defined value substitution
Preprocessor question: defined value substitution [message #482346] Wed, 26 August 2009 10:31 Go to next message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
Hi. I'm am trying to do something that I supposed that the preprocessor would do, but I am not sure if this behaviour is implemented.

I know the code would seem dumb, but is just for making the post short.


//#define ROWS = 10

int Rows = ROWS


It gives me errors because ROWS is not defined.


Regards.

David Lucena.
Re: Preprocessor question: defined value substitution [message #482353 is a reply to message #482346] Wed, 26 August 2009 10:56 Go to previous messageGo to next message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
Looking at the antenna preprocessor source code I have found something and I've tested it. Its something limited, but works.

You will define your symbol somewhere

//#define ROWS = 10


And to recover its value and assing it:

int Rows;
//#expand Rows = %ROWS%;


That has its limitations, as you cannot do things like:

CreateRows( #expand %ROWS% );


But instead you have to do:

int Rows;
//#expand Rows = %ROWS%;
CreateRows( #expand %ROWS% );



Anyone has gone deep in the preprocessor? Maybe I'll try the antenna documentation, now that I remember.



Edited: I should had take a look to the antenna documentation. It is just I forget that preprocessor is the antenna, not the MTJ... Sorry.

[Updated on: Wed, 26 August 2009 10:58]

Report message to a moderator

Re: Preprocessor question: defined value substitution [message #482390 is a reply to message #482353] Wed, 26 August 2009 12:31 Go to previous messageGo to next message
Diego Madruga Sandin is currently offline Diego Madruga SandinFriend
Messages: 116
Registered: July 2009
Senior Member
Quote:

The preprocessor supports the following directives inside a Java source file. All directives follow a "//" comment that starts at the beginning of a line (whitespace is allowed left of them, but no Java code). That way, they don't interfere with normal Java compilation. Directives must not span multiple lines of code. In addition, whitespace is allowed between the // and the # of the directive to maintain preprocessor commands validity after eclipse source formatting.



From antenna proprocessor documentation

I believe the correct to declare what you want is:

//#expand  CreateRows( %ROWS% ); 


Re: Preprocessor question: defined value substitution [message #482391 is a reply to message #482390] Wed, 26 August 2009 12:41 Go to previous message
David Lucena is currently offline David LucenaFriend
Messages: 74
Registered: August 2009
Member
David bows.
Previous Topic:Preprocessor question: defined value substitution
Next Topic:Re: Preprocessor question: defined value substitution
Goto Forum:
  


Current Time: Sat Apr 20 08:42:33 GMT 2024

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

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

Back to the top