Author Topic: Preprocessor directives C++  (Read 24860 times)

jechard

  • Community Member
  • Posts: 15
  • Hero Points: 0
Preprocessor directives C++
« on: February 18, 2010, 03:06:21 PM »
Trying to get preprocessor directives for SE Core for eclipse working (C++) and am having trouble with both of the following scenarios:

1) I would like SE to gray out or somehow indicate that code not covered by a preprocessor directive is something I can ignore.
2) Set up different preprocessor directives for different workspaces.  It appears that you are stuck with a set of global directives that can be used across all workspaces.

Is this possible in the core product?  Many of the files I tend to have to maintain have many preprocessor directives, and it would be great if my IDE could help me quickly eliminate those that I can ignore.

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Preprocessor directives C++
« Reply #1 on: February 19, 2010, 08:42:00 PM »
Quote
I would like SE to gray out or somehow indicate that code not covered by a preprocessor directive is something I can ignore.
...
Many of the files I tend to have to maintain have many preprocessor directives, and it would be great if my IDE could help me quickly eliminate those that I can ignore.

So you want to see code which is inactive due to preprocessor directives colored as inactive?  I thought that we had the facility for this:  if you have a certain directive defined as inactive in C/C++ Preprocessing, then the code should be colored the "Inactive Code" color at Window > SlickEdit Preferences > Appearance > Colors.  The same thing that you see when you use "#if 0" in your code.  It doesn't appear to be working, though, in either normal SlickEdit or the Eclipse plug-in...so I'm going to have to get back to you on this one.  This might just be buggy, and in need of some fixing.

You should be able to use Select Display (Display > Selective Display) to hide all elements blocked by certain preprocessor directives...if you want to try an alternative approach.

Quote
Set up different preprocessor directives for different workspaces.  It appears that you are stuck with a set of global directives that can be used across all workspaces.

Unfortunately right now these settings are global...we don't have the facility to do per-workspace or per-project settings  :(.

- Ryan

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Preprocessor directives C++
« Reply #2 on: February 20, 2010, 11:38:38 AM »
Quote
Unfortunately right now these settings are global...we don't have the facility to do per-workspace or per-project settings

That's a pitty indeed... among all those fabtastic new features and improvements !
So I'd like to renew this long standing request which would be really useful esp. for cross-platform devs.
I hope putting it (optionally) into workspace scope at least is not that difficult.
Keep up the good work,
HS2
« Last Edit: February 20, 2010, 11:40:59 AM by hs2 »

jechard

  • Community Member
  • Posts: 15
  • Hero Points: 0
Re: Preprocessor directives C++
« Reply #3 on: February 23, 2010, 02:26:46 PM »
Seems #if 0 works, but #if SOME_DEF does not.  Also, #ifdef 0 doesn't work either.  Seems this is restricted to just the #if 0 and nothing else.  If a patch becomes available, I'd love to get my hands on it!

Thanks
« Last Edit: February 23, 2010, 03:20:32 PM by jechard »

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Preprocessor directives C++
« Reply #4 on: March 02, 2010, 04:01:21 PM »
This is a bug in SlickEdit 14.0.2 (which is the base for Core 3.5.0), and has been fixed for the next release of SlickEdit (and the Eclipse plug-in).  It does require a new build, however...so there won't be a hotfix available for Core 3.5.0 :(.

- Ryan

jechard

  • Community Member
  • Posts: 15
  • Hero Points: 0
Re: Preprocessor directives C++
« Reply #5 on: August 31, 2010, 03:16:21 PM »
This is a bug in SlickEdit 14.0.2 (which is the base for Core 3.5.0), and has been fixed for the next release of SlickEdit (and the Eclipse plug-in).  It does require a new build, however...so there won't be a hotfix available for Core 3.5.0 :(.

- Ryan

Ryan,

I've updated to the latest drop of Core 3.5.1, and don't see this feature working yet.  Do you have any updates on whether it should be working or not now?  #if 0 works, #if TEST_VAR (which is set to 0) does not.  Likewise, #ifdef 0 does not work.  Am I missing something, or did this not make the cut for 3.5.1?

