%
\catcode`@=11
\let\@dump\dump
\let\dump\relax
\input latex.ltx
\input multexbase.tex

%% addtion/modification of latex
%%
\makeatletter

% ltlogos
%
\DeclareRobustCommand{\JTeX}{\leavevmode\lower.5ex\hbox{J}\kern-.18em\TeX}
\DeclareRobustCommand{\JLaTeX}{\leavevmode\lower.5ex\hbox{\rm J}\kern-.1em
    \LaTeX}
\DeclareRobustCommand{\JLaTeXe}{\leavevmode\lower.5ex\hbox{\rm J}\kern-.1em
    \LaTeXe}
\DeclareRobustCommand{\MuLTeX}{\leavevmode M\kern-.1667em u\kern-.1667em
    \lower.5ex\hbox{L}\kern-.25em\TeX}
\DeclareRobustCommand{\MuLLaTeX}{\leavevmode M\kern-.1667em u\kern-.1667em
    \lower.5ex\hbox{L}\kern-.1em\LaTeX}
\DeclareRobustCommand{\MuLLaTeXe}{\leavevmode M\kern-.1667em u\kern-.1667em
    \lower.5ex\hbox{L}\kern-.1em\LaTeXe}

%
\def\forallml#1{%
  \def\@mltmp@loop##1,{%
    \if>##1>\let\@mltmp@loop\relax\else#1{##1}\fi \@mltmp@loop}%
  \expandafter\@mltmp@loop\allmlcharset,,%
}

% ltfssbas
% redefine \DeclareFixedFont
\def\DeclareFixedFont#1#2#3#4#5#6{%
   \begingroup
      \math@fontsfalse
      \every@math@size{}%
      \fontsize{#6}\z@
      \usefont{#2}{#3}{#4}{#5}%
      \ifx\@mltmp@cs\relax
        \global\expandafter\let\expandafter#1\the\font
      \else
%        \global\expandafter\let\expandafter#1\the\mlfont
%            \csname mcs\@mltmp@cs\endcsname
        \global\expandafter\let\expandafter#1\mlfont@name
      \fi
   \endgroup
  }
\DeclareRobustCommand\mlfontencoding[2]{%
    \expandafter\ifx\csname T@#2\endcsname\relax
      \@latex@error{Encoding scheme `#2' unknown}\@eha
    \else
      \expandafter\edef\csname#1@encoding\endcsname{#2}%
      \expandafter\edef\csname MLcs@#2\endcsname{#1}%
    \fi
}
\def\ml@encoding#1{\csname#1@encoding\endcsname}
\DeclareRobustCommand\mlfontfamily[2]{%
  \expandafter\edef\csname#1@family\endcsname{#2}}
\def\ml@family#1{\csname#1@family\endcsname}
\DeclareRobustCommand\mlfontseries[2]{%
  \expandafter\edef\csname#1@series\endcsname{#2}}
\def\ml@series#1{\csname#1@series\endcsname}
\DeclareRobustCommand\mlfontshape [2]{%
  \expandafter\edef\csname#1@shape\endcsname{#2}}
\def\ml@shape#1{\csname#1@shape\endcsname}

% re-define \usefont
\def\usefont#1#2#3#4{%
\expandafter\let\expandafter\@mltmp@cs\csname MLcs@#1\endcsname
\ifx\@mltmp@cs\relax
  \fontencoding{#1}\fontfamily{#2}\fontseries{#3}\fontshape{#4}\selectafont
\else
  \mlfontencoding{\@mltmp@cs}{#1}\mlfontfamily{\@mltmp@cs}{#2}%
  \mlfontseries{\@mltmp@cs}{#3}\mlfontshape{\@mltmp@cs}{#4}%
  \selectmlfont{\@mltmp@cs}%
\fi
\ignorespaces}

\def\pickup@mlfont#1{%
    \expandafter \ifx \mlfont@name \relax
       \define@newmlfont{#1}%
    \fi}
\def\define@newmlfont#1{%
  \begingroup
    \let\typeout\@font@info
    \escapechar\m@ne
    \expandafter\expandafter\expandafter
       \split@name\expandafter\string\mlfont@name\@nil
      \try@load@fontshape % try always
    \expandafter\ifx
       \csname\curr@fontshape\endcsname \relax
      \wrong@mlfontshape{#1}\else
      \extract@mlfont{#1}\fi
  \endgroup}
\def\DeclareErrorMLFont#1#2#3#4#5#6{%
      \expandafter\xdef\csname error@#1fontshape\endcsname{%
          \noexpand\expandafter\noexpand\split@name\noexpand\string
          \expandafter\noexpand\csname#2/#3/#4/#5/#6\endcsname
          \noexpand\@nil}%
      \expandafter\gdef\csname#1default@family\endcsname{#3}%
      \expandafter\gdef\csname#1default@series\endcsname{#4}%
      \expandafter\gdef\csname#1default@shape\endcsname{#5}%
      \expandafter\let\expandafter\ml@reserved\csname#1default@family\endcsname
      \global\expandafter\let\csname#1@family\endcsname\ml@reserved
      \expandafter\let\expandafter\ml@reserved\csname#1default@series\endcsname
      \global\expandafter\let\csname#1@series\endcsname\ml@reserved
      \expandafter\let\expandafter\ml@reserved\csname#1default@shape\endcsname
      \global\expandafter\let\csname#1@shape\endcsname\ml@reserved
}
\@onlypreamble\DeclareErrorMLFont
\def\wrong@mlfontshape#1{%
    \csname D@\f@encoding\endcsname      % install defaults if in math
    \edef\reserved@a{\csname\curr@fontshape\endcsname}%
  \ifx\last@mlfontshape\reserved@a
     \errmessage{Corrupted NFSS tables}%
     \csname error@#1fontshape\endcsname
  \else
    \expandafter\let\expandafter\f@shape\csname#1default@shape\endcsname
    \expandafter\ifx\csname\curr@fontshape\endcsname\relax
       \expandafter\let\expandafter\f@series\csname#1default@series\endcsname
        \expandafter
          \ifx\csname\curr@fontshape\endcsname\relax
           \expandafter\let\expandafter\f@family
                       \csname#1default@family\endcsname
        \fi \fi
  \fi
     \@font@warning{Font shape `\expandafter\string\reserved@a'
                     \expandafter\@gobble\string\@undefined\MessageBreak
                   using `\curr@fontshape' instead\@wrong@font@char}%
    \global\let\last@mlfontshape\reserved@a
    \gdef\@defaultsubs{%
      \@font@warning{Some font shapes were not available, defaults
                      substituted.\@gobbletwo}}%
    \global\expandafter\expandafter\expandafter\let
       \expandafter\reserved@a
           \csname\curr@fontshape\endcsname
    \xdef\mlfont@name{\expandafter\noexpand
      \csname\curr@fontshape/\f@size\endcsname}%
    \pickup@mlfont{#1}}

\def\extract@mlfont#1{%
   \get@external@mlfont{#1}%
   \global\expandafter\font\mlfont@name\external@font\relax
   \global\expandafter\fontmcs\mlfont@name\csname mcs#1\endcsname
    \mlfont@name \relax
    \csname \f@encoding+\f@family\endcsname
    \csname\curr@fontshape\endcsname
    \relax
       }
\def\get@external@mlfont#1{%
   \let\external@font\@empty
   \edef\font@info{\expandafter\expandafter\expandafter\string
        \csname \curr@fontshape \endcsname}%
   \try@size@range
   \ifx\external@font\@empty
      \try@size@substitution
      \ifx\external@font\@empty
         \@latex@error{Font \expandafter \string\mlfont@name\space
                     not found}\@eha
         \csname error@#1fontshape\endcsname
         \get@external@mlfont{#1}%
   \fi\fi
}

% ltfsstrc
% re-define \selectfont
\DeclareRobustCommand\selectfont
        {%
    \ifx\f@linespread\baselinestretch \else
      \set@fontsize\baselinestretch\f@size\f@baselineskip \fi
    \selectafont \forallml{\selectmlfont}%
    \size@update
    \enc@update
    }
\def\selectafont{%
    \xdef\font@name{%
      \csname\curr@fontshape/\f@size\endcsname}%
    \pickup@font
    \font@name}
\def\selectmlfont#1{%
    \xdef\mlfont@name{\expandafter\noexpand
      \csname\ml@encoding{#1}/\ml@family{#1}/%
             \ml@series{#1}/\ml@shape{#1}/\f@size\endcsname}%
    \pickup@mlfont{#1}%
    \mlfont@name}

\def\@ml@rmfamily#1{\mlfontfamily{#1}{\csname#1rmdefault\endcsname}}%
\DeclareRobustCommand\rmfamily
        {\not@math@alphabet\rmfamily\mathrm
         \fontfamily\rmdefault\forallml\@ml@rmfamily\selectfont}
\def\@ml@sffamily#1{\mlfontfamily{#1}{\csname#1sfdefault\endcsname}}%
\DeclareRobustCommand\sffamily
        {\not@math@alphabet\sffamily\mathsf
         \fontfamily\sfdefault\forallml\@ml@sffamily\selectfont}
\def\@ml@ttfamily#1{\mlfontfamily{#1}{\csname#1ttdefault\endcsname}}%
\DeclareRobustCommand\ttfamily
        {\not@math@alphabet\ttfamily\mathtt
         \fontfamily\ttdefault\forallml\@ml@ttfamily\selectfont}
\def\@ml@bfseries#1{\mlfontseries{#1}{\csname#1bfdefault\endcsname}}%
\DeclareRobustCommand\bfseries
        {\not@math@alphabet\bfseries\mathbf
         \fontseries\bfdefault\forallml\@ml@bfseries\selectfont}
\def\@ml@mdseries#1{\mlfontseries{#1}{\csname#1mddefault\endcsname}}%
\DeclareRobustCommand\mdseries
        {\not@math@alphabet\mdseries\relax
         \fontseries\mddefault\forallml\@ml@mdseries\selectfont}
\def\@ml@upshape#1{\mlfontshape{#1}{\csname#1updefault\endcsname}}%
\DeclareRobustCommand\upshape
        {\not@math@alphabet\upshape\relax
         \fontshape\updefault\forallml\@ml@upshape\selectfont}
\def\@ml@slshape#1{\mlfontshape{#1}{\csname#1sldefault\endcsname}}%
\DeclareRobustCommand\slshape
        {\not@math@alphabet\slshape\relax
         \fontshape\sldefault\forallml\@ml@slshape\selectfont}
\def\@ml@scshape#1{\mlfontshape{#1}{\csname#1scdefault\endcsname}}%
\DeclareRobustCommand\scshape
        {\not@math@alphabet\scshape\relax
         \fontshape\scdefault\forallml\@ml@scshape\selectfont}
\def\@ml@itshape#1{\mlfontshape{#1}{\csname#1itdefault\endcsname}}%
\DeclareRobustCommand\itshape
        {\not@math@alphabet\itshape\mathit
         \fontshape\itdefault\forallml\@ml@itshape\selectfont}

\def\@ml@normalfont#1{%
  \mlfontencoding{#1}{\csname#1encodingdefault\endcsname}%
  \mlfontfamily{#1}{\csname#1familydefault\endcsname}%
  \mlfontseries{#1}{\csname#1seriesdefault\endcsname}%
  \mlfontshape{#1}{\csname#1shapedefault\endcsname}}%
\DeclareRobustCommand\normalfont
    {\fontencoding{\encodingdefault}\fontfamily{\familydefault}%
     \fontseries{\seriesdefault}\fontshape{\shapedefault}%
     \forallml\@ml@normalfont
     \selectfont}

\DeclareErrorMLFont{jp}{JP}{mjp}{m}{n}{10}  %%% don't modify this setting
\DeclareErrorMLFont{cn}{CN}{mcn}{m}{n}{10} %%% overwrite it in mulfonttext.cfg
\DeclareErrorMLFont{kr}{KR}{mkr}{m}{n}{10} %%% if necessary
\DeclareErrorMLFont{jsp}{JSP}{mjsp}{m}{n}{10}
\InputIfFileExists{mulfonttext.cfg}
           {\typeout{====================================^^J%
                     ^^J%
                      Local config file mulfonttext.cfg used^^J%
                     ^^J%
                     ====================================}%
             \def\@addtofilelist##1{\xdef\@filelist{\@filelist,##1}}%
            }
           {\input{mulfonttext.ltx}}

% ltclass
%
\def\documentstyle{%
  \makeatletter\input{mullatex209.def}\makeatother
  \documentclass}
%\def\NeedsMuLTeXFormat#1{%

%%
%% end of addtion/modification of latex

% basic multi-lingual fonts
\def\mlbasefontnames{%
ltni10,ltnii10,ltniii10,ltniv10,ltnv10,%
crl10,grk10,hbw10,thai10,kana10,%
jp10,cn10,kr10,jsp10,bvi10,bvii10,%
viscl10,viscu10}
\allmlfonts{\tenml}{ten}{\mlbasefontnames}
\tenml

%
%
\input sitemlcode

\def\mlfmtname{MuLLaTeX2e}%
\def\mlfmtversion{1999/08/16}%

\let\dump\@dump
\makeatother
\dump
\endinput
