1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
#!/usr/bin/perl
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
@files = @ARGV;
print <<'EOD';
\documentstyle[twoside]{report}
\raggedbottom
\pagestyle{headings}
\begin{document}
\appendix
\chapter{Subroutine Descriptions}
\section{Introduction}
This appendix includes a list of all the PGPLOT subroutines,
and then gives detailed instructions for the use of each routine in
Fortran programs. The subroutine descriptions are in alphabetical order.
\section{Arguments}
The subroutine descriptions indicate the data type of each
argument. When arguments are described as ``input'', they may be
replaced with constants or expressions in the {\tt CALL}
statement, but make sure that the constant or expression has the
correct data type.
\begin{description}
\item[{\tt INTEGER} arguments]
should be declared
{\tt INTEGER} or {\tt INTEGER*4} in the calling program,
not {\tt INTEGER*2}.
\item[{\tt REAL} arguments]
should be declared
{\tt REAL} or {\tt REAL*4} in the calling program, not
{\tt REAL*8} or {\tt DOUBLE PRECISION}.
\item[{\tt LOGICAL} arguments]
these should be declared
{\tt LOGICAL} or {\tt LOGICAL*4} in the calling program.
\item[{\tt CHARACTER} arguments]
may be any valid Fortran
{\tt CHARACTER} variable (declared
{\tt CHARACTER*n} for some integer {\tt n}).
\end{description}
\section{Index of Routines}
EOD
# Extract documentation from pgplot source code: output index of routines
print '\begin{description}';
while (<>) {
chop; # strip record separator
if (/^C\*/) {
($module, $rest) = split (' ', $_, 2);
$module = substr($module, 2);
print "\\item[$module] $rest";
$ref{$module} = "<A href=\"#$module\">$module</A>";
push (@modules, $module);
}
}
# reverse sort so that modules with the same first few characters occur
# longest to shortest.
@modules = sort {length($b) <=> length($a)} @modules;
print '\end{description}';
print ' ';
print '{\small';
print '\hrule';
# Extract documentation from pgplot source code: output LaTeX code
@ARGV = @files;
while (<>)
{
/^C\*/ && do
{
print '';
print ''; chop;
($module, $rest) = split (' ', substr($_, 2), 2);
print "\\subsection*{$module $rest \}";
next;
};
/^C\+/ && do
{
print '\begin{verbatim}' if $echo == 0;
$echo = 1;
print &Getline0();
next;
};
/^C--/ && do
{
print '\end{verbatim}' if $echo == 1;
print '\hrule' if $echo == 1;
$echo = 0;
next;
};
next if ! $echo;
/^C/ && do
{
chop;
print substr($_, 2) if $echo == 1;
next;
};
chop; print;
}
print <<'EOD';
}
\end{document}
EOD
sub Getline0 {
if ($getline_ok = (($_ = <>) ne '')) {
chop; # strip record separator
}
$_;
}
|