%%
%% This is file `rtkinenc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% rtkinenc.dtx  (with options: `pkg')
%% 
%% This file may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.2 of this
%% license or (at your option) any later version. The latest version
%% of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%% 
%% This file may only be distributed together with a copy of the source
%% file from which it was generated. You may distribute that source file
%% without this generated file.
%% 
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{rtkinenc}
   [2000/01/24 v1.0 Rethinking input encoding package]
\newcount\RIE@last@char
\global\RIE@last@char=\m@ne
\@ifundefined{RieC}{}{%
   \PackageError{rtkinenc}{Redefining \protect\RieC}{%
      I had expected \protect\RieC\space to be undefined.\MessageBreak
      Since it wasn't, there's a chance I have\MessageBreak
      broken something.\MessageBreak\@ehc
   }
}
\def\RieC{%
   \ifx \protect\@typeset@protect
      \expandafter\RIE@char
   \else
      \noexpand\RieC
   \fi
}
\let\RIE@text@char=\@secondoftwo
\let\RIE@char=\RIE@text@char
\def\RIE@code@char#1#2{%
   \global\RIE@last@char=#1
   #2%
   \global\RIE@last@char=\m@ne
}
\@ifundefined{RieBC}{}{%
   \PackageError{rtkinenc}{Redefining \protect\RieBC}{%
      I had expected \protect\RieBC\space to be undefined.\MessageBreak
      Since it wasn't, there's a chance I have\MessageBreak
      broken something.\MessageBreak\@ehc
   }
}
\def\RieBC{%
   \ifx \protect\@typeset@protect
      \expandafter\RIE@both@char
   \else
      \noexpand\RieBC
   \fi
}
\def\RIE@both@char#1#2#3{%
   \ifx \RIE@char\RIE@code@char
      \global\RIE@last@char=#1
   \fi
   \ifmmode #3\else #2\fi
   \ifx \RIE@char\RIE@code@char
      \global\RIE@last@char=\m@ne
   \fi
}
\def\@tempa{\@autoerr\TextSymbolUnavailable}
\ifx \@tempa\TextSymbolUnavailable
   \@autoerr\relax
\fi
\let\@@TextSymbolUnavailable=\TextSymbolUnavailable
\def\TextSymbolUnavailable{%
   \ifnum \m@ne<\RIE@last@char
      \expandafter\RIE@symbol@unavailable \expandafter\RIE@last@char
   \else
      \expandafter\@@TextSymbolUnavailable
   \fi
}
\PackageInfo{rtkinenc}{Redefining \protect\TextSymbolUnavailable}
\newcommand\SetUnavailableAction{\def\RIE@symbol@unavailable##1##2}
\SetUnavailableAction{%
   \ifx #2\relax
      \begingroup
         \let\RIE@char=\RIE@text@char
         \RIE@undefined{#1}%
      \endgroup
   \else
      \@@TextSymbolUnavailable{#2}%
   \fi
}
\def\RIE@undefined#1{%
   \ifx \RIE@char\RIE@text@char
      \PackageError{rtkinenc}{%
         Input character #1 is undefined\MessageBreak
         in inputencoding \RIE@encoding}\@eha
   \else
      \RIE@symbol@unavailable{#1}\relax
   \fi
}
\newcommand\InputModeCode{\let\RIE@char=\RIE@code@char}
\newcommand\InputModeText{\let\RIE@char=\RIE@text@char}
\newcommand\IfInputModeCode{%
   \ifx \RIE@char\RIE@code@char
      \expandafter\@firstoftwo
   \else
      \expandafter\@secondoftwo
   \fi
}
\expandafter\ifx \csname DeclareInputText\endcsname\relax
   \begingroup
      \catcode\z@=13
      \gdef\DeclareInputText#1#2{%
         \@inpenc@test
         \begingroup
            \uccode\z@=#1%
            \uppercase{%
         \endgroup
            \expandafter\def \expandafter^^@%
         }\expandafter{\expandafter\RieC \expandafter{\number#1}{#2}}%
      }%
   \endgroup
\else
   \PackageError{rtkinenc}{\protect\DeclareInputText\space
      already defined}{\@ehd\MessageBreak
      Likely cause: you are already using the inputenc package.}
\fi
\@ifundefined{DeclareInputMath}{%
   \let\DeclareInputMath=\DeclareInputText
}{%
   \PackageError{rtkinenc}{\protect\DeclareInputMath\space
      already defined}{\@ehd\MessageBreak
      Likely cause: you are already using the inputenc package.}
}
\expandafter\ifx \csname DeclareInputBoth\endcsname\relax
   \begingroup
      \catcode\z@=13
      \gdef\DeclareInputBoth#1#2#3{%
         \@inpenc@test
         \begingroup
            \uccode\z@=#1%
            \uppercase{%
         \endgroup
            \expandafter\def \expandafter^^@%
         }\expandafter{\expandafter\RieBC \expandafter{\number#1}%
            {#2}{#3}%
         }%
      }%
   \endgroup
\else
   \PackageError{rtkinenc}{\protect\DeclareInputBoth\space
      already defined}\@ehd
\fi
\def\inputencoding#1{%
   \gdef\@inpenc@test{\global\let\@inpenc@test\relax}%
   \protected@edef\RIE@encoding{#1}%
   \ifvmode
      \RIE@loop\^^A\^^H%
      \RIE@loop\^^K\^^K%
      \RIE@loop\^^N\^^_%
      \RIE@loop\^^?\^^ff%
      \input{#1.def}%
   \fi
   \ifx \@inpenc@test\relax \else
      \PackageWarning{rtkinenc}%
              {No characters defined\MessageBreak
               by input encoding change to `#1'}%
   \fi
}
\begingroup
   \catcode\z@=\active
   \gdef\RIE@loop#1#2{%
      \@tempcnta=`#1\relax
      \count@=\uccode\z@
      \loop
         \catcode\@tempcnta\active
         \uccode\z@=\@tempcnta
         \uppercase{%
            \expandafter\def \expandafter^^@\expandafter{%
               \expandafter\RIE@undefined\expandafter{\the\@tempcnta}%
            }%
         }%
      \ifnum `#2>\@tempcnta
         \advance \@tempcnta \@ne
      \repeat
      \uccode\z@=\count@
   }
\endgroup
\newcommand\TypesetHexNumber[1]{%
   \begingroup
      \count@=#1\relax
      \chardef\@tempa=\count@
      \divide \count@ \sixt@@n
      \ifcase\count@
         0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or 9\or a\or b\or
         c\or d\or e\else f%
      \fi
      \multiply \count@ -\sixt@@n
      \advance \count@ \@tempa
      \ifcase\count@
         0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or 9\or a\or b\or
         c\or d\or e\else f%
      \fi
   \endgroup
}
\newcommand\TypesetOctalNumber[1]{%
   \begingroup
      \count@=#1\relax
      \chardef\@tempa=\count@
      \divide \count@ 64\relax
      \the\count@
      \multiply \count@ -64%
      \advance \count@ \@tempa
      \chardef\@tempa=\count@
      \divide \count@ 8\relax
      \the\count@
      \multiply \count@ -8%
      \advance \count@ \@tempa
      \the\count@
   \endgroup
}
\newcommand\verifycharcode[2]{%
   \ifnum `#1=#2 \else
      \PackageWarning{rtkinenc}{%
         Input character with code \number#2\MessageBreak
         should be the character with code \number`#1}%
   \fi
}
\DeclareOption*{\inputencoding{\CurrentOption}}
\ProcessOptions
\endinput
%%
%% End of file `rtkinenc.sty'.
