diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/meta-fun.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/meta-fun.lua | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/context/base/meta-fun.lua b/Master/texmf-dist/tex/context/base/meta-fun.lua index 9a6d971baa6..7594d0c78d7 100644 --- a/Master/texmf-dist/tex/context/base/meta-fun.lua +++ b/Master/texmf-dist/tex/context/base/meta-fun.lua @@ -9,7 +9,6 @@ if not modules then modules = { } end modules ['meta-fun'] = { -- very experimental, actually a joke ... see metafun manual for usage local format, loadstring, type = string.format, loadstring, type -local texwrite = tex.write local metapost = metapost @@ -17,42 +16,42 @@ metapost.metafun = metapost.metafun or { } local metafun = metapost.metafun function metafun.topath(t,connector) - texwrite("(") + context("(") if #t > 0 then for i=1,#t do if i > 1 then - texwrite(connector or "..") + context(connector or "..") end local ti = t[i] if type(ti) == "string" then - texwrite(ti) + context(ti) else - texwrite(format("(%s,%s)",ti.x or ti[1] or 0,ti.y or ti[2] or 0)) + context("(%s,%s)",ti.x or ti[1] or 0,ti.y or ti[2] or 0) end end else - texwrite("origin") + context("origin") end - texwrite(")") + context(")") end function metafun.interpolate(f,b,e,s,c) local done = false - texwrite("(") + context("(") for i=b,e,(e-b)/s do local d = loadstring(format("return function(x) return %s end",f)) if d then d = d() if done then - texwrite(c or "...") + context(c or "...") else done = true end - texwrite(format("(%s,%s)",i,d(i))) + context("(%s,%s)",i,d(i)) end end if not done then - texwrite("origin") + context("origin") end - texwrite(")") + context(")") end |