Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Real-Time Software Components (RTSC) » #ifdef for .cfg files?
#ifdef for .cfg files? [message #677492] Wed, 08 June 2011 12:49 Go to next message
Brian Cruickshank is currently offline Brian Cruickshank
Messages: 19
Registered: September 2009
Junior Member
Is there any way to conditionally enable entries in a .cfg file? e.g. something along the lines of the following would be useful:

#ifdef ENABLE_LOAD_MONITORING
Load = xdc.useModule('ti.sysbios.utils.Load');
Load.taskEnabled = true;
Load.hwiEnabled = false;
#endif

with ENABLE_LOAD_MONITORING defined in e.g. the build settings or some external file.

Regards,
Brian
(no subject) [message #677547 is a reply to message #677492] Wed, 08 June 2011 15:27 Go to previous messageGo to next message
Dave Russo is currently offline Dave Russo
Messages: 172
Registered: July 2009
Senior Member
..cfg files are JavaScript files interpreted by the Rhino JavaScript
engine.

So, while there is no #ifdef, you have the full power of JavaScript
if/then/else as well as the ability to get environment variables or read
files via java.

For example,
if (java.lang.System.getenv("ENABLE_LOAD_MONITORING")) {
:
}

See http://rtsc.eclipse.org/docs-tip/The_XDCscript_Language and
http://rtsc.eclipse.org/docs-tip/The_XDCscript_Language#The_environment__and_arguments_objects
for details.

On 6/8/2011 9:49 AM, Brian Cruickshank wrote:
> Is there any way to conditionally enable entries in a .cfg file? e.g.
> something along the lines of the following would be useful:
>
> #ifdef ENABLE_LOAD_MONITORING
> Load = xdc.useModule('ti.sysbios.utils.Load');
> Load.taskEnabled = true;
> Load.hwiEnabled = false;
> #endif
>
> with ENABLE_LOAD_MONITORING defined in e.g. the build settings or some
> external file.
>
> Regards,
> Brian
Re: #ifdef for .cfg files? [message #681740 is a reply to message #677492] Thu, 09 June 2011 14:32 Go to previous message
Brian Cruickshank is currently offline Brian Cruickshank
Messages: 19
Registered: September 2009
Junior Member
Cool! Thank you!
Previous Topic:problem when using filter for linking
Next Topic:Non-trivial package.bld examples?
Goto Forum:
  


Current Time: Fri Jul 25 12:11:36 EDT 2014

Powered by FUDForum. Page generated in 0.02086 seconds