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

JeppeOland

  • Junior Community Member
  • Posts: 8
  • Hero Points: 1
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: 250
  • Hero Points: 8
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

  • Junior Community Member
  • Posts: 8
  • Hero Points: 1
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

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2091
  • Hero Points: 259
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: 346
  • Hero Points: 13
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: 2725
  • Hero Points: 281
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