2 -- There are two interfaces:
5 -- new * execute^1 * finish
8 mpx = mp.new({ini_version = true, command_line = "plain \\dump"})
13 dofile("/opt/tex/texmf-local/tex/context/base/l-table.lua");
16 local v = m:execute(s)
17 -- print ('<<term:'..v.term..'>>')
18 print ('<<log:'..v.log..'>>')
20 for _,gs in ipairs(v.fig) do
21 local b = gs:objects()
22 for _,vv in ipairs(b) do
23 print(vv, vv.type, table.serialize(vv.path), table.serialize(vv.color))
25 -- print(gs:postscript())
30 -- chunks have to have 'complete file' nesting state
34 "p = (0,0){right}..(20,100)..(50,60)..(75,50)...(25,25)..cycle;",
35 "pickup pencircle scaled 2;",
36 "beginfig(1); fill p withcolor (1,0,0); draw p dashed evenly; endfig;",
37 "beginfig(2); fill p withcolor (0,1,0); draw p dashed evenly; endfig;",
38 "beginfig(3); fill p withcolor (0,0,1); draw p dashed evenly; endfig;",
39 "beginfig(4); fill p withcolor (1,1,0); draw p dashed evenly; endfig;",
40 [[beginfig(5); fill p withcolor (1,0,1); draw p dashed evenly; endfig;
41 beginfig(6); fill p withcolor (0,1,1); draw p dashed evenly; endfig;]],
42 "beginfig(7); label(\"stuff\", (0,0)); endfig;",
45 function finder (a,b,c)
47 if a == "mpost.map" then
48 return "/opt/tex/texmf-local/fonts/map/pdftex/pdftex.map"
50 if a =="cmr10.tfm" then
51 return "/opt/tex/texmf/fonts/tfm/public/cm/cmr10.tfm"
56 mpx = mp.new({mem_name = "plain.mem",
57 command_line = "\\relax ",
60 for _,l in ipairs(lines) do