File: gvmap.sh

package info (click to toggle)
graphviz 2.38.0-17
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 80,692 kB
  • ctags: 27,194
  • sloc: ansic: 1,038,718; sh: 14,765; cpp: 11,377; makefile: 4,480; yacc: 3,339; xml: 2,466; tcl: 1,950; cs: 1,890; objc: 1,157; perl: 422; lex: 375; awk: 241; python: 45; ruby: 41; php: 26
file content (104 lines) | stat: -rwxr-xr-x 2,181 bytes parent folder | download | duplicates (6)
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
#!/bin/sh

# Script for gvmap pipeline
# Use -A to add flags for gvmap; e.g., -Ae results in gvmap -e
# -K can be used to change the original layout; by default, sfdp is used
# -T is used to specify the final output format
# -G, -N and -E flags can be used to tailor the rendering
# -g, -n and -e flags can be used to tailor the initial layout
# Be careful of spaces in the flags. If these are not wrapped in quotes, the
# parts will be separated during option processing.

LAYOUT=sfdp
trap 'rm -f $TMPFILE1 $TMPFILE2 $TMPINFILE errout; exit' 0 1 2 3 15
OPTSTR="vVA:[gvmap flags]G:[attr=val]E:[attr=val]N:[attr=val]g:[attr=val]e:[attr=val]n:[attr=val]K:[layout]T:[output format]o:[outfile]"
FLAGS1=
FLAGS2=
FLAGS3=

while getopts ":$OPTSTR" c
do
  case $c in
  v )
    VERBOSE=1
    FLAGS1="$FLAGS1 -v"
    FLAGS2="$FLAGS2 -v"
    FLAGS3="$FLAGS3 -v"
    ;;
  V )
	dot -V
    exit 0
    ;;
  K )
    LAYOUT=$OPTARG
    ;;
  A )
    FLAGS2="$FLAGS2 -$OPTARG"
    ;;
  T )
    FLAGS3="$FLAGS3 -T$OPTARG"
    ;;
  e )
      FLAGS1="$FLAGS1 -E$OPTARG"
    ;;
  n )
      FLAGS1="$FLAGS1 -N$OPTARG"
    ;;
  g )
      FLAGS1="$FLAGS1 -G$OPTARG"
    ;;
  E )
      FLAGS3="$FLAGS3 -E$OPTARG"
    ;;
  N )
      FLAGS3="$FLAGS3 -N$OPTARG"
    ;;
  G )
      FLAGS3="$FLAGS3 -G$OPTARG"
    ;;
  o )
      FLAGS3="$FLAGS3 -o$OPTARG"
    ;;
  :)
    print -u 2 $OPTARG requires a value
    exit 2
    ;;
  \? )
    if [ "$OPTARG" = '?' ]
    then
      getopts -a gvmap "$OPTSTR" x '-?'
      exit 0
    else
      print -u 2 "gvmap: unknown flag $OPTARG - ignored"
    fi
    ;;
  esac
done
shift $((OPTIND-1))

if [ $# -eq 0 ]
then
  if [ -n $VERBOSE ]
  then
    print -u 2 "$LAYOUT -Goverlap=prism $FLAGS1 | gvmap $FLAGS2 | neato -n2 $FLAGS3"
  fi
  $LAYOUT -Goverlap=prism $FLAGS1 | gvmap $FLAGS2 | neato -n2 $FLAGS3
else
  while $(( $# > 0 ))
  do
    if [ -f $1 ]
    then
      if [ -n $VERBOSE ]
      then
        print -u 2 "$LAYOUT -Goverlap=prism $FLAGS1 $1 | gvmap $FLAGS2 | neato -n2 $FLAGS3"
      fi
      $LAYOUT -Goverlap=prism $FLAGS1 $1 | gvmap $FLAGS2 | neato -n2 $FLAGS3
    else
      print -u 2 "gvmap: unknown input file $1 - ignored"
    fi
    shift
  done
fi