supp-dir.mkiv / last modification: 2020-01-30 14:16
%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

\chardef\directionlefttoright\zerocount
\chardef\directionrighttoleft\plusone

\edef\??bdir{\ifdefined\bodydir bdir\else direction\fi}

\unexpanded\edef\naturalhbox  {\hbox  \??bdir\directionlefttoright}
\unexpanded\edef\naturalvbox  {\vbox  \??bdir\directionlefttoright}
\unexpanded\edef\naturalvtop  {\vtop  \??bdir\directionlefttoright}
\unexpanded\edef\naturalhpack {\hpack \??bdir\directionlefttoright}
\unexpanded\edef\naturalvpack {\vpack \??bdir\directionlefttoright}
\unexpanded\edef\naturaltpack {\tpack \??bdir\directionlefttoright}

\unexpanded\edef\reversehbox  {\hbox  \??bdir\directionrighttoleft}
\unexpanded\edef\reversevbox  {\vbox  \??bdir\directionrighttoleft}
\unexpanded\edef\reversevtop  {\vtop  \??bdir\directionrighttoleft}
\unexpanded\edef\reversehpack {\hpack \??bdir\directionrighttoleft}
\unexpanded\edef\reversevpack {\vpack \??bdir\directionrighttoleft}
\unexpanded\edef\reversetpack {\tpack \??bdir\directionrighttoleft}

\ifdefined\bodydir
    \let\bodydir      \undefined \let\normalbodydir      \undefined
    \let\bodydirection\undefined \let\normalbodydirection\undefined
\fi

\ifdefined\pagedir
    \let\pagedir      \undefined \let\normalpagedir      \undefined
    \let\pagedirection\undefined \let\normalpagedirection\undefined
\fi

% \expanded{\defineactivecharacter \number"2000E} {\textdirection\directionrighttoleft\relax}
% \expanded{\defineactivecharacter \number"2000F} {\textdirection\directionlefttoright\relax}

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

\unexpanded\def\showdirsinmargin
  {\normalexpanded{\inleft{\naturalhbox
     {\ttxx[\syst_direction_string\pardirection,\syst_direction_string\textdirection]}}}}

\protect \endinput