blob: 935c310afac4ddfed6f7f15810f94e8ea8fcd498 (
plain)
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
|
# Convert a sorted file with entries
# file<tab>name
# to a libref-style "referenced-by" map on stdout (4 entries per line)
# [09-Sep-87]
BEGIN {
FS = "\t";
nref = 0;
callee = "";
print "*********************************************************************";
print "* ..File.. * ...Global Symbol... *";
print "*********************************************************************";
print "* * *";
}
{
if (($1 != "") && ($1 != callee) && (callee != ""))
{
if (length(callee) > 20)
the_callee = substr(callee,1,20);
else
the_callee = callee;
printf "* %-20s->",the_callee;
nref4 = 4*int((nref + 3)/4);
for (k = nref; k < nref4; ++k)
refby[k] = " ";
nref = nref4;
for (k = 0; k < nref; )
{
printf " %-10s",refby[k];
++k;
if ((k % 4) == 0)
{
printf "*\n";
if (k < nref)
{
printf "* *";
}
}
}
nref = 0;
print "* * *";
}
if ($1 != "")
callee = $1; # first type--initial entry for new callee
if ($2 == "")
$2 = $4; # second type--same callee, different caller
if ($2 != "") # not third type
{
if (length($2) > 10)
$2 = substr($2,1,10);
refby[nref] = $2;
nref++; # awk treats refby[nref++] as refby[++nref], sigh...
}
}
END {
if (length(callee) > 20)
the_callee = substr(callee,1,20);
else
the_callee = callee;
printf "* %-20s->",the_callee;
nref4 = 4*int((nref + 3)/4);
for (k = nref; k < nref4; ++k)
refby[k] = " ";
nref = nref4;
for (k = 0; k < nref; )
{
printf " %-10s",refby[k];
++k;
if ((k % 4) == 0)
{
printf "*\n";
if (k < nref)
{
printf "* *";
}
}
}
nref = 0;
print "* * *";
print "*********************************************************************";
}
|