% This file contains macros interfacing between US-TeX and SWE-TeX.
% The macro \usinput may be used to read a file containing
% macros written in US-TeX.
%
% By Lennart B\"orjeson, Elmer KTH
%
\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&% Include Swedish symbols
  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  \do\/\do\<\do\>\do\|\do\]\do\[}%
%
\def\lt{<}%
\def\gt{>}%
%
\def\swedishmode{%                          This makes TeX know Swedish...
    \catcode`\/=0 \catcode`\<=1 \catcode`\>=2
    \catcode`\}=13 \catcode`\{=13 \catcode`\|=13
    \catcode`\]=13 \catcode`\[=13 \catcode`\\=13
    \escapechar`\/}%
%
\def\usmode{%                               ...and this switches back...
    \catcode`\/=12 \catcode`\<=12 \catcode`\>=12
    \catcode`\}=2 \catcode`\{=1 \catcode`\|=12
    \catcode`\]=12 \catcode`\[=12 \catcode`\\=0
    \escapechar`\\}%
%
\swedishmode           % ...this defines our Swedish characters.
/let}=/aa /def{</"a>/def|</"o>%
/let]=/AA /def[</"A>/def\</"O>%
/usmode
%
\def\ifswedishmode{\ifnum\the\escapechar=47\relax }%
\def\ifusmode{\ifnum\the\escapechar=92\relax }%
%
\def\usinput#1{%         This \inputs a file in US-mode.
    \ifswedishmode
       \let\callingmode=\swedishmode
    \else
       \let\callingmode=\usmode
    \fi
    \usmode
    \input #1
    \callingmode}%
%
\def\sweinput#1{%        This /inputs in Swedish mode.
    \ifswedishmode
       \let\callingmode=\swedishmode
    \else
       \let\callingmode=\usmode
    \fi
    \swedishmode
    \input #1
    \callingmode}%
