From 6591e18e59fb54ae285d1a95ea74fc9101c00af8 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 19 Jan 2010 23:29:00 +0100 Subject: beta 2010.01.19 23:29 --- scripts/context/lua/mtxrun.lua | 51 ++++++++++++++++++++++++++-------- scripts/context/stubs/mswin/mtxrun.lua | 51 ++++++++++++++++++++++++++-------- scripts/context/stubs/unix/mtxrun | 51 ++++++++++++++++++++++++++-------- 3 files changed, 117 insertions(+), 36 deletions(-) (limited to 'scripts') diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 033c236ad..96fcbf6f1 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -1893,10 +1893,7 @@ elseif name == "linux" then elseif name == "macosx" then -- a rather inconsistent mess function os.resolvers.platform(t,k) - local platform, architecture = "", os.resultof("uname -m") or "" - if architecture == "" then - architecture = os.getenv("HOSTTYPE") or "" - end + local platform, architecture = "", os.getenv("HOSTTYPE") or "" if architecture == "" then architecture = os.resultof("echo $HOSTTYPE") or "" end @@ -1976,6 +1973,19 @@ function os.uuid() ) end +function os.timezone(delta) + local d = tonumber(tonumber(os.date("%H")-os.date("!%H"))) + if delta then + if d > 0 then + return format("+%02i:00",d) + else + return format("-%02i:00",-d) + end + else + return 1 + end +end + end -- of closure @@ -2400,7 +2410,7 @@ function url.hashed(str) end function url.hasscheme(str) - return not url.split(str).nosheme + return url.split(str)[1] ~= "" end function url.addscheme(str,scheme) @@ -3657,13 +3667,15 @@ function setters.new(name) return t end -trackers = setters.new("trackers") -directives = setters.new("directives") +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") -- nice trick: we overload two of the directives related functions with variants that -- do tracing (itself using a tracker) .. proof of concept -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) local e = directives.enable local d = directives.disable @@ -3678,6 +3690,19 @@ function directives.disable(...) d(...) end +local e = experiments.enable +local d = experiments.disable + +function experiments.enable(...) + commands.writestatus("experiments","enabling: %s",concat({...}," ")) + e(...) +end + +function experiments.disable(...) + commands.writestatus("experiments","disabling: %s",concat({...}," ")) + d(...) +end + end -- of closure @@ -3853,11 +3878,14 @@ local function add_attribute(namespace,tag,value) if tag == "xmlns" then xmlns[#xmlns+1] = resolvens(value) at[tag] = value + elseif namespace == "" then + at[tag] = value elseif namespace == "xmlns" then xml.checkns(tag,value) at["xmlns:" .. tag] = value else - at[tag] = value + -- for the moment this way: + at[namespace .. ":" .. tag] = value end end @@ -5992,8 +6020,7 @@ this module. Since this module is also used in we've put them here instead of loading mode modules there then needed.

--ldx]]-- - -local function xmlgsub(t,old,new) +local function xmlgsub(t,old,new) -- will be replaced local dt = t.dt if dt then for k=1,#dt do @@ -6007,7 +6034,7 @@ local function xmlgsub(t,old,new) end end -xmlgsub = xmlgsub +--~ xml.gsub = xmlgsub function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual if d and k then diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 033c236ad..96fcbf6f1 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -1893,10 +1893,7 @@ elseif name == "linux" then elseif name == "macosx" then -- a rather inconsistent mess function os.resolvers.platform(t,k) - local platform, architecture = "", os.resultof("uname -m") or "" - if architecture == "" then - architecture = os.getenv("HOSTTYPE") or "" - end + local platform, architecture = "", os.getenv("HOSTTYPE") or "" if architecture == "" then architecture = os.resultof("echo $HOSTTYPE") or "" end @@ -1976,6 +1973,19 @@ function os.uuid() ) end +function os.timezone(delta) + local d = tonumber(tonumber(os.date("%H")-os.date("!%H"))) + if delta then + if d > 0 then + return format("+%02i:00",d) + else + return format("-%02i:00",-d) + end + else + return 1 + end +end + end -- of closure @@ -2400,7 +2410,7 @@ function url.hashed(str) end function url.hasscheme(str) - return not url.split(str).nosheme + return url.split(str)[1] ~= "" end function url.addscheme(str,scheme) @@ -3657,13 +3667,15 @@ function setters.new(name) return t end -trackers = setters.new("trackers") -directives = setters.new("directives") +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") -- nice trick: we overload two of the directives related functions with variants that -- do tracing (itself using a tracker) .. proof of concept -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) local e = directives.enable local d = directives.disable @@ -3678,6 +3690,19 @@ function directives.disable(...) d(...) end +local e = experiments.enable +local d = experiments.disable + +function experiments.enable(...) + commands.writestatus("experiments","enabling: %s",concat({...}," ")) + e(...) +end + +function experiments.disable(...) + commands.writestatus("experiments","disabling: %s",concat({...}," ")) + d(...) +end + end -- of closure @@ -3853,11 +3878,14 @@ local function add_attribute(namespace,tag,value) if tag == "xmlns" then xmlns[#xmlns+1] = resolvens(value) at[tag] = value + elseif namespace == "" then + at[tag] = value elseif namespace == "xmlns" then xml.checkns(tag,value) at["xmlns:" .. tag] = value else - at[tag] = value + -- for the moment this way: + at[namespace .. ":" .. tag] = value end end @@ -5992,8 +6020,7 @@ this module. Since this module is also used in we've put them here instead of loading mode modules there then needed.

