blob: 36da0200fce736a34864fa5c7884fffa1da8f4b6 (
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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
#/*@@
# @file MakeUtils.pl
# @date July 1999
# @author Tom Goodale
# @desc
# Utility perl routines needed by the Makefile.
# @enddesc
# @version $Header$
#@@*/
#/*@@
# @routine buildthorns
# @date Tue Jan 19 14:02:07 1999
# @author Tom Goodale
# @desc
# Creates an compiled ThornList
# @enddesc
# @version $Id$
#@@*/
sub buildthorns
{
my($arrangement_dir,$choice) = @_;
my(@arrangements);
my(%info);
chdir $arrangement_dir || die "Can't change directory to $arrangement_dir\n";
open(ARRANGEMENTS, "ls|");
while(<ARRANGEMENTS>)
{
chop;
# Ignore CVS and backup stuff
next if (m:^CVS$:);
next if (m:^\#:);
next if (m:~$:);
next if (m:\.bak$:i);
next if (m:^\.:);
# Just pick directories
if( -d $_)
{
push (@arrangements, $_);
}
}
close ARRANGEMENTS;
if ($choice =~ "thorns")
{
foreach $arrangement (@arrangements)
{
chdir $arrangement;
open(THORNLIST, "ls|");
while(<THORNLIST>)
{
chop;
# Ignore CVS and backup stuff
next if (m:^CVS$:);
next if (m:^\#:);
next if (m:~$:);
next if (m:\.bak$:i);
next if (m:^\.:);
# Allow each arrangement to have a documentation directory.
next if (m:^doc$:);
# Just pick directories
if( -d $_)
{
push(@total_list, "$arrangement/$_");
}
}
chdir "..";
}
}
else
{
@total_list = @arrangements;
}
if($choice =~ "thorns")
{
foreach $thorn (@total_list)
{
if( -r "$thorn/interface.ccl" && -r "$thorn/param.ccl")
{
$info{$thorn} = &ThornInfo($thorn);
}
# print "$thorn \# $info{$thorn}\n";
}
}
else
{
foreach $arrangement (@total_list)
{
$info{$arrangement} = 1;
}
}
chdir "..";
return %info;
}
#/*@@
# @routine ThornInfo
# @date Sun Oct 17 15:57:44 1999
# @author Tom Goodale
# @desc
# Determines some info about a thorn.
# @enddesc
# @calls
# @calledby
# @history
#
# @endhistory
#
#@@*/
sub ThornInfo
{
my($thorn) = @_;
my($implementation) = "";
my($friends) = "";
my($inherits) = "";
my($shares) = "";
open(INTERFACE, "<$thorn/interface.ccl") || die "Unable to open $thorn/interface.ccl";
while(<INTERFACE>)
{
chop;
if (m/^\s*IMPLEMENTS:\s*([a-z]+[a-z_0-9]*)\s*$/i)
{
$implementation = $1;
}
elsif (m/^\s*INHERITS\s*:((\s*[a-zA-Z]+[a-zA-Z_0-9]*)*\s*)$/i)
{
$inherits = $1;
}
elsif (m/^\s*FRIEND\s*:((\s*[a-zA-Z]+[a-zA-Z_0-9]*)*\s*)$/i)
{
$friends = $1;
}
}
close(INTERFACE);
open(PARAM, "<$thorn/param.ccl") || die "Unable to open $thorn/param.ccl";
while(<PARAM>)
{
chop;
if($line =~ m/SHARES\s*:(.*)/i)
{
$share .= " $1";
}
}
close(PARAM);
if($inherits =~ /^[\s\t\n]*$/)
{
$inherits = " ";
}
else
{
$inherits =~ s:^\s*::;
$inherits =~ s:\s*$::;
$inherits =~ s:[\s\t\n]+:,:g;
}
if($friends =~ /^[\s\t\n]*$/)
{
$friends = " ";
}
else
{
$friends =~ s:^\s*::;
$friends =~ s:\s*$::;
$friends =~ s:[\s\t\n]+:,:g;
}
if($shares =~ /^[\s\t\n]*$/)
{
$shares = " ";
}
else
{
$shares =~ s:^\s*::;
$shares =~ s:\s*$::;
$shares =~ s:[\s\t\n]+:,:g;
}
return "$implementation ($inherits) [$friends] {$shares}";
}
1;
|