From 36ee3b791e253a00877a7b25e2d94b1dfc90a174 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 12 Jun 2019 00:08:48 +0200 Subject: 2019-06-11 19:28:00 --- tex/context/base/mkiv/mlib-run.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tex/context/base/mkiv/mlib-run.lua') diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua index 3365e3d42..bd4818659 100644 --- a/tex/context/base/mkiv/mlib-run.lua +++ b/tex/context/base/mkiv/mlib-run.lua @@ -288,6 +288,11 @@ metapost.defaultmethod = "default" local mpxformats = { } local nofformats = 0 local mpxpreambles = { } +local mpxextradata = { } + +function metapost.getextradata(mpx) + return mpxextradata[mpx] +end function metapost.pushformat(specification,f,m) -- was: instance, name, method if type(specification) ~= "table" then @@ -338,6 +343,7 @@ function metapost.pushformat(specification,f,m) -- was: instance, name, method report_metapost("initializing instance %a using format %a and method %a",usedinstance,format,method) mpx = metapost.checkformat(format,method) mpxformats[usedinstance] = mpx + mpxextradata[mpx] = { } if mpp ~= "" then preamble = mpp end @@ -349,7 +355,6 @@ function metapost.pushformat(specification,f,m) -- was: instance, name, method return mpx end - -- luatex.wrapup(function() -- for k, mpx in next, mpxformats do -- mpx:finish() @@ -365,14 +370,16 @@ function metapost.reset(mpx) -- nothing elseif type(mpx) == "string" then if mpxformats[mpx] then - mpxformats[mpx]:finish() + mpxextradata[mpx] = nil mpxformats[mpx] = nil + mpxformats[mpx]:finish() end else for name, instance in next, mpxformats do if instance == mpx then + mpxextradata[mpx] = nil + mpxformats[mpx] = nil mpx:finish() - mpxformats[name] = nil break end end -- cgit v1.2.3