%D \module
%D   [      file=t-ltlen,
%D        version=2005.07.xx,
%D          title=\CONTEXT\ User Module,
%D       subtitle=\LaTeX\ compatibility length commands,
%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 the \type{\newlength} command and
%D related ``length'' functionality.

\usemodule[ltbase]
\unprotect

%D \section{Length Commands}
%D
%D This is borrowed nearly wholesale from \type{ltlength.dtx}.
%D
%D Definitions of lengths.

% \newlength is not used except in classes.  \setlength is used
% in various class files, ltmath, ltoutput, lttab, ltxdoc, proc,
% and slides.  \addtolength is used similarly.  The remaining
% commands are not used outside of classes, doc, and latex209.
%
% Note that this implies that \setlength is being used for things
% that were not created with \newlength!

\def\newlength#1{\@ifdefinable#1{\newskip#1}}
\def\setlength#1#2{#1#2\relax}
\def\addtolength#1#2{\advance#1 #2\relax}

%D Macros to set a length to a dimension of a box containing the
%D second argument.

\def\@settodim#1#2#3{\setbox\@tempboxa\hbox{{#3}}#2#1\@tempboxa
       \setbox\@tempboxa\box\voidb@x}

\def\settoheight{\@settodim\ht}
\def\settodepth {\@settodim\dp}
\def\settowidth {\@settodim\wd}

%D \type{\@settopoint} takes the contents of the skip register that
%D is supplied as its argument and removes the fractional part to
%D make it a whole number of points. This can be used in class files
%D to avoid values like |345.4666666pt| when calulating a dimension.

% This is used in classes, proc, and slides.

\def\@settopoint#1{\divide#1\p@\multiply#1\p@}



\protect