tags:

views:

151

answers:

3

Hi all, is there any tool that can parse a valid C program and generate a report which contains list of functions, global variables, #define constants, local variables in each function etc.

+3  A: 

Doxygen does all of the above.

Thank you very much i tried it. its really good tool very helpful
udpsunil
Doxygen works best when you put specially-formatted comments in your code, usually with your function declarations.
Tryke
A: 

Try exuberant-ctags with the -x option and tell it to generate all of its kinds. Exuberant CTAGS is the default ctags on many linux distros.

You might try: exuberant-ctags -x --c-kinds=cdefglmnpstuvx --language-force=c filename

will even work if filename doesn't have .c extension.

You can use exuberant-ctags --list-kinds=c to see the possible tags.

Under windows, the cygwin environment supports ctags. I'm not sure if there's a windows build that doesn't need cygwin.

Thomas Kammeyer
This one is equally good. It has support for many languages which is a plus point. Thank you
udpsunil
A: 

There are a few tools, depending on what you want to do. I'm not sure what you mean by "report", things like lxr will do html etc. cross referenced links. But for a person to use to help understand some code, then ncc or cscope (the later of which is in most Linux distributions) also some of the IDEs have some of these features (like eclipse). Older alternatives to cscope are ctags and etags.

James Antill
cscope isn't newer than exuberant-ctags, but cscope is very much worth the mention because it, unlike ctags, find call graph info. The "flexible parsing" in cscope is even workable to some extent in C++ code (I use vim+exuberant ctags+cscope to edit code and it works very well).
Thomas Kammeyer