%D \module
%D   [      file=t-ltbase,
%D        version=2005.07.xx,
%D          title=\CONTEXT\ User Module,
%D       subtitle=\LaTeX\ compatibility base module,
%D         author=Brooks Moses,
%D           date=\currentdate,
%D      copyright={Brooks Moses; The LaTeX3 Project}]

%D This \ConTeXt\ module is part of the \LaTeX-compatibility
%D module set.  It provides basic functionality needed by the
%D other modules.
%D
%D In many cases, this section will also hold components of the
%D compatibility code that are primarily aliases to equivalent
%D parts in \ConTeXt, or are too small to merit their own file.

\unprotect

%D \section{Basic pieces collected from other files.}

%D From \type{ltcntrl.dtx}.

\def\@empty{}



%D \section{\LaTeX\ Directory Checks}
%D
%D From \type{ltdirchk.dtx}.  We trust \ConTeXt\ to do this for us, for
%D now.
%D
%D A few commands from this are needed later, though.

\def\strip@prefix#1>{}



%D \section{Plain \TeX\ and Dimensions}
%D
%D From \type{ltplain.dtx}.  All of this is already included in \ConTeXt,
%D although we will want to go back and set some of the dimensions later.

%D \LaTeX\ change: \type{\kern\z@} added to end of \type{\hrulefill} and
%D \type{\dotfill} to make them work in `tabular' and `array' environments.
%D \LaTeX\ change: \type{\leavevmode} added at begining of
%D \type{\dotfill} and \type{\hrulefill} so that they work as expected in
%D vertical mode.
%D
%D [### Note that \ConTeXt has its own definition of \type{\dotfill}; is
%D this a conflict?]

\def\hrulefill{\leavevmode\leaders\hrule\hfill\kern\z@}
\def\dotfill{%
  \leavevmode
  \cleaders \hb@xt@ .44em{\hss.\hss}\hfill
  \kern\z@}



%D \section{Version}
%D
%D From \type{ltvers.dtx}.  It's not clear what the appropriate values 
%D here are.  We'll try this, and see if things break.

\def\fmtname{ConTeXt LaTeX Emulation}
\def\fmtversion{prerelease}



%D \subsection{Saved Versions of \TeX\ Primitives}
%D
%D Needless to say, we will want to be careful with changing these,
%D as there is possible interference with \ConTeXt usage!

\let\@@par=\par
\let\@@hyph=\-

%D For now, we will not redefine \type{\-}, assuming that \ConTeXt\
%D has a good way to deal with this.  Thus, we define \type{\dishyph}
%D directly to the revised version.
%D ### Is this a good idea?

%\def\-{\discretionary{-}{}{}}
\def\@dischyph{\discretionary{-}{}{}}

\let\@@italiccorr=\/

%D The following definitions save token space.  E.g., using
%D \type{\@height} instead of height saves 5 tokens at the cost in time
%D of one macro expansion.

\def\@height{height} \def\@depth{depth} \def\@width{width}
\def\@minus{minus}
\def\@plus{plus}

%D The next one is another 100 tokens worth.

\def\hb@xt@{\hbox to}



%D \section{Allocations and Counters}
%D
%D From \type{ltalloc.dtx}.

%D The constant $32$.

\chardef\@xxxii=32

%D Constants $1001$--$1004$.

\mathchardef\@Mi=10001
\mathchardef\@Mii=10002
\mathchardef\@Miii=10003
\mathchardef\@Miv=10004

%D Scratch count registers used by \LaTeX\ kernel commands.

\newcount\@tempcnta
\newcount\@tempcntb

%D General boolean switch used by \LaTeX\ kernel commands.

\newif\if@tempswa

%D Scratch dimen registers used by \LaTeX\ kernel commands.

\newdimen\@tempdima
\newdimen\@tempdimb
\newdimen\@tempdimc

%D Scratch box register used by \LaTeX\ kernel commands.

\newbox\@tempboxa

%D Scratch skip registers used by \LaTeX\ kernel commands.

\newskip\@tempskipa
\newskip\@tempskipb

%D Scratch token register used by \LaTeX\ kernel commands.

\newtoks\@temptokena

%D Glue used for \type{\right}- \& \type{\leftskip} = 0pt plus 1fil

\newskip\@flushglue \@flushglue = 0pt plus 1fil






\protect