diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-29 16:26:18 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-11-29 16:26:18 +0100 |
commit | 78976f3bd5f9087ff5be3469c6abb94df51ebdf9 (patch) | |
tree | 2c468d878e2600ffd319d5806c0ce1d42027ad28 | |
parent | 44ba990b30247a129dbb8b12e8c8154e37b5eb33 (diff) | |
download | lualibs-78976f3bd5f9087ff5be3469c6abb94df51ebdf9.tar.gz |
sync with Context as of 2013-11-29
-rw-r--r-- | lualibs-os.lua | 33 | ||||
-rw-r--r-- | lualibs-trac-inf.lua | 5 | ||||
-rw-r--r-- | lualibs-util-env.lua | 4 | ||||
-rw-r--r-- | lualibs-util-str.lua | 2 |
4 files changed, 30 insertions, 14 deletions
diff --git a/lualibs-os.lua b/lualibs-os.lua index 7f3fd7c..bfafa4f 100644 --- a/lualibs-os.lua +++ b/lualibs-os.lua @@ -197,9 +197,8 @@ end -- no need for function anymore as we have more clever code and helpers now -- this metatable trickery might as well disappear -os.resolvers = os.resolvers or { } -- will become private - -local resolvers = os.resolvers +local resolvers = os.resolvers or { } +os.resolvers = resolvers setmetatable(os, { __index = function(t,k) local r = resolvers[k] @@ -222,6 +221,8 @@ local function guess() return os.resultof("echo $HOSTTYPE") or "" end +-- os.bits = 32 | 64 + if platform ~= "" then os.platform = platform @@ -230,10 +231,14 @@ elseif os.type == "windows" then -- we could set the variable directly, no function needed here - function os.resolvers.platform(t,k) + -- PROCESSOR_ARCHITECTURE : binary platform + -- PROCESSOR_ARCHITEW6432 : OS platform + + function resolvers.platform(t,k) local platform, architecture = "", os.getenv("PROCESSOR_ARCHITECTURE") or "" if find(architecture,"AMD64") then - platform = "mswin-64" + -- platform = "mswin-64" + platform = "win64" else platform = "mswin" end @@ -244,7 +249,7 @@ elseif os.type == "windows" then elseif name == "linux" then - function os.resolvers.platform(t,k) + function resolvers.platform(t,k) -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then @@ -271,7 +276,7 @@ elseif name == "macosx" then therefore not permitted to run the 64 bit kernel. ]]-- - function os.resolvers.platform(t,k) + function resolvers.platform(t,k) -- local platform, architecture = "", os.getenv("HOSTTYPE") or "" -- if architecture == "" then -- architecture = os.resultof("echo $HOSTTYPE") or "" @@ -294,7 +299,7 @@ elseif name == "macosx" then elseif name == "sunos" then - function os.resolvers.platform(t,k) + function resolvers.platform(t,k) local platform, architecture = "", os.resultof("uname -m") or "" if find(architecture,"sparc") then platform = "solaris-sparc" @@ -308,7 +313,7 @@ elseif name == "sunos" then elseif name == "freebsd" then - function os.resolvers.platform(t,k) + function resolvers.platform(t,k) local platform, architecture = "", os.resultof("uname -m") or "" if find(architecture,"amd64") then platform = "freebsd-amd64" @@ -322,7 +327,7 @@ elseif name == "freebsd" then elseif name == "kfreebsd" then - function os.resolvers.platform(t,k) + function resolvers.platform(t,k) -- we sometimes have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then @@ -341,7 +346,7 @@ else -- os.setenv("MTX_PLATFORM",platform) -- os.platform = platform - function os.resolvers.platform(t,k) + function resolvers.platform(t,k) local platform = "linux" os.setenv("MTX_PLATFORM",platform) os.platform = platform @@ -350,6 +355,12 @@ else end +function resolvers.bits(t,k) + local bits = find(os.platform,"64") and 64 or 32 + os.bits = bits + return bits +end + -- beware, we set the randomseed -- from wikipedia: Version 4 UUIDs use a scheme relying only on random numbers. This algorithm sets the diff --git a/lualibs-trac-inf.lua b/lualibs-trac-inf.lua index 79cbdba..802f2e6 100644 --- a/lualibs-trac-inf.lua +++ b/lualibs-trac-inf.lua @@ -122,6 +122,9 @@ function statistics.show() if statistics.enable then -- this code will move local register = statistics.register + register("used platform", function() + return format("%s, type: %s, binary subtree: %s",os.platform or "unknown",os.type or "unknown", environment.texos or "unknown") + end) register("luatex banner", function() return lower(status.banner) end) @@ -179,7 +182,7 @@ function statistics.timed(action) starttiming("run") action() stoptiming("run") - report("total runtime: %s",elapsedtime("run")) + report("total runtime: %s seconds",elapsedtime("run")) end -- goodie diff --git a/lualibs-util-env.lua b/lualibs-util-env.lua index 1184c1d..0a708ea 100644 --- a/lualibs-util-env.lua +++ b/lualibs-util-env.lua @@ -42,7 +42,7 @@ local basicengines = allocate { -- ["texluajit.exe"] = "luajittex", } -local luaengines=allocate { +local luaengines = allocate { ["lua"] = true, ["luajit"] = true, } @@ -66,6 +66,8 @@ elseif luaengines[file.removesuffix(arg[-1])] then -- arg[k-1] = arg[k] -- end -- remove(arg) -- last +-- +-- environment.used_as_library = true elseif validengines[file.removesuffix(arg[0])] then if arg[1] == "--luaonly" then arg[-1] = arg[0] diff --git a/lualibs-util-str.lua b/lualibs-util-str.lua index 24a3f6e..af8b165 100644 --- a/lualibs-util-str.lua +++ b/lualibs-util-str.lua @@ -647,7 +647,7 @@ local format_extension = function(extensions,f,name) end end --- aA b cC d eE f gG hH iI jJ lL mM N o p qQ r sS tT uU wW xX +-- aA b cC d eE f gG hH iI jJ lL mM N o p qQ r sS tT uU wW xX z local builder = Cs { "start", start = ( |