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

535a* 21+   507  535b
#------------------------------------------------------------------
#---
#--- 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 408, ALLPROSELIBRARYNAME 350, and projectname 127.

We do nothing if a certain file does not (yet) exist.

535b* 21+   535a  536a
if (! -f "$projectname.lsf") {exit 0;}

Uses projectname 127.

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.

536a* 21+   535b  536b
%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 127.

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.

536b* 21+   536a  536c
$undocumentedFileDetected=0;
while (<>) {
    chomp;
    if (! $documented{$_}) {
        $undocumentedFileDetected=1;
        $undocumented = $_;
        last;
    }
}

Uses undocumented 440.

There is no need to write out a file undocumented.tex if no undocumented file has been found.

536c* 21+   536b  537a
if (! $undocumentedFileDetected) {exit 0;}

We write out to the file undocumented.tex all the undocumented files together with some explanation.

537a* 21+   536c  539b
open(DF, ">undocumented.tex");
print Section text 537b
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 440.

The text that introduces the list of undocumented files.

537bprint Section text 537b  (537a)
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 350, projectname 127, and undocumented 440.