tags:

views:

48

answers:

1

I posted a question on the DOxygen forums and also am posting it here for a better response.

I have a moderately sized C project of about 2,900 functions. I am using DOxygen 1.5.9 and it is successfully generating a call graph for the functions. Is there a way to extract this out for further analysis? A simple paired list would be sufficient, e.g.

Caller,Callee
FunctionX, FunctionY
...

I am comfortable with XSLT but I must say that the DOxygen XML output is complex. Has anyone done this before and can provide some guidance on how to parse the XML files?

Thanks in advance!

A: 

Based on what I see in the contrived example that I created,

  • Parse files with a name similar to ^_(.+)\d+(c|cpp|h|hpp)\.xml$, if my regex-foo is right.
  • Find all <memberdef kind="function">. It has a unique id attribute. I believe the XPath for this is //memberdef[@kind='function'].
  • Within that element, find all <references>.
  • For each of those tags, the refid attribute uniquely refers to the id attribute of the corresponding <memberdef> that is being called.
  • The text node within each <references> corresponds to the <name> of the corresponding <memberdef> that is being called.

This seems like a nice, straightforward way to express call graphs. You should have no trouble using XSLT or any other sane XML-parsing suite to get the desired results.

Reinderien