jsmacro icon indicating copy to clipboard operation
jsmacro copied to clipboard

Support for boolean operator for ifdef / ifndef

Open ZeeD opened this issue 10 years ago • 1 comments

As far as I know, at the moment there is no way to enable a section of code if two or more variables are defined.

let's say I want to have a generic "DEBUG" compilation mode wich, if enabled, automatically "enable" the logs, enable some UI modifications, etc. I also want some more fine grained variables; something along the lines of ENABLE_LOGS, ENABLE_UI_NEXT etc...

At the moment I need to duplicate the code and do something like

...normal stuff... //#ifdef DEBUG console.log('log debug stuff'); //#endif //#ifdef ENABLE_LOGS console.log('log debug stuff'); //#endif ...normal stuff...

it would be neat, for me, to do something like

//#ifdef DEBUG or ENABLE_LOGS console.log('log debug stuff'); //#endif

I have no specified sintax for the boolean combination, if "and" and "not" or "&&" and "||" or some variant are fine

ZeeD avatar Jun 16 '15 10:06 ZeeD

This is a good idea. I hadn't touched the code in while, but this gave me a good reason to get back in there. I'll try adding it.

smartt avatar Jun 17 '15 17:06 smartt