C-Module dependency graph

I wrote a script to create a module dependency graph from a set of files using graphvizKeine Zugangsberechtigung. This script works only for C.

1. Result

The graph shows how the modules are dependent.

2. Script

You need to change the project path to run the script.

# Author: Andreas Tobola
# http://www.tnotes.de/CDependencyGraph
echo "digraph G {" > $FILE_OUT
echo "rankdir=LR;" >> $FILE_OUT
echo "fontsize=24;" >> $FILE_OUT
for mfile in `ls ./rat2src`
  module=`echo $mfile | sed 's/[.]/ /' | awk '{print $1}'`
  echo $module" ("$mfile")"
  modlist=`cat ./rat2src/$mfile | grep -v '<' |  grep '#include'| awk '{print $2}'  | sed 's/<//g'  | sed 's/>//g' | sed 's/[.]/ /g' | sed 's/"//g' | awk '{print $1}' | grep -v $module`
  for link in $modlist
     echo "   "$link
     echo "\""$module"\" -> \""$link"\"" >> $FILE_OUT
echo "}" >> $FILE_OUT
echo "graphviz..."
dot -Tpng $FILE_OUT  -o rat2moddep.png

Siehe auch C

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki