Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Non-standard C++
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dushan
Junior Member

USA
16 Posts

Posted - Jul 20 2006 :  3:21:14 PM  Show Profile  Reply with Quote
Hi,

My workplace uses a custom preprocessor that adds a number of non-standard features to C++. Replies to a post I made to this forum a few months back have helped me to get VA to work reasonably well with our codebase (thank you!), however there's still one major problem remaining.

Our preprocessor adds an 'extends' keyword, which as far as VA is concerned is identical to ': public'. Unfortunately there's currently no way of telling VA that this is the case. I avoid it like plague in my own code but there's an awful lot of code I have to deal with on daily basis that doesn't.

Is there any chance you could add an optional preprocess step before VA starts parsing the source file? A simple search & replace given a user defined dictionary would fix our problem and provide a useful workaround for others dealing with non-standard C/C++ code.

Thanks

feline
Whole Tomato Software

United Kingdom
19024 Posts

Posted - Jul 20 2006 :  5:38:03 PM  Show Profile  Reply with Quote
you could try adding a #define like to tell VA that "extends" is the same as ": public" to either:

C:\\Program Files\\Visual Assist X\\Misc\\StdAfx.h

or

C:\\Program Files\\Visual Assist X\\Misc\\StdafxVa.h

i am not sure that this would work, but it might. you would need to restart your IDE after making such an edit, and you may need to rebuild your symbol database.

zen is the art of being at one with the two'ness
Go to Top of Page

dushan
Junior Member

USA
16 Posts

Posted - Jul 20 2006 :  6:55:36 PM  Show Profile  Reply with Quote
I have tried #defining 'extends' before with no luck.

As a quick test I just tried:

#define EXTENDS : public

class ClassA
{
public:
int foo();
};

class ClassB EXTENDS ClassA
{
public:
int bar();
};

Although VA knows that 'EXTENDS' is a define (it's purple), it fails to parse ClassB correctly ('ClassB' has a red wavy underline, no auto-completion on instances of ClassB). So unless VA treats #defines in StdAfx.h differently, this won't work.

It appears that the VA parser doesn't expand #defines - which I believe is the right thing to do. It would be nice if VA had a simple string replace step before the parser kicks in, driven by a text file with a bunch of 'map from' / 'map to' pairs.

Edit:
Incidentally, I think this would also help with Qt issues (e.g. topic 4990) as 'public slots:' and 'signals:' could be mapped to 'public:'.

Edited by - dushan on Jul 21 2006 1:46:12 PM
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Jul 21 2006 :  01:04:58 AM  Show Profile  Reply with Quote
Did you try it in one of the two mentioned files? VA treats those differently than ones in the code.

Joe Pizzi
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jul 21 2006 :  12:12:36 PM  Show Profile  Reply with Quote
VA X expands preprocessor macros that have parens. Hence, you might try:

#define EXTENDS() : public

Put this in stdafx.h in the Misc subdirectory of your VA X installation directory. Then press Rebuild on the Performance node of our options dialog and restart your IDE. (VA X only reads its own stdafx.h during full parsing.)

If you want to save a step, press Rebuild and exit your IDE. Change stdafx.h and restart your IDE.

We haven't tested the example ourselves. Let us know what you discover.
Go to Top of Page

dushan
Junior Member

USA
16 Posts

Posted - Jul 21 2006 :  1:40:47 PM  Show Profile  Reply with Quote
Moving the #define to StdAfx[Va].h and adding the parens produces the same results. The 'EXTENDS' is recognised ('Alt+G' jumps to the StdAfx file) but the subclass still fails to parse.

We're using the stable build (1440) right now, should I try the latest beta build?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19024 Posts

Posted - Jul 22 2006 :  11:40:29 AM  Show Profile  Reply with Quote
the latest beta is worth trying on its own merits, the refactoring support has already become completely invaluable to me however i have no idea if the latest beta will work any differently in this case.

i intend to try this experiment myself for the Qt signals and slots, it is just a case of finding the time to do so.

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19024 Posts

Posted - Jul 23 2006 :  3:26:52 PM  Show Profile  Reply with Quote
quote:
Originally posted by dushan

We're using the stable build (1440) right now, should I try the latest beta build?


using VS2005 and VA 1530 i tried placing the #define into:

C:\\Program Files\\Visual Assist X\\Misc\\StdAfx.h

and then placed your two sample classes into a .h file, and VA parsed the code correctly for me. so it looks like this should work for you in 1530.

zen is the art of being at one with the two'ness
Go to Top of Page

dushan
Junior Member

USA
16 Posts

Posted - Jul 24 2006 :  5:49:50 PM  Show Profile  Reply with Quote
Thanks Feline, that did the trick!

I hope that this is an official feature and that it won't be going away in future builds...

I've got to say that 1530 feels a lot snappier than 1440 and I love the new refactoring tools.

Fantastic job!
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jul 24 2006 :  6:06:03 PM  Show Profile  Reply with Quote
Our mistake. We should have mentioned you needed the fix for case 1213 which is available only in the 15xx builds.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000