39 Warn About Undocumented Files
This Perl script is intended to generate the file undocumented.tex if files are
found that do not appear inside a ∖sourcefile command in myalps.tex.nw,
The script should be called as follows
perl undocumented.pl $(projectname) allprosefiles.list \
$(ALLPROSELIBRARYNAME) files.list
|
532a⟨* 21⟩+
≡ ⊲503 532b ⊳
#------------------------------------------------------------------
#---
#--- ALLPROSE
#--- Copyright (C) Ralf Hemmecke (ralf@hemmecke.de)
#--- http://www.hemmecke.de/aldor
#---
#------------------------------------------------------------------
if (scalar(@ARGV) < 4) {
print STDERR "Usage: $0 projectname allprosefiles.list ALLPROSELIBRARYNAME files.list\n";
die "";
}
$projectname=shift;
$allprosefiles=shift;
$ALLPROSELIBRARYNAME=shift;
Uses allprosefiles.list 403, ALLPROSELIBRARYNAME 346, and projectname 124.
We do nothing if a certain file does not (yet) exist.
As documented file counts every file that either appears in the list of
source files generated during the first LATEX run that compiles the project
documentation. These names correspond to filenames appearing in a ∖sourcefile
command.
Furthermore, all files of ALLPROSE automatically count as documented.
533a⟨* 21⟩+
≡ ⊲532b 533b ⊳
%documented=();
open(SF, "$projectname.lsf"); #$
while(<SF>) {if (/^\\SourceFile {(.*)}/) {$documented{$1}=1;}}
close(SF);
open(SF, "$allprosefiles");
while(<SF>) {if (/^(.*)\.nw/) {$documented{$1}=1;}}
close(SF);
Uses projectname 124.
Now we go through the list of files given by the filename that is given as the
fourth parameter (files.list). (See target fileslist.)
If an undocumented file is detected, we stop the loop.
533b⟨* 21⟩+
≡ ⊲533a 533c ⊳
$undocumentedFileDetected=0;
while (<>) {
chomp;
if (! $documented{$_}) {
$undocumentedFileDetected=1;
$undocumented = $_;
last;
}
}
Uses undocumented 436.
There is no need to write out a file undocumented.tex if no undocumented file
has been found.
533c⟨* 21⟩+
≡ ⊲533b 534 ⊳
if (! $undocumentedFileDetected) {exit 0;}
We write out to the file undocumented.tex all the undocumented files together
with some explanation.
534⟨* 21⟩+
≡ ⊲533c 536b ⊳
open(DF, ">undocumented.tex");
⟨print Section text 535⟩
print DF "\\begin{itemize}\n";
print DF "\\item \\srcfile{$undocumented}\n";
while (<>) {
chomp;
if (! $documented{$_}) {print DF "\\item \\srcfile{$_}\n";}
}
print DF "\\end{itemize}\n";
close(DF);
Uses undocumented 436.
The text that introduces the list of undocumented files.
535⟨print Section text 535⟩≡ (534)
print DF <<’EOTEXT’;
\section{Undocumented Files}
\begin{ToDo}
You should shortly describe in
EOTEXT
print DF "\\srcfile{$projectname.tex}";
print DF <<’EOTEXT’;
the following files by using the \usetexcommand{sourcefile} command.
Search for \usetexcommand{sourcefile} in
EOTEXT
print DF "\\srcfile{$ALLPROSELIBRARYNAME.tex} ";
print DF <<’EOTEXT’;
in order to find some examples.
\end{ToDo}
This section has been generated by the script
\srcfile{tools/undocumented.pl} called in the target
\usemaketarget{undocumented} in \srcfile{Makefile.inc}.
The section will automatically disappear if the following filename(s)
are written inside a \usetexcommand{sourcefile} command.
EOTEXT
Uses ALLPROSELIBRARYNAME 346, projectname 124, and undocumented 436.