summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/supp-dir.tex
blob: ad14eab1d101cabf0bb7be16d1d84d7f41f21aef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
%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 / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D Inspired by and needed for Adam Lindsay's \XETEX\ efforts:
%D
%D \starttyping
%D \starttext
%D   \input tufte \par
%D   \pardir TRT \input tufte \par \input tufte \par
%D   \pardir TLT \input tufte \par
%D \stoptext
%D \stoptyping

\unprotect

\chardef \inlinedirection      \zerocount % 0==notset 1==LR 2==RL
\let     \checkinlinedirection \donothing

\beginETEX \beginL

    \ifx\pardir \undefined

      \def\pardir#1#2#3% messages end up in a higher level command
        {\global\TeXXeTstate\plusone
         \if#2L\chardef\inlinedirection\plusone\else
         \if#2R\chardef\inlinedirection\plustwo\fi\fi
         \checkinlinedirection} % needed / added

      \let\normalpardir\pardir

      \def\checkinlinedirection
        {\ifcase\inlinedirection\or\beginL\or\beginR\fi}

    \else

%       \let\normalpardir\pardir

%       \def\pardir#1#2#3%
%         {\if#2L\chardef\inlinedirection\plusone\else
%          \if#2R\chardef\inlinedirection\plustwo\fi\fi
%          \normalpardir#1#2#3}

%       \def\beginL
%         {} % todo: \normalpardir...

%       \def\beginR
%         {} % todo: \normalpardir...

%      \def\checkinlinedirection
%        {\ifcase\inlinedirection\or\beginL\or\beginR\fi}

    \fi

\endETEX

% see core-ini.tex
%
% \appendtoks \checkinlinedirection \to \everypar

\protect \endinput