Skip to main content



      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 06:31 Go to next message
Eclipse UserFriend
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 06:56 Go to previous messageGo to next message
Eclipse UserFriend
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 06:58] by Moderator

Re: Preprocessor question: defined value substitution [message #482390 is a reply to message #482353] Wed, 26 August 2009 08:31 Go to previous messageGo to next message
Eclipse UserFriend
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 08:41 Go to previous message
Eclipse UserFriend
David bows.
Previous Topic:Preprocessor question: defined value substitution
Next Topic:Re: Preprocessor question: defined value substitution
Goto Forum:
  


Current Time: Sat Mar 15 21:12:30 EDT 2025

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

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

Back to the top