Thanks.

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Preprocessor directives C++
« Reply #6 on: September 02, 2010, 06:54:08 PM »
Sorry for the delay in the response, but this fix did not make it into Core 3.5.1.  I have confirmed that the issue is fixed in Core 3.6.0, though, which is currently in development.

- Ryan

jechard

  • Community Member
  • Posts: 15
  • Hero Points: 0
Re: Preprocessor directives C++
« Reply #7 on: September 02, 2010, 06:57:32 PM »
Ryan,

Any planned delivery date on 3.6?  Just curious.

Thanks

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Preprocessor directives C++
« Reply #8 on: September 08, 2010, 01:39:25 PM »
I'm not allowed to be too specific with release dates, but I think we are trying to go to beta sometime in October.  Our release would then follow the normal beta period.

- Ryan

joelhaynie

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Re: Preprocessor directives C++
« Reply #9 on: May 18, 2011, 08:44:28 PM »
Can you clarify how to configure this feature?  I have Core 3.6.1.  I see that #if 0 works to "grey out code", but #if _SOME_TAG_ does not.  Is there a mechanism to add / include / define your common ".h" file/s?
How does it search for my workspace / project Preprocessor Macros?

jechard

  • Community Member
  • Posts: 15
  • Hero Points: 0
Re: Preprocessor directives C++
« Reply #10 on: May 19, 2011, 11:59:58 AM »
Quote
Can you clarify how to configure this feature?  I have Core 3.6.1.  I see that #if 0 works to "grey out code", but #if _SOME_TAG_ does not.  Is there a mechanism to add / include / define your common ".h" file/s?
How does it search for my workspace / project Preprocessor Macros?

You get to this through Slickedit Preferences->Languages->Application Languages->C/C++->C/C++ Preprocessing

Here you can define and undefine the variables you want.  Slight caveat, however.  This is not for a workspace, but for everything.  So when you set a preprocessor and don't want it for another workspace, you need to undefine it.

mwilkins

  • Community Member
  • Posts: 28
  • Hero Points: 1
Re: Preprocessor directives C++
« Reply #11 on: August 03, 2011, 07:32:45 AM »
What about say

#ifdef VOLTAGE_BOOST
    VoltageBoost();
#endif 

How do I get it to grey out the VoltageBoost(); line if VOLTAGE_BOOST has not been defined (ie  if #define VoltageBoost has not been done)?

I see the Original eclipse will now grey it out fine without the slickedit plugin

thanks

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: Preprocessor directives C++
« Reply #12 on: August 03, 2011, 01:32:49 PM »
Go to where jechard specified in the previous post, and create a new preprocessor definition for VOLTAGE_BOOST.  Then instead of inserting a value in the text field, just check the undef check box for this definition.  You will have to close/reopen any affected files in order to see this change because it will not update on the fly.

- Ryan

mwilkins

  • Community Member
  • Posts: 28
  • Hero Points: 1
Re: Preprocessor directives C++
« Reply #13 on: August 05, 2011, 09:10:37 AM »
Go to where jechard specified in the previous post, and create a new preprocessor definition for VOLTAGE_BOOST.  Then instead of inserting a value in the text field, just check the undef check box for this definition.  You will have to close/reopen any affected files in order to see this change because it will not update on the fly.

- Ryan
Thanks Ryan,
Is there any chance this can done properly in the version you are developing? For us, it is not ideal to be adding each definition for each project we do. We use a large amount if #ifdef stuff to bring in various features for customers on a project by project basis, and it would be un-realistic to do it this way as opening another customers project, would grey out the wrong code.
As I said, the standard eclipse IDE now does it perfectly just by not defining the define, or commenting it out, the code will grey out. Could you not implement it the same way they do?

EDIT: I have just closed Eclipse, and reopened which has auto reloaded all my open files ( as usual). The file which should have the sections Greyed out, now has them coloured again! If I close the document and re-open it, they are Greyed again..... So it has bugs too!

Cheers
« Last Edit: August 05, 2011, 10:15:55 AM by mwilkins »