|
version 1.1, 2017/08/22 12:33:54
|
version 1.1.1.2, 2021/03/17 19:50:23
|
|
Line 3
|
Line 3
|
| $srcdir = $ARGV[0]; |
$srcdir = $ARGV[0]; |
| |
|
| open(OUT, ">prog.sgml") || die "Cannot create output file"; |
open(OUT, ">prog.sgml") || die "Cannot create output file"; |
| include("doc/prog-head.sgml"); | process("", "doc/prog-root"); |
| process(""); | |
| include("doc/prog-foot.sgml"); | |
| close OUT; |
close OUT; |
| exit 0; |
exit 0; |
| |
|
|
Line 20 sub include {
|
Line 18 sub include {
|
| |
|
| sub process { |
sub process { |
| my $dir = shift @_; |
my $dir = shift @_; |
| print "$dir/Doc\n"; | my $doc = "$dir/" . shift @_; |
| open(IN, "$srcdir/$dir/Doc") || die "Unable to read $dir/Doc"; | print "$doc\n"; |
| | open(IN, "$srcdir/$doc") || die "Unable to read $doc"; |
| my @docfile = <IN>; |
my @docfile = <IN>; |
| close IN; |
close IN; |
| foreach $_ (@docfile) { |
foreach $_ (@docfile) { |
|
Line 30 sub process {
|
Line 29 sub process {
|
| /^([A-Z]+)\s*(.*)/ || die "Parse error: $_"; |
/^([A-Z]+)\s*(.*)/ || die "Parse error: $_"; |
| $cmd = $1; |
$cmd = $1; |
| $arg = $2; |
$arg = $2; |
| if ($cmd eq "C") { process("$dir/$arg"); } | if ($cmd eq "C") { process("$dir/$arg", "Doc"); } |
| elsif ($cmd eq "H") { |
elsif ($cmd eq "H") { |
| push @stack, "H"; |
push @stack, "H"; |
| print OUT "<chapt>$arg\n"; |
print OUT "<chapt>$arg\n"; |