diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base')
45 files changed, 554 insertions, 279 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkii/cont-new.mkii b/Master/texmf-dist/tex/context/base/mkii/cont-new.mkii index faa50ce78bc..a1981921bed 100644 --- a/Master/texmf-dist/tex/context/base/mkii/cont-new.mkii +++ b/Master/texmf-dist/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.03.05 15:40} +\newcontextversion{2019.03.21 21:39} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/Master/texmf-dist/tex/context/base/mkii/context.mkii b/Master/texmf-dist/tex/context/base/mkii/context.mkii index c0e85684519..a6f8647ee54 100644 --- a/Master/texmf-dist/tex/context/base/mkii/context.mkii +++ b/Master/texmf-dist/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2019.03.05 15:40} +\edef\contextversion{2019.03.21 21:39} %D For those who want to use this: diff --git a/Master/texmf-dist/tex/context/base/mkiv/char-ini.mkiv b/Master/texmf-dist/tex/context/base/mkiv/char-ini.mkiv index 0519aaf915f..5979b86854d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/char-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/char-ini.mkiv @@ -57,14 +57,34 @@ \unexpanded\def\checkedtextchar#1% #2% {\clf_doifelsecharinfont\numexpr#1\relax{\char#1}} % {#2} +% \unexpanded\def\textormathchar#1% +% {\relax\ifmmode +% \char#1\relax +% \else\iffontchar\font#1\relax +% \char#1\relax +% \else +% \normalstartimath\char#1\normalstopimath +% \fi\fi} + +\newconditional\prefermathovertextchar + \unexpanded\def\textormathchar#1% - {\relax\ifmmode - \char#1\relax - \else\iffontchar\font#1\relax - \char#1\relax + {\begingroup + \scratchcounter#1\relax + \ifmmode + \char\scratchcounter \else - \normalstartimath\char#1\normalstopimath - \fi\fi} + \ifconditional\prefermathovertextchar + % dirty trick .. maybe let this adapt to bf too ? + \setfontid\fontid\textfont\c_font_fam_mr + \fi + \iffontchar\font\scratchcounter + \char\scratchcounter + \else + \normalstartimath\char\scratchcounter\normalstopimath + \fi + \fi + \endgroup} \unexpanded\def\textormathchars#1% {{\font_text_or_mathchars#1\relax}} diff --git a/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua index ccbbb2454b8..15ebc9d9595 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/cldf-ini.lua @@ -793,7 +793,7 @@ local function writer(parent,command,...) -- already optimized before call tj = storefunction(tj) if tokenflushmode then if newtoken then - flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_code),"]") + flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_token_code),"]") else flush(currentcatcodes,"[",t_cldl_luafunction,tj,"]") end @@ -811,7 +811,7 @@ local function writer(parent,command,...) -- already optimized before call tj = storefunction(tj) if tokenflushmode then if newtoken then - flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_code),j == tn and "]" or ",") + flush(currentcatcodes,"[",newtoken(tj,lua_expandable_call_token_code),j == tn and "]" or ",") else flush(currentcatcodes,"[",t_cldl_luafunction,tj,j == tn and "]" or ",") end diff --git a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv index 913fa747f0b..f7581465258 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.03.05 15:40} +\newcontextversion{2019.03.21 21:39} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv index 81558c98a03..4059a29759b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/context.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.03.05 15:40} +\edef\contextversion{2019.03.21 21:39} \edef\contextkind {beta} %D Kind of special: diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-exp.lua b/Master/texmf-dist/tex/context/base/mkiv/data-exp.lua index 76fd3c7b0f4..ce7f952228b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-exp.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-exp.lua @@ -344,9 +344,11 @@ local function scan(files,remap,spec,path,n,m,r,onlyone,tolerant) local pattern = tolerant and lessweird or weird local filelist = { } local noffiles = 0 - for name in directory(full) do + for name, mode in directory(full) do if not lpegmatch(pattern,name) then - local mode = attributes(full..name,"mode") + if not mode then + mode = attributes(full..name,"mode") + end if mode == "file" then n = n + 1 noffiles = noffiles + 1 diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua b/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua index 948827161ea..d25a6b2f972 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-tmp.lua @@ -68,6 +68,8 @@ caches.ask = false caches.relocate = false caches.defaults = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" } +directives.register("system.caches.fast",function(v) caches.fast = true end) + local writable, readables, usedreadables = nil, { }, { } -- we could use a metatable for writable and readable but not yet @@ -364,7 +366,9 @@ local saveoptions = { compact = true } function caches.savedata(filepath,filename,data,raw) local tmaname, tmcname = caches.setluanames(filepath,filename) data.cache_uuid = os.uuid() - if caches.direct then + if caches.fast then + file.savedata(tmaname,table.fastserialize(data,true)) + elseif caches.direct then file.savedata(tmaname,table.serialize(data,true,saveoptions)) else table.tofile(tmaname,data,true,saveoptions) diff --git a/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua b/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua index 6f20b4a9d96..388ae0c1053 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/data-zip.lua @@ -37,6 +37,81 @@ zip.archives = archives local registeredfiles = zip.registeredfiles or { } zip.registeredfiles = registeredfiles +local zipfiles = utilities.zipfiles + +local openzip, closezip, validfile, wholefile, filehandle, traversezip + +if zipfiles then + + local ipairs = ipairs + + openzip = zipfiles.open + closezip = zipfiles.close + validfile = zipfiles.found + wholefile = zipfiles.unzip + + traversezip = function(zfile) + return ipairs(zipfiles.list(zfile)) + end + + local streams = utilities.streams + local openstream = streams.open + local readstring = streams.readstring + local streamsize = streams.size + + local metatable = { + close = streams.close, + read = function(stream,n) + readstring(stream,n == "*a" and streamsize(stream) or n) + end + } + + filehandle = function(zfile,queryname) + local data = wholefile(zfile,queryname) + if data then + local stream = openstream(data) + if stream then + return setmetatableindex(stream,metatable) + end + end + end + +else + + openzip = zip.open + closezip = zip.close + + validfile = function(zfile,queryname) + local dfile = zfile:open(queryname) + if dfile then + dfile:close() + return true + end + return false + end + + traversezip = function(zfile) + return z:files() + end + + wholefile = function(zfile,queryname) + local dfile = zfile:open(queryname) + if dfile then + local s = dfile:read("*all") + dfile:close() + return s + end + end + + filehandle = function(zfile,queryname) + local dfile = zfile:open(queryname) + if dfile then + return dfile + end + end + +end + local function validzip(str) -- todo: use url splitter if not find(str,"^zip://") then return "zip:///" .. str @@ -52,7 +127,7 @@ function zip.openarchive(name) local arch = archives[name] if not arch then local full = resolvers.findfile(name) or "" - arch = full ~= "" and zip.open(full) or false + arch = full ~= "" and openzip(full) or false archives[name] = arch end return arch @@ -61,7 +136,7 @@ end function zip.closearchive(name) if not name or (name == "" and archives[name]) then - zip.close(archives[name]) + closezip(archives[name]) archives[name] = nil end end @@ -106,9 +181,7 @@ function resolvers.finders.zip(specification) if trace_locating then report_zip("finder: archive %a found",archive) end - local dfile = zfile:open(queryname) - if dfile then - dfile:close() + if validfile(zfile,queryname) then if trace_locating then report_zip("finder: file %a found",queryname) end @@ -139,12 +212,12 @@ function resolvers.openers.zip(specification) if trace_locating then report_zip("opener; archive %a opened",archive) end - local dfile = zfile:open(queryname) - if dfile then + local handle = filehandle(zfile,queryname) + if handle then if trace_locating then report_zip("opener: file %a found",queryname) end - return resolvers.openers.helpers.textopener('zip',original,dfile) + return resolvers.openers.helpers.textopener('zip',original,handle) elseif trace_locating then report_zip("opener: file %a not found",queryname) end @@ -171,15 +244,13 @@ function resolvers.loaders.zip(specification) if trace_locating then report_zip("loader: archive %a opened",archive) end - local dfile = zfile:open(queryname) - if dfile then + local data = wholefile(zfile,queryname) + if data then logs.show_load(original) if trace_locating then report_zip("loader; file %a loaded",original) end - local s = dfile:read("*all") - dfile:close() - return true, s, #s + return true, data, #data elseif trace_locating then report_zip("loader: file %a not found",queryname) end @@ -231,7 +302,7 @@ function resolvers.registerzipfile(z,tree) if trace_locating then report_zip("registering: using filter %a",filter) end - for i in z:files() do + for i in traversezip(z) do local filename = i.filename local path, name = match(filename,filter) if not path then diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-lib.mkvi b/Master/texmf-dist/tex/context/base/mkiv/font-lib.mkvi index 3cff8175161..081ae0f388c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-lib.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/font-lib.mkvi @@ -50,6 +50,7 @@ \registerctxluafile{font-otc}{} \registerctxluafile{font-oth}{} \registerctxluafile{font-osd}{} +% \doifelsefileexists{font-osm.lua}{\registerctxluafile{font-osm}{}}{} \registerctxluafile{font-ocl}{} % we use otf code for type one diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-one.lua b/Master/texmf-dist/tex/context/base/mkiv/font-one.lua index 18ba5118532..9b296cac551 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-one.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-one.lua @@ -761,7 +761,7 @@ local function check_afm(specification,fullname) if foundname == "" then foundname = fonts.names.getfilename(fullname,"afm") or "" end - if foundname == "" and afm.autoprefixed then + if fullname and foundname == "" and afm.autoprefixed then local encoding, shortname = match(fullname,"^(.-)%-(.*)$") -- context: encoding-name.* if encoding and shortname and fonts.encodings.known[encoding] then shortname = findbinfile(shortname,'afm') or "" -- just to be sure diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-osd.lua b/Master/texmf-dist/tex/context/base/mkiv/font-osd.lua index 32d791b48e9..f51ae7bf71b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-osd.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-osd.lua @@ -615,6 +615,8 @@ local function initializedevanagi(tfmdata) end end -- + -- needs checking: this might be needed per instance ? + -- if script == "deva" then sharedfeatures["dv04"] = true -- dv04_remove_joiners elseif script == "dev2" then @@ -689,7 +691,7 @@ local function initialize_one(font,attr) -- we need a proper hook into the datas if not devanagaridata then - devanagaridata = { + devanagaridata = { reph = false, vattu = false, blwfcache = { }, @@ -1329,7 +1331,7 @@ end function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replacement) local stop = getnext(start) - local font = getfont(start) + local font = getfont(start) -- hm local last = start while stop do local char = ischar(stop,font) diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua b/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua index dfe32b57b26..18c25fbfd97 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/font-syn.lua @@ -515,15 +515,20 @@ local function cleanname(name) end local function cleanfilename(fullname,defaultsuffix) - local path, name, suffix = splitname(fullname) - name = gsub(lower(name),"[^%a%d]","") - if suffix and suffix ~= "" then - return name .. ".".. suffix - elseif defaultsuffix and defaultsuffix ~= "" then - return name .. ".".. defaultsuffix - else - return name + if fullname then + local path, name, suffix = splitname(fullname) + if name then + name = gsub(lower(name),"[^%a%d]","") + if suffix and suffix ~= "" then + return name .. ".".. suffix + elseif defaultsuffix and defaultsuffix ~= "" then + return name .. ".".. defaultsuffix + else + return name + end + end end + return "badfontname" end local sorter = function(a,b) diff --git a/Master/texmf-dist/tex/context/base/mkiv/grph-inc.lua b/Master/texmf-dist/tex/context/base/mkiv/grph-inc.lua index f66f8249ab4..0856e0de9bb 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/grph-inc.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/grph-inc.lua @@ -1611,15 +1611,15 @@ function includers.generic(data) ds.pageindex = nofimages local image = wrapimage(figure) local pager = new_latelua { action = updatepage, n = nofimages } - image.next = pager - pager.prev = image - local box = hpack(image) - -- indexed[figure.index] = figure - box.width = figure.width - box.height = figure.height - box.depth = 0 + image.next = pager + pager.prev = image + local box = hpack(image) + box.width = figure.width + box.height = figure.height + box.depth = 0 texsetbox(nr,box) ds.objectnumber = figure.objnum + -- indexed[figure.index] = figure ctx_relocateexternalfigure() end return data diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua b/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua index b0b2c52836a..325039cb1e6 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/l-dir.lua @@ -91,13 +91,15 @@ local function glob_pattern_function(path,patt,recurse,action) end local dirs local nofdirs = 0 - for name in walkdir(usedpath) do + for name, mode, size, time in walkdir(usedpath) do if name ~= "." and name ~= ".." then local full = path .. name - local mode = attributes(full,'mode') + if mode == nil then + mode = attributes(full,'mode') + end if mode == 'file' then if not patt or find(full,patt) then - action(full) + action(full,size,time) end elseif recurse and mode == "directory" then if dirs then @@ -134,10 +136,12 @@ local function glob_pattern_table(path,patt,recurse,result) local dirs local nofdirs = 0 local noffiles = #result - for name, a in walkdir(usedpath) do + for name, mode in walkdir(usedpath) do if name ~= "." and name ~= ".." then local full = path .. name - local mode = attributes(full,'mode') + if mode == nil then + mode = attributes(full,'mode') + end if mode == 'file' then if not patt or find(full,patt) then noffiles = noffiles + 1 @@ -193,7 +197,7 @@ local function collectpattern(path,patt,recurse,result) if not find(path,"/$") then path = path .. '/' end - for name in scanner, first do + for name in scanner, first do -- cna be optimized if name == "." then -- skip elseif name == ".." then @@ -321,11 +325,13 @@ local function globfiles(path,recurse,func,files) -- func == pattern or function end files = files or { } local noffiles = #files - for name in walkdir(path) do + for name, mode in walkdir(path) do if find(name,"^%.") then --- skip else - local mode = attributes(name,'mode') + if mode == nil then + mode = attributes(name,'mode') + end if mode == "directory" then if recurse then globfiles(path .. "/" .. name,recurse,func,files) @@ -350,11 +356,13 @@ local function globdirs(path,recurse,func,files) -- func == pattern or function end files = files or { } local noffiles = #files - for name in walkdir(path) do + for name, mode in walkdir(path) do if find(name,"^%.") then --- skip else - local mode = attributes(name,'mode') + if mode == nil then + mode = attributes(name,'mode') + end if mode == "directory" then if not func or func(name) then noffiles = noffiles + 1 @@ -597,8 +605,7 @@ local stack = { } function dir.push(newdir) local curdir = currentdir() insert(stack,curdir) - if newdir and newdir ~= "" then - chdir(newdir) + if newdir and newdir ~= "" and chdir(newdir) then return newdir else return curdir diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-file.lua b/Master/texmf-dist/tex/context/base/mkiv/l-file.lua index 46b6847d331..1b039a43866 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/l-file.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/l-file.lua @@ -73,13 +73,9 @@ local P, R, S, C, Cs, Cp, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg -- better this way: ------ tricky = S("/\\") * P(-1) local attributes = lfs.attributes function lfs.isdir(name) - -- if not lpegmatch(tricky,name) then - -- name = name .. "/." - -- end return attributes(name,"mode") == "directory" end @@ -336,43 +332,52 @@ end -- But after some testing Taco and I came up with the more robust -- variant: -function file.is_writable(name) - if not name then - -- error - elseif lfs.isdir(name) then - name = name .. "/m_t_x_t_e_s_t.tmp" - local f = io.open(name,"wb") - if f then - f:close() - os.remove(name) - return true - end - elseif lfs.isfile(name) then - local f = io.open(name,"ab") - if f then - f:close() - return true - end - else - local f = io.open(name,"ab") - if f then - f:close() - os.remove(name) - return true +if lfs.isreadablefile and lfs.iswritablefile then + + file.is_readable = lfs.isreadablefile + file.is_writable = lfs.iswritablefile + +else + + function file.is_writable(name) + if not name then + -- error + elseif lfs.isdir(name) then + name = name .. "/m_t_x_t_e_s_t.tmp" + local f = io.open(name,"wb") + if f then + f:close() + os.remove(name) + return true + end + elseif lfs.isfile(name) then + local f = io.open(name,"ab") + if f then + f:close() + return true + end + else + local f = io.open(name,"ab") + if f then + f:close() + os.remove(name) + return true + end end + return false end - return false -end -local readable = P("r") * Cc(true) + local readable = P("r") * Cc(true) -function file.is_readable(name) - if name then - local a = attributes(name) - return a and lpegmatch(readable,a.permissions) or false - else - return false + function file.is_readable(name) + if name then + local a = attributes(name) + return a and lpegmatch(readable,a.permissions) or false + else + return false + end end + end file.isreadable = file.is_readable -- depricated diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-lua.lua b/Master/texmf-dist/tex/context/base/mkiv/l-lua.lua index d8989364ed5..5570e83dc8d 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/l-lua.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/l-lua.lua @@ -250,5 +250,6 @@ end -- if not loaded["socket.url"] then loaded["socket.url"] = socket.url end if LUAVERSION > 5.3 then - collectgarbage("generational") + -- collectgarbage("collect") + -- collectgarbage("generational") -- crashes on unix end diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-os.lua b/Master/texmf-dist/tex/context/base/mkiv/l-os.lua index cf469f79d32..15408565c34 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/l-os.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/l-os.lua @@ -230,22 +230,6 @@ function os.launch(str) execute(format(launchers[os.name] or launchers.unix,str)) end -if not os.times then -- ? - -- utime = user time - -- stime = system time - -- cutime = children user time - -- cstime = children system time - function os.times() - return { - utime = os.gettimeofday(), -- user - stime = 0, -- system - cutime = 0, -- children user - cstime = 0, -- children system - } - end -end - - local gettimeofday = os.gettimeofday or os.clock os.gettimeofday = gettimeofday diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-dis.lua b/Master/texmf-dist/tex/context/base/mkiv/lang-dis.lua index 5603d119342..90e84f65d42 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lang-dis.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lang-dis.lua @@ -180,7 +180,6 @@ end -- experiment: for now not in not in export mode! local flatten = languages.flatten -local getlist = nodes.getlist nodes.handlers.flattenline = flatten diff --git a/Master/texmf-dist/tex/context/base/mkiv/lpdf-col.lua b/Master/texmf-dist/tex/context/base/mkiv/lpdf-col.lua index b697dc4816a..9ba64abba75 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lpdf-col.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lpdf-col.lua @@ -429,7 +429,8 @@ function codeinjections.setfigurecolorspace(data,figure) local ref = indexcolorref(color) if ref then figure.colorspace = ref - data.used.color = color + data.used.color = color + data.used.colorref = ref end end end diff --git a/Master/texmf-dist/tex/context/base/mkiv/lpdf-pde.lua b/Master/texmf-dist/tex/context/base/mkiv/lpdf-pde.lua index 9d14f8f5e82..c1680137da2 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lpdf-pde.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lpdf-pde.lua @@ -1003,7 +1003,15 @@ if img then do return openpdf(str,userpassword,ownerpassword,true) end - local function querypdf(pdfdoc,pagenumber) + local sizes = { + crop = "CropBox", + media = "MediaBox", + bleed = "BleedBox", + art = "ArtBox", + trim = "TrimBox", + } + + local function querypdf(pdfdoc,pagenumber,size) if pdfdoc then if not pagenumber then pagenumber = 1 @@ -1011,9 +1019,9 @@ if img then do local root = pdfdoc.Catalog local page = pdfdoc.pages[pagenumber] if page then - -- todo + local sizetag = sizes[size or "crop"] or sizes.cro local mediabox = page.MediaBox or { 0, 0, 0, 0 } - local cropbox = page.CropBox or mediabox + local cropbox = page[sizetag] or mediabox return { filename = pdfdoc.filename, pagenumber = pagenumber, diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua b/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua index 1c9222d95d1..586c5948e98 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/luat-fmt.lua @@ -79,6 +79,13 @@ local runners = { checkers = checkers, reporter = report_format, }, + luametatex = sandbox.registerrunner { + name = "make luametatex format", + program = "luametatex", + template = template, + checkers = checkers, + reporter = report_format, + }, luajittex = sandbox.registerrunner { name = "make luajittex format", program = "luajittex", diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-lib.mkiv b/Master/texmf-dist/tex/context/base/mkiv/luat-lib.mkiv index d5f6099ca79..6660323698b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/luat-lib.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/luat-lib.mkiv @@ -54,6 +54,10 @@ %registerctxluafile{util-soc-imp-ftp} {} %registerctxluafile{util-soc-imp-smtp} {} +\ifcase\contextlmtxmode\else + \registerctxluafile{util-zip}{} +\fi + \registerctxluafile{data-ini}{} \registerctxluafile{data-exp}{} \registerctxluafile{data-env}{} diff --git a/Master/texmf-dist/tex/context/base/mkiv/luat-run.lua b/Master/texmf-dist/tex/context/base/mkiv/luat-run.lua index 98f98177705..00cc6507502 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/luat-run.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/luat-run.lua @@ -64,8 +64,9 @@ local function stop_run() end end if quit then - if status.setexitcode then - status.setexitcode(1) + local setexitcode = lua.setexitcode or status.setexitcode + if setexitcode then + setexitcode(1) if type(quit) == "table" then logs.newline() report_tex("quitting due to: %, t",quit) diff --git a/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua b/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua index 670c0e16b35..09872ef0fb7 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/mlib-run.lua @@ -348,6 +348,13 @@ function metapost.pushformat(specification,f,m) -- was: instance, name, method return mpx end + +-- luatex.wrapup(function() +-- for k, mpx in next, mpxformats do +-- mpx:finish() +-- end +-- end) + function metapost.popformat() nofformats = nofformats - 1 end diff --git a/Master/texmf-dist/tex/context/base/mkiv/mtx-context-listing.tex b/Master/texmf-dist/tex/context/base/mkiv/mtx-context-listing.tex index 1053e80b9c3..285113850e1 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mtx-context-listing.tex +++ b/Master/texmf-dist/tex/context/base/mkiv/mtx-context-listing.tex @@ -116,10 +116,10 @@ -- forced end context.page() - context.setupfootertexts( -- return true: we need to keep this entry - { function() context.detokenize(pattern and filename or file.basename(filename)) return true end }, - { function() context.pagenumber() return true end } - ) +-- context.setupfootertexts( -- return true: we need to keep this entry +-- { function() context.detokenize(pattern and filename or file.basename(filename)) return true end }, +-- { function() context.pagenumber() return true end } +-- ) if scite then context.scitefile { filename } -- here { } elseif pretty then diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-met.lua b/Master/texmf-dist/tex/context/base/mkiv/node-met.lua index f5db4babdcd..574c71f60fd 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-met.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-met.lua @@ -136,103 +136,82 @@ nodes.is_zero_glue = node.is_zero_glue nodes.tonode = function(n) return n end nodes.tonut = function(n) return n end -local n_getid = node.getid -local n_getlist = node.getlist -local n_getnext = node.getnext -local n_getprev = node.getprev -local n_getchar = node.getchar -local n_getfont = node.getfont -local n_getsubtype = node.getsubtype -local n_getfield = node.getfield -local n_getattr = node.get_attribute -local n_getdisc = node.getdisc -local n_getleader = node.getleader - -local n_setfield = node.setfield -local n_setattr = n_setfield - -local n_setnext = node.setnext or -- always - function(c,n) - n_setfield(c,"next",n) - end -local n_setprev = node.setprev or -- always - function(c,p) - n_setfield(c,"prev",p) - end -local n_setlist = node.setlist or -- always - function(c,l) - n_setfield(c,"list",l) - end -local n_setlink = node.setlink or -- always - function(...) - -- not that fast but not used often anyway - local h = nil - for i=1,select("#",...) do - local n = select(i,...) - if not n then - -- go on - elseif h then - n_setfield(h,"next",n) - n_setfield(n,"prev",h) - else - h = n - end +-- These are never used in \CONTEXT, only as a gimmick in node operators +-- so we keep them around. + +local n_getfield = node.getfield +local n_getattr = node.get_attribute + +local n_setfield = node.setfield +local n_setattr = n_setfield + +nodes.getfield = n_getfield +nodes.setfield = n_setfield +nodes.getattr = n_getattr +nodes.setattr = n_setattr +nodes.takeattr = nodes.unset_attribute + +local function n_getid (n) return n_getfield(n,"id") end +local function n_getsubtype(n) return n_getfield(n,"subtype") end + +nodes.getid = n_getid +nodes.getsubtype = n_getsubtype + +local function n_getchar(n) return n_getfield(n,"char") end +local function n_setchar(n,c) return n_setfield(n,"char",c) end +local function n_getfont(n) return n_getfield(n,"font") end +local function n_setfont(n,f) return n_setfield(n,"font",f) end + +nodes.getchar = n_getchar +nodes.setchar = n_setchar +nodes.getfont = n_getfont +nodes.setfont = n_setfont + +local function n_getlist (n) return n_getfield(n,"list") end +local function n_setlist (n,l) return n_setfield(n,"list",l) end +local function n_getleader(n) return n_getfield(n,"leader") end +local function n_setleader(n,l) return n_setfield(n,"leader",l) end + +nodes.getlist = n_getlist +nodes.setlist = n_setlist +nodes.getleader = n_getleader +nodes.setleader = n_setleader + +local function n_getnext(n) return n_getfield(n,"next") end +local function n_setnext(n,nn) return n_setfield(n,"next",nn) end +local function n_getprev(n) return n_getfield(n,"prev") end +local function n_setprev(n,pp) return n_setfield(n,"prev",pp) end +local function n_getboth(n) return n_getfield(n,"prev"), n_getfield(n,"next") end +local function n_setboth(n,pp,nn) return n_setfield(n,"prev",pp), n_setfield(n,"next",nn) end + +nodes.getnext = n_getnext +nodes.setnext = n_setnext +nodes.getprev = n_getprev +nodes.setprev = n_setprev +nodes.getboth = n_getboth +nodes.setboth = n_setboth + +local function n_setlink(...) + -- not that fast but not used often anyway + local h = nil + for i=1,select("#",...) do + local n = select(i,...) + if not n then + -- go on + elseif h then + n_setfield(h,"next",n) + n_setfield(n,"prev",h) + else + h = n end - return h - end -local n_setboth = node.setboth or -- always - function(c,p,n) - n_setfield(c,"prev",p) - n_setfield(c,"next",n) - end - -nodes.setnext = n_setnext -nodes.setprev = n_setprev -nodes.setlink = n_setlink -nodes.setboth = n_setboth -nodes.setlist = n_setlist - -nodes.getfield = n_getfield -nodes.setfield = n_setfield -nodes.getattr = n_getattr -nodes.setattr = n_setattr -nodes.takeattr = nodes.unset_attribute - -nodes.getnext = n_getnext -nodes.getprev = n_getprev -nodes.getid = n_getid -nodes.getchar = n_getchar -nodes.getfont = n_getfont -nodes.getsubtype = n_getsubtype -nodes.getlist = n_getlist -nodes.getleader = n_getleader -nodes.getdisc = n_getdisc - -if not node.getwhd then - function node.getwhd(n) - return n_getfield(n,"width"), n_getfield(n,"height"), n_getfield(n,"depth") end + return h end -if not node.setwhd then - function node.setwhd(n,w,h,d) - n_setfield(n,"width",w or 0) - n_setfield(n,"height",h or 0) - n_setfield(n,"depth",d or 0) - end -end - -nodes.getwhd = node.getwhd -nodes.setwhd = node.setwhd - -nodes.is_char = node.is_char -nodes.ischar = node.is_char - -nodes.is_glyph = node.is_glyph -nodes.isglyph = node.is_glyph +nodes.setlink = n_setlink -nodes.getbox = node.getbox or tex.getbox -nodes.setbox = node.setbox or tex.setbox +nodes.getbox = node.getbox or tex.getbox +nodes.setbox = node.setbox or tex.setbox local n_flush_node = nodes.flush local n_copy_node = nodes.copy diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-pro.lua b/Master/texmf-dist/tex/context/base/mkiv/node-pro.lua index b6b1305886f..606d5b8d773 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-pro.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-pro.lua @@ -14,6 +14,7 @@ local report_nodes = logs.reporter("nodes","processors") local nodes = nodes local tasks = nodes.tasks local nuts = nodes.nuts +local tonut = nodes.tonut nodes.processors = nodes.processors or { } local processors = nodes.processors @@ -25,7 +26,6 @@ local actions = tasks.actions("processors") do - local tonut = nuts.tonut local isglyph = nuts.isglyph local getnext = nuts.getnext @@ -178,9 +178,9 @@ do local texnest = tex.nest - local getlist = nodes.getlist - local setlist = nodes.setlist - local getsubtype = nodes.getsubtype + local getlist = nuts.getlist + local setlist = nuts.setlist + local getsubtype = nuts.getsubtype local linelist_code = nodes.listcodes.line @@ -191,12 +191,15 @@ do local whatever = texnest[texnest.ptr] if whatever then local line = whatever.tail - if line and getsubtype(line) == linelist_code then - local head = getlist(line) - if head then - local result = actions(head,groupcode,line) - if result and result ~= head then - setlist(line,result) + if line then + line = tonut(line) + if getsubtype(line) == linelist_code then + local head = getlist(line) + if head then + local result = actions(head,groupcode,line) + if result and result ~= head then + setlist(line,result) + end end end end diff --git a/Master/texmf-dist/tex/context/base/mkiv/node-tsk.lua b/Master/texmf-dist/tex/context/base/mkiv/node-tsk.lua index 0378c14c62a..ca7c7fee45b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/node-tsk.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/node-tsk.lua @@ -627,12 +627,11 @@ local tonode = nodes.nuts.tonode %localize% -return function(head,groupcode,line) - local nuthead = tonut(head) - local nutline = tonut(line) +-- we operate exclusively on nuts +return function(nuthead,groupcode,nutline) %actions% - return tonode(nuthead) + return nuthead end ]], diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi index 160cc452209..36e4882d25a 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-apa.mkvi @@ -696,6 +696,30 @@ apa:Advanced={Publicación en línea avanzada}, apa:Retrieved={Obtenido de}] % {Disponible desde}] + +\setupbtxlabeltext + [sv] + [apa:number={nr.}, + apa:edition={Utgåva}, + apa:Editor=Redaktör, + apa:Editors=Redaktörer, + apa:Volume=Band, + apa:Volumes=Band, + apa:nd={u.å.}, % utan årtal + apa:supplement=Bilaga, % Supplement + apa:MotionPicture=Spelfilm, % ? + apa:Writer={Manusförfattare}, % Assuming for a movie + apa:Writers={Manusförfattare}, % + apa:Producer=Producent, % Assuming for a movie + apa:Producers=Producenter, % + apa:Director={Regissör}, % Assuming for a movie + apa:Directors={Regissörer}, % + apa:Recordedby={Inspelad av}, % Assuming for a movie + apa:Author={Författare}, + apa:Translator={Översättare}, + apa:Advanced={Avancerad onlinepublikation}, % ? + apa:Retrieved={Hämtad från}] + % cite setups % The following differs from the default returning n.d. if year is empty diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi index 4180b64914f..4e12fbfc7b3 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-aps.mkvi @@ -514,6 +514,20 @@ aps:tobe={que se publicará}, aps:unpublished={inédito}] +\setupbtxlabeltext + [sv] + [aps:number={nr.}, + aps:edition={Utgåva}, + aps:Editor=Redaktör, + aps:Editors=Redaktörer, + aps:Volume=Band, + aps:Volumes=Band, + aps:supplement=Bilaga, + aps:inpress={under tryckning}, + aps:tobe={att publiceras}, + aps:unpublished={opublicerat}] + + % cite setups \startsetups btx:aps:nd diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-commands.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-commands.mkvi index 14e2dbae12d..281b8324a3e 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-commands.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-commands.mkvi @@ -10,6 +10,6 @@ \definebtxcommand\acro #1{\dontleavehmode{\smallcaps#1}} \let\<< -\let\<> +\let\>> \protect \endinput diff --git a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-default.mkvi b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-default.mkvi index 22638c900d1..fef993fe052 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/publ-imp-default.mkvi +++ b/Master/texmf-dist/tex/context/base/mkiv/publ-imp-default.mkvi @@ -342,24 +342,36 @@ [it] [\s!default:and=e, \s!default:number={nº}, - \s!default:edition={ed.}, % edizione + \s!default:edition={ed.}, % edizione \s!default:Editor={A cura di}, \s!default:Editors={A cura di}, - \s!default:Volume={Vol.}, % Volume - \s!default:Volumes={Vol.}, % Volumi + \s!default:Volume={Vol.}, % Volume + \s!default:Volumes={Vol.}, % Volumi \s!default:others={et al.}] \setupbtxlabeltext [es] [\s!default:and=y, \s!default:number={nº}, - \s!default:edition={ed.}, % edición - \s!default:Editor=Editor, % Ed./Eds. + \s!default:edition={ed.}, % edición + \s!default:Editor=Editor, % Ed./Eds. \s!default:Editors=Editores, \s!default:Volume={Vol.}, % Volumen \s!default:Volumes={Vols.}, % Volúmenes \s!default:others={et al.}] +\setupbtxlabeltext + [sv] + [\s!default:and=och, + \s!default:number={nr.}, + \s!default:edition={Utgåva}, + \s!default:Editor=Redaktör, + \s!default:Editors=Redaktörer, + \s!default:Volume=Band, + \s!default:Volumes=Band, + \s!default:others={et al.}] + + % First some helpers: \starttexdefinition btx:default:composed-title diff --git a/Master/texmf-dist/tex/context/base/mkiv/spac-hor.mkiv b/Master/texmf-dist/tex/context/base/mkiv/spac-hor.mkiv index 32b7f06fb81..24c7c789341 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/spac-hor.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/spac-hor.mkiv @@ -717,7 +717,7 @@ \global\s_spac_narrower_left \zeropoint \global\s_spac_narrower_right \zeropoint \global\s_spac_narrower_middle\zeropoint - \edef\askednarrower{#1} + \edef\askednarrower{#1}% \ifx\askednarrower\v!reverse \ifconditional\s_spac_narrower_last_swap \leftskip \s_spac_narrower_right_last diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf Binary files differindex d0d2324d8c7..211e6773fae 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf +++ b/Master/texmf-dist/tex/context/base/mkiv/status-files.pdf diff --git a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf Binary files differindex a0d9f04f4d1..a9c4cb67312 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf +++ b/Master/texmf-dist/tex/context/base/mkiv/status-lua.pdf diff --git a/Master/texmf-dist/tex/context/base/mkiv/symb-ini.mkiv b/Master/texmf-dist/tex/context/base/mkiv/symb-ini.mkiv index abf85767576..428fcd381f3 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/symb-ini.mkiv +++ b/Master/texmf-dist/tex/context/base/mkiv/symb-ini.mkiv @@ -44,9 +44,23 @@ %D \stoptyping \installcorenamespace{symbol} +\installcorenamespace{symbols} \installcorenamespace{symbolset} \installcorenamespace{symboldefault} +%D For now we only have one option. + +\installparameterhandler\??symbols {symbols} +\installsetuphandler \??symbols {symbols} + +\appendtoks + \doifelse{\symbolsparameter\c!stylealternative}\v!math + \settrue\setfalse\prefermathovertextchar +\to \everysetupsymbols + +\setupsymbols + [\c!stylealternative=\v!text] + \let\currentsymbol \empty \let\currentsymbolset\empty diff --git a/Master/texmf-dist/tex/context/base/mkiv/trac-log.lua b/Master/texmf-dist/tex/context/base/mkiv/trac-log.lua index 206af566803..e76c9f6849e 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/trac-log.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/trac-log.lua @@ -114,7 +114,7 @@ local direct, subdirect, writer, pushtarget, poptarget, setlogfile, settimedlog, -- we don't want this overhead for single messages (not that there are that -- many; we could have a special weak table) -if runningtex then +if runningtex and texio then if texio.setescape then texio.setescape(0) -- or (false) diff --git a/Master/texmf-dist/tex/context/base/mkiv/typo-mar.lua b/Master/texmf-dist/tex/context/base/mkiv/typo-mar.lua index f8665e0b061..ce8375eeaf7 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/typo-mar.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/typo-mar.lua @@ -204,7 +204,6 @@ end function margins.save(t) setmetatable(t,defaults) local content = takebox(t.number) - setprop(content,"specialcontent","margindata") local location = t.location local category = t.category local inline = t.inline @@ -220,6 +219,7 @@ function margins.save(t) report_margindata("ignoring empty margin data %a",location or "unknown") return end + setprop(content,"specialcontent","margindata") local store if inline then store = inlinestore diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua b/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua index 9f96a01b911..79af277437b 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua @@ -14,10 +14,14 @@ local char = string.char -- flac files). In Lua 5.3 we can probably do this better. Some code will move -- here. +-- We could comment those that are in fio and sio. + utilities = utilities or { } local files = { } utilities.files = files +-- we could have a gc method that closes but files auto close anyway + local zerobased = { } function files.open(filename,zb) @@ -249,7 +253,7 @@ end if bit32 then - local rshift = bit32.rshift + local rshift = bit32.rshift function files.writecardinal2(f,n) local a = char(n % 256) @@ -258,6 +262,35 @@ if bit32 then f:write(b,a) end + function files.writecardinal4(f,n) + local a = char(n % 256) + n = rshift(n,8) + local b = char(n % 256) + n = rshift(n,8) + local c = char(n % 256) + n = rshift(n,8) + local d = char(n % 256) + f:write(d,c,b,a) + end + + function files.writecardinal2le(f,n) + local a = char(n % 256) + n = rshift(n,8) + local b = char(n % 256) + f:write(a,b) + end + + function files.writecardinal4le(f,n) + local a = char(n % 256) + n = rshift(n,8) + local b = char(n % 256) + n = rshift(n,8) + local c = char(n % 256) + n = rshift(n,8) + local d = char(n % 256) + f:write(a,b,c,d) + end + else local floor = math.floor @@ -269,17 +302,35 @@ else f:write(b,a) end -end + function files.writecardinal4(f,n) + local a = char(n % 256) + n = floor(n/256) + local b = char(n % 256) + n = floor(n/256) + local c = char(n % 256) + n = floor(n/256) + local d = char(n % 256) + f:write(d,c,b,a) + end + + function files.writecardinal2le(f,n) + local a = char(n % 256) + n = floor(n/256) + local b = char(n % 256) + f:write(a,b) + end + + function files.writecardinal4le(f,n) + local a = char(n % 256) + n = floor(n/256) + local b = char(n % 256) + n = floor(n/256) + local c = char(n % 256) + n = floor(n/256) + local d = char(n % 256) + f:write(a,b,c,d) + end -function files.writecardinal4(f,n) - local a = char(n % 256) - n = rshift(n,8) - local b = char(n % 256) - n = rshift(n,8) - local c = char(n % 256) - n = rshift(n,8) - local d = char(n % 256) - f:write(d,c,b,a) end function files.writestring(f,s) @@ -292,30 +343,42 @@ end if fio and fio.readcardinal1 then - files.readcardinal1 = fio.readcardinal1 - files.readcardinal2 = fio.readcardinal2 - files.readcardinal3 = fio.readcardinal3 - files.readcardinal4 = fio.readcardinal4 - files.readinteger1 = fio.readinteger1 - files.readinteger2 = fio.readinteger2 - files.readinteger3 = fio.readinteger3 - files.readinteger4 = fio.readinteger4 - files.readfixed2 = fio.readfixed2 - files.readfixed4 = fio.readfixed4 - files.read2dot14 = fio.read2dot14 - files.setposition = fio.setposition - files.getposition = fio.getposition - - files.readbyte = files.readcardinal1 - files.readsignedbyte = files.readinteger1 - files.readcardinal = files.readcardinal1 - files.readinteger = files.readinteger1 - - local skipposition = fio.skipposition - files.skipposition = skipposition - - files.readbytes = fio.readbytes - files.readbytetable = fio.readbytetable + files.readcardinal1 = fio.readcardinal1 + files.readcardinal2 = fio.readcardinal2 + files.readcardinal3 = fio.readcardinal3 + files.readcardinal4 = fio.readcardinal4 + + files.readcardinal1le = fio.readcardinal1le or files.readcardinal1le + files.readcardinal2le = fio.readcardinal2le or files.readcardinal2le + files.readcardinal3le = fio.readcardinal3le or files.readcardinal3le + files.readcardinal4le = fio.readcardinal4le or files.readcardinal4le + + files.readinteger1 = fio.readinteger1 + files.readinteger2 = fio.readinteger2 + files.readinteger3 = fio.readinteger3 + files.readinteger4 = fio.readinteger4 + + files.readinteger1le = fio.readinteger1le or files.readinteger1le + files.readinteger2le = fio.readinteger2le or files.readinteger2le + files.readinteger3le = fio.readinteger3le or files.readinteger3le + files.readinteger4le = fio.readinteger4le or files.readinteger4le + + files.readfixed2 = fio.readfixed2 + files.readfixed4 = fio.readfixed4 + files.read2dot14 = fio.read2dot14 + files.setposition = fio.setposition + files.getposition = fio.getposition + + files.readbyte = files.readcardinal1 + files.readsignedbyte = files.readinteger1 + files.readcardinal = files.readcardinal1 + files.readinteger = files.readinteger1 + + local skipposition = fio.skipposition + files.skipposition = skipposition + + files.readbytes = fio.readbytes + files.readbytetable = fio.readbytetable function files.skipshort(f,n) skipposition(f,2*(n or 1)) @@ -327,6 +390,30 @@ if fio and fio.readcardinal1 then end +if fio and fio.writecardinal1 then + + files.writecardinal1 = fio.writecardinal1 + files.writecardinal2 = fio.writecardinal2 + files.writecardinal3 = fio.writecardinal3 + files.writecardinal4 = fio.writecardinal4 + + files.writecardinal1le = fio.writecardinal1le + files.writecardinal2le = fio.writecardinal2le + files.writecardinal3le = fio.writecardinal3le + files.writecardinal4le = fio.writecardinal4le + + files.writeinteger1 = fio.writeinteger1 or fio.writecardinal1 + files.writeinteger2 = fio.writeinteger2 or fio.writecardinal2 + files.writeinteger3 = fio.writeinteger3 or fio.writecardinal3 + files.writeinteger4 = fio.writeinteger4 or fio.writecardinal4 + + files.writeinteger1le = files.writeinteger1le or fio.writecardinal1le + files.writeinteger2le = files.writeinteger2le or fio.writecardinal2le + files.writeinteger3le = files.writeinteger3le or fio.writecardinal3le + files.writeinteger4le = files.writeinteger4le or fio.writecardinal4le + +end + if fio and fio.readcardinaltable then files.readcardinaltable = fio.readcardinaltable diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua b/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua index dc8ba72f1c3..976989a77ab 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-sac.lua @@ -29,6 +29,12 @@ function streams.openstring(f,zerobased) end end +function streams.getstring(f) + if f then + return f[1] + end +end + function streams.close() -- dummy end @@ -137,7 +143,7 @@ function streams.readcardinal2(f) return 0x100 * a + b end -function streams.readcardinal2LE(f) +function streams.readcardinal2le(f) local i = f[2] local j = i + 1 f[2] = j + 1 @@ -217,6 +223,14 @@ function streams.readcardinal4(f) return 0x1000000 * a + 0x10000 * b + 0x100 * c + d end +function streams.readcardinal4le(f) + local i = f[2] + local j = i + 3 + f[2] = j + 1 + local d, c, b, a = byte(f[1],i,j) + return 0x1000000 * a + 0x10000 * b + 0x100 * c + d +end + function streams.readinteger4(f) local i = f[2] local j = i + 3 diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-soc-imp-mime.lua b/Master/texmf-dist/tex/context/base/mkiv/util-soc-imp-mime.lua index 4b5d2baff10..7a5cef27b64 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-soc-imp-mime.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-soc-imp-mime.lua @@ -3,8 +3,8 @@ local type, tostring = type, tostring -local mime = require("mime.core") -local ltn12 = ltn12 or require("ltn12") +local mime = mime or package.loaded.mime or require("mime.core") +local ltn12 = ltn12 or package.loaded.ltn12 or require("ltn12") local filtercycle = ltn12.filter.cycle diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-soc-imp-socket.lua b/Master/texmf-dist/tex/context/base/mkiv/util-soc-imp-socket.lua index 3da155749fd..d1486f8f838 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-soc-imp-socket.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-soc-imp-socket.lua @@ -5,7 +5,7 @@ local type, tostring, setmetatable = type, tostring, setmetatable local min = math.min local format = string.format -local socket = require("socket.core") +local socket = socket or package.loaded.socket or require("socket.core") local connect = socket.connect local tcp4 = socket.tcp4 diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-str.lua b/Master/texmf-dist/tex/context/base/mkiv/util-str.lua index 5f175e22712..a04b2083586 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-str.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-str.lua @@ -14,7 +14,6 @@ local format, gsub, rep, sub, find = string.format, string.gsub, string.rep, str local load, dump = load, string.dump local tonumber, type, tostring, next, setmetatable = tonumber, type, tostring, next, setmetatable local unpack, concat = table.unpack, table.concat -local unpack, concat = table.unpack, table.concat local P, V, C, S, R, Ct, Cs, Cp, Carg, Cc = lpeg.P, lpeg.V, lpeg.C, lpeg.S, lpeg.R, lpeg.Ct, lpeg.Cs, lpeg.Cp, lpeg.Carg, lpeg.Cc local patterns, lpegmatch = lpeg.patterns, lpeg.match local utfchar, utfbyte, utflen = utf.char, utf.byte, utf.len diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-tab.lua b/Master/texmf-dist/tex/context/base/mkiv/util-tab.lua index be5f1318cbc..2f425cca384 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-tab.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-tab.lua @@ -311,7 +311,8 @@ function tables.encapsulate(core,capsule,protect) end end --- best keep [%q] keys (as we have some in older applications i.e. saving user data +-- best keep [%q] keys (as we have some in older applications i.e. saving user data (otherwise +-- we also need to check for reserved words) local f_hashed_string = formatters["[%q]=%q,"] local f_hashed_number = formatters["[%q]=%s,"] |