From 989909187ebdac48c8cbc65a99840ed58d3f4f46 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 12 Dec 2019 14:10:47 +0100 Subject: 2019-12-12 13:14:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context-error.lmx | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/context.mkxl | 2 +- tex/context/base/mkiv/font-syn.lua | 9 +- tex/context/base/mkiv/grph-inc.lua | 11 +-- tex/context/base/mkiv/l-file.lua | 20 +++-- tex/context/base/mkiv/l-md5.lua | 28 +++--- tex/context/base/mkiv/lpdf-fmt.lua | 12 +-- tex/context/base/mkiv/lpdf-wid.lua | 41 ++++----- tex/context/base/mkiv/status-files.pdf | Bin 26588 -> 26571 bytes tex/context/base/mkiv/status-lua.pdf | Bin 269277 -> 269620 bytes tex/context/base/mkiv/trac-deb.lua | 96 +++++++++++++++++++-- tex/context/base/mkiv/trac-log.lua | 4 +- tex/context/interface/mkiv/i-context.pdf | Bin 894061 -> 893979 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 61165 -> 61165 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 21 +++-- 19 files changed, 179 insertions(+), 75 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 1a0170924..5086e2879 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.12.12 00:57} +\newcontextversion{2019.12.12 13:04} %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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index c80c787d3..eb457e5f5 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2019.12.12 00:57} +\edef\contextversion{2019.12.12 13:04} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index a461be673..a5c18eb49 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2019.12.12 00:57} +\newcontextversion{2019.12.12 13:04} %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/mkiv/context-error.lmx b/tex/context/base/mkiv/context-error.lmx index b82b552f8..d1a758b05 100644 --- a/tex/context/base/mkiv/context-error.lmx +++ b/tex/context/base/mkiv/context-error.lmx @@ -46,7 +46,7 @@
-            
+
             
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index e3ee67729..1fab22308 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.12.12 00:57} +\edef\contextversion{2019.12.12 13:04} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index 1a56b8e3b..8618c229a 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.12.12 00:57} +\edef\contextversion{2019.12.12 13:04} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/font-syn.lua b/tex/context/base/mkiv/font-syn.lua index a68276504..1d5e18032 100644 --- a/tex/context/base/mkiv/font-syn.lua +++ b/tex/context/base/mkiv/font-syn.lua @@ -26,6 +26,7 @@ local formatters, topattern = string.formatters, string.topattern local round = math.round local P, R, S, C, Cc, Ct, Cs = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.Cs local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local isfile, modificationtime = lfs.isfile, lfs.modification local allocate = utilities.storage.allocate local sparse = utilities.storage.sparse @@ -465,11 +466,11 @@ function names.getpaths(trace) if name == "" then -- after all, fontconfig is a unix thing name = filejoin("/etc",confname) - if not lfs.isfile(name) then + if not isfile(name) then name = "" -- force quit end end - if name ~= "" and lfs.isfile(name) then + if name ~= "" and isfile(name) then if trace_names then report_names("%s fontconfig file %a","loading",name) end @@ -482,7 +483,7 @@ function names.getpaths(trace) incname = filejoin(path,incname) end end - if lfs.isfile(incname) then + if isfile(incname) then if trace_names then report_names("%s fontconfig file %a","merging included",incname) end @@ -1096,7 +1097,7 @@ local function analyzefiles(olddata) end -- needs checking with ttc / ttx : date not updated ? local result = nil - local modification = lfs.attributes(completename,"modification") + local modification = modificationtime(completename) if olddata and modification and modification > 0 then local oldindex = oldindices[storedname] -- index into specifications if oldindex then diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 1d59972ab..8032f3c24 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -55,6 +55,7 @@ local todimen = string.todimen local collapsepath = file.collapsepath local formatters = string.formatters local odd = math.odd +local isfile, isdir, modificationtime = lfs.isfile, lfs.isdir, lfs.modification local P, R, S, Cc, C, Cs, Ct, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.match @@ -832,7 +833,7 @@ local function register(askedname,specification) if subpath and subpath ~= "" and subpath ~= "." then newpath = newpath .. "/" .. subpath end - if not lfs.isdir(newpath) then + if not isdir(newpath) then dir.makedirs(newpath) if not file.is_writable(newpath) then if trace_conversion then @@ -870,8 +871,8 @@ local function register(askedname,specification) local newname = file.join(newpath,newbase) oldname = collapsepath(oldname) newname = collapsepath(newname) - local oldtime = lfs.attributes(oldname,'modification') or 0 - local newtime = lfs.attributes(newname,'modification') or 0 + local oldtime = modificationtime(oldname) or 0 + local newtime = modificationtime(newname) or 0 if newtime == 0 or oldtime > newtime then if trace_conversion then report_inclusion("converting %a (%a) from %a to %a",askedname,oldname,format,newformat) @@ -1003,7 +1004,7 @@ local function locate(request) -- name, format, cache end else local foundname = resolvers.findbinfile(askedname) - if not foundname or not lfs.isfile(foundname) then -- foundname can be dummy + if not foundname or not isfile(foundname) then -- foundname can be dummy if trace_figures then report_inclusion("unknown url %a",askedname) end @@ -1390,7 +1391,7 @@ function existers.generic(askedname,resolve) local result if hasscheme(askedname) then result = resolvers.findbinfile(askedname) - elseif lfs.isfile(askedname) then + elseif isfile(askedname) then result = askedname elseif resolve then result = resolvers.findbinfile(askedname) diff --git a/tex/context/base/mkiv/l-file.lua b/tex/context/base/mkiv/l-file.lua index 1b039a438..d0af94f09 100644 --- a/tex/context/base/mkiv/l-file.lua +++ b/tex/context/base/mkiv/l-file.lua @@ -76,17 +76,27 @@ local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg local attributes = lfs.attributes function lfs.isdir(name) - return attributes(name,"mode") == "directory" + if name then + return attributes(name,"mode") == "directory" + end end function lfs.isfile(name) - local a = attributes(name,"mode") - return a == "file" or a == "link" or nil + if name then + local a = attributes(name,"mode") + return a == "file" or a == "link" or nil + end end function lfs.isfound(name) - local a = attributes(name,"mode") - return (a == "file" or a == "link") and name or nil + if name then + local a = attributes(name,"mode") + return (a == "file" or a == "link") and name or nil + end +end + +function lfs.modification(name) + return name and attributes(name,"modification") or nil end if sandbox then diff --git a/tex/context/base/mkiv/l-md5.lua b/tex/context/base/mkiv/l-md5.lua index 6758fa444..9e3f7672d 100644 --- a/tex/context/base/mkiv/l-md5.lua +++ b/tex/context/base/mkiv/l-md5.lua @@ -20,6 +20,8 @@ end local md5, file = md5, file local gsub = string.gsub +local modification, isfile, touch = lfs.modification, lfs.isfile, lfs.touch +local loaddata, savedata = io.loaddata, io.savedata -- local gsub, format, byte = string.gsub, string.format, string.byte -- @@ -55,10 +57,12 @@ do end +local md5HEX = md5.HEX + function file.needsupdating(oldname,newname,threshold) -- size modification access change - local oldtime = lfs.attributes(oldname,"modification") + local oldtime = modification(oldname) if oldtime then - local newtime = lfs.attributes(newname,"modification") + local newtime = modification(newname) if not newtime then return true -- no new file, so no updating needed elseif newtime >= oldtime then @@ -76,34 +80,36 @@ end file.needs_updating = file.needsupdating function file.syncmtimes(oldname,newname) - local oldtime = lfs.attributes(oldname,"modification") - if oldtime and lfs.isfile(newname) then - lfs.touch(newname,oldtime,oldtime) + local oldtime = modification(oldname) + if oldtime and isfile(newname) then + touch(newname,oldtime,oldtime) end end -function file.checksum(name) +local function checksum(name) if md5 then - local data = io.loaddata(name) + local data = loaddata(name) if data then - return md5.HEX(data) + return md5HEX(data) end end return nil end +file.checksum = checksum + function file.loadchecksum(name) if md5 then - local data = io.loaddata(name .. ".md5") + local data = loaddata(name .. ".md5") return data and (gsub(data,"%s","")) end return nil end function file.savechecksum(name,checksum) - if not checksum then checksum = file.checksum(name) end + if not checksum then checksum = checksum(name) end if checksum then - io.savedata(name .. ".md5",checksum) + savedata(name .. ".md5",checksum) return checksum end return nil diff --git a/tex/context/base/mkiv/lpdf-fmt.lua b/tex/context/base/mkiv/lpdf-fmt.lua index f56b56b52..388db0be3 100644 --- a/tex/context/base/mkiv/lpdf-fmt.lua +++ b/tex/context/base/mkiv/lpdf-fmt.lua @@ -402,7 +402,7 @@ local formats = utilities.storage.allocate { object_compression = true, -- new include_cidsets = false, include_charsets = false, - attachments = true, + attachments = true, -- new inject_metadata = function() injectxmpinfo("xml://rdf:RDF","2A",false) end @@ -428,7 +428,7 @@ local formats = utilities.storage.allocate { object_compression = true, include_cidsets = false, include_charsets = false, - attachments = "externa", + attachments = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","2B",false) end @@ -456,7 +456,7 @@ local formats = utilities.storage.allocate { object_compression = true, include_cidsets = false, include_charsets = false, - attachments = "external", + attachments = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","2U",false) end @@ -484,7 +484,7 @@ local formats = utilities.storage.allocate { object_compression = true, include_cidsets = false, include_charsets = false, - attachments = "internal", + attachments = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","3A",false) end @@ -510,7 +510,7 @@ local formats = utilities.storage.allocate { object_compression = true, include_cidsets = false, include_charsets = false, - attachments = "external", + attachments = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","3B",false) end @@ -536,7 +536,7 @@ local formats = utilities.storage.allocate { object_compression = true, include_cidsets = false, include_charsets = false, - attachments = "external", + attachments = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","3U",false) end diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua index 96b36324f..835ec100a 100644 --- a/tex/context/base/mkiv/lpdf-wid.lua +++ b/tex/context/base/mkiv/lpdf-wid.lua @@ -26,6 +26,8 @@ if not modules then modules = { } end modules ['lpdf-wid'] = { local tonumber, next = tonumber, next local gmatch, gsub, find, lower = string.gmatch, string.gsub, string.find, string.lower +local filenameonly, basefilename, filesuffix, addfilesuffix = file.nameonly, file.basename, file.suffix, file.addsuffix +local isfile, modificationtime = lfs.isfile, lfs.modification local stripstring = string.strip local settings_to_array = utilities.parsers.settings_to_array local settings_to_hash = utilities.parsers.settings_to_hash @@ -224,21 +226,11 @@ local tobesavedobjrefs = utilities.storage.allocate() local collectedobjrefs = utilities.storage.allocate() local permitted = true local enabled = true -local embedded = true function codeinjections.setattachmentsupport(option) if option == false then permitted = false enabled = false - embedded = true - elseif not permitted then - -- already dealt with - elseif option == "internal" or option == true then - enabled = true - embedded = true - elseif option == "external" then - enabled = true - embedded = false end end @@ -321,7 +313,7 @@ function codeinjections.embedfile(specification) return r else local foundname = resolvers.findbinfile(filename) or "" - if foundname == "" or not lfs.isfile(foundname) then + if foundname == "" or not isfile(foundname) then filestreams[filename] = false return nil else @@ -329,15 +321,15 @@ function codeinjections.embedfile(specification) end end end - -- needs to cleaned up: + -- needs to be cleaned up: usedname = usedname ~= "" and usedname or filename or name - local basename = keepdir == true and usedname or file.basename(usedname) + local basename = keepdir == true and usedname or basefilename(usedname) local basename = gsub(basename,"%./","") local savename = name ~= "" and name or basename if not filetype or filetype == "" then - filetype = name and (filename and file.suffix(filename)) or "txt" + filetype = name and (filename and filesuffix(filename)) or "txt" end - savename = file.addsuffix(savename,filetype) -- type is mandate for proper working in viewer + savename = addfilesuffix(savename,filetype) -- type is mandate for proper working in viewer local a = pdfdictionary { Type = pdfconstant("EmbeddedFile"), Subtype = mimetype and mimetype ~= "" and pdfconstant(mimetype) or nil, @@ -347,12 +339,11 @@ function codeinjections.embedfile(specification) f = pdfflushstreamobject(data,a) specification.data = true -- signal that still data but already flushed else - local foundname = specification.foundname or filename - local attributes = lfs.attributes(foundname) + local modification = modificationtime(specification.foundname or filename) if attributes then a.Params = { Size = attributes.size, - ModDate = lpdf.pdftimestamp(attributes.modification), + ModDate = lpdf.pdftimestamp(modification), } end f = pdfflushstreamfileobject(foundname,a,compress) @@ -388,7 +379,7 @@ function nodeinjections.attachfile(specification) specification.file = registered end local foundname = resolvers.findbinfile(filename) or "" - if foundname == "" or not lfs.isfile(foundname) then + if foundname == "" or not isfile(foundname) then report_attachment("invalid filename %a, ignoring registered %a",filename,registered) return nil else @@ -415,6 +406,9 @@ function nodeinjections.attachfile(specification) if title == "" then title = registered end + if title == "" and filename then + title = filenameonly(filename) + end local aref = attachments[registered] if not aref then aref = codeinjections.embedfile(specification) @@ -510,11 +504,7 @@ function nodeinjections.comment(specification) -- brrr: seems to be done twice local subtitle = specification.subtitle or "" -- as author local author = specification.author or "" local option = settings_to_hash(specification.option or "") - if author == "" then - if title == "" then - title = tag - end - else + if author ~= "" then if subtitle == "" then subtitle = title elseif title ~= "" then @@ -522,6 +512,9 @@ function nodeinjections.comment(specification) -- brrr: seems to be done twice end title = author end + if title == "" then + title = tag + end local content, richcontent = checkcontent(text,option) local d = pdfdictionary { Subtype = pdfconstant("Text"), diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 9eaf11f05..3ab12ae5b 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index b30aaa78e..233714c09 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/trac-deb.lua b/tex/context/base/mkiv/trac-deb.lua index a6174034c..71055eafa 100644 --- a/tex/context/base/mkiv/trac-deb.lua +++ b/tex/context/base/mkiv/trac-deb.lua @@ -13,16 +13,100 @@ local status = status local tonumber, tostring, type = tonumber, tostring, type local format, concat, match, find, gsub = string.format, table.concat, string.match, string.find, string.gsub +local lpegmatch = lpeg.match -- maybe tracers -> tracers.tex (and tracers.lua for current debugger) ------ report_tex = logs.reporter("tex error") ------ report_lua = logs.reporter("lua error") -local report_nl = logs.newline -local report_str = logs.writer +----- report_tex = logs.reporter("tex error") +----- report_lua = logs.reporter("lua error") +local report_nl = logs.newline +local report_str = logs.writer -tracers = tracers or { } -local tracers = tracers +tracers = tracers or { } +local tracers = tracers + +tracers.lists = { } +local lists = tracers.lists + +tracers.strings = { } +local strings = tracers.strings + +local texgetdimen = tex.getdimen +local texgettoks = tex.gettoks +local texgetcount = tex.getcount +local texgethelp = tex.gethelptext or function() end +local fatalerror = tex.fatalerror + +local implement = interfaces.implement + +-- this is used in lmx files but needs to be redone + +strings.undefined = "undefined" + +function tracers.dimen(name) + local d = texgetdimen(name) + return d and number.topoints(d) or strings.undefined +end + +function tracers.count(name) + return texgetcount(name) or strings.undefined +end + +function tracers.toks(name,limit) + local t = texgettoks(name) + return t and string.limit(t,tonumber(limit) or 40) or strings.undefined +end + +function tracers.primitive(name) + return tex[name] or strings.undefined +end + +lists.scratch = { + 0, 2, 4, 6, 8 +} + +lists.internals = { + 'p:hsize', 'p:parindent', 'p:leftskip','p:rightskip', + 'p:vsize', 'p:parskip', 'p:baselineskip', 'p:lineskip', 'p:topskip' +} + +lists.context = { + 'd:lineheight', + 'c:realpageno', 'c:userpageno', 'c:pageno', 'c:subpageno' +} + +local types = { + ['d'] = tracers.dimen, + ['c'] = tracers.count, + ['t'] = tracers.toks, + ['p'] = tracers.primitive +} + +local splitboth = lpeg.splitat(":") + +function tracers.type(csname) + local tag, name = lpegmatch(splitboth,csname) + return tag or "" +end + +function tracers.name(csname) + local tag, name = lpegmatch(splitboth,csname) + return name or csname +end + +function tracers.cs(csname) + local tag, name = lpegmatch(splitboth,csname) + if name and types[tag] then + return types[tag](name) + else + return tracers.primitive(csname) + end +end + +function tracers.knownlist(name) + local l = lists[name] + return l and #l > 0 +end local savedluaerror = nil local usescitelexer = nil diff --git a/tex/context/base/mkiv/trac-log.lua b/tex/context/base/mkiv/trac-log.lua index 1469441b3..bb154067f 100644 --- a/tex/context/base/mkiv/trac-log.lua +++ b/tex/context/base/mkiv/trac-log.lua @@ -1044,8 +1044,8 @@ end -- this is somewhat slower but prevents out-of-order messages when print is mixed -- with texio.write -io.stdout:setvbuf('no') -io.stderr:setvbuf('no') +-- io.stdout:setvbuf('no') +-- io.stderr:setvbuf('no') -- windows: > nul 2>&1 -- unix : > null 2>&1 diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 1cf1043ce..0db39992b 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index 9cc078b86..0fe3ac1d5 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 281eb84d7..99e077949 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 12/12/19 00:57:44 +-- merge date : 12/12/19 13:04:40 do -- begin closure to overcome local limits and interference @@ -2529,15 +2529,24 @@ local checkedsplit=string.checkedsplit local P,R,S,C,Cs,Cp,Cc,Ct=lpeg.P,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Cp,lpeg.Cc,lpeg.Ct local attributes=lfs.attributes function lfs.isdir(name) - return attributes(name,"mode")=="directory" + if name then + return attributes(name,"mode")=="directory" + end end function lfs.isfile(name) - local a=attributes(name,"mode") - return a=="file" or a=="link" or nil + if name then + local a=attributes(name,"mode") + return a=="file" or a=="link" or nil + end end function lfs.isfound(name) - local a=attributes(name,"mode") - return (a=="file" or a=="link") and name or nil + if name then + local a=attributes(name,"mode") + return (a=="file" or a=="link") and name or nil + end +end +function lfs.modification(name) + return name and attributes(name,"modification") or nil end if sandbox then sandbox.redefine(lfs.isfile,"lfs.isfile") -- cgit v1.2.3