% File: bplain.tex. Suggested by Johannes Braams. The file will probably be
% included in a future babel release.
%
% \CheckSum{}
% \def\filename{bplain.tex}
%
%    As Don Knuth has declared that the filename \file{hyphen.tex} may
%    only be used to designate \emph{his} version of the american
%    English hyphenation patterns, a new solution has to be found in
%    order to be able to load hyphenation patterns for other languages
%    in a plain-based \TeX-format. 
%
%    This file can be used as a replacementwrapper around
%    \file{plain.tex} to acheive the desired effect, based on the
%    \pkg{babel} package. If you load it with ini\TeX, you will get a
%    file called \file\filename, which you can use as a replacement
%    for \file{plain.tex}
%.
%    As this file is going to be read as the first thing ini\TeX\
%    sees, we need to set some categhory codes just to be able to
%    chahge the definition of |\input|
%    \begin{macrocode}
\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 let's see if a file called \file{hyphen.cfg} can be found
%    somewhere on \TeX's input path by trying to open it for
%    reading... 
%    \begin{macrocode}
\openin 0 hyphen.cfg
%    \end{macrocode}
%    If the file wasn't fount the following test turns out true.
%    \begin{macrocode}
\ifeof0
\else
%    \end{macrocode}
%    When \file{hyphen.cfg} could be opened we make sure that
%    \emph{it} will be read instead of the file \file{hyphen.tex}
%    which should (according to Don Knuth's ruling) contain the
%    american English hyphenation patterns and nothing else.
%
%    We do this by first saving the original meaning of |\input| ( and
%    I use a one letter control sequence for that so as not to waste
%    multi-letter control sequence on this in the format).
%    \begin{macrocode}
  \let\a\input
%    \end{macrocode}
%    Then |\input| is defined to forget about its argument and load
%    \file{hyphen.cfg} instead.
%    \begin{macrocode}
  \def\input #1 {%
    \let\input\a
    \a hyphen.cfg
%    \end{macrocode}
%    Once that's done the original meaning of |\input| can be restored
%    and the definition of |\a| can be forgotten.
%    \begin{macrocode}
    \let\a\undefined
  }
\fi
%    \end{macrocode}
%    Now that we have made sure that \file{hyphen.cfg} will be loaded
%    at the right moment it is time to load \file{plain.tex}.
%    \begin{macrocode}
\a plain.tex
%    \end{macrocode}
%    Finally we change the contents of |\fmtname| to indicate that
%    this is \emph{not} the plain format, but a format based on plain
%    with the \pkg{babel} package preloaded.
%    \begin{macrocode}
\def\fmtname{babel-plain}
