%D \module
%D   [       file=supp-dir,
%D        version=2004.11.11,
%D          title=\CONTEXT\ Support Macros,
%D       subtitle=Directional Things,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\unprotect

\aliased\let\directionlefttoright\zerocount
\aliased\let\directionrighttoleft\plusone

\ifdefined\s!direction \else \cdef\s!direction{direction} \fi

\permanent\protected\edef\naturalhbox  {\hbox \s!direction\directionlefttoright}
\permanent\protected\edef\naturalvbox  {\vbox \s!direction\directionlefttoright}
\permanent\protected\edef\naturalvtop  {\vtop \s!direction\directionlefttoright}
\permanent\protected\edef\naturalhpack {\hpack\s!direction\directionlefttoright}
\permanent\protected\edef\naturalvpack {\vpack\s!direction\directionlefttoright}
\permanent\protected\edef\naturaltpack {\tpack\s!direction\directionlefttoright}

\permanent\protected\edef\reversehbox  {\hbox \s!direction\directionrighttoleft}
\permanent\protected\edef\reversevbox  {\vbox \s!direction\directionrighttoleft}
\permanent\protected\edef\reversevtop  {\vtop \s!direction\directionrighttoleft}
\permanent\protected\edef\reversehpack {\hpack\s!direction\directionrighttoleft}
\permanent\protected\edef\reversevpack {\vpack\s!direction\directionrighttoleft}
\permanent\protected\edef\reversetpack {\tpack\s!direction\directionrighttoleft}

\def\syst_direction_string#1{\ifcase#1=\plusone r2l\else l2r\fi}

\permanent\protected\def\showdirsinmargin
  {\expanded{\inleft{\naturalhbox
     {\ttxx[\syst_direction_string\pardirection,\syst_direction_string\textdirection]}}}}

\protect \endinput
