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
 Technical Support
 Autotext and VS macros?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

FlintZA
New Member

South Africa
8 Posts

Posted - Oct 03 2007 :  05:32:24 AM  Show Profile  Reply with Quote
Is there any way to utilise Visual Studio macros within autotext code?
Specifically, I am trying to automatically generate text which includes the project name and the VS $(ProjectName) macro would do the trick.
Alternatively, is there another way to access the project name?

bugfix
Tomato Guru

Germany
324 Posts

Posted - Oct 03 2007 :  08:54:56 AM  Show Profile  Reply with Quote
depending what you're trying to do a way might be to use projects' preprocessor settings. like _PROJECTNAME=$(ProjectName)

-bugfix

http://www.mf-sd.de
Go to Top of Page

FlintZA
New Member

South Africa
8 Posts

Posted - Oct 03 2007 :  09:10:09 AM  Show Profile  Reply with Quote
I suppose a better description may have helped :)
We use an autotext script that generates our comment block and header guard for .h files based on the filename.
I have run into a situation where two headers in different libraries have the same name (valid in this case) and while I can differentiate the header files themselves due to their location the guards end up being the same so only the first file's content gets handled:

/Core/PlatformSpecifics.h:

/* File header comment */
#ifndef _PlatformSpecifics_h__
#define _PlatformSpecifics_h__

namespace core 
{
// Code
}

#endif // _PlatformSpecifics_h__


/UserInterface/PlatformSpecifics.h:

/* File header comment */
#ifndef _PlatformSpecifics_h__
#define _PlatformSpecifics_h__

namespace userinterface
{
// Code
}

#endif // _PlatformSpecifics_h__


In another file:

#include <Core/PlatformSpecifics.h> // Ok, everything gets included
#include <UserInterface/PlatformSpecifics.h> // Broken, guards prevent anything from being included


I want to prefix the project/library name to the file name in guards to prevent this in future. I can obviously do it manually in the couple of cases it may arise, but I'd prefer save myself the pain of tracking down a silly mistake like same-name headers while in deadline groggyness :)

Unfortunately the above solution doesn't quite work in this case. I considered using a GUID macro, but that seems a bit dirty to me.
Go to Top of Page

bugfix
Tomato Guru

Germany
324 Posts

Posted - Oct 03 2007 :  12:27:56 PM  Show Profile  Reply with Quote
guess you have to stick w/ smth like __$GUID_STRING$_$FILE_BASE$_h__ or write some VS macro to do the job.

http://www.mf-sd.de
Go to Top of Page

hotzenplotz
Senior Member

Austria
34 Posts

Posted - Oct 03 2007 :  2:16:56 PM  Show Profile  Reply with Quote
Well, I just used a custom "VAX macro" in the autotext entry, that way VAX asks me what to put there when I use the autotext.
Like this:
#ifndef INCLUDED_$INCLUDE_GUARD_NAME$
...

It would be more comfortable if VAX could put something meaningful there itself, but since I have very specific wishes about what $INCLUDE_GUARD_NAME$ should be, this is probably the best way for me.

Use the source, Luke!
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Oct 03 2007 :  3:07:26 PM  Show Profile  Reply with Quote
You could do something like this to get the filename from VA - then you can enter a custom prefix (or not):

#ifndef $prefix$$FILE_BASE$_h__
#define $prefix$$FILE_BASE$_h__

$selected$

#endif // $prefix$$FILE_BASE$_h__
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Oct 03 2007 :  3:16:20 PM  Show Profile  Reply with Quote
To answer the original question, no you can not use Visual Studio macros within autotext code. The list of reserved strings is available at: http://www.wholetomato.com/products/features/autotext.asp
Go to Top of Page

FlintZA
New Member

South Africa
8 Posts

Posted - Oct 04 2007 :  02:24:58 AM  Show Profile  Reply with Quote
Thanks for the suggestions.
I do already use the FILE_BASE keyword just without the prefix. I'll consider the guid and prompt options. It's a real pity about not using the VS macros.. feature request forums here I come :)
Go to Top of Page

mwb1100
Ketchup Master

82 Posts

Posted - Oct 04 2007 :  12:00:02 PM  Show Profile  Reply with Quote
quote:
Originally posted by FlintZA

Thanks for the suggestions.
I do already use the FILE_BASE keyword just without the prefix. I'll consider the guid and prompt options.



I used to use a guard something like $FILE_BASE_UPPER$_$FILE_EXT_UPPER$_$GUID_STRING$, but co-workers didn't like it so I had to remove the GUID portion. Now I can point them here and show that the GUID solves a real problem, not just an imaginary one.

Note that GUID_STRING doesn't exactly work because of embedded '-' character, but the snippet gives the idea.
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Oct 04 2007 :  2:17:16 PM  Show Profile  Reply with Quote
A request for GUID_STRING_ALT (any better name)?
Go to Top of Page

FlintZA
New Member

South Africa
8 Posts

Posted - Oct 05 2007 :  02:42:09 AM  Show Profile  Reply with Quote
quote:
but co-workers didn't like it so I had to remove the GUID

That's one of the reasons I'm not too keen on it, I can just see the arguments I'll end up having about it :)
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