summaryrefslogtreecommitdiff
path: root/luaotfload-basics-gen.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-23 23:57:40 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-23 23:57:40 +0200
commit7e703cea3a68c7f6e52e63f0335f22ed1a231f84 (patch)
tree2b0aa995d7a749afd027a44f9e4c85ce09a160bd /luaotfload-basics-gen.lua
parentc6f6dd62e24c3a204a57d74d35759bb5a38c53b3 (diff)
downloadluaotfload-7e703cea3a68c7f6e52e63f0335f22ed1a231f84.tar.gz
update basics-gen.lua
Diffstat (limited to 'luaotfload-basics-gen.lua')
-rw-r--r--luaotfload-basics-gen.lua48
1 files changed, 30 insertions, 18 deletions
diff --git a/luaotfload-basics-gen.lua b/luaotfload-basics-gen.lua
index 727086e..61f3910 100644
--- a/luaotfload-basics-gen.lua
+++ b/luaotfload-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,26 +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
- if _G["loadstring"] then s=loadstring(d) else s=load(d) end
- f:write(string.dump(s))
- 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