Hallo Taco et al
\startlua local function finder(name, mode, ftype) if mode=="w" then return name else return kpse.find_file(name,ftype) end end
Jein!
Try this, a little more elaborate, version of finder:
local function finder(name, mode, ftype) local found if mode=="w" then found = name else found = kpse.find_file(name,ftype) end print("MPlib finder: " .. name .. " -> " .. found) return found end
maybe that will give a clue.
Example 1: my test file with your finder. -------------------------------------------------------------- MPlib finder: mpost.mp -> d:/context/tex/texmf/metapost/base/mpost.mp MPlib finder: mpost.map -> MPlib finder: plain.mp -> d:/context/tex/texmf/metapost/base/plain.mp t={ ["log"]="This is MetaPost, Version 1.003 (INIMP) 23 APR 2008 07:51 (mpost.mp(plain.mp\ Preloading the plain mem file, version 0.99)", ["status"]=0, ["term"]="This is MetaPost, Version 1.003 (Cweb version 0.40) (INIMP)\ (mpost.mp(plain.mp\ Preloading the plain mem file, version 0.99)", } MPlib finder: mpost.mem -> t={ ["log"]=" )\ Beginning to dump on file mpost.mem\ (mem=mpost 8.4.23)\ at most 736 strings of total length 3629\ 3326 memory locations dumped; current usage is 1021&2227\ 501 symbolic tokens\ ", ["status"]=0, ["term"]=" )\ Beginning to dump on file mpost.mem\ (mem=mpost 8.4.23)\ at most 736 strings of total length 3629\ 3326 memory locations dumped; current usage is 1021&2227\ 501 symbolic tokens\ Transcript written on mpost.log.\ ", } -------------------------------------------------------------- found = "" no mpost.mem, no mpost.log Example 2: my test file with your finder and ("wb" not "w") -------------------------------------------------------------- MPlib finder: mpost.mp -> d:/context/tex/texmf/metapost/base/mpost.mp MPlib finder: mpost.map -> MPlib finder: plain.mp -> d:/context/tex/texmf/metapost/base/plain.mp t={ ["log"]="This is MetaPost, Version 1.003 (INIMP) 23 APR 2008 07:58 (mpost.mp(plain.mp\ Preloading the plain mem file, version 0.99)", ["status"]=0, ["term"]="This is MetaPost, Version 1.003 (Cweb version 0.40) (INIMP)\ (mpost.mp(plain.mp\ Preloading the plain mem file, version 0.99)", } MPlib finder: mpost.mem -> mpost.mem t={ ["log"]=" )\ Beginning to dump on file mpost.mem\ (mem=mpost 8.4.23)\ at most 736 strings of total length 3629\ 3326 memory locations dumped; current usage is 1021&2227\ 501 symbolic tokens\ ", ["status"]=0, ["term"]=" )\ Beginning to dump on file mpost.mem\ (mem=mpost 8.4.23)\ at most 736 strings of total length 3629\ 3326 memory locations dumped; current usage is 1021&2227\ 501 symbolic tokens\ Transcript written on mpost.log.\ ", } -------------------------------------------------------------- mpost.mem gets written now but no mpost.log grusz Wolfgang
Hi, Wolfgang Werners-Lucchini wrote:
Example 1: my test file with your finder. -------------------------------------------------------------- MPlib finder: mpost.mem ->
So it was running the kpse.find_file instead of returning a local name, and it is not found. There is a silent error here that I should make explicit, but the real problem (as Akira noted) is that it was in the "else" branch at all.
Example 2: my test file with your finder and ("wb" not "w") -------------------------------------------------------------- MPlib finder: mpost.mem -> mpost.mem
That is correct, here it will write to the local file mpost.mem
mpost.mem gets written now but no mpost.log
I can remove that line, it is misleading. The content of the log file is in <result>.log Best wishes, Taco
participants (2)
-
Taco Hoekwater
-
Wolfgang Werners-Lucchini