summaryrefslogtreecommitdiff
path: root/tex/generic/context/luatex/luatex-basics-gen.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-04-23 14:00:26 +0300
committerMarius <mariausol@gmail.com>2013-04-23 14:00:26 +0300
commit194ec205e1d49ddd144ba3523b61472ee97c9383 (patch)
treeab7d6eafd62fa95c68c578d5b5f7ee62ea07e444 /tex/generic/context/luatex/luatex-basics-gen.lua
parentd22f2847f74dc48da29da18c8aa2f2da10d6d177 (diff)
downloadcontext-194ec205e1d49ddd144ba3523b61472ee97c9383.tar.gz
beta 2013.04.23 12:46
Diffstat (limited to 'tex/generic/context/luatex/luatex-basics-gen.lua')
-rw-r--r--tex/generic/context/luatex/luatex-basics-gen.lua49
1 files changed, 30 insertions, 19 deletions
diff --git a/tex/generic/context/luatex/luatex-basics-gen.lua b/tex/generic/context/luatex/luatex-basics-gen.lua
index 288cfa2e1..61f3910eb 100644
--- a/tex/generic/context/luatex/luatex-basics-gen.lua
+++ b/tex/generic/context/luatex/luatex-basics-gen.lua
@@ -130,7 +130,9 @@ end
caches = { }
-local writable, readables = nil, { }
+local writable = nil
+local readables = { }
+local usingjit = jit
if not caches.namespace or caches.namespace == "" or caches.namespace == "context" then
caches.namespace = 'generic'
@@ -204,7 +206,7 @@ end
local function makefullname(path,name)
if path and path ~= "" then
name = "temp-" .. name -- clash prevention
- return file.addsuffix(file.join(path,name),"lua"), file.addsuffix(file.join(path,name),"luc")
+ return file.addsuffix(file.join(path,name),"lua"), file.addsuffix(file.join(path,name),usingjit and "lub" or "luc")
end
end
@@ -265,27 +267,36 @@ end
-- this) in which case one should limit the method to luac and enable support
-- for execution.
-caches.compilemethod = "both"
+-- function caches.compile(data,luaname,lucname)
+-- local d = io.loaddata(luaname)
+-- if not d or d == "" then
+-- d = table.serialize(data,true) -- slow
+-- end
+-- if d and d ~= "" then
+-- local f = io.open(lucname,'w')
+-- if f then
+-- local s = loadstring(d)
+-- if s then
+-- f:write(string.dump(s,true))
+-- end
+-- f:close()
+-- end
+-- end
+-- end
function caches.compile(data,luaname,lucname)
- local done = false
- if caches.compilemethod == "luac" or caches.compilemethod == "both" then
- done = os.spawn("texluac -o " .. string.quoted(lucname) .. " -s " .. string.quoted(luaname)) == 0
+ local d = io.loaddata(luaname)
+ if not d or d == "" then
+ d = table.serialize(data,true) -- slow
end
- if not done and (caches.compilemethod == "dump" or caches.compilemethod == "both") then
- local d = io.loaddata(luaname)
- if not d or d == "" then
- d = table.serialize(data,true) -- slow
- end
- if d and d ~= "" then
- local f = io.open(lucname,'w')
- if f then
- local s = loadstring(d)
- if s then
- f:write(string.dump(s,true))
- end
- f:close()
+ if d and d ~= "" then
+ local f = io.open(lucname,'w')
+ if f then
+ local s = loadstring(d)
+ if s then
+ f:write(string.dump(s,true))
end
+ f:close()
end
end
end