Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Real-Time Software Components (RTSC) » #ifdef for .cfg files?
#ifdef for .cfg files? [message #677492] Wed, 08 June 2011 16:49 Go to next message
Brian Cruickshank is currently offline Brian CruickshankFriend
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 19:27 Go to previous messageGo to next message
Dave Russo is currently offline Dave RussoFriend
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 18:32 Go to previous message
Brian Cruickshank is currently offline Brian CruickshankFriend
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 Sep 20 12:15:47 GMT 2024

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

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

Back to the top