SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: JimmieC on May 26, 2015, 03:26:41 pm

Title: Grey-out preprocessor block if not defined C\C++, v2011
Post by: JimmieC on May 26, 2015, 03:26:41 pm
Can SE grey-out a block of conditionally compiled code if the condition is not defined?
For example:


In header file:
#define ALARM_DBG 0

In .c\.cpp file:
#if ALARM_DBG == 1
         if(LampAlarm.I != 5 || AudioAlarm.I != 5)
         {
            asm( " NOP "); // breakpoint
         }
#endif


Code Composer 5.5 (Eclipse-based) will color the whole block if it is not-active code. Can SE do that as well?

Jim
Title: Re: Grey-out preprocessor block if not defined C\C++, v2011
Post by: JimmieC on May 26, 2015, 07:07:09 pm
Here is a screen shot from CCS 5.5.

Maybe a feature that can be added to SE if it does not already support it. I am at v2011 so I have an older version.

Title: Re: Grey-out preprocessor block if not defined C\C++, v2011
Post by: rajkej on May 26, 2015, 08:48:27 pm
SE does color code the blocks as in the attached example. If you are using some macros that SE doesn't have defined then you might want to go define them in tools->options->Languages->Application Langugages->C/C++->C/C++ Preprocessing.
Title: Re: Grey-out preprocessor block if not defined C\C++, v2011
Post by: JimmieC on May 26, 2015, 09:25:28 pm
Adding the defines is an extra step but it is a work-around.

CCS 5.5 just figures it out from the source files. Maybe SE will implement this in a future release.

I will give your suggestion a try.


Thanks,
Jim
Title: Re: Grey-out preprocessor block if not defined C\C++, v2011
Post by: hs2 on May 27, 2015, 05:14:44 am
This won't change at least in the foreseeable future because:

CCS might do a more or less good job because it handles just it's very own CCS C/C++ projects.
Although I have my doubts that it's (still) 'fast and fluid' with larger projects b/c it's Eclipse based., But I'm biased ;)
Luckily there is an alternative :)

HS2
Title: Re: Grey-out preprocessor block if not defined C\C++, v2011
Post by: JimmieC on May 27, 2015, 01:25:25 pm
Quote
>> b/c it's Eclipse based

Eclipse = sluggish.
Title: Re: Grey-out preprocessor block if not defined C\C++, v2011
Post by: Clark on May 27, 2015, 01:49:19 pm
In addition to the problems mentioned above, SlickEdit would need precise include file information which users really don't want to take the time to set up. As already mentioned, a full parse with includes would drastically slow down tagging (a very bad thing).

At the moment, it makes more sense to make it easier for users to set their defines. There is still more we could do here. I thought we had a "Scan for defines" feature which allows you to pull out referenced defines out of a source file (like the current source file) and set them but it only seems to be available on the Selective Display dialog. There is an "Import..." button which can help but if you have tons of header files this isn't as helpful for quickly setting up defines so you can better view the current source file.