From 0f82c3f6ef101a553b3f28d9f9d8cb905106eec2 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 11 Sep 2012 22:00:16 +0300 Subject: beta 2012.09.11 20:36 --- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4145 -> 4142 bytes tex/context/base/context-version.png | Bin 106487 -> 106519 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-sys.lua | 18 ++++++++++++++---- tex/context/base/l-os.lua | 2 +- tex/context/base/lxml-lpt.lua | 3 ++- tex/context/base/lxml-tab.lua | 14 +++++++++++--- tex/context/base/lxml-tex.lua | 16 ++++++++++------ tex/context/base/status-files.pdf | Bin 24586 -> 24585 bytes tex/context/base/status-lua.pdf | Bin 195007 -> 195020 bytes tex/context/base/util-sql.lua | 13 +++++++++---- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 15 files changed, 52 insertions(+), 24 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index e92106c05..ec95eb332 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.09.10 00:57} +\newcontextversion{2012.09.11 20:36} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index b5125f072..cfe4e9cc6 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.09.10 00:57} +\newcontextversion{2012.09.11 20:36} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 50e2e7800..d5b6b48d6 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index c4afeadb1..df3ece839 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 4d6937ead..a1bd203d9 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.09.10 00:57} +\edef\contextversion{2012.09.11 20:36} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 7bd9bb409..5e1f7c680 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.09.10 00:57} +\edef\contextversion{2012.09.11 20:36} %D For those who want to use this: diff --git a/tex/context/base/core-sys.lua b/tex/context/base/core-sys.lua index cf027e1c6..d68ef05d7 100644 --- a/tex/context/base/core-sys.lua +++ b/tex/context/base/core-sys.lua @@ -33,15 +33,25 @@ function commands.updatefilenames(jobname,fulljobname,inputfilename,outputfilena local outputfilename = outputfilename or environment.inputfilebarename or "" environment.outputfilename = outputfilename -- - commands.writestatus("files",format("jobname: %q, input: %q, result: %q, suffix: %s", - jobfilename,inputfilename,outputfilename,inputfilesuffix)) + local runpath = resolvers.cleanpath(lfs.currentdir()) + environment.runpath = runpath + -- + statistics.register("running on path", function() + return environment.runpath + end) + -- + statistics.register("job file properties", function() + return format("jobname: %s, input: %s, suffix: %s",jobfilename,inputfilename,inputfilesuffix) + end) + -- end statistics.register("result saved in file", function() -- suffix will be fetched from backend + local outputfilename = environment.outputfilename or environment.jobname or tex.jobname or "" if tex.pdfoutput > 0 then - return format( "%s.%s, compresslevel %s, objectcompreslevel %s", environment.outputfilename, "pdf", tex.pdfcompresslevel, tex.pdfobjcompresslevel) + return format( "%s.%s, compresslevel %s, objectcompreslevel %s",outputfilename,"pdf",tex.pdfcompresslevel, tex.pdfobjcompresslevel) else - return format( "%s.%s", environment.outputfilename, "dvi") -- hard to imagine + return format( "%s.%s",outputfilename,"dvi") -- hard to imagine end end) diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua index 04e849db1..700affdac 100644 --- a/tex/context/base/l-os.lua +++ b/tex/context/base/l-os.lua @@ -28,7 +28,7 @@ local os = os local date = os.date local find, format, gsub, upper, gmatch = string.find, string.format, string.gsub, string.upper, string.gmatch local concat = table.concat -local random, ceil = math.random, math.ceil +local random, ceil, randomseed = math.random, math.ceil, math.randomseed local rawget, rawset, type, getmetatable, setmetatable, tonumber = rawget, rawset, type, getmetatable, setmetatable, tonumber -- The following code permits traversing the environment table, at least diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua index a2926f03b..3293300b4 100644 --- a/tex/context/base/lxml-lpt.lua +++ b/tex/context/base/lxml-lpt.lua @@ -554,7 +554,8 @@ local lp_reserved = C("and") + C("or") + C("not") + C("div") + C("mod") + C("tr -- return t .. "(" -- end -local lp_lua_function = (R("az","AZ","__")^1 * (P(".") * R("az","AZ","__")^1)^1) * ("(") / "%0(" +-- local lp_lua_function = (R("az","AZ","__")^1 * (P(".") * R("az","AZ","__")^1)^1) * ("(") / "%0(" +local lp_lua_function = Cs((R("az","AZ","__")^1 * (P(".") * R("az","AZ","__")^1)^1) * ("(")) / "%0" local lp_function = C(R("az","AZ","__")^1) * P("(") / function(t) -- todo: better . handling if expressions[t] then diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua index 9a6ac9082..4ef019075 100644 --- a/tex/context/base/lxml-tab.lua +++ b/tex/context/base/lxml-tab.lua @@ -721,7 +721,12 @@ local function _xmlconvert_(data, settings) else errorhandler = errorhandler or xml.errorhandler if errorhandler then - xml.errorhandler(format("load error: %s",errorstr)) + local currentresource = settings.currentresource + if currentresource and currentresource ~= "" then + xml.errorhandler(format("load error in [%s]: %s",currentresource,errorstr)) + else + xml.errorhandler(format("load error: %s",errorstr)) + end end end else @@ -766,7 +771,7 @@ function xmlconvert(data,settings) if ok then return result else - return _xmlconvert_("") + return _xmlconvert_("",settings) end end @@ -827,7 +832,10 @@ function xml.load(filename,settings) elseif filename then -- filehandle data = filename:read("*all") end - return xmlconvert(data,settings) + settings.currentresource = filename + local result = xmlconvert(data,settings) + settings.currentresource = nil + return result end --[[ldx-- diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index 80dd77874..3f1ec8254 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -382,7 +382,10 @@ function xml.load(filename,settings) noffiles, nofconverted = noffiles + 1, nofconverted + 1 starttiming(xml) local ok, data = resolvers.loadbinfile(filename) + settings = settings or { } + settings.currentresource = filename local xmltable = xml.convert((ok and data) or "",settings) + settings.currentresource = nil stoptiming(xml) return xmltable end @@ -391,12 +394,13 @@ local function entityconverter(id,str) return xmlentities[str] or xmlprivatetoken(str) or "" -- roundtrip handler end -function lxml.convert(id,data,entities,compress) +function lxml.convert(id,data,entities,compress,currentresource) local settings = { -- we're now roundtrip anyway unify_predefined_entities = true, utfize_entities = true, resolve_predefined_entities = true, resolve_entities = function(str) return entityconverter(id,str) end, -- needed for mathml + currentresource = tostring(currentresource or id), } if compress and compress == variables.yes then settings.strip_cm_and_dt = true @@ -411,13 +415,13 @@ end function lxml.load(id,filename,compress,entities) filename = commands.preparedfile(filename) -- not commands! if trace_loading then - report_lxml("loading file '%s' as '%s'",filename,id) + report_lxml("loading file %q as %q",filename,id) end noffiles, nofconverted = noffiles + 1, nofconverted + 1 -- local xmltable = xml.load(filename) starttiming(xml) local ok, data = resolvers.loadbinfile(filename) - local xmltable = lxml.convert(id,(ok and data) or "",compress,entities) + local xmltable = lxml.convert(id,(ok and data) or "",compress,entities,format("id: %s, file: %s",id,filename)) stoptiming(xml) lxml.store(id,xmltable,filename) return xmltable, filename @@ -458,14 +462,14 @@ function xml.getbuffer(name,compress,entities) -- we need to make sure that comm end nofconverted = nofconverted + 1 local data = buffers.getcontent(name) - xmltostring(lxml.convert(name,data,compress,entities)) -- one buffer + xmltostring(lxml.convert(name,data,compress,entities,format("buffer: %s",tostring(name or "?")))) -- one buffer end function lxml.loadbuffer(id,name,compress,entities) starttiming(xml) nofconverted = nofconverted + 1 local data = buffers.collectcontent(name or id) -- name can be list - local xmltable = lxml.convert(id,data,compress,entities) + local xmltable = lxml.convert(id,data,compress,entities,format("buffer: %s",tostring(name or id or "?"))) lxml.store(id,xmltable) stoptiming(xml) return xmltable, name or id @@ -474,7 +478,7 @@ end function lxml.loaddata(id,str,compress,entities) starttiming(xml) nofconverted = nofconverted + 1 - local xmltable = lxml.convert(id,str or "",compress,entities) + local xmltable = lxml.convert(id,str or "",compress,entities,format("id: %s",id)) lxml.store(id,xmltable) stoptiming(xml) return xmltable, id diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index b5c7464c8..28a1d8093 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 51523908b..49957706f 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/util-sql.lua b/tex/context/base/util-sql.lua index aeee7c09b..bcd82c210 100644 --- a/tex/context/base/util-sql.lua +++ b/tex/context/base/util-sql.lua @@ -19,7 +19,7 @@ if not modules then modules = { } end modules ['util-sql'] = { -- context in a regular tds tree (the standard distribution) it makes sense to put shared -- code in the context distribution. That way we don't need to reinvent wheels every time. -local format = string.format +local format, match = string.format, string.match local random = math.random local rawset, setmetatable, loadstring, type = rawset, setmetatable, loadstring, type local P, S, V, C, Cs, Ct, Cc, Cg, Cf, patterns, lpegmatch = lpeg.P, lpeg.S, lpeg.V, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.Cc, lpeg.Cg, lpeg.Cf, lpeg.patterns, lpeg.match @@ -27,6 +27,7 @@ local concat = table.concat local osuuid = os.uuid local osclock = os.clock or os.time +local ostime = os.time local trace_sql = false trackers.register("sql.trace", function(v) trace_sql = v end) local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end) @@ -558,11 +559,15 @@ sql.setmethod("client") -- presets = "...", -- } +-- for i=1,10 do +-- local dummy = uuid() -- else same every time, don't ask +-- end + sql.tokens = { - length = 42, + length = 42, -- but in practice we will reserve some 50 characters new = function() - return format("%s+%05x",osuuid(),random(1,0xFFFFF)) -- 36 + 1 + 5 = 42 - end, + return format("%s-%s",osuuid(),match(format("%x05",random(ostime())),".-(.....)$")) -- 36 + 1 + 5 = 42 + end, -- or random(0xFFFFF*osclock()) } -- -- -- diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 4700859ff..fb6fe9348 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 09/10/12 00:57:08 +-- merge date : 09/11/12 20:36:54 do -- begin closure to overcome local limits and interference -- cgit v1.2.3