On 13 Apr 2008 at 13:31, ntg-context-request@ntg.nl wrote: Hallo Taco, thank you for your example.
% start low-level \startlua local function finder(name, mode, ftype) if mode=="w" then return name else return kpse.find_file(name,ftype) end end mp = mplib.new ( { hash_size = 100000, main_memory = 2000000, param_size = 100000, find_file = finder, ini_version = true } ) if mp then res = mp:execute('plain') mp:finish() end
this first step runs with res=0, but there is no 'plain.mem' dumped. (I have temporary appended 'dump;' to plain.mp) this first step runs with res=0 with mp:execute('mpost'), but no 'mpost.mem' the first step even runs with res=0 and mp:execute('\\plain; dump;'), but no 'plain.mem' after that I produced 'plain.mem' executing 'texmfstart texexec --make plain'
mp = mplib.new ( { hash_size = 100000, main_memory = 2000000, param_size = 100000, find_file = finder, } )
if mp then res = mp:execute( "\\beginfig(1) draw (0,0) .. (1,1) .. (2,1); endfig; bye;" ) tex.print("[" .. tostring(res.status) .. "]") mp:finish() end \stoplua % stop low-level
this second step returns res=3. Is there a find_file function necessary to find the mem-file given in 'mem_name' or is such a function only necessary for file-names in 'mp:execute'? Wolfgang -- Musensturm-Verlag -- Postfach 1249 -- 36126 Gersfeld
Wolfgang Werners-Lucchini wrote:
Is there a find_file function necessary to find the mem-file given in 'mem_name' or is such a function only necessary for file-names in 'mp:execute'?
the find function is needed in context you can use metapost.process('formatname',datastream) this will generate the format if needed and reuse it ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Wolfgang Werners-Lucchini wrote:
if mp then res = mp:execute('plain') mp:finish() end
this first step runs with res=0, but there is no 'plain.mem' dumped.
For the other readers: res itself can't really be "zero". It is either a table, or nil. The actual return value is the status field in the table, and that can vary from 0 (good run) to 3 (extremely bad run), and you can end up with "nil" if you have invalid arguments.
(I have temporary appended 'dump;' to plain.mp)
After the above, you should have plain.mem in the local directory. You can try printing res.term or res.log or even print(table.serialize(res)) to check if what mp is doing.
after that I produced 'plain.mem' executing 'texmfstart texexec --make plain'
I assume that will create a tex plain.fmt file. But even if it does create a .mem file, you will not succeed unless you are using "newmpost" from the mplib-alpha-0.40 distribution and the values you sset up for hash_size, main_memory, and param_size in the loading stage are identical to the values used by newmpost from texmf.cnf during mem generation. Best wishes, Taco
participants (3)
-
Hans Hagen
-
Taco Hoekwater
-
Wolfgang Werners-Lucchini