2000-05-05 17:14:44 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
$srcdir = $ARGV[0];
|
|
|
|
|
2000-05-31 11:29:56 +00:00
|
|
|
open(OUT, ">prog.sgml") || die "Cannot create output file";
|
2000-06-05 09:51:24 +00:00
|
|
|
include("doc/prog-head.sgml");
|
2000-05-05 17:14:44 +00:00
|
|
|
process("");
|
2000-06-05 09:51:24 +00:00
|
|
|
include("doc/prog-foot.sgml");
|
2000-05-05 17:14:44 +00:00
|
|
|
close OUT;
|
|
|
|
exit 0;
|
|
|
|
|
2000-05-31 11:29:56 +00:00
|
|
|
sub include {
|
|
|
|
my $f = shift @_;
|
2000-06-05 09:51:24 +00:00
|
|
|
open(IN, "$srcdir/$f") || die "Unable to find $f";
|
2000-05-31 11:29:56 +00:00
|
|
|
while (<IN>) {
|
|
|
|
print OUT;
|
|
|
|
}
|
|
|
|
close IN;
|
|
|
|
}
|
|
|
|
|
2000-05-05 17:14:44 +00:00
|
|
|
sub process {
|
|
|
|
my $dir = shift @_;
|
2018-04-23 09:29:13 +00:00
|
|
|
print "$dir/progdoc\n";
|
|
|
|
open(IN, "$srcdir/$dir/progdoc") || die "Unable to read $dir/progdoc";
|
2000-05-05 17:14:44 +00:00
|
|
|
my @docfile = <IN>;
|
|
|
|
close IN;
|
|
|
|
foreach $_ (@docfile) {
|
|
|
|
chomp;
|
|
|
|
/^#/ && next;
|
2000-05-31 11:29:56 +00:00
|
|
|
/^([A-Z]+)\s*(.*)/ || die "Parse error: $_";
|
|
|
|
$cmd = $1;
|
|
|
|
$arg = $2;
|
2000-05-05 17:14:44 +00:00
|
|
|
if ($cmd eq "C") { process("$dir/$arg"); }
|
|
|
|
elsif ($cmd eq "H") {
|
|
|
|
push @stack, "H";
|
2000-06-02 17:23:53 +00:00
|
|
|
print OUT "<chapt>$arg\n";
|
2000-05-05 17:14:44 +00:00
|
|
|
} elsif ($cmd eq "S") {
|
|
|
|
print " $arg\n";
|
2000-05-31 11:29:56 +00:00
|
|
|
open(DOC, "cd $srcdir/$dir ; $srcdir/doc/kernel-doc -bird $arg |") || die "Unable to start kernel-doc";
|
|
|
|
while (<DOC>) { print OUT; }
|
2000-05-05 17:14:44 +00:00
|
|
|
close DOC;
|
2000-05-31 11:29:56 +00:00
|
|
|
} elsif ($cmd eq "D") {
|
|
|
|
print " $arg\n";
|
2000-06-05 09:51:24 +00:00
|
|
|
include("$dir/$arg");
|
2000-05-05 17:14:44 +00:00
|
|
|
} else { die "Unknown command: $cmd"; }
|
|
|
|
}
|
|
|
|
}
|