[latex3-commits] [git/LaTeX3-latex3-luaotfload] 3.12-20200126: imported lualibs (df675af)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Feb 2 22:36:36 CET 2020


Repository : https://github.com/latex3/luaotfload
On branch  : 3.12-20200126
Link       : https://github.com/latex3/luaotfload/commit/df675afec78546b857a89f1c416dc0f2600c8ff0

>---------------------------------------------------------------

commit df675afec78546b857a89f1c416dc0f2600c8ff0
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Feb 2 22:36:36 2020 +0100

    imported lualibs


>---------------------------------------------------------------

df675afec78546b857a89f1c416dc0f2600c8ff0
 .../tex/luatex/lualibs/lualibs-basic-merged.lua    | 145 +++++++---------
 supporttexmf/tex/luatex/lualibs/lualibs-basic.lua  |   4 +-
 .../tex/luatex/lualibs/lualibs-extended-merged.lua |   9 +-
 .../tex/luatex/lualibs/lualibs-extended.lua        |   4 +-
 supporttexmf/tex/luatex/lualibs/lualibs-file.lua   |  20 ++-
 supporttexmf/tex/luatex/lualibs/lualibs-gzip.lua   | 191 ++++++++++++++-------
 supporttexmf/tex/luatex/lualibs/lualibs-io.lua     |   2 +-
 supporttexmf/tex/luatex/lualibs/lualibs-lua.lua    |   6 +-
 supporttexmf/tex/luatex/lualibs/lualibs-md5.lua    |  28 +--
 supporttexmf/tex/luatex/lualibs/lualibs-os.lua     |   2 +-
 supporttexmf/tex/luatex/lualibs/lualibs-table.lua  |   2 +-
 .../tex/luatex/lualibs/lualibs-util-sta.lua        |   9 +-
 .../tex/luatex/lualibs/lualibs-util-str.lua        |   2 +-
 supporttexmf/tex/luatex/lualibs/lualibs.lua        |   4 +-
 14 files changed, 252 insertions(+), 176 deletions(-)

diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-basic-merged.lua b/supporttexmf/tex/luatex/lualibs/lualibs-basic-merged.lua
index bee6c7d..38c4deb 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-basic-merged.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-basic-merged.lua
@@ -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 @@ if LUAVERSION<5.2 and jit then
  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 @@ if not modules then modules={} end modules ['l-table']={
  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 open,flush,write,read=io.open,io.flush,io.write,io.read
 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 date,time=os.date,os.time
 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,15 +3564,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")
@@ -3957,35 +3963,46 @@ if not modules then modules={} end modules ['l-gzip']={
  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
-   f:close()
-   local g=gzip.open(filename,"rb")
-   if g then
-    local str=g:read("*all")
-    g:close()
-    return str
-   end
   else
-   local str=f:read("*all")
+   local data=f:read("*all")
    f:close()
-   return str
+   if data and data~="" then
+    if suffix(filename)=="gz" then
+     data=decompress(data,gzipwindow)
+    end
+    return data
+   end
   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,58 +4010,24 @@ if gzip then
   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
  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 @@ if not md5 then
 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 @@ do
   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 @@ function file.needsupdating(oldname,newname,threshold)
 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/supporttexmf/tex/luatex/lualibs/lualibs-basic.lua b/supporttexmf/tex/luatex/lualibs/lualibs-basic.lua
index a9c63e6..807e81c 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-basic.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-basic.lua
@@ -29,8 +29,8 @@ local loadmodule        = lualibs.loadmodule
 
 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",
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-extended-merged.lua b/supporttexmf/tex/luatex/lualibs/lualibs-extended-merged.lua
index c250240..acf7c5a 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-extended-merged.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-extended-merged.lua
@@ -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 @@ local format_N  if environment.FORMAT then
   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 @@ function stacker.new(name)
   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
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-extended.lua b/supporttexmf/tex/luatex/lualibs/lualibs-extended.lua
index 6ddf921..df53b86 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-extended.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-extended.lua
@@ -30,8 +30,8 @@ lualibs = lualibs or { }
 
 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",
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-file.lua b/supporttexmf/tex/luatex/lualibs/lualibs-file.lua
index 1b039a4..d0af94f 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-file.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-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/supporttexmf/tex/luatex/lualibs/lualibs-gzip.lua b/supporttexmf/tex/luatex/lualibs/lualibs-gzip.lua
index 31466bd..f141b5e 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-gzip.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-gzip.lua
@@ -5,39 +5,77 @@ if not modules then modules = { } end modules ['l-gzip'] = {
     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
+
+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, suffixes = file.suffix, file.suffixes
+    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
-            f:close()
-            local g = gzip.open(filename,"rb")
-            if g then
-                local str = g:read("*all")
-                g:close()
-                return str
-            end
         else
-            local str = f:read("*all")
+            local data = f:read("*all")
             f:close()
-            return str
+            if data and data ~= "" then
+                if suffix(filename) == "gz" then
+                    data = decompress(data,gzipwindow)
+                end
+                return data
+            end
         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 @@ if gzip then
         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,46 +92,89 @@ if flate then
     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
     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
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-io.lua b/supporttexmf/tex/luatex/lualibs/lualibs-io.lua
index fa3ad3c..a955262 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-io.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-io.lua
@@ -13,7 +13,7 @@ local concat = table.concat
 ----- 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 = "/" , ":"
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-lua.lua b/supporttexmf/tex/luatex/lualibs/lualibs-lua.lua
index 5139921..f411230 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-lua.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-lua.lua
@@ -37,9 +37,9 @@ end
 
 -- 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
 
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-md5.lua b/supporttexmf/tex/luatex/lualibs/lualibs-md5.lua
index 6758fa4..9e3f767 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-md5.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-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/supporttexmf/tex/luatex/lualibs/lualibs-os.lua b/supporttexmf/tex/luatex/lualibs/lualibs-os.lua
index aa04e25..8394d19 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-os.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-os.lua
@@ -30,7 +30,7 @@ local date, time = os.date, os.time
 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)
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-table.lua b/supporttexmf/tex/luatex/lualibs/lualibs-table.lua
index e828203..98b377b 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-table.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-table.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['l-table'] = {
     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
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-util-sta.lua b/supporttexmf/tex/luatex/lualibs/lualibs-util-sta.lua
index 7819395..9ca1c67 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-util-sta.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-util-sta.lua
@@ -81,6 +81,8 @@ end
 
 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 @@ function stacker.new(name)
     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 @@ function stacker.new(name)
 
     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
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs-util-str.lua b/supporttexmf/tex/luatex/lualibs/lualibs-util-str.lua
index 432b39e..68c9be5 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs-util-str.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs-util-str.lua
@@ -944,7 +944,7 @@ local format_N  if environment.FORMAT then
         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)
diff --git a/supporttexmf/tex/luatex/lualibs/lualibs.lua b/supporttexmf/tex/luatex/lualibs/lualibs.lua
index 14d24ff..ea6f1eb 100644
--- a/supporttexmf/tex/luatex/lualibs/lualibs.lua
+++ b/supporttexmf/tex/luatex/lualibs/lualibs.lua
@@ -25,8 +25,8 @@ lualibs = lualibs or { }
 
 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 latex3-commits mailing list.