From: Morgan Deters Date: Wed, 27 Oct 2010 05:29:39 +0000 (+0000) Subject: support focus on a particular subpackage (e.g. "expr") X-Git-Tag: cvc5-1.0.0~8774 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=12ce65216cf464f4a894ca4640895d29a638d681;p=cvc5.git support focus on a particular subpackage (e.g. "expr") --- diff --git a/contrib/depgraph b/contrib/depgraph old mode 100644 new mode 100755 index c03c2209f..e85bcd694 --- a/contrib/depgraph +++ b/contrib/depgraph @@ -10,15 +10,23 @@ progname=`basename "$0"` postproc='sort -u' mode=packages +target= if [ $# -gt 0 ]; then - if [ $# -eq 1 -a "$1" = "-a" ]; then + if [ "$1" = "-a" ]; then postproc=cat mode=headers - else - echo "usage: $progname [-a]" + shift + fi + if [ $# -gt 0 -a "$1" != "-h" ]; then + target="$1" + shift + fi + if [ $# -gt 0 ]; then + echo "usage: $progname [-a] [target]" echo " -a ("all") produces _all_ headers in the source, with clusters for packages." - echo " the default behavior produces just package dependence information." + echo " the default behavior produces just package dependence information." + echo " with target, focus on dependences of that particular package (e.g. \"expr\")" exit 1 fi fi @@ -56,6 +64,7 @@ if [ "$mode" = headers ]; then file=`echo "$path" | sed 's,^[^/]*/,,'` package=`echo "$file" | sed 's,^\(.*\)/.*,\1,'` file=`echo "$file" | sed 's,^.*/,,'` + if [ -n "$target" -a "$target" != "$package" ]; then continue; fi if [ -n "$oldpackage" -a "$package" != "$oldpackage" ]; then echo ' }' fi @@ -76,6 +85,7 @@ for path in $paths; do package=`echo "$file" | sed 's,^\(.*\)/.*,\1,'` file=`echo "$file" | sed 's,^.*/,,'` incs=`grep '^# *include *".*"' "$path" | sed 's,^# *include *"\(.*\)".*,\1,'` + if [ -n "$target" -a "$target" != "$package" ]; then continue; fi for inc in $incs; do case "$inc" in expr/expr.h) inc=expr/expr_template.h ;; @@ -99,13 +109,23 @@ for path in $paths; do fi incpath=`echo "$incpath" | sed 's,^\./,,'` incpath=`echo "$incpath" | sed "s,^$dir/,,"` + incdir=`echo "$incpath" | sed 's,^\([^/]*\).*,\1,'` + incpackage=`echo "$incpath" | sed 's,^\(.*\)/.*,\1,'` + incfile=`echo "$incpath" | sed 's,^.*/,,'` if [ "$mode" = packages ]; then - incdir=`echo "$incpath" | sed 's,^\([^/]*\).*,\1,'` - incpackage=`echo "$incpath" | sed 's,^\(.*\)/.*,\1,'` - incfile=`echo "$incpath" | sed 's,^.*/,,'` - [ "$package" != "$incpackage" ] && echo " \"$package\" -> \"$incpackage\";" + if [ "$package" != "$incpackage" ]; then + if [ -n "$target" ]; then + echo " \"$package\" -> \"$incpackage\"[label=\"$incfile\"];" + else + echo " \"$package\" -> \"$incpackage\";" + fi + fi else - echo " \"$package/$file\" -> \"$incpath\";" + if [ -n "$target" ]; then + [ "$package" != "$incpackage" ] && echo " \"$package/$file\" -> \"$incpackage\"[label=\"$incfile\"];" + else + echo " \"$package/$file\" -> \"$incpath\";" + fi fi done done | $postproc