--ldx]]-- - -local function xmlgsub(t,old,new) +local function xmlgsub(t,old,new) -- will be replaced local dt = t.dt if dt then for k=1,#dt do @@ -6007,7 +6034,7 @@ local function xmlgsub(t,old,new) end end -xmlgsub = xmlgsub +--~ xml.gsub = xmlgsub function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual if d and k then diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 033c236ad..96fcbf6f1 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -1893,10 +1893,7 @@ elseif name == "linux" then elseif name == "macosx" then -- a rather inconsistent mess function os.resolvers.platform(t,k) - local platform, architecture = "", os.resultof("uname -m") or "" - if architecture == "" then - architecture = os.getenv("HOSTTYPE") or "" - end + local platform, architecture = "", os.getenv("HOSTTYPE") or "" if architecture == "" then architecture = os.resultof("echo $HOSTTYPE") or "" end @@ -1976,6 +1973,19 @@ function os.uuid() ) end +function os.timezone(delta) + local d = tonumber(tonumber(os.date("%H")-os.date("!%H"))) + if delta then + if d > 0 then + return format("+%02i:00",d) + else + return format("-%02i:00",-d) + end + else + return 1 + end +end + end -- of closure @@ -2400,7 +2410,7 @@ function url.hashed(str) end function url.hasscheme(str) - return not url.split(str).nosheme + return url.split(str)[1] ~= "" end function url.addscheme(str,scheme) @@ -3657,13 +3667,15 @@ function setters.new(name) return t end -trackers = setters.new("trackers") -directives = setters.new("directives") +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") -- nice trick: we overload two of the directives related functions with variants that -- do tracing (itself using a tracker) .. proof of concept -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) local e = directives.enable local d = directives.disable @@ -3678,6 +3690,19 @@ function directives.disable(...) d(...) end +local e = experiments.enable +local d = experiments.disable + +function experiments.enable(...) + commands.writestatus("experiments","enabling: %s",concat({...}," ")) + e(...) +end + +function experiments.disable(...) + commands.writestatus("experiments","disabling: %s",concat({...}," ")) + d(...) +end + end -- of closure @@ -3853,11 +3878,14 @@ local function add_attribute(namespace,tag,value) if tag == "xmlns" then xmlns[#xmlns+1] = resolvens(value) at[tag] = value + elseif namespace == "" then + at[tag] = value elseif namespace == "xmlns" then xml.checkns(tag,value) at["xmlns:" .. tag] = value else - at[tag] = value + -- for the moment this way: + at[namespace .. ":" .. tag] = value end end @@ -5992,8 +6020,7 @@ this module. Since this module is also used in we've put them here instead of loading mode modules there then needed.

--ldx]]-- - -local function xmlgsub(t,old,new) +local function xmlgsub(t,old,new) -- will be replaced local dt = t.dt if dt then for k=1,#dt do @@ -6007,7 +6034,7 @@ local function xmlgsub(t,old,new) end end -xmlgsub = xmlgsub +--~ xml.gsub = xmlgsub function xml.strip_leading_spaces(dk,d,k) -- cosmetic, for manual if d and k then -- cgit v1.2.3