diff options
author | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-14 17:38:55 +0000 |
---|---|---|
committer | Mojca Miklavec <mojca.miklavec@gmail.com> | 2012-05-14 17:38:55 +0000 |
commit | 15995e10bfc68edf79970c4ea4fbb6678566c46e (patch) | |
tree | 2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/meta-fun.lua | |
parent | c9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff) |
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
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 |