Author Topic: Editor confused by macros on main function definition  (Read 9574 times)

JeppeOland

  • Community Member
  • Posts: 44
  • Hero Points: 2
Editor confused by macros on main function definition
« on: November 05, 2015, 07:21:32 PM »
(This problem also exists on SlickEdit 2012 which I normally use, but I figured I would report it here sicne I just noticed it on the beta).

For some modules, I use a wrappering macro to be able to use the same code for multiple linked objects:
#define WRAPPER(FUNC)   SomeWrapper##FUNC

static int WRAPPER(Monkey)(uint64_t uFlags, ACP_MemoryInfo *pMemoryInfo)
{
   Something1 = 10;
   Something2 = 11;
   Something3 = 12;
   Something4 = 13;
   Something5 = 14;

   return 0;
}

In this example, if you put a line before "Something1" and type "if (", the autocompletion will put the curly-braces in for you, and you can expand the section to be included using the arrow keys.

Unfortunately, hitting the down key moves the end-curly all the way past the end of the function...

rajkej

  • Senior Community Member
  • Posts: 336
  • Hero Points: 14
Re: Editor confused by macros on main function definition
« Reply #1 on: November 05, 2015, 09:27:10 PM »
Have you tried defining the WRAPPER macro within slickedit? You would do this in Tools->Options->Languages->C/C++->C/C++ Preprocessing.

SE doesn't parse your code and auto build that preprocessing list for things like this.

JeppeOland

  • Community Member
  • Posts: 44
  • Hero Points: 2
Re: Editor confused by macros on main function definition
« Reply #2 on: November 05, 2015, 10:04:16 PM »
No I haven't tried that, but that's a lot to ask everybody working on the project to do.

I'm not sure how much it has to do with parsing the macros etc ...
If you completely cut out the function definition line, and just leave the { ... then it works as you would expect.

Dennis

  • Senior Community Member
  • Posts: 3955
  • Hero Points: 515
Re: Editor confused by macros on main function definition
« Reply #3 on: November 06, 2015, 12:45:53 AM »
To share the #defines with everyone else, add them to your workspace-specific preprocessing.

Project > Workspace Properties... > C/C++ Preprocessing...

That will create a workspace_cpp.h file in the same directory as your .vpw file, and you can check that into source control.

JimmieC

  • Senior Community Member
  • Posts: 490
  • Hero Points: 17
Re: Editor confused by macros on main function definition
« Reply #4 on: November 06, 2015, 01:51:04 PM »
Does the workspace also store user preferences like background color, window docking, etc?

If so, that would force everyone to use the same preferences.

Jim

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Editor confused by macros on main function definition
« Reply #5 on: November 06, 2015, 02:40:03 PM »
workspaces merely contain projects similar to MS VS solutions/projects and no user specifc settings.
HS2