I want to code an application that calculates a program's complexity. I may have put this the wrong way: I want to count the operators, variables, function calls etc. in a C/C++ program.
At first I thought about reading the .C file as a .txt file, looping through each character and counting a symbol's appearance: ";" 10 times, "." 2 times, "^" 1 time, printf 3 times etc.
However, if someone uses #include <math.h>, I need to count the number of calls to math functions and so on.
What I need to do is obtain the names of functions included in a header and check for their calls. How to do that? Or any other ideas ?
LE: I'd also have to check for user defined functions. This might not be so doable as I originally thought. :D