% \iffalse meta-comment
%
% Copyright (C) 1989--1993 by Frank Mittelbach, Rainer Schoepf.
% All rights reserved.
% 
% This file is part of the NFSS2 (New Font Selection Scheme) package.
% 
%  This package is distributed in the hope that it will be useful,
%  but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% 
% 
% IMPORTANT NOTICE:
% 
% For error reports in case of UNCHANGED versions see readme files.
% 
% Please do not request updates from us directly.  Distribution is
% done through Mail-Servers and TeX organizations.
% 
% You are not allowed to change this file.  You may however copy
% this file to a file with a different name and then change the copy
% if you obey the restrictions on file changes described in
% readme.mz.
% 
% You are allowed to distribute this file under the condition that
% it is distributed together with all files mentioned in readme.mz8.
% If you receive only some of these files from someone, complain!
% 
% You are NOT ALLOWED to distribute this file alone.  You are NOT
% ALLOWED to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
% \fi
%^^A must be first since this is an initex file
\catcode`\{=1 %^^A left brace is begin-group character
\catcode`\}=2 %^^A right brace is end-group character
\def\fileversion{v2.0a}
\def\filedate{93/03/07}
\def\docdate {93/03/08}
% \CheckSum{79}
%% \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       This is a META comment
%
% File `nfssboot.dtx'.
% Copyright (C) 1993 Frank Mittelbach and Rainer Sch\"opf,
% all rights reserved.
%
% \fi
%
%
% \title{The {\tt nfssboot.dtx} file\thanks {This file has version
%    number \fileversion, dated \filedate.  The documentation was last
%    revised on \docdate}\\ for use with NFSS2}
% \author{Frank Mittelbach}
%
% \MakeShortVerb\|
%
% \def\dst{\expandafter{\csname mediumseries\endcsname\sc docstrip}}
%
% \setcounter{StandardModuleDepth}{1}
%
% \maketitle
%
% \section{Overview}
%
%   This file contains the startup code for producing formats
%   containing NFSS2.  At the moment it only supports \LaTeX{} formats
%   but in the future code for plain \TeX{} startup etc.\ may be
%   added.
%
%   In other words, instead of {\tt lplain.tex} you should supply the
%   file {\tt nfss2ltx.tex} (which will be generated by the \dst{}
%   program from this file) to the Ini\TeX{} program. This file will
%   then input all the necessary code, like {\tt lplain.tex}, {\tt
%   latex.tex}, etc.
%
%   If you want to put site-specific modifications into your format,
%   either supply them when Ini\TeX{} stops with an asterisk prompt,
%   or write your own startup file, which should then have the
%   following form:
%   \begin{quote}
%        |\input nfss2ltx.tex| \\
%        |\makeatletter|       \\
%        |  |\meta{Your own code}\\
%        |\makeatother| \\
%        |\dump|
%   \end{quote}
%
% \StopEventually{}
%
% \section{Module switches for the \dst{} program}
%
%  The \dst{} will generate the above file from this source using the
%  following module directives:
% \begin{center}
% \begin{tabular}{ll}
%   driver & produce a documentation driver file \\
%   boot   & produce a bootstrap file (there is only one currently) \\
%   ltx    & produce the NFSS2 bootstrapping code for \LaTeX \\
% \end{tabular}
% \end{center}
% A typical \dst{} command file would then have entries like:
% \begin{verbatim}
%\generateFile{nfss2ltx.tex}{t}{\from{nfssboot.dtx}{boot,ltx}}
%\end{verbatim}
% for generating nfss2 files.
%
%
% \section{The code}
%
%    When this file starts Ini\TeX{} has just come to life and at this
%    point it only knows a few primitive commands. It doesn't even
%    know that |{}|es are supposed to surround arguments. Thus we have
%    to tell it quite a bit of what everybody thinks is \TeX{}'s
%    syntax.
%
%    We need braces for arguments and the hash mark for parameter
%    definitions:
%    \begin{macrocode}
%<*boot>
\catcode`\{=1 % left brace is begin-group character
\catcode`\}=2 % right brace is end-group character
\catcode`\#=6 % hash mark is macro parameter character
%    \end{macrocode}
%
%    Now we can really start by identifying the latest version of this
%    file on the VDU and in the transcript file.
%    \begin{macrocode}
\def\space{ }
\immediate\write 16 {File: 
%<+ltx>  `nfss2ltx.tex' 
 \fileversion\space <\filedate> (FMi and RmS)}
\immediate\write 16 {English Documentation
     \space\space\space\space\space  <\docdate> (FMi and RmS)}
%    \end{macrocode}
%    
%    Next thing we do is to provide ourselves with a private letter
%    for use in control sequence names.
%    \begin{macrocode}
\catcode`@=11
%    \end{macrocode}
%
% \subsection{The \LaTeX{} NFSS2 startup code}
%
%    Normally a new format for \LaTeX{} is produced by supplying
%    Ini\TeX{}  with the file {\tt lplain.tex}. This file contains
%    several |\input| statements at near the end it will |\input| the
%    file {\tt lfonts.tex} which contains the code of \LaTeX's old
%    font selection.
%
%    Thus, to produce a format containing NFSS2 we have to find a way
%    to prevent Ini\TeX{} from reading {\tt lfonts.tex} and instead
%    supplying the file containing NFSS2, i.e., {\tt nfsscode.tex} at
%    this point.
%
%    We can achieve this by redefining the |\input| command so that it
%    will look at the string following it, and, when it finds that
%    this string is {\tt lfonts} inputs the file {\tt nfsscode.tex}
%    instead.
%
%    For this we make first a save copy of the original |\input|
%    primitive.
%    \begin{macrocode}
%<*ltx>
\let\@@input\input
%    \end{macrocode}
%    
%    Then we save the string {\tt lfonts} in a macro so that we can
%    later make an |\ifx| test.
%    \begin{macrocode}
\def\@tempa{lfonts}
%    \end{macrocode}
%    
%    Then comes the redefinition of |\input|. We define it to be a
%    macro with one argument delimited by a space. This will
%    successfully parse |\input| \meta{filename}\verb*= = and also
%    |\input| \meta{filename}\meta{newline}. 
%
%    It would somehow fail on something like |\input|
%    \meta{filename}|\relax| since it will actually pick up not only
%    the \meta{filename} but also everything else up to the next real
%    blank (the one after |\relax| wouldn't be found). But this is not
%    much of a problem because in this case we know for sure that we
%    are not in the situation |\input lfonts| and so can just put
%    everything back into the input stream.
%    \begin{macrocode}
\def\input#1 {%
%    \end{macrocode}
%    So, first save the argument, then compare it with the string
%    saved in |\@tempa|.
%    \begin{macrocode}
  \def\@tempb{#1}%
  \ifx\@tempa\@tempb
%    \end{macrocode}
%    If they agree, then give |\input| its original meaning back,
%    undefine the temp macros, input the NFSS2 code and finish.
%    \begin{macrocode}
   \let\input\@@input
   \let\@tempa\undefined \let\@tempb\undefined
   \input nfsscode.tex
%    \end{macrocode}
%    Otherwise save the argument again in |\@tempb| but preceded by
%    the real |\@@input| function and followed by a space (which was
%    gobbled by our |\input| definition.
%    \begin{macrocode}
  \else
    \def\@tempb{\@@input #1 }%
%    \end{macrocode}
%    Then get the |\fi| out of the way just in case that within the
%    |#1| we have scanned something which wasn't actually finished; a
%    stupid example would be:
% \begin{verbatim}
%  \input filename\def\stupid #1 #2 {...}
%\end{verbatim}
%    In this example we would get everything up to |\stupid #1| into
%    the argument of |\input|. Thus, by using |\expandafter| the |\fi|
%    gets removed and the |\@tempb| expands to more or less what was
%    originally in the file.
%    \begin{macrocode}
    \expandafter
    \@tempb
  \fi
}
%    \end{macrocode}
%
%    Having done this we input {\tt lplain.tex} which finishes the
%    startup code for \LaTeX.
%    \begin{macrocode}
\@@input lplain.tex
%</ltx>
%</boot>
%    \end{macrocode}
%
%
% \section{A driver for this document}
%
%    The next bit of code contains the documentation driver file for
%    \TeX{}, i.e., the file that will produce the documentation you
%    are currently reading. It will be extracted from this file by the
%    \dst{} program.
%    \begin{macrocode}
%<*driver>
\documentstyle[doc]{article}

% dimensions from ltugboat.sty:

\setlength\textwidth{31pc} 
\setlength\textheight{54pc}
\setlength{\parindent}{0pt}
\setlength{\parskip}{2pt plus 1pt minus 1pt}
\setlength{\oddsidemargin}{8pc} 
\setlength{\marginparwidth}{8pc}
\setlength{\topmargin}{-2.5pc} 
\setlength{\headsep}{20pt}
\setlength{\columnsep}{1.5pc} 
\setlength{\columnwidth}{18.75pc}

\DisableCrossrefs

\CodelineIndex     % Index code by line number

%\OnlyDescription  % comment out for implementation details

\begin{document}
   \DocInput{nfssboot.dtx}
\end{document}
%</driver>
%    \end{macrocode}
%
% \DeleteShortVerb{\|}
%
% \Finale
%
\endinput
