diff options
Diffstat (limited to 'tex/context/base/l-os.lua')
-rw-r--r-- | tex/context/base/l-os.lua | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua index 57edc3915..bfafa4f95 100644 --- a/tex/context/base/l-os.lua +++ b/tex/context/base/l-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] @@ -235,7 +234,7 @@ elseif os.type == "windows" then -- PROCESSOR_ARCHITECTURE : binary platform -- PROCESSOR_ARCHITEW6432 : OS platform - function os.resolvers.platform(t,k) + function resolvers.platform(t,k) local platform, architecture = "", os.getenv("PROCESSOR_ARCHITECTURE") or "" if find(architecture,"AMD64") then -- platform = "mswin-64" @@ -250,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 @@ -277,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 "" @@ -300,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" @@ -314,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" @@ -328,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 @@ -347,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 @@ -356,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 |