Started a glossary implementation (initialized from the socket lib glossary) in Gloss...
[senf.git] / doclib / dot
1 #!/bin/sh
2
3 topdir="`dirname "$0"`"; topdir="`cd "$topdir/.."; pwd`"
4 "$topdir/doclib/dot-munge.pl" "$1"
5
6 case "$2" in
7     -Tpng:gd)
8         first="$1"; shift; shift
9         set -- "$first" "-Tpng" "$@"
10         ;;
11     *)
12 esac
13
14 set -e
15
16 dot "$@"
17 if [ -r "$4" ]; then
18     size="`pngtopnm "$4" | sed -n -e '2p'`"
19     width_a="${size% *}"
20     height_a="${size#* }"
21     if [ $width_a -gt 800 ]; then
22         for file in "${1%.dot}".*; do
23             cp "$file" "$file.a"
24         done
25         sed -e 's/rankdir=LR/rankdir=TB/' -e t -e 's/rankdir=TB/rankdir=LR/' "$1.a" > "$1"
26         dot "$@"
27         size="`pngtopnm "$4" | sed -n -e '2p'`"
28         width_b="${size% *}"
29         height_b="${size#* }"
30         if [ $width_a -lt $width_b ]; then
31             for file in "${1%.dot}".*.a; do
32                 mv "$file" "${file%.a}"
33             done
34         else
35             rm "${1%.dot}".*.a
36         fi
37     fi
38 fi