%%%%%%%%%%%%%%
% hyconfig.tex  
%                  Hyphenation configuration code 
% Updates:
% 02/28/92 language number setting was wrong.
% 03/20/92 allow hyphenation exceptions file (in language.dat) loading.
% 06/23/92 call the appropriate hymltex* file when using MlTeX
% 07/03/92 add \accenthypencodes
% 08/24/92 introduce \l@<language> being the language number
% 08/26/92 suppress absolute font character references normally unneeded
% 03/03/93 add dialect feature via ``='' sign.
% 04/02/93 add \input compatible.tex when \csubinverse undefined.
% 08/19/93 apply \c mods from MJF -- July 14, 92 
% 08/20/93 insert space after \input X for NFSS2 (H. Soulard) 
% 01/13/94 add \j def for non french languages (noted by R. Lemieux).
% 03/22/94 \LANGUAGESinFORMAT now contains all languages names (proposed
%             by Michel Lavaud).
%          \input hyphen replaced by \input ushyphen (sugg. of M.Lavaud).
% 05/05/94 \patterns@loaded replace \LANGUAGESinFORMAT as in Babel.
% 08/10/94 \input replaced by \@@input if already defined.
% 10/18/94 Load compatible.tex only outside MlTeX.
% 12/13/94 Allow nothing else than =name in language.dat
% 12/17/94 Let language counter progress when equal sign after first language.
% 12/22/94 Don't load compatible.tex whith 2e any way.
% 03/02/95 "      "     "             "    any other format not OT1, this
%          was clearly pointed by Thierry Bouche.
% 03/22/95 \encodingdefault may be undefined (as pointed by Loic Prylli).
% 96/09/10 Allow exception file to be blank in language.dat.
% 96/10/29 Messages numbered.
% 96/12/31 TeX 2 no more supported. taking in acount new frhyph.tex, no more
%          usage of compatible.tex.
% 98/04/22 As pointed by T.Esser when reading language.dat file either .tex
%          file loading or error message might occur. Macro \@l@ngu@ge now
%          revisited.
% 98/04/22 ushyph.tex file defaultly loaded (instead of ushyphen).
% 99/01/20 No-blank empty exception file name now checked.
%
\message{languages: patterns and exceptions,}
%%
%%      checksum        = "03884 102 502 4716"
%%
\ifx\@@input\undefined\let\@@input\input\fi%
\def\@temp{}%
%\let\charsubdef\undefined% for testing purposes only
\ifx\charsubdef\undefined\else\def\@temp{\@@input hymltex3.tex \endinput}\fi
\@temp
%%%%%%%%%%%%%% pure TeX usage
\language=0
% ======== Load Patterns as described in language.dat ======

% (language.dat was introduced by Johannes Braams)

{\newcount\l@nguage\newcount\initl@\newcount\workl@%
       % Compatibility with TeX 2: \language count
       \ifx\language\let\language\l@nguage\fi

\initl@=\language\l@nguage=\initl@\workl@=\l@nguage
\xdef\patterns@loaded{}% will contain all languages names
\def\@newlanguage[#1]#2{\language=#1%
        \workl@=#1\advance\workl@ by -\initl@
        \message{-38- The #2 language is used as language number \the\workl@}%
      \expandafter\xdef\csname l@#2\endcsname{\the\workl@}% 08/24/92
      \xdef\patterns@loaded{\patterns@loaded\space #2}
      \expandafter\xdef\csname#2\endcsname{\language=\the\workl@\relax}%2/28/92
\ifx\undefined\defaultlanguage\gdef\defaultlanguage{\csname#2\endcsname}\fi}%
% test if #1 equal ``='' that means same language hyphenation but a dialect.
\edef\test{=}%
\def\@language#1#2 #3 #4/#5{\def\@tempa{=}\def\@tempb{#1}%
    \ifx\@tempa\@tempb%
                     \ifnum\l@nguage > \initl@ \advance\l@nguage by -1\fi%
                     \@newlanguage[\the\l@nguage]{#2}%
                     \ifnum\l@nguage \test \initl@ \advance\l@nguage by -1\fi%
    \else\edef\test{<}\@l@ngu@ge#1#2 #3 #4/{#5}% 
    \fi}%
\def\@l@ngu@ge#1 #2 #3/#4{\begingroup\@newlanguage[#4]{#1}%
  \def\@tempa{#2}% Get patterns file name and
  \ifx\@tempa\empty\else\expandafter\@@input#2 \relax%% load that file if any
    \edef\@tempa{#3}% Get exceptions file name.
     \ifx\@tempa\empty\else% Check if empty, 
      \edef\@tempb{\space\space}% else if blanks, two or
       \ifx\@tempa\@tempb\else\edef\@tempb{\space}% just one, otherwise
        \ifx\@tempa\@tempb\else\expandafter\@@input#3 \relax\fi%load that file.
       \fi%
     \fi% 
 \fi%
                          \endgroup}
\newif\if@more\@moretrue
\openin1 = language.dat
\ifeof1\message{-39- Error: file language.dat not found, trying to load %
                 US-english hyphenation file}\language=0\input ushyph 
\else\advance\l@nguage by -1
\loop  \endlinechar=-1  \read1 to \@lineD  \endlinechar`\^^M
  \ifx\@lineD\empty  \else \advance\l@nguage by 1%
    \edef\@lineD{\@lineD\space/{\the\l@nguage}}%
    \expandafter\@language\@lineD
  \fi
  \ifeof1 \@morefalse \fi
  \if@more\repeat
\fi\closein1

}\defaultlanguage% go to the default language (first defined in language.dat) 
\endinput
