Jonathan Sauer wrote:
Hello,
[...] "dofile" etc will not be adapted to kpse based loading since in principle this is pure lua, but you can easily write a wrapper, say "doluatexfile" that first locates the file (using kpse) and then does it.
I disagree about this being the correct way: IMO, TeX uses some kind of virtual file system: All files, as far as TeX The Program is concerned, are in the same directory, and kpathsea is simply a way of mapping real directories onto this virtual one. When I say "\input myfile", TeX simply tries to open this file by calling a system-specific routine -- in web2c one that first uses kpathsea to resolve the real file name and path, in OzTeX one which uses a config file directly etc.
You can "escape" this virtual file system by specifying a full path name, or partially by specifying a partial path name (IIRC, I am not quite sure if the latter is correct).
Still, normally you are inside the virtual file system TeX uses to find and read files -- all files, .tex files as well as fonts, graphics etc. Now, Lua resides inside TeX, and therefore I think it should use this same virtual file system when accessing files, meaning kpathsea. Otherwise, two parts of LuaTeX behave differently.
So IMO changing dofile to use kpathsea would not change its "pure Lua" status, but simply adapt it to the host environment.
the tex part of luatex should behave as tex (tex manual), the lua part as lua (lua manual) and glue between them (luatex manual) this is what callbacks are for: that way you can define your own preferences; actually, you can redefine dofile originaldofile = dofile function dofile(name) return originaldofile(kpse.find_file(name)) end or whatever you like. This is the whole idea behind luatex ... users and macro writers can implement their own solutions which prevents endless discussions about what should be implemented how/when ... each can implement his/her own preferences on top of core functionality. I ca even imagine that someone does *not* want to look into the places where tex files are -) (btw, the same is true for reading from zip files ... the tools are there but you need to wrote you rown glue code) actually, this virtual file system is indeed virtual in the sense that one can replace it completely by another one and in such a situation dofile may be reimplemented differently btw, lua files can live in areas that are not considered tex input, for instance in texmf/scripts/<program>/lua or whatsoever I suppose that macro packages will behave consistently and define some rules for writers of extensions. (At least this what i do for context). Hans ----------------------------------------------------------------- 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 -----------------------------------------------------------------