[aspectc-user] Small API addition request.

Matthias Urban matthias.urban at pure-systems.com
Tue Nov 14 17:42:50 CET 2006


Hi Robert,

> I've come up against the first piece of API magick I don't know if I can do 
> without. I am writing classes that build a master database of an entire 
> project, and along the way I'm dealing with eradication of duplicates and 
> merging of classes that contain function members in more than one source 
> file. I'm having to do a bit of re-jigging of the classes to make the graph 
> remain consistent.
> 
> What I really need to be able to do is re-assign pointers by numbers to 
> objectinfos. i.e. Wherever you can do a call in the style of 
> 
> int FunctionInfos ();
> CFunctionInfo * FunctionInfo ( int );
> 
>  ( the current ones I'm working with are BaseClasses (), FunctionInfos (), 
> Friends () ) 
> 
> I need to be able to re-point the entries along the lines of
> 
> void setFunctionInfo ( int , CFunctionInfo * );
> 
> The alternative is keeping a complex register of what's been removed and 
> readded (thus changing the numbering) while iterating over the functions or 
> maybe even doing some horrible horrible memory tricks to copy my desired 
> CObjectInfo into the space already pointed to.
> 
> Thoughts?

Why do you need to re-assign the n-th function info? The order has no 
meaning. It's true that it usually reflects the order in the source 
file, but that is not guaranteed. A semantic object (like an info for a 
function, class etc) is identified by the point-of-declaration of the 
corresponding syntactic object.

Semantic objects that represent the same function, class etc. are 
connected to each other. For instance:

   class X {
     void foo();      // connected with implementation of foo
   };

   void X::foo() {    // connected with declaration of foo
   }

You can connect two object infos using the NextObject(info) method of 
CObjectInfo. If two objects are connected, a call to DefObject() always 
returns the object info representing the implementation (if there is 
any). So you can have several declarations of the same entity. Maybe you 
can use this to build your master database.

I don't know if this was very helpful for you. But replacing semantic 
objects is a delicate issue. Btw, we are currently working exactly on 
this interface and the data structures behind it to improve the 
performance (memory and runtime).

Best regards,
Matthias

-- 
Matthias Urban                          Phone: +49-391-544569-32
pure-systems GmbH                       Fax:   +49-391-544569-90



More information about the aspectc-user mailing list