Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Deep Macro parsing

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
zakker Posted - Sep 21 2010 : 06:01:22 AM
example 1:

file: classes.inl
DECLARE_ATOM_CLASS( AC_STATIC, static )
DECLARE_ATOM_CLASS( AC_DYNAMIC, dynamic )
DECLARE_ATOM_CLASS( AC_MULTISTATE, multistate )

and now use it:
enum atom_class_e
{
    AC_FIRST_LIST           = 0,

#define DECLARE_ATOM_CLASS( e, a ) e,
#include "classes.inl"
#undef DECLARE_ATOM_CLASS
    
    ATOM_CLASSES_COUNT,
    AC_UNDEFINED,
};

atom_c::atom_definition_s atom_c::g_classes[ ATOM_CLASSES_COUNT ] = 
{
#define DECLARE_ATOM_CLASS( e, a ) { #a, atom_##a##_c::instance },
#include "classes.inl"
#undef DECLARE_ATOM_CLASS
};


example 2:
#define LOGICPARAMS \    LPRM( CUSTOMVAR1,   prm_word ) \    LPRM( CUSTOMVAR2,   prm_word ) \    LPRM( MTYPE,        prm_mtype ) \    LPRM( LOCTYPE,      prm_loctype ) \    LPRM( SURFTYPE,     prm_surftype )

and now use it:
// types
#define LPRM(x, y) typedef y::TYPE typeof_##x;
    LOGICPARAMS
#undef LPRM

// enum : LP_CUSTOMVAR1, LP_CUSTOMVAR2 ... LP_max
#define LPRM(x, y) LP_##x,
enum lp_e { LOGICPARAMS LP_max };
#undef LPRM

// sizeof : LPSZ_CUSTOMVAR1, LPSZ_CUSTOMVAR2 ...
#define LPRM(x, y) LPSZ_##x = sizeof(y::TYPE),
enum lpsz_e { LOGICPARAMS };
#undef LPRM
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Sep 24 2010 : 11:13:43 AM
I am not sure I understand the problem with "AC_STATIC". If I understand your code correctly then you are giving DECLARE_ATOM_CLASS different definitions at different points in the same file. This is going to confuse VA's parser, especially when some of the definitions use ##

Since you are using DECLARE_ATOM_CLASS to mean different things at different points, I am not sure how to try and work around this either. Any simple hack to try and help VA's parser is never going to capture what you are doing here.

It might be possible to use VA's StdAfx.h file here, if there was a single simple definition of DECLARE_ATOM_CLASS that would help a bit:

http://docs.wholetomato.com?W302
zakker Posted - Sep 22 2010 : 02:21:01 AM
enum atom_class_e does not use any ## command, but AC_STATIC, for example, VA's parser can't handle too. I understand that multiple #include of the same file is hack, but compiler allows it :)
feline Posted - Sep 21 2010 : 7:49:36 PM
Unfortunately VA's parser does not understand the ## command inside macros for generating names:

case=729

Which is why you are going to be having problems with this code. If you only use macro's that use ## occasionally you might be able to add dummy helper macro's to help VA's parser that give the generated names.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000