File: dotty.ksh

package info (click to toggle)
graphviz 2.26.3-5%2Bsqueeze2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 63,032 kB
  • ctags: 25,930
  • sloc: ansic: 212,134; sh: 20,316; cpp: 7,239; makefile: 4,211; yacc: 3,335; xml: 2,450; tcl: 1,900; cs: 1,890; objc: 1,149; perl: 829; lex: 363; awk: 171; python: 41; ruby: 35; php: 26
file content (119 lines) | stat: -rwxr-xr-x 2,518 bytes parent folder | download | duplicates (12)
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
114
115
116
117
118
119

set -A FILES
MLEVEL="0"
LMODE="async"
FLAGS=

function usage {
    print "usage: dotty [-V] [-lm (sync|async)] [-el (0|1)] <filename>"
}

function processoptions {
    while [[ $# > 0 ]] do
        case $1 in
        -V)
            print "dotty version 96c (09-24-96)"
			FLAGS=$FLAGS" -V"
            shift
            ;;
        -f)
            shift
            loadfile=$1
            shift
            ;;
        -lt)
            shift
            layouttool=$1
            shift
            ;;
        -lm)
            shift
            LMODE=$1
            if [[ $LMODE != 'sync' && $LMODE != 'async' ]] then
                usage
                exit 1
            fi
            shift
            ;;
        -el)
            shift
            MLEVEL=$1
            if [[ $MLEVEL != '0' && $MLEVEL != '1' ]] then
                usage
                exit 1
            fi
            shift
            ;;
        -)
            FILES[${#FILES[@]}]="'"$1"'"
            shift
            ;;
        -*)
            usage
            exit 1
            ;;
        *)
            FILES[${#FILES[@]}]="'"$1"'"
            shift
            ;;
        esac
    done
}

if [[ $DOTTYOPTIONS != '' ]] then
    processoptions $DOTTYOPTIONS
fi
processoptions "$@"

if [[ $DOTTYPATH != '' ]] then
    export LEFTYPATH="$DOTTYPATH:$LEFTYPATH"
fi

CMDS=""

CMDS="dotty.protogt.layoutmode = '$LMODE';"

CMDS=$(print $CMDS dotty.mlevel = $MLEVEL";")

if [[ $loadfile != '' ]] then
    CMDS=$(print $CMDS load \("'"$loadfile"'"\)";")
fi

if [[ $layouttool != '' ]] then
    CMDS=$(print $CMDS dotty.protogt.lserver = "'$layouttool';")
fi

if [[ $FILES = '' ]] then
    FILES=null
fi
FUNC="dotty.createviewandgraph"
for i in "${FILES[@]}"; do
    CMDS=$(print $CMDS $FUNC \($i, "'"file"'", null, null\)";")
done

leftypath=$(whence -p lefty)
if [[ $leftypath == '' ]] then
    print -u2 "dotty: cannot locate the lefty program"
    print -u2 "       make sure that your path includes"
    print -u2 "       the directory containing dotty and lefty"
    exit 1
fi

$leftypath $FLAGS -e "
load ('dotty.lefty');
checkpath = function () {
    if (tablesize (dotty) > 0)
        remove ('checkpath');
    else {
        echo ('dotty: cannot locate the dotty scripts');
        echo ('       make sure that the environment variable LEFTYPATH');
        echo ('       is set to the directory containing dotty.lefty');
        exit ();
    }
};
checkpath ();
dotty.init ();
monitorfile = dotty.monitorfile;
$CMDS
txtview ('off');
"