summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-04-06 21:43:13 +0000
committerKarl Berry <karl@freefriends.org>2016-04-06 21:43:13 +0000
commitc534836c5cf31728afb592a36ab345f786e06e39 (patch)
tree0ab23c1a08aac90df04c7e472d529af19f395d2c /Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex
parent5c59ebfc8bb1cabb783923ac8f627f6982216385 (diff)
tex-ini-files (27feb16)
git-svn-id: svn://tug.org/texlive/trunk@40270 c570f23f-e606-0410-a88d-b1316a301751
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.tex68
1 files changed, 68 insertions, 0 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
new file mode 100644
index 00000000000..fa9f81a3b9e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/tex-ini-files/luatexconfig.tex
@@ -0,0 +1,68 @@
+% tex-ini-files 2016-02-27: luatexconfig.tex
+
+% Load shared (PDF) settings in LuaTeX
+
+\begingroup
+ \catcode`\{=1 %
+ \catcode`\}=2 %
+ \catcode`\#=6 %
+ % Enable one marker primitive and one for the looping
+ \directlua{
+ tex.enableprimitives("", {"pdfvariable", "unless"})
+ }%
+ % From plain.tex
+ \def\loop#1\repeat{\def\body{#1}\iterate}%
+ \def\iterate{%
+ \body
+ \let\next\iterate
+ \else
+ \let\next\relax
+ \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 %
+ \fi
+ }%
+ \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
+ \fi
+ \repeat
+\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