summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-01-08 00:06:05 +0000
committerKarl Berry <karl@freefriends.org>2016-01-08 00:06:05 +0000
commitc93aadda1a0628b25e0c02305d42ea4330d51d91 (patch)
tree63b5754e28b4030536115b3231561d4693081585 /Master
parent4ed56a2178d1e7438de5fe9a4f9cd9adc59dea8c (diff)
luamplib (6jan16)
git-svn-id: svn://tug.org/texlive/trunk@39312 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/NEWS3
-rw-r--r--Master/texmf-dist/doc/luatex/luamplib/luamplib.pdfbin160445 -> 160514 bytes
-rw-r--r--Master/texmf-dist/source/luatex/luamplib/luamplib.dtx87
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua46
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty31
5 files changed, 98 insertions, 69 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS
index a9a75f247b4..ed1d29c0568 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/NEWS
+++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS
@@ -1,5 +1,8 @@
History of the luamplib package
+2016/01/02 2.11.2
+ * updates for luatex 0.87
+
2015/10/02 2.11.1
* adapts to latex 2015/10/01 and luatexbase v1.0
* allows `btex ... etex' and `verbatimtex ... etex' even when
diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
index 1b92a224569..99ac85e3997 100644
--- a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
+++ b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
index 69446150a88..9d1af863bf3 100644
--- a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
+++ b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment -- by the way, this file contains UTF-8
%
-% Copyright (C) 2008-2015 by Hans Hagen, Taco Hoekwater, Elie Roux,
+% Copyright (C) 2008-2016 by Hans Hagen, Taco Hoekwater, Elie Roux,
% Manuel Pégourié-Gonnard, Philipp Gesang and Kim Dohyun.
% Currently maintained by the LuaLaTeX development team.
% Support: <lualatex-dev@tug.org>
@@ -85,7 +85,7 @@ See source file '\inFileName' for licencing and contact information.
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{luamplib.drv}%
- [2015/10/02 v2.11.1 Interface for using the mplib library]%
+ [2016/01/02 v2.11.2 Interface for using the mplib library]%
\documentclass{ltxdoc}
\usepackage{metalogo,multicol,mdwlist,fancyvrb,xspace}
\usepackage[x11names]{xcolor}
@@ -153,7 +153,7 @@ See source file '\inFileName' for licencing and contact information.
% \author{Hans Hagen, Taco Hoekwater, Elie Roux, Philipp Gesang and Kim Dohyun\\
% Maintainer: LuaLaTeX Maintainers ---
% Support: \email{lualatex-dev@tug.org}}
-% \date{2015/10/02 v2.11.1}
+% \date{2016/01/02 v2.11.2}
%
% \maketitle
%
@@ -369,8 +369,8 @@ luamplib.lastlog = ""
luatexbase.provides_module {
name = "luamplib",
- version = "2.11.1",
- date = "2015/10/02",
+ version = "2.11.2",
+ date = "2016/01/02",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -396,7 +396,6 @@ local texsprint = tex.sprint
local textprint = tex.tprint
local texget = tex.get
-local texset = tex.set
local texgettoks = tex.gettoks
local texgetbox = tex.getbox
@@ -1204,7 +1203,8 @@ local function processwithTEXboxes (data)
end
luamplib.processwithTEXboxes = processwithTEXboxes
-local pdfmode = texget("pdfoutput") > 0 and true or false
+local pdfoutput = tonumber(texget("outputmode")) or tonumber(texget("pdfoutput"))
+local pdfmode = pdfoutput > 0
local function start_pdf_code()
if pdfmode then
@@ -1250,8 +1250,13 @@ end
% Transparency and Shading
% \begin{macrocode}
local pdf_objs = {}
+local token, getpageres, setpageres = newtoken or token
+local pgf = { bye = "pgfutil@everybye", extgs = "pgf@sys@addpdfresource@extgs@plain" }
-if not pdfmode then
+if pdfmode then -- repect luaotfload-colors
+ getpageres = pdf.getpageresources or function() return pdf.pageresources end
+ setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end
+else
texsprint("\\special{pdf:obj @MPlibTr<<>>}",
"\\special{pdf:obj @MPlibSh<<>>}")
end
@@ -1280,8 +1285,6 @@ local transparancy_modes = { [0] = "Normal",
"Compatible",
}
-local pgf_loaded
-
local function update_tr_res(res,mode,opaq)
local os = format("<</BM /%s/ca %.3f/CA %.3f/AIS false>>",mode,opaq,opaq)
local on, new = update_pdfobjs(os)
@@ -1289,8 +1292,8 @@ local function update_tr_res(res,mode,opaq)
if pdfmode then
res = format("%s/MPlibTr%i %i 0 R",res,on,on)
else
- if pgf_loaded then
- texsprint(format("\\csname pgf@sys@addpdfresource@extgs@plain\\endcsname{/MPlibTr%i%s}",on,os))
+ if pgf.loaded then
+ texsprint(format("\\csname %s\\endcsname{/MPlibTr%i%s}", pgf.extgs, on, os))
else
texsprint(format("\\special{pdf:put @MPlibTr<</MPlibTr%i%s>>}",on,os))
end
@@ -1300,27 +1303,28 @@ local function update_tr_res(res,mode,opaq)
end
local function tr_pdf_pageresources(mode,opaq)
- pgf_loaded = pgf_loaded or (newtoken and newtoken.create("pgfutil@everybye").cmdname == "assign_toks")
+ if token and pgf.bye and not pgf.loaded then
+ pgf.loaded = token.create(pgf.bye).cmdname == "assign_toks"
+ pgf.bye = pgf.loaded and pgf.bye
+ end
local res, on_on, off_on = "", nil, nil
res, off_on = update_tr_res(res, "Normal", 1)
res, on_on = update_tr_res(res, mode, opaq)
if pdfmode then
if res ~= "" then
- local tpr = texget("pdfpageresources") -- respect luaotfload-colors
- local no_extgs = not stringfind(tpr,"/ExtGState<<.*>>")
- local pgf_pdf_loaded = no_extgs and pgf_loaded
- if pgf_pdf_loaded then
- texsprint(format("\\csname pgf@sys@addpdfresource@extgs@plain\\endcsname{%s}",res))
+ if pgf.loaded then
+ texsprint(format("\\csname %s\\endcsname{%s}", pgf.extgs, res))
else
- if no_extgs then
- tpr = tpr.."/ExtGState<<>>"
+ local tpr, n = getpageres() or "", 0
+ tpr, n = tpr:gsub("/ExtGState<<", "%1"..res)
+ if n == 0 then
+ tpr = format("%s/ExtGState<<%s>>", tpr, res)
end
- tpr = tpr:gsub("/ExtGState<<","%1"..res)
- texset("global","pdfpageresources",tpr)
+ setpageres(tpr)
end
end
else
- if not pgf_loaded then
+ if not pgf.loaded then
texsprint(format("\\special{pdf:put @resources<</ExtGState @MPlibTr>>}"))
end
end
@@ -1328,8 +1332,6 @@ local function tr_pdf_pageresources(mode,opaq)
end
local shading_res
-local getpageres = pdf.getpageresources or function() return pdf.pageresources end
-local setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end
local function shading_initialize ()
shading_res = {}
@@ -1699,26 +1701,39 @@ luamplib.colorconverter = colorconverter
% \begin{macrocode}
\bgroup\expandafter\expandafter\expandafter\egroup
\expandafter\ifx\csname selectfont\endcsname\relax
- \input luatexbase-modutils.sty
+ \input ltluatex
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
- [2015/10/02 v2.11.1 mplib package for LuaTeX]
- \RequirePackage{luatexbase-modutils}
+ [2016/01/02 v2.11.2 mplib package for LuaTeX]
+ \ifx\newluafunction\@undefined
+ \input ltluatex
+ \fi
\fi
% \end{macrocode}
%
% Loading of lua code.
%
% \begin{macrocode}
-\RequireLuaModule{luamplib}
+\directlua{require("luamplib")}
+% \end{macrocode}
+%
+% Support older formats
+% \begin{macrocode}
+\ifx\scantextokens\undefined
+ \let\scantextokens\luatexscantextokens
+\fi
+\ifx\pdfoutput\undefined
+ \let\pdfoutput\outputmode
+ \protected\def\pdfliteral{\pdfextension literal}
+\fi
% \end{macrocode}
+
%
% Set the format for metapost.
%
% \begin{macrocode}
-\def\mplibsetformat#1{%
- \directlua{luamplib.setformat("\luatexluaescapestring{#1}")}}
+\def\mplibsetformat#1{\directlua{luamplib.setformat("#1")}}
% \end{macrocode}
%
% \textsf{luamplib} works in both PDF and DVI mode,
@@ -1733,9 +1748,9 @@ luamplib.colorconverter = colorconverter
\ifcsname PackageWarning\endcsname
\PackageWarning{luamplib}{take dvipdfmx path, no support for other dvi tools currently.}
\else
- \write16{}
- \write16{luamplib Warning: take dvipdfmx path, no support for other dvi tools currently.}
- \write16{}
+ \write128{}
+ \write128{luamplib Warning: take dvipdfmx path, no support for other dvi tools currently.}
+ \write128{}
\fi
\fi
\def\mplibsetupcatcodes{%
@@ -1755,7 +1770,7 @@ luamplib.colorconverter = colorconverter
\def\mplibreplacenewlinebr{%
\begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinebr}
\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
- \def\mplibdoreplacenewlinebr#1^^J{\endgroup\luatexscantextokens{{}#1~}}}
+ \def\mplibdoreplacenewlinebr#1^^J{\endgroup\scantextokens{{}#1~}}}
% \end{macrocode}
%
% The Plain-specific stuff.
@@ -1766,7 +1781,7 @@ luamplib.colorconverter = colorconverter
\def\mplibreplacenewlinecs{%
\begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinecs}
\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
- \def\mplibdoreplacenewlinecs#1^^J{\endgroup\luatexscantextokens{\relax#1~}}}
+ \def\mplibdoreplacenewlinecs#1^^J{\endgroup\scantextokens{\relax#1~}}}
\def\mplibcode{%
\mplibstartlineno\inputlineno
\begingroup
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index 9cae3851d65..db75e0d90c0 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
@@ -18,8 +18,8 @@ luamplib.lastlog = ""
luatexbase.provides_module {
name = "luamplib",
- version = "2.11.1",
- date = "2015/10/02",
+ version = "2.11.2",
+ date = "2016/01/02",
description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
}
@@ -40,7 +40,6 @@ local texsprint = tex.sprint
local textprint = tex.tprint
local texget = tex.get
-local texset = tex.set
local texgettoks = tex.gettoks
local texgetbox = tex.getbox
@@ -769,7 +768,8 @@ local function processwithTEXboxes (data)
end
luamplib.processwithTEXboxes = processwithTEXboxes
-local pdfmode = texget("pdfoutput") > 0 and true or false
+local pdfoutput = tonumber(texget("outputmode")) or tonumber(texget("pdfoutput"))
+local pdfmode = pdfoutput > 0
local function start_pdf_code()
if pdfmode then
@@ -812,8 +812,13 @@ local function putTEXboxes (object,prescript)
end
local pdf_objs = {}
+local token, getpageres, setpageres = newtoken or token
+local pgf = { bye = "pgfutil@everybye", extgs = "pgf@sys@addpdfresource@extgs@plain" }
-if not pdfmode then
+if pdfmode then -- repect luaotfload-colors
+ getpageres = pdf.getpageresources or function() return pdf.pageresources end
+ setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end
+else
texsprint("\\special{pdf:obj @MPlibTr<<>>}",
"\\special{pdf:obj @MPlibSh<<>>}")
end
@@ -842,8 +847,6 @@ local transparancy_modes = { [0] = "Normal",
"Compatible",
}
-local pgf_loaded
-
local function update_tr_res(res,mode,opaq)
local os = format("<</BM /%s/ca %.3f/CA %.3f/AIS false>>",mode,opaq,opaq)
local on, new = update_pdfobjs(os)
@@ -851,8 +854,8 @@ local function update_tr_res(res,mode,opaq)
if pdfmode then
res = format("%s/MPlibTr%i %i 0 R",res,on,on)
else
- if pgf_loaded then
- texsprint(format("\\csname pgf@sys@addpdfresource@extgs@plain\\endcsname{/MPlibTr%i%s}",on,os))
+ if pgf.loaded then
+ texsprint(format("\\csname %s\\endcsname{/MPlibTr%i%s}", pgf.extgs, on, os))
else
texsprint(format("\\special{pdf:put @MPlibTr<</MPlibTr%i%s>>}",on,os))
end
@@ -862,27 +865,28 @@ local function update_tr_res(res,mode,opaq)
end
local function tr_pdf_pageresources(mode,opaq)
- pgf_loaded = pgf_loaded or (newtoken and newtoken.create("pgfutil@everybye").cmdname == "assign_toks")
+ if token and pgf.bye and not pgf.loaded then
+ pgf.loaded = token.create(pgf.bye).cmdname == "assign_toks"
+ pgf.bye = pgf.loaded and pgf.bye
+ end
local res, on_on, off_on = "", nil, nil
res, off_on = update_tr_res(res, "Normal", 1)
res, on_on = update_tr_res(res, mode, opaq)
if pdfmode then
if res ~= "" then
- local tpr = texget("pdfpageresources") -- respect luaotfload-colors
- local no_extgs = not stringfind(tpr,"/ExtGState<<.*>>")
- local pgf_pdf_loaded = no_extgs and pgf_loaded
- if pgf_pdf_loaded then
- texsprint(format("\\csname pgf@sys@addpdfresource@extgs@plain\\endcsname{%s}",res))
+ if pgf.loaded then
+ texsprint(format("\\csname %s\\endcsname{%s}", pgf.extgs, res))
else
- if no_extgs then
- tpr = tpr.."/ExtGState<<>>"
+ local tpr, n = getpageres() or "", 0
+ tpr, n = tpr:gsub("/ExtGState<<", "%1"..res)
+ if n == 0 then
+ tpr = format("%s/ExtGState<<%s>>", tpr, res)
end
- tpr = tpr:gsub("/ExtGState<<","%1"..res)
- texset("global","pdfpageresources",tpr)
+ setpageres(tpr)
end
end
else
- if not pgf_loaded then
+ if not pgf.loaded then
texsprint(format("\\special{pdf:put @resources<</ExtGState @MPlibTr>>}"))
end
end
@@ -890,8 +894,6 @@ local function tr_pdf_pageresources(mode,opaq)
end
local shading_res
-local getpageres = pdf.getpageresources or function() return pdf.pageresources end
-local setpageres = pdf.setpageresources or function(s) pdf.pageresources = s end
local function shading_initialize ()
shading_res = {}
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index be09b7aa3a1..3cfeb24912b 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
@@ -10,16 +10,25 @@
%%
\bgroup\expandafter\expandafter\expandafter\egroup
\expandafter\ifx\csname selectfont\endcsname\relax
- \input luatexbase-modutils.sty
+ \input ltluatex
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
- [2015/10/02 v2.11.1 mplib package for LuaTeX]
- \RequirePackage{luatexbase-modutils}
+ [2016/01/02 v2.11.2 mplib package for LuaTeX]
+ \ifx\newluafunction\@undefined
+ \input ltluatex
+ \fi
+\fi
+\directlua{require("luamplib")}
+\ifx\scantextokens\undefined
+ \let\scantextokens\luatexscantextokens
+\fi
+\ifx\pdfoutput\undefined
+ \let\pdfoutput\outputmode
+ \protected\def\pdfliteral{\pdfextension literal}
\fi
-\RequireLuaModule{luamplib}
-\def\mplibsetformat#1{%
- \directlua{luamplib.setformat("\luatexluaescapestring{#1}")}}
+
+\def\mplibsetformat#1{\directlua{luamplib.setformat("#1")}}
\ifnum\pdfoutput>0
\let\mplibtoPDF\pdfliteral
\else
@@ -27,9 +36,9 @@
\ifcsname PackageWarning\endcsname
\PackageWarning{luamplib}{take dvipdfmx path, no support for other dvi tools currently.}
\else
- \write16{}
- \write16{luamplib Warning: take dvipdfmx path, no support for other dvi tools currently.}
- \write16{}
+ \write128{}
+ \write128{luamplib Warning: take dvipdfmx path, no support for other dvi tools currently.}
+ \write128{}
\fi
\fi
\def\mplibsetupcatcodes{%
@@ -44,13 +53,13 @@
\def\mplibreplacenewlinebr{%
\begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinebr}
\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
- \def\mplibdoreplacenewlinebr#1^^J{\endgroup\luatexscantextokens{{}#1~}}}
+ \def\mplibdoreplacenewlinebr#1^^J{\endgroup\scantextokens{{}#1~}}}
\bgroup\expandafter\expandafter\expandafter\egroup
\expandafter\ifx\csname selectfont\endcsname\relax
\def\mplibreplacenewlinecs{%
\begingroup \mplibpostmpcatcodes \mplibdoreplacenewlinecs}
\begingroup\lccode`\~=`\^^M \lowercase{\endgroup
- \def\mplibdoreplacenewlinecs#1^^J{\endgroup\luatexscantextokens{\relax#1~}}}
+ \def\mplibdoreplacenewlinecs#1^^J{\endgroup\scantextokens{\relax#1~}}}
\def\mplibcode{%
\mplibstartlineno\inputlineno
\begingroup