\def\fileversion{v1.0b}
\def\filedate{91/06/30}
\def\docdate{91/08/05}

%% \CheckSum{82}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%
%\iffalse
%
%
%% Style-option `vrbinput' to use with LaTeX v2.09
%%       and style-option `verbatim' (by Rainer Sch\"opf)
%% Copyright (C) 1991 by Bernd Raichle, all rights reserved.
%
% Copying of this file is authorized only if either
% (1) you make absolutely no changes to your copy, including name, or
% (2) if you do make changes, you name it something other than
%     vrbinput.doc.
% This restriction helps ensure that all styles developed here
% remain identical.
%
% Error reports please to:
%        Bernd Raichle
%        Stettener Str.~73
%        D-7300 Esslingen
%        Federal Republic of Germany}
% Email: raichle@azu.Informatik.Uni-Stuttgart.DE
%
%\fi
%
%
% \changes{v1.0b}{91/08/05}{Revised documentation.}
% \changes{v1.0a}{91/06/30}{Added tests for `verbatim' style option}
%
%
% \DoNotIndex{\fileversion,\filedate,\docdate}
% \DoNotIndex{\@ifundefined,\typeout,\space,\@spaces,\@ifstar}
% \DoNotIndex{\@vobeyspaces,\endtrivlist,\@doendpe,\input}
% \DoNotIndex{\begingroup,\endgroup,\def,\relax}
% \DoNotIndex{\ifnum,\ifeof,\else,\fi,\csname,\endcsname}
% \DoNotIndex{\openin,\closein,\read,\endinput}
% \DoNotIndex{\expandafter,\endlinechar,\the}
% \DoNotIndex{\@ne,\m@ne,\next,\frenchspacing}
% \DoNotIndex{\newread}
%
%
% \title{An enhanced Implementation of the {\tt verbatiminput}
%        Command\thanks{This file has version number \fileversion{}
%        dated \filedate.
%        The documentation was last revised on \docdate.}}
%
% \author{Bernd Raichle\\
%         Stettener Str.~73\\
%         D-7300 Esslingen\\
%         Federal Republic of Germany\\
%         Internet: {\tt raichle@azu.Informatik.Uni-Stuttgart.DE}}
%
% \date{June 17, 1991}
%
% \markboth
%        {Vrbinput style option, version \fileversion, as of \filedate}
%        {Vrbinput style option, version \fileversion, as of \filedate}
%
% \maketitle
%
% \begin{abstract}
%   This style option reimplements the {\tt verbatiminput} command
%   provided by the style-option `verbatim' written by Rainer Sch\"opf.
%   It offers a similar interface to programmers as the one provided
%   by the {\tt verbatim} environment in `verbatim'.
% \end{abstract}
%
%
% \let\docDescribeMacro\DescribeMacro
% \let\docDescribeEnv\DescribeEnv
% \def\DescribeMacro#1{}
% \def\DescribeEnv#1{}
%
% \section{Usage notes}
%
% \DescribeMacro{\verbatiminput}
% |\verbatiminput| is a command with one argument that inputs a
% file verbatim, i.e.\ the command |verbatiminput{xx.yy}|
% has the same effect as\\[2pt]
%   \hspace*{\MacroIndent}|\begin{verbatim}|\\
%   \hspace*{\MacroIndent}\meta{Contents of the file {\tt xx.yy}}\\
%   \hspace*{\MacroIndent}|\end{verbatim}|\\[2pt]
% This command has also a |*|-variant that prints spaces as \verb*+ +.
%
% \StopEventually{}
%
%
% \section{Interfaces for style file designers}
%
% The {\tt verbatim} environment of the style-option `verbatim' offers
% a good interface for programmers.  It provides some user-definable
% macros to implement variants of the standard environment.
% In contrast to the {\tt verbatim} environment there is no such
% interface for the {\tt verbatiminput} command.  This style
% reimplements this command with a similar interface.
%
%
% \subsection{The interface}
%
% \DescribeMacro{\verbatim@readfile}
% After all specific setup, like switching of category codes, has been
% done, the |\verbatim@readfile| macro is called with a file as
% argument.  This reads the file line by line and calls the macros
% described below.  If the input file is not found a warning is issued.
%
% \DescribeMacro{\verbatim@startline}
% \DescribeMacro{\verbatim@addtoline}
% \DescribeMacro{\verbatim@processline}
% \DescribeMacro{\verbatim@finish}
% These are the things that concern the start of a verbatim
% environment.  Once this (and other) setup has been done, the code in
% this style file reads and processes lines from the input file in the
% following way:
% \begin{enumerate}
%   \item Before it starts to read an input line the macro
%     |\verbatim@startline| is called.
%   \item After a complete line has been read, the macro
%     |\verbatim@addtoline| is called with the characters of this line
%     as its only argument.
%     In contrast to the {\tt verbatim} environment, this happens only
%     once per line.
%   \item The macro |\verbatim@processline| is called next to process
%     the characters that previous calls of |\verbatim@addtoline| has
%     accumulated.
%   \item Finally, there is the macro |\verbatim@finish| that is called
%     at the end of the input file.
% \end{enumerate}
% Note that the macros |\verbatim@startline| and |\verbatim@finish| are
% always called at least once.
%
% \subsection{Simple examples}
%
% We define a variant of the |\verbatiminput| command that prints
% line numbers in the left margin.  This is done by a counter called
% |VerbatimLineNo|.  We initialize this counter by the command and
% define the macro |\verbatim@processline| to print the line with this
% number.
%
%\begin{verbatim}
%\newcounter{VerbatimLineNo}
%\def\verbatimnumbered#1{\begingroup
%  \setcounter{VerbatimLineNo}{0}%
%  \def\verbatim@processline{%
%    \addtocounter{VerbatimLineNo}{1}%
%\end{verbatim}
%
% \newpage
% \SelfDocumenting
% \begin{multicols}{2}
%
%\begin{verbatim}
%    \leavevmode
%    \llap{\theVerbatimLineNo
%          \ \hskip\@totalleftmargin}%
%    \the\verbatim@line\par}%
%  \verbatiminput{#1}\endgroup}
%\end{verbatim}
%
% Another possibility is to define a variant of the |verbatim|
% environment that boxes and centers the whole verbatim text.
% Note that the boxed text should be less than a page otherwise you
% have to change this example.
%
%\begin{verbatim}
%\def\verbatimboxed#1{\begingroup
%  \def\verbatim@processline{%
%    {\setbox0=\hbox
%       {\the\verbatim@line}%
%     \hsize=\wd0
%     \the\verbatim@line\par}}%
%  \setbox0=\vbox{\verbatiminput{#1}}%
%  \centerline{\fbox{\box0}}\endgroup}
%\end{verbatim}
% \end{multicols}
%
%
% \let\DescribeMacro\docDescribeMacro
% \let\DescribeEnv\docDescribeEnv
% 
% \section{The Implementation}
%
% The original |\verbatiminput| commands reads the file with \TeX's
% |\input|-primitive.  To implement the interface it's necessary to
% regain control after each line end.  This could be done by changing
% the category code of the end-of-line character to active and define a
% macro for this character.  Another and better possibility is \TeX's
% |\read|-primitive which reads exactly one line and assigns the
% characters of this line to a control sequence.
%
% \medskip
%
%    It doesn't matter if this file is read twice.  But there could
%    be another style option who wants to read this file and
%    redefine some macros.  If this file would be read a second time
%    these redefinitions would be overwritten.
%    \begin{macrocode}
\@ifundefined{verbatim@readfile}{}{\endinput}
%    \end{macrocode}
%
%    As always we begin by identifying the latest version of this file
%    on the VDU and in the transcript file.
%    \begin{macrocode}
\typeout{Style-Option: `vrbinput' \fileversion \space <\filedate> (br)}
\typeout{English Documentation \@spaces\@spaces\space\space <\docdate> (br)}
%    \end{macrocode}
%
% \changes{v1.0b}{91/08/05}{Moved `input of `verbatim' to this place.}
% \changes{v1.0b}{91/08/05}{Replaced `verbatim@font with `verbatim@@@ to
%                           be consistent with `verbatim' style option.}
%    This style option uses and changes some of the definitions in the
%    `verbatim' style option.
%    We make sure that the style option is loaded.
%    \begin{macrocode}
\@ifundefined{verbatim@@@}{\input{verbatim.sty}}{}
%    \end{macrocode}
%
% \begin{macro}{\verbatim@in@stream}
%    We begin by allocating an input stream (out of the 16 available
%    input streams).  \LaTeX\ v2.09 currently uses input stream~1 when
%    it tests the existance of a file.  This is done without allocating
%    the stream so it's possible that |\newread| returns this stream
%    number.  The |\csname| is necessary because |\newread| is defined
%    {\tt outer}.
%\iffalse
%  Vorstellbar ist auch der Aufruf von `verbatiminput innerhalb eines
%  `verbatiminput (z.B: wenn man `input-Anweisungen im zu lesenden File
%  hat und auch diese Files automatisch lesen will).  Dies kann man
%  jedoch nur ermoeglichen, wenn man einen besseren Mechanismus
%  verwendet als es das simple, statische `newread darstellt.
%  Vorstellbar fuer eine neuere \LaTeX-Version ist eine (lokale)
%  Allokation des Streams durch ein `open und eine Freigabe des Streams
%  durch `close oder Verlassen der Gruppe.
%\fi
%    \begin{macrocode}
\newread\verbatim@in@stream
\ifnum\verbatim@in@stream=\@ne
  \csname newread\endcsname\verbatim@in@stream
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verbatim@readfile}
%    The macro |\verbatim@readfile| encloses the main loop by
%    |\verbatim@startline| and |\verbatim@finish|.  This makes sure
%    that the user can initialize and finish the command when the file
%    is empty or doesn't exist.  The {\tt verbatim} environment has a
%    similar behaviour when called with an empty text.
%    \begin{macrocode}
\def\verbatim@readfile#1{%
  \verbatim@startline
%    \end{macrocode}
%    When the file is not found we issue a warning.
%    \begin{macrocode}
  \openin\verbatim@in@stream #1\relax
  \ifeof\verbatim@in@stream
    \typeout{No file #1.}%
  \else
%    \end{macrocode}
%    While reading from the file it is useful to switch off the
%    recognition of the end-of-line character.  This saves us stripping
%    off spaces from the contents of the line.
%    \begin{macrocode}
    \expandafter\endlinechar\expandafter\m@ne
    \expandafter\verbatim@read@file
    \expandafter\endlinechar\the\endlinechar\relax
    \closein\verbatim@in@stream
  \fi
  \verbatim@finish
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verbatim@read@file}
%    All the work is done in |\verbatim@read@file|.  It reads the input
%    file line by line and recursively calls itself until the end of
%    the file.
%    \begin{macrocode}
\def\verbatim@read@file{%
  \read\verbatim@in@stream to\next
  \ifeof\verbatim@in@stream
  \else
%    \end{macrocode}
%    For each line we call |\verbatim@addtoline| with the contents of
%    the line. \hskip0pt plus 3cm\penalty0\hskip0pt plus -3cm
%    |\verbatim@processline| is called next.
%    \begin{macrocode}
    \expandafter\verbatim@addtoline\expandafter{\next}%
    \verbatim@processline
%    \end{macrocode}
%    After processing the line we call |\verbatim@startline| to
%    initialize all before we read the next line.
%    \begin{macrocode}
    \verbatim@startline
%    \end{macrocode}
%    Without |\expandafter| each call of |\verbatim@read@file| uses
%    space in \TeX's input stack.\footnote{A standard \TeX\ would
%    report an overflow error if you try to read a file with more than
%    ca.\ 200~lines.  The same error occurs if the first line of code
%    in \S 390 of {\sl ``TeX: The Program''\/} is missing.}
%    \begin{macrocode}
    \expandafter\verbatim@read@file
  \fi
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\verbatiminput}
%    |\verbatiminput| first starts a group to keep font and category
%    changes local.
%    Then it calls the macro |\verbatim@input| width additional
%    arguments, depending on whether a star follows.
%    \begin{macrocode}
\def\verbatiminput{\begingroup
  \@ifstar{\verbatim@input\relax}%
          {\verbatim@input{\frenchspacing\@vobeyspaces}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\verbatim@input}
%    |\verbatim@input| sets up everything as in the |\verbatim| macro.
%    \begin{macrocode}
\def\verbatim@input#1#2{\@verbatim #1\relax
%    \end{macrocode}
%    Then it reads in the file, finishes off the {\tt trivlist}
%    environment started by |\@verbatim| and closes the group.
%    This restores everything to its normal settings.
%    \begin{macrocode}
  \verbatim@readfile{#2}\endtrivlist\endgroup\@doendpe}
%    \end{macrocode}
% \end{macro}
%
% \Finale
%
\endinput
