texlive[53682] Master/texmf-dist: lualibs (4feb20)
commits+karl at tug.org
commits+karl at tug.org
Wed Feb 5 22:26:21 CET 2020
Revision: 53682
http://tug.org/svn/texlive?view=revision&revision=53682
Author: karl
Date: 2020-02-05 22:26:20 +0100 (Wed, 05 Feb 2020)
Log Message:
-----------
lualibs (4feb20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/luatex/lualibs/NEWS
trunk/Master/texmf-dist/doc/luatex/lualibs/README.md
trunk/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf
trunk/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-gzip.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-io.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-lua.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-md5.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-os.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-table.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sta.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-str.lua
trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua
Modified: trunk/Master/texmf-dist/doc/luatex/lualibs/NEWS
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/lualibs/NEWS 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/doc/luatex/lualibs/NEWS 2020-02-05 21:26:20 UTC (rev 53682)
@@ -1,4 +1,7 @@
History of the lualibs package
+2020/02/02 v2.70/
+ * sync with Context current as of 2020/01/26.
+
2019/11/06 v2.69/
* corrected github address and version info.
Modified: trunk/Master/texmf-dist/doc/luatex/lualibs/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/luatex/lualibs/README.md 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/doc/luatex/lualibs/README.md 2020-02-05 21:26:20 UTC (rev 53682)
@@ -1,10 +1,10 @@
# The Lualibs Package
-VERSION: 2.69
+VERSION: 2.70
-DATE: 2019-11-06
+DATE: 2020-02-02
-FONTLOADERDATE: 2019-10-29
+FONTLOADERDATE: 2020-01-26
Lualibs is a collection of Lua modules useful for general programming.
Modified: trunk/Master/texmf-dist/doc/luatex/lualibs/lualibs.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx
===================================================================
--- trunk/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/source/luatex/lualibs/lualibs.dtx 2020-02-05 21:26:20 UTC (rev 53682)
@@ -37,7 +37,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: lualibs 2019-11-06 v2.69 Lua additional functions.}
+\Msg{* Package: lualibs 2020-02-02 v2.70 Lua additional functions.}
\Msg{************************************************************************}
\keepsilent
@@ -107,7 +107,7 @@
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{lualibs.drv}
- [2019/11/06 v2.69 Lua Libraries.]
+ [2020/02/02 v2.70 Lua Libraries.]
\documentclass{ltxdoc}
\usepackage{fancyvrb,xspace}
\usepackage[x11names]{xcolor}
@@ -208,7 +208,7 @@
% \GetFileInfo{lualibs.drv}
%
% \title{The \identifier{lualibs} package}
-% \date{2019/11/06 v2.69}
+% \date{2020/02/02 v2.70}
% \author{Élie Roux · \email{elie.roux at telecom-bretagne.eu}\\
% Philipp Gesang · \email{phg at phi-gamma.net}\\
% The \LaTeX3 Project · \email{https://github.com/latex3/lualibs/}\\
@@ -429,8 +429,8 @@
lualibs.module_info = {
name = "lualibs",
- version = "2.69", --TAGVERSION
- date = "2019-11-06", --TAGDATE
+ version = "2.70", --TAGVERSION
+ date = "2020-02-02", --TAGDATE
description = "ConTeXt Lua standard libraries.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
@@ -583,8 +583,8 @@
local lualibs_basic_module = {
name = "lualibs-basic",
- version = "2.69", --TAGVERSION
- date = "2019-11-06", --TAGDATE
+ version = "2.70", --TAGVERSION
+ date = "2020-02-02", --TAGDATE
description = "ConTeXt Lua libraries -- basic collection.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
@@ -665,8 +665,8 @@
local lualibs_extended_module = {
name = "lualibs-extended",
- version = "2.69", --TAGVERSION
- date = "2019-11-06", --TAGDATE
+ version = "2.70", --TAGVERSION
+ date = "2020-02-02", --TAGDATE
description = "ConTeXt Lua libraries -- extended collection.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -1,6 +1,6 @@
-- merged file : lualibs-basic-merged.lua
-- parent file : lualibs-basic.lua
--- merge date : Tue Oct 29 16:47:31 2019
+-- merge date : Sun Feb 2 22:31:00 2020
do -- begin closure to overcome local limits and interference
@@ -20,9 +20,6 @@
MINORVERSION=2
LUAVERSION=5.2
end
-if lua and lua.openfile then
- io.open=lua.openfile
-end
if not lpeg then
lpeg=require("lpeg")
end
@@ -1369,7 +1366,7 @@
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-local type,next,tostring,tonumber,select=type,next,tostring,tonumber,select
+local type,next,tostring,tonumber,select,rawget=type,next,tostring,tonumber,select,rawget
local table,string=table,string
local concat,sort=table.concat,table.sort
local format,lower,dump=string.format,string.lower,string.dump
@@ -2774,7 +2771,7 @@
local byte,find,gsub,format=string.byte,string.find,string.gsub,string.format
local concat=table.concat
local type=type
-if string.find(os.getenv("PATH"),";",1,true) then
+if string.find(os.getenv("PATH") or "",";",1,true) then
io.fileseparator,io.pathseparator="\\",";"
else
io.fileseparator,io.pathseparator="/",":"
@@ -3121,7 +3118,7 @@
local find,format,gsub,upper,gmatch=string.find,string.format,string.gsub,string.upper,string.gmatch
local concat=table.concat
local random,ceil,randomseed=math.random,math.ceil,math.randomseed
-local rawget,rawset,type,getmetatable,setmetatable,tonumber,tostring=rawget,rawset,type,getmetatable,setmetatable,tonumber,tostring
+local type,setmetatable,tonumber,tostring=type,setmetatable,tonumber,tostring
do
local selfdir=os.selfdir
if selfdir=="" then
@@ -3567,16 +3564,25 @@
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")
sandbox.redefine(lfs.isdir,"lfs.isdir")
@@ -3957,35 +3963,46 @@
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
-if gzip then
- local suffix,suffixes=file.suffix,file.suffixes
+gzip=gzip or {}
+if not zlib then
+ zlib=xzip
+elseif not xzip then
+ xzip=zlib
+end
+if zlib then
+ local suffix=file.suffix
+ local suffixes=file.suffixes
+ local find=string.find
+ local openfile=io.open
+ local gzipwindow=15+16
+ local gziplevel=3
+ local identifier="^\x1F\x8B\x08"
+ local compress=zlib.compress
+ local decompress=zlib.decompress
function gzip.load(filename)
- local f=io.open(filename,"rb")
+ local f=openfile(filename,"rb")
if not f then
- elseif suffix(filename)=="gz" then
+ else
+ local data=f:read("*all")
f:close()
- local g=gzip.open(filename,"rb")
- if g then
- local str=g:read("*all")
- g:close()
- return str
+ if data and data~="" then
+ if suffix(filename)=="gz" then
+ data=decompress(data,gzipwindow)
+ end
+ return data
end
- else
- local str=f:read("*all")
- f:close()
- return str
end
end
- function gzip.save(filename,data)
+ function gzip.save(filename,data,level)
if suffix(filename)~="gz" then
filename=filename..".gz"
end
- local f=io.open(filename,"wb")
+ local f=openfile(filename,"wb")
if f then
- local s=zlib.compress(data or "",9,nil,15+16)
- f:write(s)
+ data=compress(data or "",level or gziplevel,nil,gzipwindow)
+ f:write(data)
f:close()
- return #s
+ return #data
end
end
function gzip.suffix(filename)
@@ -3993,16 +4010,6 @@
local gzipped=extra=="gz"
return suffix,gzipped
end
-else
-end
-if flate then
- local type=type
- local find=string.find
- local compress=flate.gz_compress
- local decompress=flate.gz_decompress
- local absmax=128*1024*1024
- local initial=64*1024
- local identifier="^\x1F\x8B\x08"
function gzip.compressed(s)
return s and find(s,identifier)
end
@@ -4009,42 +4016,18 @@
function gzip.compress(s,level)
if s and not find(s,identifier) then
if not level then
- level=3
+ level=gziplevel
elseif level<=0 then
return s
elseif level>9 then
level=9
end
- return compress(s,level) or s
+ return compress(s,level or gziplevel,nil,gzipwindow) or s
end
end
- function gzip.decompress(s,size,iterate)
+ function gzip.decompress(s)
if s and find(s,identifier) then
- if type(size)~="number" then
- size=initial
- end
- if size>absmax then
- size=absmax
- end
- if type(iterate)=="number" then
- max=size*iterate
- elseif iterate==nil or iterate==true then
- iterate=true
- max=absmax
- end
- if max>absmax then
- max=absmax
- end
- while true do
- local d=decompress(s,size)
- if d then
- return d
- end
- size=2*size
- if not iterate or size>max then
- return false
- end
- end
+ return decompress(s,gzipwindow)
else
return s
end
@@ -4072,6 +4055,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
do
local patterns=lpeg and lpeg.patterns
if patterns then
@@ -4087,10 +4072,11 @@
md5.sumHEXA=md5.HEX
end
end
+local md5HEX=md5.HEX
function file.needsupdating(oldname,newname,threshold)
- 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
elseif newtime>=oldtime then
@@ -4106,31 +4092,32 @@
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
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -29,8 +29,8 @@
local lualibs_basic_module = {
name = "lualibs-basic",
- version = "2.69", --TAGVERSION
- date = "2019-11-06", --TAGDATE
+ version = "2.70", --TAGVERSION
+ date = "2020-02-02", --TAGDATE
description = "ConTeXt Lua libraries -- basic collection.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -1,6 +1,6 @@
-- merged file : lualibs-extended-merged.lua
-- parent file : lualibs-extended.lua
--- merge date : Tue Oct 29 16:47:22 2019
+-- merge date : Sun Feb 2 22:30:49 2020
do -- begin closure to overcome local limits and interference
@@ -579,7 +579,7 @@
n=n+1
if not f or f=="" then
return format("FORMAT(a%s,'%%.9f')",n)
- elseif f==".6" then
+ elseif f==".6" or f=="0.6" then
return format("FORMAT(a%s)",n)
else
return format("FORMAT(a%s,'%%%sf')",n,f)
@@ -4134,8 +4134,11 @@
insert(tops,top)
end
local function resolve_step(ti)
+ if not top then
+ return
+ end
local result=nil
- local noftop=top and #top or 0
+ local noftop=#top
if ti>0 then
local current=list[ti]
if current then
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -30,8 +30,8 @@
local lualibs_extended_module = {
name = "lualibs-extended",
- version = "2.69", --TAGVERSION
- date = "2019-11-06", --TAGDATE
+ version = "2.70", --TAGVERSION
+ date = "2020-02-02", --TAGDATE
description = "ConTeXt Lua libraries -- extended collection.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-file.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -76,19 +76,29 @@
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")
sandbox.redefine(lfs.isdir, "lfs.isdir")
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-gzip.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-gzip.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-gzip.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -5,39 +5,77 @@
license = "see context related readme files"
}
-if gzip then
+-- We only have a few official methods here:
+--
+-- local decompressed = gzip.load (filename)
+-- local resultsize = gzip.save (filename,compresslevel)
+-- local compressed = gzip.compress (str,compresslevel)
+-- local decompressed = gzip.decompress (str)
+-- local iscompressed = gzip.compressed (str)
+-- local suffix, okay = gzip.suffix (filename)
+--
+-- In LuaMetaTeX we have only xzip which implements a very few methods:
+--
+-- compress (str,level,method,window,memory,strategy)
+-- decompress (str,window)
+-- adler32 (str,checksum)
+-- crc32 (str,checksum)
+--
+-- Special window values are:
+--
+-- flate : - 15
+-- zlib : 15
+-- gzip : 15 | 16
+-- auto : 15 | 32
- local suffix, suffixes = file.suffix, file.suffixes
+gzip = gzip or { } -- so in luatex we keep the old ones too
+if not zlib then
+ zlib = xzip -- in luametatex we shadow the old one
+elseif not xzip then
+ xzip = zlib
+end
+
+if zlib then
+
+ local suffix = file.suffix
+ local suffixes = file.suffixes
+ local find = string.find
+ local openfile = io.open
+
+ local gzipwindow = 15 + 16 -- +16: gzip, +32: gzip|zlib
+ local gziplevel = 3
+ local identifier = "^\x1F\x8B\x08"
+
+ local compress = zlib.compress
+ local decompress = zlib.decompress
+
function gzip.load(filename)
- local f = io.open(filename,"rb")
+ local f = openfile(filename,"rb")
if not f then
-- invalid file
- elseif suffix(filename) == "gz" then
+ else
+ local data = f:read("*all")
f:close()
- local g = gzip.open(filename,"rb")
- if g then
- local str = g:read("*all")
- g:close()
- return str
+ if data and data ~= "" then
+ if suffix(filename) == "gz" then
+ data = decompress(data,gzipwindow)
+ end
+ return data
end
- else
- local str = f:read("*all")
- f:close()
- return str
end
end
- function gzip.save(filename,data)
+ function gzip.save(filename,data,level)
if suffix(filename) ~= "gz" then
filename = filename .. ".gz"
end
- local f = io.open(filename,"wb")
+ local f = openfile(filename,"wb")
if f then
- local s = zlib.compress(data or "",9,nil,15+16)
- f:write(s)
+ data = compress(data or "",level or gziplevel,nil,gzipwindow)
+ f:write(data)
f:close()
- return #s
+ return #data
end
end
@@ -47,24 +85,6 @@
return suffix, gzipped
end
-else
-
- -- todo: fallback on flate
-
-end
-
-if flate then
-
- local type = type
- local find = string.find
-
- local compress = flate.gz_compress
- local decompress = flate.gz_decompress
-
- local absmax = 128*1024*1024
- local initial = 64*1024
- local identifier = "^\x1F\x8B\x08"
-
function gzip.compressed(s)
return s and find(s,identifier)
end
@@ -72,43 +92,19 @@
function gzip.compress(s,level)
if s and not find(s,identifier) then -- the find check might go away
if not level then
- level = 3
+ level = gziplevel
elseif level <= 0 then
return s
elseif level > 9 then
level = 9
end
- return compress(s,level) or s
+ return compress(s,level or gziplevel,nil,gzipwindow) or s
end
end
- function gzip.decompress(s,size,iterate)
+ function gzip.decompress(s)
if s and find(s,identifier) then
- if type(size) ~= "number" then
- size = initial
- end
- if size > absmax then
- size = absmax
- end
- if type(iterate) == "number" then
- max = size * iterate
- elseif iterate == nil or iterate == true then
- iterate = true
- max = absmax
- end
- if max > absmax then
- max = absmax
- end
- while true do
- local d = decompress(s,size)
- if d then
- return d
- end
- size = 2 * size
- if not iterate or size > max then
- return false
- end
- end
+ return decompress(s,gzipwindow)
else
return s
end
@@ -115,3 +111,70 @@
end
end
+
+-- In luametatex we can use this one but it doesn't look like there wil be stream
+-- support so for now we still use zlib (the performance difference is not that
+-- spectacular in our usage.
+
+-- if flate then
+--
+-- local type = type
+-- local find = string.find
+--
+-- local compress = flate.gz_compress
+-- local decompress = flate.gz_decompress
+--
+-- local absmax = 128*1024*1024
+-- local initial = 64*1024
+-- local identifier = "^\x1F\x8B\x08"
+--
+-- function gzip.compressed(s)
+-- return s and find(s,identifier)
+-- end
+--
+-- function gzip.compress(s,level)
+-- if s and not find(s,identifier) then -- the find check might go away
+-- if not level then
+-- level = 3
+-- elseif level <= 0 then
+-- return s
+-- elseif level > 9 then
+-- level = 9
+-- end
+-- return compress(s,level) or s
+-- end
+-- end
+--
+-- function gzip.decompress(s,size,iterate)
+-- if s and find(s,identifier) then
+-- if type(size) ~= "number" then
+-- size = initial
+-- end
+-- if size > absmax then
+-- size = absmax
+-- end
+-- if type(iterate) == "number" then
+-- max = size * iterate
+-- elseif iterate == nil or iterate == true then
+-- iterate = true
+-- max = absmax
+-- end
+-- if max > absmax then
+-- max = absmax
+-- end
+-- while true do
+-- local d = decompress(s,size)
+-- if d then
+-- return d
+-- end
+-- size = 2 * size
+-- if not iterate or size > max then
+-- return false
+-- end
+-- end
+-- else
+-- return s
+-- end
+-- end
+--
+-- end
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-io.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-io.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-io.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -13,7 +13,7 @@
----- floor = math.floor
local type = type
-if string.find(os.getenv("PATH"),";",1,true) then
+if string.find(os.getenv("PATH") or "",";",1,true) then
io.fileseparator, io.pathseparator = "\\", ";"
else
io.fileseparator, io.pathseparator = "/" , ":"
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-lua.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-lua.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-lua.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -37,9 +37,9 @@
-- this is lmtx only:
-if lua and lua.openfile then
- io.open = lua.openfile
-end
+-- if lua and lua.openfile then
+-- io.open = lua.openfile
+-- end
-- lpeg
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-md5.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-md5.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-md5.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -20,6 +20,8 @@
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 @@
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,25 +80,27 @@
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
@@ -101,9 +107,9 @@
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
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-os.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-os.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-os.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -30,7 +30,7 @@
local find, format, gsub, upper, gmatch = string.find, string.format, string.gsub, string.upper, string.gmatch
local concat = table.concat
local random, ceil, randomseed = math.random, math.ceil, math.randomseed
-local rawget, rawset, type, getmetatable, setmetatable, tonumber, tostring = rawget, rawset, type, getmetatable, setmetatable, tonumber, tostring
+local type, setmetatable, tonumber, tostring = type, setmetatable, tonumber, tostring
-- This check needs to happen real early on. Todo: we can pick it up from the commandline
-- if we pass --binpath= (which is useful anyway)
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-table.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-table.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-table.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -6,7 +6,7 @@
license = "see context related readme files"
}
-local type, next, tostring, tonumber, select = type, next, tostring, tonumber, select
+local type, next, tostring, tonumber, select, rawget = type, next, tostring, tonumber, select, rawget
local table, string = table, string
local concat, sort = table.concat, table.sort
local format, lower, dump = string.format, string.lower, string.dump
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sta.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sta.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-sta.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -81,6 +81,8 @@
function stacker.new(name)
+ -- to be sped up, mmaybe foo:bar syntax here but then quite some access
+
local report = logs.reporter("stacker",name or nil)
local s
@@ -93,6 +95,7 @@
local hashing = true
local function push(...)
+ -- todo check if more than 1 argument
for i=1,select("#",...) do
insert(stack,(select(i,...))) -- watch the ()
end
@@ -153,8 +156,12 @@
local function resolve_step(ti) -- keep track of changes outside function !
-- todo: optimize for n=1 etc
+ if not top then
+ -- report("messed op stacker %a",name)
+ return
+ end
local result = nil
- local noftop = top and #top or 0
+ local noftop = #top
if ti > 0 then
local current = list[ti]
if current then
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-str.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-str.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-str.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -944,7 +944,7 @@
n = n + 1
if not f or f == "" then
return format("FORMAT(a%s,'%%.9f')",n)
- elseif f == ".6" then
+ elseif f == ".6" or f == "0.6" then
return format("FORMAT(a%s)",n)
else
return format("FORMAT(a%s,'%%%sf')",n,f)
Modified: trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua
===================================================================
--- trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua 2020-02-05 20:01:12 UTC (rev 53681)
+++ trunk/Master/texmf-dist/tex/luatex/lualibs/lualibs.lua 2020-02-05 21:26:20 UTC (rev 53682)
@@ -25,8 +25,8 @@
lualibs.module_info = {
name = "lualibs",
- version = "2.69", --TAGVERSION
- date = "2019-11-06", --TAGDATE
+ version = "2.70", --TAGVERSION
+ date = "2020-02-02", --TAGDATE
description = "ConTeXt Lua standard libraries.",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
copyright = "PRAGMA ADE / ConTeXt Development Team",
More information about the tex-live-commits
mailing list.