Author Topic: Coloring code depending on preprocessing the code is possible?  (Read 2454 times)

jorgeguzmanj

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Coloring code depending on preprocessing the code is possible?
« on: November 23, 2009, 05:56:33 pm »
Hello, I've been working with SE some months, but I'm not a professional with tool yet. I tried to search in the forum for this topic but I couldn't find it, if you know this topic was already discussed pleasee post the link to that topic.
THANKS all for your help. AHH my SE version is: 12.0.0.0 and I usually program C code for embedded systems, so this feature is always really appreciated.

Is there a way to allow SE to color certain parts of the code depending on if a definition, or macro is true or false or is define or not? I mean, for example, if I have the following code:
Code: [Select]
#if defined ( C_ENABLE_MULTICHANNEL_API )
# define C_MULTIPLE_RECEIVE_CHANNEL
# define MULTIPLE_RECEIVE_CHANNEL
#else
# define C_SINGLE_RECEIVE_CHANNEL
#endif

I would like to SE to color different the code that is really compiled due the TRUE case of the #if defined, and with other color (like gray) the part of the condition that will not be met or compiled due it is in the FALSE case.
I saw this feature in many other IDEs, so hopefully SE will have it too. Please let me know if you need clarification on this. THANKS


tsinhi

  • Community Member
  • Posts: 11
  • Hero Points: 0
Re: Coloring code depending on preprocessing the code is possible?
« Reply #1 on: November 27, 2009, 12:41:14 am »
Slickedit support the feature what you need ,you can see menu[view->selective Display.. ] for help...

davehohl

  • Senior Community Member
  • Posts: 230
  • Hero Points: 11
Re: Coloring code depending on preprocessing the code is possible?
« Reply #2 on: November 30, 2009, 11:33:52 pm »
The Selective Display can expand/contract blocks based on defines, but I don't think it can color code.  There is a setting in the language-specific coloring options to color inactive sections of code, but that only seems to work for #if 0, not for #defined symbols.

hs2

  • Senior Community Member
  • Posts: 2725
  • Hero Points: 281
Re: Coloring code depending on preprocessing the code is possible?
« Reply #3 on: November 30, 2009, 11:52:14 pm »
@davehohl: It's a bit more difficult than you might think. Have a look at this thread for some further details.
HS2

davehohl

  • Senior Community Member
  • Posts: 230
  • Hero Points: 11
Re: Coloring code depending on preprocessing the code is possible?
« Reply #4 on: December 03, 2009, 01:19:21 am »
hs2, thanks for the historical perspective.  At least I know the SE team has considered it.

jorgeguzmanj

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: Coloring code depending on preprocessing the code is possible?
« Reply #5 on: December 04, 2009, 04:45:51 pm »
Hi guys,
thanks all for your replies to my Q.

I was reading your answers and summarazing:
> seems SE can not use a corloring feature as I described due they are discussing about how implement it
> SE supports a Selective Display/Preprocessor directives that could be a work around for the coloring feature (seems really limited)
    >> Q:  Do you know if is there a wey to apply the Selective Display/Preprocessor directives for a entire project/Workspace and not only file by file?