Author |
Topic |
|
dushan
Junior Member
USA
16 Posts |
Posted - Feb 28 2006 : 10:04:06 PM
|
I love VA and I've now used it long enough to be completely hooked on it. Unfortunately I've recently started on a project that uses 'enhanced' C (i.e. runs all code through a magic preprocessor). I've got VA partially working with this project (that parser is magic! ), but it's lacking the following:
Custom keywords The pre-processor recognises quite a few non-standard keywords that VA knows nothing about. I found the cpp.va file, but don't know the meaning of the numbers associated with each keyword. I've added my keywords to cpp.va and this works pretty well, however the file is clearly not intended to be edited (it's undocumented, read only, gets clobbered with upgrades and has lot's of -?s). It would be nice to have an official way of doing this (per project config file of some sorts). Failing that, documenting the magic numbers would be great too.
VA pre-processor The config file could also define trivial translations that VA would perform on the code before parsing it. This is a very blunt tool, but it would help in my case in fixing some annoying custom syntactic sugar. Most painful of these is the use of 'extend' keyword instead of ':', which breaks VA's ability to parse class hierarchies. If I could tell VA to '#define extends : public' before parsing, all would be good. Any solution to this would be very welcome.
Custom extensions VA already has this feature unofficially (via a registry hack as described in the FAQ), but it would be nice to do this through the config dialog or the config file suggested above. Also, Alt+O currently doesn't seem to work for source files with non-standard extensions - I can switch from a source file to a header (headers use standard '.h'), but not the other way round (source files and headers live in the same directory).
I understand that I'm in a minority here and that my problems are self inflicted, but perhaps there are others out there suffering similar misguided attempts to improve C in various funny ways.
Whole Tomato, can you help?
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Mar 01 2006 : 12:01:16 AM
|
The IDE support user-defined keywords. Look for and update usertype.dat
There exists a subdirectory Misc in the VA X installation directory, StdAfx.h, which VA X reads before parsing any other files. (And only after "Rebuild" is pressed and the IDE is restarted.) The file contains a series of #defines to coerce VA X into parsing properly some statements in un-preprocessed C/C++.
You can make VA X ignore "extends" just as it ignores "__attribute__()". Offhand, we aren't sure you can make it replace "extends" with a colon.
Your observation about Alt+O not working on non-standard conventions is correct. Your best option is successive presses of Alt+G. |
|
|
dushan
Junior Member
USA
16 Posts |
Posted - Mar 01 2006 : 2:42:13 PM
|
Thanks for pointing me to 'usertype.dat' - I really didn't like messing with cpp.va (incidentally, what are those magic numbers in cpp.va?).
I did try putting '#define extends : public' in StdAfx.h before posting here but VA doesn't apply the translation before parsing (I could Alt+G on 'extends' and it would take me to StdAfx.h, but failed to parse the derived class correctly). I saw a post elsewhere on the forum where someone has defined the 'class' keyword to something else. Putting a reverse define in StdAfx.h also didn't help. Modifying C/C++ is obviously an evil thing to do, but is there any chance VA will support such silliness in the future? Could the grammar definition be exposed or is it too much of a support nightmare?
Can anyone suggest an alternative plugin for the Alt+O functionality?
|
|
|
feline
Whole Tomato Software
United Kingdom
19001 Posts |
Posted - Mar 01 2006 : 6:55:34 PM
|
it would be worth looking at www.codeproject.com for possible tools to help with alt-o. one i came across recently is http://www.codeproject.com/macro/VSHelper.asp , check out the "Opposite (switch between C/CPP and H files)" section in the article. it looks like this should point you in the right direction.
as for the changes to C++, is this a one off in house change, or is it via a 3rd party library / tool that others might use.
given we are still grappling with some of the more intricate C++ template code out there this is unlikely to be an imminent priority. |
zen is the art of being at one with the two'ness |
|
|
dushan
Junior Member
USA
16 Posts |
Posted - Mar 01 2006 : 10:15:58 PM
|
Awesome - I have Alt+O working now. The Codeproject helper is also a great base for any future plugins I might need - thanks very much!
This leaves me with only one problem (the blasted 'extends'). I'm afraid this is an in house change and I can see that you have more important things to worry about. I was hoping that there might be a simple generic solution that would be useful to a wider audience - such as an optional preprocess step before VA begins looking at the syntax (see Visual SlickEdit's 'Tools -> Tag Files -> Options -> C Preprocessing...')
In any case - thanks again for your help, dev studio without VA feels very much like wordpad.
|
|
|
|
Topic |
|