-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_call_graph.sh
executable file
·59 lines (48 loc) · 1.01 KB
/
build_call_graph.sh
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
#!/bin/bash
## @brief build dot file to svg with js plugin embedded
## @email [email protected]
## @date 2019-06-17-Mon
cwd=`pwd`
# check if symlink
file=`readlink $0`
if [ "x${file}" == "x" ]; then
file=$0
fi
pushd "$(dirname ${file})" > /dev/null
attach=`pwd -P`/call_graph_highlight_plugin.xml
popd > /dev/null
src=$1
out=$2
if [ ! -f ${attach} ]; then
echo "attachment: ${attach} not found, unable to continue"
exit -1
fi
if [ "x${src}" == "x" ]; then
echo "usage:"
echo " $0 "'${src} ${out}'
exit -1
fi
if [ ! -f ${src} ]; then
echo "src: ${src} not found, unable to continue"
exit -1
fi
if [ "x${out}" == "x" ]; then
out=${cwd}/a.svg
else
if [[ "${out}" != "/*" ]] || [[ "${out}" != "~*" ]]; then
out=${out}
else
out="${cwd}/${out}"
fi
fi
# echo ${out}
which dot > /dev/null
if [ $? -ne 0 ]; then
echo "no graphviz dot found"
exit -1
fi
dot -Tsvg -o ${out} ${src} > /dev/null
sed -i.bak 's#</svg>##' ${out}
rm -f ${out}.bak
cat "${attach}" >> ${out}
echo "</svg>" >> ${out}