From: Scott D. F. <sd...@ms...> - 2006-08-08 14:50:57
|
Hi, I am having a spot of trouble translating C function declarations (ones without a definition, that is). Consider the following simple program foo.cc and metaclass TransCFunc: int foo( int x = 5 ); int main() {...} int foo( int x ) {...} ////////////////////////////////////////////////////////////////////// char* const DEFAULT_METACLASS = "TransCFunc"; class TransCFunc : public Class { public: static bool Initialize(); ... void TranslateClass( Environment* env ); void TranslateMemberFunction( Environment* env, Member& m ); }; // class TransCFunc bool TransCFunc::Initialize() { ChangeDefaultMetaclass(DEFAULT_METACLASS); SetMetaclassForFunctions(DEFAULT_METACLASS); return true; } void TransCFunc::TranslateClass( Environment* env ) { cout << "CLASS: " << Name()->ToString() << endl; } void TransCFunc::TranslateMemberFunction( Environment* env, Member& m ) { cout << "MEMBER: " << Name()->ToString() << "::" << m.Name()->ToString() << endl; } Running a compiler generated from TransCFunc on foo.cc gives the output: MEMBER: <C>::main MEMBER: <C>::foo I would have expected TranslateMemberFunction() to get called for the first foo() declaration, but this does not seem to be the case. Anyone know how I can get it to translate? Thanks, Scott |