1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#!/bin/sh
#
# depgraph
# Morgan Deters, 27 October 2010
#
# Builds a graphviz graph of dependences between source and header files in CVC4.
#
progname=`basename "$0"`
postproc='sort -u'
mode=packages
if [ $# -gt 0 ]; then
if [ $# -eq 1 -a "$1" = "-a" ]; then
postproc=cat
mode=headers
else
echo "usage: $progname [-a]"
echo " -a ("all") produces _all_ headers in the source, with clusters for packages."
echo " the default behavior produces just package dependence information."
exit 1
fi
fi
cd "`dirname \"$0\"`/.."
if ! [ -d src -a -d test/unit ]; then
echo "$progname: source directory malformed; is this CVC4 ?!" >&2
exit 1
fi
echo "digraph G {"
paths=`find src -name '*.c' \
-o -name '*.cc' \
-o -name '*.cpp' \
-o -name '*.C' \
-o -name '*.h' \
-o -name '*.hh' \
-o -name '*.hpp' \
-o -name '*.H' \
-o -name '*.y' \
-o -name '*.yy' \
-o -name '*.ypp' \
-o -name '*.Y' \
-o -name '*.l' \
-o -name '*.ll' \
-o -name '*.lpp' \
-o -name '*.L' \
-o -name '*.g'`
if [ "$mode" = headers ]; then
oldpackage=
for path in $paths; do
dir=`echo "$path" | sed 's,^\([^/]*\).*,\1,'`
file=`echo "$path" | sed 's,^[^/]*/,,'`
package=`echo "$file" | sed 's,^\(.*\)/.*,\1,'`
file=`echo "$file" | sed 's,^.*/,,'`
if [ -n "$oldpackage" -a "$package" != "$oldpackage" ]; then
echo ' }'
fi
if [ "$package" != "$oldpackage" ]; then
echo " subgraph \"cluster$package\" {"
echo " label=\"$package\";"
oldpackage="$package"
fi
echo " \"$package/$file\"[label=\"$file\"];"
done
if [ -n "$oldpackage" ]; then
echo ' }'
fi
fi
for path in $paths; do
dir=`echo "$path" | sed 's,^\([^/]*\).*,\1,'`
file=`echo "$path" | sed 's,^[^/]*/,,'`
package=`echo "$file" | sed 's,^\(.*\)/.*,\1,'`
file=`echo "$file" | sed 's,^.*/,,'`
incs=`grep '^# *include *".*"' "$path" | sed 's,^# *include *"\(.*\)".*,\1,'`
for inc in $incs; do
case "$inc" in
expr/expr.h) inc=expr/expr_template.h ;;
expr/expr_manager.h) inc=expr/expr_manager_template.h ;;
expr/kind.h) inc=expr/kind_template.h ;;
expr/metakind.h) inc=expr/metakind_template.h ;;
theory/theoryof_table.h) inc=theory/theoryof_table_template.h ;;
util/integer.h) inc=util/integer.h.in ;;
util/rational.h) inc=util/rational.h.in ;;
util/tls.h) inc=util/tls.h.in ;;
cvc4autoconfig.h) inc=cvc4autoconfig.h.in ;;
esac
incpath=
dirpackageparent="$dir/`dirname "$package"`"
for incdir in "$dir" "$dir/include" "$dir/$package" . "$dirpackageparent"; do
if [ -e "$incdir/$inc" ]; then incpath="$incdir/$inc"; break; fi
done
if [ -z "$incpath" ]; then
echo "$progname: error: can't find include file '$inc' from source '$path'" >&2
exit 1
fi
incpath=`echo "$incpath" | sed 's,^\./,,'`
incpath=`echo "$incpath" | sed "s,^$dir/,,"`
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\";"
else
echo " \"$package/$file\" -> \"$incpath\";"
fi
done
done | $postproc
echo "}"
|