From: Stefan S. <se...@sy...> - 2004-05-10 19:03:46
|
hi Aitor, Aitor Garay-Romero wrote: > - do OpenC++ meta-programs have access to the source code comments? the current opencxx code doesn't allow this. However, I'm using a branched version of opencxx as part of the synopsis project (http://synopsis.fresco.org) where we added support for comments (specifically to document the code, but indeed any metadata could be embedded and processed). I plan to get synopsis and opencxx closer to each other, as I believe both have important features that would be even more powerful when used together. What you suggest sounds entirely possible and actually a very nice example of C++ meta programming. > - are the meta-programs able to transverse the inheritance hierarchy of a > given class? what do you mean by 'meta-program' here ? Tools like occ and synopsis certainly have access to that information, as they operate on the parse / syntax trees of the original source code. So they could generate the additional code you want. Note that this is a compile-time issue, there is no runtime support for introspection. > - how well does OpenC++ handle macros? And namespaces? Macros are not handled at all by opencxx, I believe. Again, synopsis deals with macros, and I'd like to find a way to give opencxx access to that, too. Namespaces should be fine (I recently patched opencxx to support namespace aliases, but that patch only fixes the parser, not the occ runtime environment. > - is it possible to introduce new methods in the generated classes? Is it > possible to do arbitrary transformations like nesting the body of a method > inside some try/catch blocks? yes, any transformation of the parse tree is possible, at least in theory. A special 'Walker' class that traverses the tree can find the nodes you are looking for and then based on these apply some modifications. I don't know how flexible the occ frontend right now is, i.e. how you would teach occ what exactly to do. From personal experience I believe that a scripting frontend to opencxx would be most powerful for really fine-grained control over the code manipulation. I don't know what opencxx's current support for code generation is. Regards, Stefan |