summaryrefslogtreecommitdiff
path: root/tex/context/base/core-pos.mkiv
blob: 860a7a967eaa1ab527f96e00fc75d806eba27c05 (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
%D \module
%D   [       file=core-pos,
%D        version=2006.09.18,
%D          title=\CONTEXT\ Core Macros,
%D       subtitle=Positioning Support,
%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.

\unprotect

% saveposition     : tag page x y
% savepositionwhd  : tag page x y w h d
% savepositionplus : tag page x y w h d list
%
% at some point (when we no longer share code) we will move to numbers
% do that we have less garbage collection and hashing
%
% the global table ptbs is equivalent to jobpositions.tobesaved
%
% btw, using a function is more efficient than passing longer code
% snippets to ctxlua

\registerctxluafile{core-pos}{1.001}

% \def\dolazysaveposition            #1#2#3#4{\expanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4"}}}}
% \def\dolazysavepositionwhd   #1#2#3#4#5#6#7{\expanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4","#5","#6","#7"}}}}
% \def\dolazysavepositionplus#1#2#3#4#5#6#7#8{\expanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4","#5","#6","#7","#8"}}}}
% \def\dosaveposition                #1#2#3#4{\expanded{\ctxlua    {ptbs['#1']={#2,"#3","#4"}}}}
% \def\dosavepositionwhd       #1#2#3#4#5#6#7{\expanded{\ctxlua    {ptbs['#1']={#2,"#3","#4","#5","#6","#7"}}}}
% \def\dosavepositionplus    #1#2#3#4#5#6#7#8{\expanded{\ctxlua    {ptbs['#1']={#2,"#3","#4","#5","#6","#7","#8"}}}}

\def\dolazysaveposition            #1#2#3#4{\normalexpanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4"}}}}
\def\dolazysavepositionwhd   #1#2#3#4#5#6#7{\normalexpanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4","#5","#6","#7"}}}}
\def\dolazysavepositionplus#1#2#3#4#5#6#7#8{\normalexpanded{\ctxlatelua{ptbs['#1']={#2,"#3","#4","#5","#6","#7","#8"}}}}
\def\dosaveposition                #1#2#3#4{\normalexpanded{\ctxlua    {ptbs['#1']={#2,"#3","#4"}}}}
\def\dosavepositionwhd       #1#2#3#4#5#6#7{\normalexpanded{\ctxlua    {ptbs['#1']={#2,"#3","#4","#5","#6","#7"}}}}
\def\dosavepositionplus    #1#2#3#4#5#6#7#8{\normalexpanded{\ctxlua    {ptbs['#1']={#2,"#3","#4","#5","#6","#7","#8"}}}}

\def\doifpositionelse            #1{\ctxlua{jobpositions.doifelse('#1')}}
\def\copyposition              #1#2{\ctxlua{jobpositions.copy('#1','#2')}}
\def\replacepospxywhd#1#2#3#4#5#6#7{\ctxlua{jobpositions.replace('#1',\number#2,"\the\dimexpr#3\relax","\the\dimexpr#4\relax","\the\dimexpr#5\relax","\the\dimexpr#6\relax","\the\dimexpr#7\relax")}}

\def\MPp       #1{\ctxlua{jobpositions.MPp("#1")}}
\def\MPx       #1{\ctxlua{jobpositions.MPx("#1")}}
\def\MPy       #1{\ctxlua{jobpositions.MPy("#1")}}
\def\MPw       #1{\ctxlua{jobpositions.MPw("#1")}}
\def\MPh       #1{\ctxlua{jobpositions.MPh("#1")}}
\def\MPd       #1{\ctxlua{jobpositions.MPd("#1")}}
\def\MPxy      #1{\ctxlua{jobpositions.MPxy("#1")}}
\def\MPll      #1{\ctxlua{jobpositions.MPll("#1")}}
\def\MPlr      #1{\ctxlua{jobpositions.MPlr("#1")}}
\def\MPur      #1{\ctxlua{jobpositions.MPur("#1")}}
\def\MPul      #1{\ctxlua{jobpositions.MPul("#1")}}
\def\MPpos     #1{\ctxlua{jobpositions.MPpos("#1")}}
\def\MPplus#1#2#3{\ctxlua{jobpositions.MPplus("#1",#2,"#3")}}
\def\MPrest  #1#2{\ctxlua{jobpositions.MPrest("#1","#2")}}

\protect \endinput