2 -- There are two interfaces:
5 -- new * execute^1 * finish
8 mpx = mplib.new({ini_version = true})
9 vv = mpx:execute("plain ");
10 v = mpx:execute("dump;");
12 print (tostring(vv.term) .. ' ' .. tostring(v.term) .. ' ' .. tostring(vvv.term))
13 print (tostring(vv.log) .. ' ' .. tostring(v.log) .. ' ' .. tostring(vvv.log))
14 print (tostring(vv.error) .. ' ' .. tostring(v.error) .. ' ' .. tostring(vvv.error))
18 dofile("/opt/tex/texmf-local/tex/context/base/l-table.lua");
21 local v = m:execute(s)
22 -- print ('<<term:'..v.term..'>>')
24 print ('<<log:'..v.log..'>>')
26 if true and v.fig then
27 for _,gs in ipairs(v.fig) do
28 print(gs:postscript())
29 local b = gs:objects()
30 for _,vv in ipairs(b) do
31 print(vv, vv.type, table.serialize(vv.path), table.serialize(vv.color))
32 if vv.type == "text" then
33 print(vv.text, vv.font, vv.dsize, table.serialize(vv.transform))
40 -- chunks have to have 'complete file' nesting state
45 "p = (0,0){right}..(20,100)..(50,60)..(75,50)...(25,25)..cycle;",
46 "q = (0,0){right}..(20,100)..(50,60)..(75,50)...(25,25);",
47 "pickup pencircle scaled 2;",
48 "beginfig(1); fill p withcolor (1,0,0); draw p dashed evenly; endfig;",
49 [[beginfig(2); fill p withcolor (1,0,1); endfig;
50 beginfig(3); draw q withcolor (0,1,1); endfig;]],
51 "beginfig(4); label(\"stuff\", (0,0)); endfig;",
54 function finder (a,b,c)
56 if a == "mpost.map" then
57 return "/opt/tex/texmf-local/fonts/map/pdftex/pdftex.map"
59 if a =="cmr10.tfm" then
60 return "/opt/tex/texmf/fonts/tfm/public/cm/cmr10.tfm"
65 mpx = mplib.new({mem_name = "plain.mem",
66 command_line = "\\relax ",
69 for _,l in ipairs(lines) do