diff options
author | Karl Berry <karl@freefriends.org> | 2021-03-06 21:58:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-03-06 21:58:15 +0000 |
commit | 974640d66e61e81cb197ad96fdff7b08343e4c5a (patch) | |
tree | 2e1f75f32f312b7f24ba82b4590ae230bcd6f399 /Master/texmf-dist/tex/context/base/mkiv/mlib-ctx.lua | |
parent | b4fa72e61230aca75f7f6fbf988821f71edfb6b2 (diff) |
context
git-svn-id: svn://tug.org/texlive/trunk@58167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/mlib-ctx.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/mlib-ctx.lua | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/mlib-ctx.lua b/Master/texmf-dist/tex/context/base/mkiv/mlib-ctx.lua index c913408cd05..24b02f6f6a6 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mlib-ctx.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/mlib-ctx.lua @@ -266,10 +266,10 @@ function metapost.getclippath(specification) -- why not a special instance for t result = metapost.filterclippath(result) end stoptiming(metapost) - metapost.pushformat() + metapost.popformat() return result else - metapost.pushformat() + metapost.popformat() end end @@ -335,12 +335,13 @@ statistics.register("metapost", function() if n and n > 0 then local elapsedtime = statistics.elapsedtime local elapsed = statistics.elapsed + local runs, stats = metapost.nofscriptruns() local instances, memory = metapost.getstatistics(true) - return format("%s seconds, loading: %s, execution: %s, n: %s, average: %s, instances: %i, luacalls: %i, memory: %0.3f M", + return format("%s seconds, loading: %s, execution: %s, n: %s, average: %s, instances: %i, luacalls: %s, memory: %0.3f M", elapsedtime(metapost), elapsedtime(mplib), elapsedtime(metapost.exectime), n, elapsedtime((elapsed(metapost) + elapsed(mplib) + elapsed(metapost.exectime)) / n), - instances, metapost.nofscriptruns(),memory/(1024*1024)) + instances, stats and stats or runs, memory/(1024*1024)) else return nil end @@ -400,3 +401,31 @@ implement { name = "mptexreset", actions = mptex.reset } + +-- moved from mlib-lua: + +mp = mp or { -- system namespace + set = { }, + get = { }, + aux = { }, + scan = { }, + skip = { }, + inject = { }, +} + +MP = MP or { } -- user namespace + +-- We had this: +-- +-- table.setmetatablecall(mp,function(t,k) mpprint(k) end) +-- +-- but the next one is more interesting because we cannot use calls like: +-- +-- lua.mp.somedefdname("foo") +-- +-- which is due to expansion of somedefdname during suffix creation. So: +-- +-- lua.mp("somedefdname","foo") + +table.setmetatablecall(mp,function(t,k,...) return t[k](...) end) +table.setmetatablecall(MP,function(t,k,...) return t[k](...) end) |