Organizing Someone Else's Code

I have a program (complete, in many individual files broken up modularly, as they should be) which I need to modify with stuff specific to our code base. This is a decidedly non-trivial modification. Their program has capabilities ours don’t in a framework that’s outside the scope of ours, so I have to recast what our program does into their terms.

The problem is that it’s all scientific code, which means there’s only the barest sketch of documentation in their case, and nothing whatsoever explicitly laid out about their code organization/class heirarchies/dependencies.

The external code is C/C++ (Mainly C but couched as C++). This means that the dependencies should be explicit. I’d dearly love to have a dependency map to make sure that I know all the places the changes I’m going to have to make will propagate to (or alternatively are derived from). No such thing is provided. This strikes me as something that there ought to be programs for.

The code is reasonably standard open source stuff, so makefiles, source, headers, no fancy documentation (just a series of .html/.pdf files already compiled). So I’m looking for a program that might be able to take the source and/or makefiles and put together a map of both code dependency and class/function dependency. It’s probably necessary that this be free or fairly cheap, since convincing the bosses to pay $200-$300 to save me 20 hours of compiling the info myself is surprisingly hard. (My time is worth more than enough that 20 hours of my time far outweighs $200-$300, but so it goes.)

As a bonus/related question: Does anyone know of a system similar to the above that includes a nice viewer that allows for a drill-down, heirarchical view of the code organization? Extra bonus points if it might work on an iPad or the like. (Ideally I’d like to transition my reference sources of all type to an iPad so that I’m not taking up screen real estate/forced to lug along a laptop to reference things necessary when designing my code).

LLVM currently uses: http://www.stack.nl/~dimitri/doxygen/ with decent results (http://llvm.org/doxygen/).

with graphviz to generate class hierarchy diagrams and such.

Moving to: http://sphinx.pocoo.org/

If those don’t do what you want, you might find an alternative at http://en.wikipedia.org/wiki/Comparison_of_documentation_generators if you haven’t already looked there.

I know you didn’t ask about this aspect, but I’ll throw this out anyway. I strongly recommend running all that code through astyle in order to get it all formatted readably in a style you are comfortable and familiar with. One of my main annoyances with C/C++ is that the compiler freely forgives all sorts of formatting sins, so working with code written by external parties can compile very cleanly and yet be incredibly hard to read and work with.

No I didn’t, but that is a -wonderful- tool to know about, thank you!