diff options
author | Marius <mariausol@gmail.com> | 2010-08-19 10:29:42 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-08-19 10:29:42 +0300 |
commit | 7d7e0d3c8d778650105cfb479f31a2bb54d69d50 (patch) | |
tree | e0c4e7d8bf466a70af56be02a0de703bbd09a5af /tex/context/base/luat-cod.lua | |
parent | b469b8ec1b494ab72cd462bfc539ce01440e6aaf (diff) | |
download | context-7d7e0d3c8d778650105cfb479f31a2bb54d69d50.tar.gz |
beta 2010.08.19 01:08
Diffstat (limited to 'tex/context/base/luat-cod.lua')
-rw-r--r-- | tex/context/base/luat-cod.lua | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tex/context/base/luat-cod.lua b/tex/context/base/luat-cod.lua index 8d61c269a..60a0b616f 100644 --- a/tex/context/base/luat-cod.lua +++ b/tex/context/base/luat-cod.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['luat-cod'] = { local match, gsub, find = string.match, string.gsub, string.find +local texconfig, lua = texconfig, lua + -- some basic housekeeping texconfig.kpse_init = false @@ -52,7 +54,7 @@ end local finalizers = { } function lua.registerfinalizer(f,comment) - if type(f) == "function"then + if type(f) == "function" then finalizers[#finalizers+1] = { action = f, comment = comment } end end @@ -69,12 +71,13 @@ end -- A first start with environments. This will be overloaded later. +environment = environment or { } +local environment = environment + local sourcefile = arg and arg[1] or "" local sourcepath = find(sourcefile,"/") and gsub(sourcefile,"/[^/]+$","") or "" local targetpath = "." -environment = environment or { } - -- delayed (via metatable): -- -- environment.jobname = tex.jobname @@ -114,20 +117,22 @@ end -- a kpse error when disabled. Thi sis en angine issue that will -- be sorted out in due time. +local isfile = lfs.isfile + local function source_file(name) local fullname = sourcepath .. "/" .. name - if lfs.isfile(fullname) then + if isfile(fullname) then return fullname end fullname = fullname .. ".tex" - if lfs.isfile(fullname) then + if isfile(fullname) then return fullname end - if lfs.isfile(name) then + if isfile(name) then return name end name = name .. ".tex" - if lfs.isfile(name) then + if isfile(name) then return name end return nil |