summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex')
-rw-r--r--Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex107
1 files changed, 54 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex b/Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex
index aa9cb55af96..5ad8913b65a 100644
--- a/Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex
+++ b/Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex
@@ -1,4 +1,4 @@
-% tex-ini-files 2016-04-14: luatexconfig.tex
+% tex-ini-files 2016-04-15: luatexconfig.tex
% Load shared (PDF) settings in LuaTeX
@@ -6,63 +6,64 @@
\catcode`\{=1 %
\catcode`\}=2 %
\catcode`\#=6 %
- % Enable one marker primitive and one for the looping
- \directlua{
- tex.enableprimitives("", {"pdfvariable", "unless"})
+ % Settings that were primitives
+ % accessed in newer LuaTeX releases via \pdfvariable
+ \def\list{%
+ {compresslevel}%
+ {decimaldigits}%
+ {horigin}%
+ {minorversion}%
+ {objcompresslevel}%
+ {pkresolution}%
+ {vorigin}%
}%
- % From plain.tex
- \def\loop#1\repeat{\def\body{#1}\iterate}%
- \def\iterate{%
- \body
- \let\next\iterate
- \else
- \let\next\relax
+ \def\do#1{%
+ \ifx\relax#1\else
+ \directlua{tex.enableprimitives("", {"pdf#1"})}%
+ \expandafter\do
\fi
- \next
}%
- \let\repeat\fi
- % The format of the data lines themselves is simple
- \ifx\pdfvariable\undefined
- \def\parse#1 = #2\relax{%
- \directlua{tex.enableprimitives("", {"pdf#1"})}%
- \expandafter\global\csname pdf#1\endcsname = #2 %
- \expandafter\global\expandafter\let\csname pdf#1\endcsname\undefined
- }%
- \directlua{tex.enableprimitives("", {"pdfoutput"})}%
- \global\pdfoutput = \ifx\dvimode\undefined 1\else 0\fi\relax
- \global\let\pdfoutput\undefined
- \else
- \directlua{
- tex.enableprimitives("", {"pageheight", "pagewidth", "outputmode"})
- }%
- \global\outputmode = \ifx\dvimode\undefined 1\else 0\fi\relax
- \global\let\outputmode\undefined
- \def\parse#1 = #2\relax{%
- \expandafter\ifx\csname #1\endcsname\relax
- \global\pdfvariable #1 = #2 %
- \else
- \expandafter\global\csname #1\endcsname = #2 %
+ % Enable all \pdf... primitives in one go
+ \expandafter\do\list{output}{pageheight}{pagewidth}{variable}\relax
+ % Other required primitives that are not named \pdf...
+ \directlua{tex.enableprimitives("",
+ {"pageheight", "pagewidth", "outputmode"})}%
+ % Newer LuaTeX releases don't have \pdfoutput, etc.:
+ % emulate names where appropriate
+ \ifx\pdfoutput\undefined
+ \global\let\pdfoutput\outputmode
+ \global\let\pdfpageheight\pageheight
+ \global\let\pdfpagewidth\pagewidth
+ \def\do#1{%
+ \ifx\relax#1\else
+ \expandafter\xdef\csname pdf#1\endcsname{\pdfvariable #1}%
+ \expandafter\do
\fi
}%
+ \expandafter\do\list\relax
\fi
- \def\storedpar{\par}%
- % Read the raw data
- \openin0=pdftexconfig.dat %
- \loop\unless\ifeof0 %
- \read0 to \line
- \unless\ifx\line\storedpar
- \if\relax\line\relax
- \else
- \expandafter\parse\line\relax
- \fi
+ % The file pdftexconfig.tex contains only <primitive> = <value> lines
+ % so can now be read using the (emulated) primitives
+ % This needs to be global so set \globaldefs for this step
+ \globaldefs=1 %
+ \input{pdftexconfig}%
+ \globaldefs=0 %
+ % Pick up on a request for DVI mode and apply it whilst \pdfoutput is
+ % still defined
+ \ifx\dvimode\relax
+ \global\pdfoutput=0 %
+ \fi
+ \global\let\dvimode\undefined
+ % Clean up all of the globally-allocated names
+ \def\do#1{%
+ \ifx\relax#1\else
+ \global\expandafter\let\csname pdf#1\endcsname\undefined
+ \expandafter\do
\fi
- \repeat
+ }%
+ \expandafter\do\list{output}{pageheight}{pagewidth}{variable}\relax
+ \global\let\outputmode\undefined
+ \global\let\pageheight\undefined
+ \global\let\pagewidth\undefined
+ \global\let\dvimode\undefined
\endgroup
-
-% Tidy up primitives and DVI mode marker
-\global\let\pageheight\undefined
-\global\let\pagewidth\undefined
-\global\let\pdfvariable\undefined
-\global\let\unless\undefined
-
-\global\let\dvimode\undefined