home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
2.x
/
plum2_28_2.lzh
/
support
/
mkconf
< prev
next >
Wrap
Text File
|
1998-10-15
|
2KB
|
89 lines
#!/bin/perl -w
# $Id: mkconf,v 2.8 1998/05/29 16:51:17 hasegawa Exp $
# copyright (c)1997-1998 pupu_j <hasegawa@agusa.nuie.nagoya-u.ac.jp>
&main(@ARGV);
sub main {
local(@args) = @_;
local($dir);
if (!@args) {
&usage();
exit(1);
}
$dir = shift(@args);
&property("$dir/plum", 'plum');
print "\n";
&traverse("$dir/module", '');
}
sub traverse {
local($base, $dir) = @_;
local(@files, $file, $prop);
opendir(DIR, "$base/$dir") || die;
@files = readdir(DIR);
closedir(DIR);
foreach $file (sort(@files)) {
next if $file =~ /^\./;
next if $file eq 'SCCS';
next if $file eq 'RCS';
next if $file eq 'CVS';
next if $file =~ /\,v$/;
if (-d "$base/$dir/$file") {
if ($dir) {
&traverse($base, "$dir/$file");
} else {
&traverse($base, $file);
}
} elsif ($file =~ /\.plm/) {
$prop = "$dir.$`";
$prop =~ tr/\//\./;
if ($dir) {
print "- $dir/$file\n";
&property("$base/$dir/$file", $prop);
} else {
print "- $file\n";
&property("$base/$file", $prop);
}
print "\n";
}
}
}
sub property {
local($file, $prop) = @_;
local(@prog, @doc);
@prog = ();
@doc = ();
if (open(FILE, $file)) {
while (defined($line = <FILE>)) {
$line =~ tr/\r\n//d;
while ($line =~ /\&\'property\(.*\,\s*\'([^\']*)\'\)/) {
push(@prog, "# $prop.$1: ");
$line = $';
}
last if $line eq '__END__';
}
while (defined($line = <FILE>)) {
$line =~ tr/\r\n//d;
if ($line =~ /^\s*\<DT\>\s+([\w\d\.]+)/) {
push(@doc, "# $1: ");
}
}
close(FILE);
}
foreach $doc (@doc) {
print $doc, "\n";
@prog = grep($_ ne $doc, @prog);
}
$last = '';
foreach $prog (sort(@prog)) {
print '# ', $prog, "\n" if $prog ne $last;
$last = $prog;
}
}
sub usage {
print 'usage: perl mkconf <plum-top-directory>', "\n";
}