Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/mam/mamdag.sh
1808 views
1
########################################################################
2
# #
3
# This software is part of the ast package #
4
# Copyright (c) 1989-2011 AT&T Intellectual Property #
5
# and is licensed under the #
6
# Eclipse Public License, Version 1.0 #
7
# by AT&T Intellectual Property #
8
# #
9
# A copy of the License is available at #
10
# http://www.eclipse.org/org/documents/epl-v10.html #
11
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
12
# #
13
# Information and Software Systems Research #
14
# AT&T Research #
15
# Florham Park NJ #
16
# #
17
# Glenn Fowler <[email protected]> #
18
# #
19
########################################################################
20
: convert MAM dependency info to dag input
21
22
COMMAND=mamdag
23
case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
24
0123) ARGV0="-a $COMMAND"
25
USAGE=$'
26
[-?
27
@(#)$Id: mamdag (AT&T Labs Research) 1998-04-01 $
28
]
29
'$USAGE_LICENSE$'
30
[+NAME?mamdag - make abstract machine to dag dependency graph conversion filter]
31
[+DESCRIPTION?\bmamdag\b reads MAM (Make Abstract Machine) target and
32
prerequisite file descriptions from the standard input and writes a
33
\bdag\b(1) description of the dependency graph on the standard output.
34
Mamfiles are generated by the \b--mam\b option of \bnmake\b(1) and
35
\bgmake\b(1).]
36
[+?\bdag\b(1) is an obsolete predecessor to \bdot\b(1); new applications should
37
use \bmamdot\b(1) and \bdot\b(1).]
38
[+SEE ALSO?\bdag\b(1), \bdot\b(1), \bmamdot\b(1), \bgmake\b(1), \bnmake\b(1)]
39
'
40
;;
41
*) ARGV0=""
42
USAGE=""
43
;;
44
esac
45
46
usage()
47
{
48
OPTIND=0
49
getopts $ARGV0 "$USAGE" OPT '-?'
50
exit 2
51
}
52
53
while getopts $ARGV0 "$USAGE" OPT
54
do case $OPT in
55
*) usage
56
;;
57
esac
58
done
59
60
integer level=0 line=0
61
list[0]=all
62
print .GR 7.50 10.0
63
print draw nodes as Box ';'
64
while read op arg arg2 argx
65
do line=line+1
66
case $op in
67
[0-9]*) op=$arg
68
arg=$arg2
69
arg2=$arg3
70
arg3=$argx
71
argx=
72
;;
73
esac
74
case $op in
75
make) case " ${list[level]} " in
76
*" \"$arg\" "*) ;;
77
*) list[level]="${list[level]} \"$arg\"" ;;
78
esac
79
level=level+1
80
list[level]=\"$arg\"
81
;;
82
prev) case " ${list[level]} " in
83
*" \"$arg\" "*) ;;
84
*) list[level]="${list[level]} \"$arg\"" ;;
85
esac
86
;;
87
done) case ${list[level]} in
88
*' '*) print ${list[level]} ';'
89
esac
90
if (( level <= 0 ))
91
then print -u2 "$COMMAND: line $line: $op $arg: no matching make op"
92
else level=level-1
93
fi
94
;;
95
esac
96
done
97
print .GE
98
99