diff options
| author | Marius <mariausol@gmail.com> | 2013-03-13 01:20:16 +0200 | 
|---|---|---|
| committer | Marius <mariausol@gmail.com> | 2013-03-13 01:20:16 +0200 | 
| commit | 4d6709d2eec4237345164c15be765be0669541d0 (patch) | |
| tree | 110053b7da1c5638de03d45cf2898ebdd49188e5 /tex | |
| parent | 1253a5723d8188696f9ab801b13ec84f16c6bf6f (diff) | |
| download | context-4d6709d2eec4237345164c15be765be0669541d0.tar.gz | |
beta 2013.03.13 00:08
Diffstat (limited to 'tex')
189 files changed, 2400 insertions, 2295 deletions
| diff --git a/tex/context/base/anch-pgr.lua b/tex/context/base/anch-pgr.lua index 7f53ef2e0..278448e3a 100644 --- a/tex/context/base/anch-pgr.lua +++ b/tex/context/base/anch-pgr.lua @@ -393,19 +393,19 @@ local function calculatemultipar(tag,obeyhang)      local b = collected[f_b_tag(tag)]      local e = collected[f_e_tag(tag)]      if not b or not e then -        report_graphics("invalid tag '%s'",tag) +        report_graphics("invalid tag %a",tag)          return { }      end      local br = b.r      local er = e.r      if not br or not er then -        report_graphics("invalid region for '%s'",tag) +        report_graphics("invalid region for %a",tag)          return { }      end      local btag, bindex = lpegmatch(splitter,br)      local etag, eindex = lpegmatch(splitter,er)      if not bindex or not eindex or btag ~= etag then -        report_graphics("invalid indices for '%s'",tag) +        report_graphics("invalid indices for %a",tag)          return { }      end      local bindex = tonumber(bindex) @@ -454,7 +454,7 @@ local function calculatemultipar(tag,obeyhang)              br = f_tag_two(btag,i)              local r = collected[br]              if not r then -               report_graphics("invalid middle for '%s'",br) +               report_graphics("invalid middle for %a",br)              else                  local p = r.p                  local pp = list[p] @@ -568,10 +568,10 @@ function backgrounds.fetchmultipar(n,anchor,page,obeyhang)              local pagedata = list[page]              if pagedata then                  local nofmultipars = #pagedata -             -- report_graphics("fetching '%s' at page %s using anchor '%s' containing %s multipars",n,page,anchor,nofmultipars) +             -- report_graphics("fetching %a at page %s using anchor %a containing %s multipars",n,page,anchor,nofmultipars)                  local a = jobpositions.collected[anchor]                  if not a then -                    report_graphics("missing anchor '%s'",anchor) +                    report_graphics("missing anchor %a",anchor)                  else                      local trace = false                      local x, y, w, h, d = a.x, a.y, a.w, a.h, a.d diff --git a/tex/context/base/attr-col.lua b/tex/context/base/attr-col.lua index d4139daf7..7c6b7909b 100644 --- a/tex/context/base/attr-col.lua +++ b/tex/context/base/attr-col.lua @@ -285,7 +285,7 @@ local function reviver(data,n)          if not v then              local gray = graycolor(0)              d = { gray, gray, gray, gray } -            report_attributes("unable to revive color %s",n or "?") +            report_attributes("unable to revive color %a",n)          else              local model = colors.forcedmodel(v[1])              if model == 2 then diff --git a/tex/context/base/attr-ini.lua b/tex/context/base/attr-ini.lua index 5a3bafce3..206a86d79 100644 --- a/tex/context/base/attr-ini.lua +++ b/tex/context/base/attr-ini.lua @@ -105,7 +105,7 @@ local function showlist(what,list)          while a do              local number, value = a.number, a.value              i = i + 1 -            report_attribute("%s %2i: attribute %3i, value %4i, name %s",tostring(what),i,number,value,names[number] or '?') +            report_attribute("%S %2i: attribute %3i, value %4i, name %a",what,i,number,value,names[number])              a = a.next          end     end diff --git a/tex/context/base/attr-lay.lua b/tex/context/base/attr-lay.lua index 059353116..9762bb202 100644 --- a/tex/context/base/attr-lay.lua +++ b/tex/context/base/attr-lay.lua @@ -110,7 +110,7 @@ local function reviver(data,n)              data[n] = d              return d          else -            report_viewerlayers("error, unknown reference '%s'",tostring(n)) +            report_viewerlayers("error: unknown reference %a",tostring(n))          end      end  end diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 5d8b4cc8c..24bc9b432 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -18,15 +18,18 @@ if not modules then modules = { } end modules ['back-exp'] = {  -- We can optimize the code ... currently the overhead is some 10% for xml + html so  -- there is no hurry. +-- todo: use more formatters.. needs testing ... also we can every 1000 results do a collapse +-- todo: delay loading (apart from basic tag stuff) +  local next, type = next, type  local format, match, concat, rep, sub, gsub, gmatch, find = string.format, string.match, table.concat, string.rep, string.sub, string.gsub, string.gmatch, string.find  local validstring = string.valid  local lpegmatch = lpeg.match  local utfchar, utfbyte, utfvalues = utf.char, utf.byte, utf.values  local insert, remove = table.insert, table.remove -local topoints = number.topoints  local fromunicode16 = fonts.mappings.fromunicode16  local sortedhash = table.sortedhash +local formatters = string.formatters  local trace_export  = false  trackers.register  ("export.trace",         function(v) trace_export  = v end)  local trace_spacing = false  trackers.register  ("export.trace.spacing", function(v) trace_spacing = v end) @@ -179,7 +182,7 @@ end)  setmetatableindex(specialspaces, function(t,k)      local v = utfchar(k)      t[k] = v -    entities[v] = format("&#x%X;",k) +    entities[v] = formatters["&#x%X;"](k)      somespace[k] = true      somespace[v] = true      return v @@ -257,17 +260,6 @@ local function hashlistdata()      end  end ---~ local spaces = { } -- watch how we also moved the -1 in depth-1 to the creator - ---~ setmetatableindex(spaces, function(t,k) ---~     if not k then ---~         return "" ---~     end ---~     local s = rep("  ",k-1) ---~     t[k] = s ---~     return s ---~ end) -  local spaces = utilities.strings.newrepeater("  ",-1)  function structurestags.setattributehash(fulltag,key,value) -- public hash @@ -1661,9 +1653,9 @@ local function push(fulltag,depth)      treestack[currentdepth] = tree      if trace_export then          if detail and detail ~= "" then -            report_export("%s<%s trigger='%s' paragraph='%s' index='%s' detail='%s'>",spaces[currentdepth-1],fulltag,currentattribute or 0,currentparagraph or 0,#treedata,detail) +            report_export("%w<%s trigger=%a paragraph=%a index=%a detail=%a>",currentdepth-1,fulltag,currentattribute or 0,currentparagraph or 0,#treedata,detail)          else -            report_export("%s<%s trigger='%s' paragraph='%s' index='%s'>",spaces[currentdepth-1],fulltag,currentattribute or 0,currentparagraph or 0,#treedata) +            report_export("%w<%s trigger=%a paragraph=%a index=%a>",currentdepth-1,fulltag,currentattribute or 0,currentparagraph or 0,#treedata)          end      end      tree = t @@ -1685,7 +1677,7 @@ local function pop()      currentdepth = currentdepth - 1      if trace_export then          if top then -            report_export("%s</%s>",spaces[currentdepth],top) +            report_export("%w</%s>",currentdepth,top)          else              report_export("</%s>",top)          end @@ -1695,7 +1687,7 @@ end  local function continueexport()      if nofcurrentcontent > 0 then          if trace_export then -            report_export("%s<!-- injecting pagebreak space -->",spaces[currentdepth]) +            report_export("%w<!-- injecting pagebreak space -->",currentdepth)          end          nofcurrentcontent = nofcurrentcontent + 1          currentcontent[nofcurrentcontent] = " " -- pagebreak @@ -1711,7 +1703,7 @@ local function pushentry(current)          local newdepth = #current          local olddepth = currentdepth          if trace_export then -            report_export("%s<!-- moving from depth %s to %s (%s) -->",spaces[currentdepth],olddepth,newdepth,current[newdepth]) +            report_export("%w<!-- moving from depth %s to %s (%s) -->",currentdepth,olddepth,newdepth,current[newdepth])          end          if olddepth <= 0 then              for i=1,newdepth do @@ -1750,28 +1742,28 @@ local function pushentry(current)                      pop()                  end              elseif trace_export then -                report_export("%s<!-- staying at depth %s (%s) -->",spaces[currentdepth],newdepth,nesting[newdepth] or "?") +                report_export("%w<!-- staying at depth %s (%s) -->",currentdepth,newdepth,nesting[newdepth] or "?")              end          end          return olddepth, newdepth      end  end -local function pushcontent(addbreak) +local function pushcontent(currentparagraph,newparagraph)      if nofcurrentcontent > 0 then -        if addbreak then +        if currentparagraph then              if currentcontent[nofcurrentcontent] == "\n" then                  if trace_export then -                    report_export("%s<!-- removing newline -->",spaces[currentdepth]) +                    report_export("%w<!-- removing newline -->",currentdepth)                  end                  nofcurrentcontent = nofcurrentcontent - 1              end          end          local content = concat(currentcontent,"",1,nofcurrentcontent)          if content == "" then -            -- omit; when addbreak we could push, remove spaces, pop -        elseif somespace[content] and addbreak then -            -- omit; when addbreak we could push, remove spaces, pop +            -- omit; when currentparagraph we could push, remove spaces, pop +        elseif somespace[content] and currentparagraph then +            -- omit; when currentparagraph we could push, remove spaces, pop          else              local olddepth, newdepth              local list = taglist[currentattribute] @@ -1782,9 +1774,9 @@ local function pushcontent(addbreak)              local nd = #td              td[nd+1] = { parnumber = currentparagraph, content = content }              if trace_export then -                report_export("%s<!-- start content with length %s -->",spaces[currentdepth],#content) -                report_export("%s%s",spaces[currentdepth],(gsub(content,"\n","\\n"))) -                report_export("%s<!-- stop content -->",spaces[currentdepth]) +                report_export("%w<!-- start content with length %s -->",currentdepth,#content) +                report_export("%w%s",currentdepth,(gsub(content,"\n","\\n"))) +                report_export("%w<!-- stop content -->",currentdepth)              end              if olddepth then                  for i=newdepth-1,olddepth,-1 do @@ -1794,22 +1786,22 @@ local function pushcontent(addbreak)          end          nofcurrentcontent = 0      end -    if addbreak then +    if currentparagraph then          pushentry(makebreaklist(currentnesting))          if trace_export then -            report_export("%s<!-- break added due to %s -->",spaces[currentdepth],addbreak) +            report_export("%w<!-- break added betweep paragraph %a and %a -->",currentdepth,currentparagraph,newparagraph)          end      end  end  local function finishexport()      if trace_export then -        report_export("%s<!-- start finalizing -->",spaces[currentdepth]) +        report_export("%w<!-- start finalizing -->",currentdepth)      end      if nofcurrentcontent > 0 then          if somespace[currentcontent[nofcurrentcontent]] then              if trace_export then -                report_export("%s<!-- removing space -->",spaces[currentdepth]) +                report_export("%w<!-- removing space -->",currentdepth)              end              nofcurrentcontent = nofcurrentcontent - 1          end @@ -1820,22 +1812,12 @@ local function finishexport()      end      currentcontent = { } -- we're nice and do a cleanup      if trace_export then -        report_export("%s<!-- stop finalizing -->",spaces[currentdepth]) +        report_export("%w<!-- stop finalizing -->",currentdepth)      end  end  -- whatsit_code localpar_code -local function tracedchar(c) -    if c == 0x20 then -        return "[space]" -    elseif c == 0 then -        return "[signal]" -    else -        return utfchar(c) -    end -end -  local function collectresults(head,list) -- is last used (we also have currentattribute)      local p      for n in traverse_nodes(head) do @@ -1845,7 +1827,7 @@ local function collectresults(head,list) -- is last used (we also have currentat              if not at then               -- we need to tag the pagebody stuff as being valid skippable               -- -             -- report_export("skipping character: 0x%05X %s (no attribute)",n.char,utfchar(n.char)) +             -- report_export("skipping character: %C (no attribute)",n.char)              else                  -- we could add tonunicodes for ligatures (todo)                  local components =  n.components @@ -1855,18 +1837,15 @@ local function collectresults(head,list) -- is last used (we also have currentat                      local c = n.char                      if last ~= at then                          local tl = taglist[at] ---                         if trace_export then ---                             report_export("%s<!-- processing glyph %s (tag %s) -->",spaces[currentdepth],utfchar(c),at) ---                         end                          pushcontent()                          currentnesting = tl                          currentparagraph = n[a_taggedpar]                          currentattribute = at                          last = at                          pushentry(currentnesting) -                if trace_export then -                    report_export("%s<!-- processing glyph %s (tag %s) -->",spaces[currentdepth],tracedchar(c),at) -                end +                        if trace_export then +                            report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,at) +                        end                          -- We need to intercept this here; maybe I will also move this                          -- to a regular setter at the tex end.                          local r = n[a_reference] @@ -1877,17 +1856,17 @@ local function collectresults(head,list) -- is last used (we also have currentat                      elseif last then                          local ap = n[a_taggedpar]                          if ap ~= currentparagraph then -                            pushcontent(format("new paragraph (%s -> %s)",tostring(currentparagraph),tostring(ap))) +                            pushcontent(currentparagraph,ap)                              pushentry(currentnesting)                              currentattribute = last                              currentparagraph = ap                          end                          if trace_export then -                            report_export("%s<!-- processing glyph %s (tag %s) -->",spaces[currentdepth],tracedchar(c),last) +                            report_export("%w<!-- processing glyph %C tagged %a) -->",currentdepth,c,last)                          end                      else                          if trace_export then -                            report_export("%s<!-- processing glyph %s (tag %s) -->",spaces[currentdepth],tracedchar(c),at) +                            report_export("%w<!-- processing glyph %C tagged %a) -->",currentdepth,c,at)                          end                      end                      local s = n[a_exportstatus] @@ -1896,14 +1875,14 @@ local function collectresults(head,list) -- is last used (we also have currentat                      end                      if c == 0 then                          if trace_export then -                            report_export("%s<!-- skipping last glyph -->",spaces[currentdepth]) +                            report_export("%w<!-- skipping last glyph -->",currentdepth)                          end                      elseif c == 0x20 then                          local a = n[a_characters]                          nofcurrentcontent = nofcurrentcontent + 1                          if a then                              if trace_export then -                                report_export("%s<!-- turning last space into special space U+%05X -->",spaces[currentdepth],a) +                                report_export("%w<!-- turning last space into special space %U -->",currentdepth,a)                              end                              currentcontent[nofcurrentcontent] = specialspaces[a] -- special space                          else @@ -1954,7 +1933,7 @@ local function collectresults(head,list) -- is last used (we also have currentat                      if last ~= a then                          local tl = taglist[a]                          if trace_export then -                            report_export("%s<!-- processing space glyph U+%05X (tag %s) case 1 -->",spaces[currentdepth],ca,a) +                            report_export("%w<!-- processing space glyph %U tagged %a case 1 -->",currentdepth,ca,a)                          end                          pushcontent()                          currentnesting = tl @@ -1966,18 +1945,18 @@ local function collectresults(head,list) -- is last used (we also have currentat                      elseif last then                          local ap = n[a_taggedpar]                          if ap ~= currentparagraph then -                            pushcontent(format("new paragraph (%s -> %s)",tostring(currentparagraph),tostring(ap))) +                            pushcontent(currentparagraph,ap)                              pushentry(currentnesting)                              currentattribute = last                              currentparagraph = ap                          end                          if trace_export then -                            report_export("%s<!-- processing space glyph U+%05X (tag %s) case 2 -->",spaces[currentdepth],ca,last) +                            report_export("%w<!-- processing space glyph %U tagged %a case 2 -->",currentdepth,ca,last)                          end                      end                      -- if somespace[currentcontent[nofcurrentcontent]] then                      --     if trace_export then -                    --         report_export("%s<!-- removing space -->",spaces[currentdepth]) +                    --         report_export("%w<!-- removing space -->",currentdepth)                      --     end                      --     nofcurrentcontent = nofcurrentcontent - 1                      -- end @@ -1992,18 +1971,18 @@ local function collectresults(head,list) -- is last used (we also have currentat                              local a = n[a_tagged]                              if a == last then                                  if trace_export then -                                    report_export("%s<!-- injecting spacing 5a -->",spaces[currentdepth]) +                                    report_export("%w<!-- injecting spacing 5a -->",currentdepth)                                  end                                  nofcurrentcontent = nofcurrentcontent + 1                                  currentcontent[nofcurrentcontent] = " "                              elseif a then                                  -- e.g LOGO<space>LOGO                                  if trace_export then -                                    report_export("%s<!-- processing glue > threshold (tag %s => %s) -->",spaces[currentdepth],last,a) +                                    report_export("%w<!-- processing glue > threshold tagged %s becomes %s -->",currentdepth,last,a)                                  end                                  pushcontent()                                  if trace_export then -                                    report_export("%s<!-- injecting spacing 5b -->",spaces[currentdepth]) +                                    report_export("%w<!-- injecting spacing 5b -->",currentdepth)                                  end                                  last = a                                  nofcurrentcontent = nofcurrentcontent + 1 @@ -2019,13 +1998,13 @@ local function collectresults(head,list) -- is last used (we also have currentat                          local a = n[a_tagged]                          if a == last then                              if trace_export then -                                report_export("%s<!-- injecting spacing 7 (stay in element) -->",spaces[currentdepth]) +                                report_export("%w<!-- injecting spacing 7 (stay in element) -->",currentdepth)                              end                              nofcurrentcontent = nofcurrentcontent + 1                              currentcontent[nofcurrentcontent] = " "                          else                              if trace_export then -                                report_export("%s<!-- injecting spacing 7 (end of element) -->",spaces[currentdepth]) +                                report_export("%w<!-- injecting spacing 7 (end of element) -->",currentdepth)                              end                              last = a                              pushcontent() @@ -2048,13 +2027,13 @@ local function collectresults(head,list) -- is last used (we also have currentat                              local a = n[a_tagged]                              if a == last then                                  if trace_export then -                                    report_export("%s<!-- injecting spacing 1 (end of line, stay in element) -->",spaces[currentdepth]) +                                    report_export("%w<!-- injecting spacing 1 (end of line, stay in element) -->",currentdepth)                                  end                                  nofcurrentcontent = nofcurrentcontent + 1                                  currentcontent[nofcurrentcontent] = " "                              else                                  if trace_export then -                                    report_export("%s<!-- injecting spacing 1 (end of line, end of element) -->",spaces[currentdepth]) +                                    report_export("%w<!-- injecting spacing 1 (end of line, end of element) -->",currentdepth)                                  end                                  last = a                                  pushcontent() @@ -2082,7 +2061,7 @@ local function collectresults(head,list) -- is last used (we also have currentat                  end                  pushentry(taglist[at]) -- has an index, todo: flag empty element                  if trace_export then -                    report_export("%s<!-- processing image (tag %s)",spaces[currentdepth],last) +                    report_export("%w<!-- processing image tagged %a",currentdepth,last)                  end                  last = nil                  currentparagraph = nil @@ -2103,7 +2082,7 @@ local function collectresults(head,list) -- is last used (we also have currentat                          if a == last then                              if not somespace[currentcontent[nofcurrentcontent]] then                                  if trace_export then -                                    report_export("%s<!-- injecting spacing 8 (%s) -->",spaces[currentdepth],topoints(kern,true)) +                                    report_export("%w<!-- injecting spacing 8 (kern %p) -->",currentdepth,kern)                                  end                                  nofcurrentcontent = nofcurrentcontent + 1                                  currentcontent[nofcurrentcontent] = " " @@ -2111,12 +2090,12 @@ local function collectresults(head,list) -- is last used (we also have currentat                          elseif a then                              -- e.g LOGO<space>LOGO                              if trace_export then -                                report_export("%s<!-- processing kern, threshold %s, tag %s => %s -->",spaces[currentdepth],topoints(limit,true),last,a) +                                report_export("%w<!-- processing kern, threshold %p, tag %s => %s -->",currentdepth,limit,last,a)                              end                              last = a                              pushcontent()                              if trace_export then -                                report_export("%s<!-- injecting spacing 9 (%s) -->",spaces[currentdepth],topoints(kern,true)) +                                report_export("%w<!-- injecting spacing 9 (kern %p) -->",currentdepth,kern)                              end                              nofcurrentcontent = nofcurrentcontent + 1                              currentcontent[nofcurrentcontent] = " " @@ -2135,13 +2114,13 @@ end  function nodes.handlers.export(head) -- hooks into the page builder      starttiming(treehash)      if trace_export then -        report_export("%s<!-- start flushing page -->",spaces[currentdepth]) +        report_export("%w<!-- start flushing page -->",currentdepth)      end   -- continueexport()      restart = true      collectresults(head)      if trace_export then -        report_export("%s<!-- stop flushing page -->",spaces[currentdepth]) +        report_export("%w<!-- stop flushing page -->",currentdepth)      end      stoptiming(treehash)      return head, true @@ -2191,7 +2170,7 @@ local function allusedstylesheets(xmlfile,cssfiles,files)              cssfile = file.addsuffix(cssfile,"css")          end          files[#files+1] = cssfile -        report_export("adding css reference '%s",cssfile) +        report_export("adding css reference '%s'",cssfile)          result[#result+1] = format(csspreamble,cssfile)      end      return concat(result) @@ -2339,16 +2318,16 @@ local function stopexport(v)      --      files = table.unique(files)      -- -    report_export("saving xml data in '%s",xmlfile) +    report_export("saving xml data in %a",xmlfile)      io.savedata(xmlfile,results)      -- -    report_export("saving css image definitions in '%s",imagefilename) +    report_export("saving css image definitions in %a",imagefilename)      io.savedata(imagefilename,allusedimages(xmlfile))      -- -    report_export("saving css style definitions in '%s",stylefilename) +    report_export("saving css style definitions in %a",stylefilename)      io.savedata(stylefilename,allusedstyles(xmlfile))      -- -    report_export("saving css template in '%s",templatefilename) +    report_export("saving css template in %a",templatefilename)      io.savedata(templatefilename,allusedelements(xmlfile))      --      if xhtmlfile then @@ -2358,7 +2337,7 @@ local function stopexport(v)              xhtmlfile = file.addsuffix(xhtmlfile,"xhtml")          end          files[#files+1] = xhtmlfile -        report_export("saving xhtml variant in '%s",xhtmlfile) +        report_export("saving xhtml variant in %a",xhtmlfile)          local xmltree = cleanxhtmltree(xml.convert(results))          xml.save(xmltree,xhtmlfile)          -- looking at identity is somewhat redundant as we also inherit from interaction @@ -2377,7 +2356,7 @@ local function stopexport(v)              firstpage  = validstring(finetuning.firstpage),              lastpage   = validstring(finetuning.lastpage),          } -        report_export("saving specification in '%s' (mtxrun --script epub --make %s)",specificationfilename,specificationfilename) +        report_export("saving specification in %a (mtxrun --script epub --make %s)",specificationfilename,specificationfilename)          io.savedata(specificationfilename,table.serialize(specification,true))      end      stoptiming(treehash) diff --git a/tex/context/base/back-ini.lua b/tex/context/base/back-ini.lua index f6b2f60f1..bdd931abd 100644 --- a/tex/context/base/back-ini.lua +++ b/tex/context/base/back-ini.lua @@ -59,7 +59,11 @@ function backends.install(what)          local backend = backends[what]          if backend then              if trace_backend then -                report_backend("initializing backend %s (%s)",what,backend.comment or "no comment") +                if backend.comment then +                    report_backend("initializing backend %a, %a",what,backend.comment) +                else +                    report_backend("initializing backend %a",what) +                end              end              backends.current = what              for category, default in next, defaults do @@ -68,7 +72,7 @@ function backends.install(what)                  setmetatableindex(target, plugin)              end          elseif trace_backend then -            report_backend("no backend named %s",what) +            report_backend("no backend named %a",what)          end      end  end diff --git a/tex/context/base/bibl-bib.lua b/tex/context/base/bibl-bib.lua index a995d7429..6ea3bc567 100644 --- a/tex/context/base/bibl-bib.lua +++ b/tex/context/base/bibl-bib.lua @@ -143,9 +143,9 @@ function bibtex.load(session,filename)      if filename ~= "" then          local data = io.loaddata(filename) or ""          if data == "" then -            report_xml("empty file '%s', no conversion to xml",filename) +            report_xml("empty file %a, no conversion to xml",filename)          elseif trace_bibxml then -            report_xml("converting file '%s' to xml",filename) +            report_xml("converting file %a to xml",filename)          end          bibtex.convert(session,data)      end diff --git a/tex/context/base/bibl-tra.lua b/tex/context/base/bibl-tra.lua index ca6403c44..1c5eb3c85 100644 --- a/tex/context/base/bibl-tra.lua +++ b/tex/context/base/bibl-tra.lua @@ -41,7 +41,7 @@ function hacks.process(settings)          interfaces.showmessage("publications",3)          io.savedata(file.addsuffix(jobname,"aux"),format(template,style,database))          if trace_bibtex then -            report_tex("processing bibtex file '%s'",jobname) +            report_tex("processing bibtex file %a",jobname)          end          os.execute(format("bibtex %s",jobname))          -- purge 'm @@ -50,7 +50,7 @@ end  function hacks.register(str)      if trace_bibtex then -        report_tex("registering bibtex entry '%s'",str) +        report_tex("registering bibtex entry %a",str)      end      registered[#registered+1] = str      ordered[str] = #registered diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index 2519a1551..8ed8c71b2 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -122,7 +122,7 @@ local function loadcontent(names) -- no print      elseif nnames == 0 then          report_buffers("invalid lua code in default buffer")      else -        report_buffers("invalid lua code in buffer '%s'",concat(names,",")) +        report_buffers("invalid lua code in buffer %a",concat(names,","))      end  end @@ -304,12 +304,12 @@ function commands.runbuffer(name,list,encapsulate)      local data = io.loaddata(name)      if data ~= content then          if trace_run then -            report_buffers("changes in '%s', processing forced",name) +            report_buffers("changes in %a, processing forced",name)          end          io.savedata(name,content)          os.execute(format(command,name))      elseif trace_run then -        report_buffers("no changes in '%s', not processed",name) +        report_buffers("no changes in %a, not processed",name)      end  end diff --git a/tex/context/base/buff-par.lua b/tex/context/base/buff-par.lua index 29742f497..2c1cd40e9 100644 --- a/tex/context/base/buff-par.lua +++ b/tex/context/base/buff-par.lua @@ -91,7 +91,7 @@ function parallel.save(category,tag,content)                  done = true              end              if trace_parallel and label ~= "" then -                report_parallel("reference found: category '%s', tag '%s', label '%s'",category,tag,label) +                report_parallel("reference found of category %a, tag %a, label %a",category,tag,label)              end              line.label   = label              line.content = strip(content) diff --git a/tex/context/base/buff-ver.lua b/tex/context/base/buff-ver.lua index 5748d9298..49e3788ac 100644 --- a/tex/context/base/buff-ver.lua +++ b/tex/context/base/buff-ver.lua @@ -164,7 +164,7 @@ function visualizers.newgrammar(name,t)      g = g and g.grammar      if g then          if trace_visualize then -            report_visualizers("cloning grammar '%s'",name) +            report_visualizers("cloning grammar %a",name)          end          for k,v in next, g do              if not t[k] then @@ -183,12 +183,12 @@ local function getvisualizer(method,nature)      local m = specifications[method] or specifications.default      if nature then          if trace_visualize then -            report_visualizers("getting visualizer '%s' with nature '%s'",method,nature) +            report_visualizers("getting visualizer %a with nature %a",method,nature)          end          return m and (m[nature] or m.parser) or nil      else          if trace_visualize then -            report_visualizers("getting visualizer '%s'",method) +            report_visualizers("getting visualizer %a",method)          end          return m and m.parser or nil      end @@ -237,11 +237,11 @@ function visualizers.load(name)          end          if texname == "" or luaname == "" then              if trace_visualize then -                report_visualizers("unknown visualizer '%s'",name) +                report_visualizers("unknown visualizer %a",name)              end          else              if trace_visualize then -                report_visualizers("loading visualizer '%s'",name) +                report_visualizers("loading visualizer %a",name)              end              lua.registercode(luaname)              context.input(texname) @@ -255,7 +255,7 @@ end  function visualizers.register(name,specification)      name = lower(name)      if trace_visualize then -        report_visualizers("registering visualizer '%s'",name) +        report_visualizers("registering visualizer %a",name)      end      specifications[name] = specification      local parser, handler = specification.parser, specification.handler @@ -358,7 +358,7 @@ function visualizers.registerescapepattern(name,befores,afters,normalmethod,esca              local after     = afters[i]              local processor = processors[i]              if trace_visualize then -                report_visualizers("registering escape pattern, name: '%s', index: '%s', before: '%s', after: '%s', processor: '%s'", +                report_visualizers("registering escape pattern, name %a, index %a, before %a, after %a, processor %a",                      name,i,before,after,processor or "default")              end              before = P(before) * space_pattern @@ -394,7 +394,7 @@ function visualizers.registerescapeline(name,befores,normalmethod,escapemethod,p              local before    = befores[i]              local processor = processors[i]              if trace_visualize then -                report_visualizers("registering escape line pattern, name: '%s', before: '%s', after: <<newline>>",name,before) +                report_visualizers("registering escape line pattern, name %a, before %a, after <<newline>>",name,before)              end              before = P(before) * space_pattern              after = space_pattern * P("\n") @@ -424,7 +424,7 @@ function visualizers.registerescapecommand(name,token,normalmethod,escapecommand      local escapepattern = escapepatterns[name]      if not escapepattern then          if trace_visualize then -            report_visualizers("registering escape token, name: '%s', token: '%s'",name,token) +            report_visualizers("registering escape token, name %a, token %a",name,token)          end          token = P(token)          local notoken = hack((1 - token)^1) @@ -493,12 +493,12 @@ local function visualize(content,settings) -- maybe also method in settings          local n = m and m[nature]          if n then              if trace_visualize then -                report_visualizers("visualize using method '%s' and nature '%s'",method,nature) +                report_visualizers("visualize using method %a and nature %a",method,nature)              end              n(content,settings)          else              if trace_visualize then -                report_visualizers("visualize using method '%s'",method) +                report_visualizers("visualize using method %a",method)              end              fallback(content,1,settings)          end diff --git a/tex/context/base/char-ini.lua b/tex/context/base/char-ini.lua index 9f8a0ce11..0b448068e 100644 --- a/tex/context/base/char-ini.lua +++ b/tex/context/base/char-ini.lua @@ -532,8 +532,8 @@ end  -- local utfbytes = { }  -- local utfchars = { }  -- --- table.setmetatableindex(utfbytes,function(t,k) local v= utfchar(k) t[k] = v return v end) --- table.setmetatableindex(utfchars,function(t,k) local v= utfbyte(k) t[k] = v return v end) +-- table.setmetatableindex(utfbytes,function(t,k) local v = utfchar(k) t[k] = v return v end) +-- table.setmetatableindex(utfchars,function(t,k) local v = utfbyte(k) t[k] = v return v end)  local function toutfstring(s)      if type(s) == "table" then @@ -834,13 +834,13 @@ if not characters.superscripts then                  if #specials == 2 then                      superscripts[k] = specials[2]                  else -                    report_defining("ignoring superscript %s %s: %s",ustring(k),utfchar(k),v.description) +                    report_defining("ignoring %s %a, char %c, description %a","superscript",ustring(k),k,v.description)                  end              elseif what == "sub" then                  if #specials == 2 then                      subscripts[k] = specials[2]                  else -                    report_defining("ignoring subscript %s %s: %s",ustring(k),utfchar(k),v.description) +                    report_defining("ignoring %s %a, char %c, description %a","subscript",ustring(k),k,v.description)                  end              end          end @@ -856,6 +856,13 @@ if not characters.superscripts then  end +-- for the moment only a few + +local tracedchars = utilities.strings.tracers + +tracedchars[0x00] = "[signal]" +tracedchars[0x20] = "[space]" +  -- the following code will move to char-tex.lua  -- tex @@ -976,14 +983,14 @@ function characters.define(tobelettered, tobeactivated) -- catcodetables          for i=1,nofactivated do              local u = activated[i]              if u then -                report_defining("character 0x%05X is active in sets %s (%s)",u,concat(tobeactivated,","),data[u].description) +                report_defining("character %U is active in set %a, containing %a",u,data[u].description,tobeactivated)              end          end          local saved = tex.catcodetable          for i=1,#tobeactivated do              local vector = tobeactivated[i]              if trace_defining then -                report_defining("defining %s active characters in vector %s",nofactivated,vector) +                report_defining("defining %a active characters in vector %a",nofactivated,vector)              end              tex.catcodetable = vector              for i=1,nofactivated do @@ -1050,7 +1057,7 @@ end  local function setuppersfcodes(v,n)      if sfstate ~= "unset" then -        report_defining("setting uppercase sf codes to %s",n) +        report_defining("setting uppercase sf codes to %a",n)          for code, chr in next, data do              if chr.category == "lu" then                  texsetsfcode(code,n) diff --git a/tex/context/base/chem-ini.lua b/tex/context/base/chem-ini.lua index c862e00e3..10db1a1e4 100644 --- a/tex/context/base/chem-ini.lua +++ b/tex/context/base/chem-ini.lua @@ -35,7 +35,7 @@ end  function commands.molecule(str)      if trace_molecules then          local rep = lpegmatch(moleculeparser,str) -        report_chemistry("molecule %s => %s",str,rep) +        report_chemistry("molecule %a becomes %a",str,rep)          context(rep)      else          context(lpegmatch(moleculeparser,str)) diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 1967948de..d0f0b9d29 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -259,7 +259,6 @@ local molecule = chemistry.molecule -- or use lpegmatch(chemistry.moleculeparser  local function fetch(txt)      local st = stack[txt]      local t = st.text[st.n] --- inspect(stack)      while not t and txt > 1 do          txt = txt - 1          st = stack[txt] @@ -267,7 +266,7 @@ local function fetch(txt)      end      if t then          if trace_textstack then -            report_chemistry("fetching from stack %s slot %s: %s",txt,st.n,t) +            report_chemistry("fetching from stack %a, slot %a, data %a",txt,st.n,t)          end          st.n = st.n + 1      end @@ -346,7 +345,7 @@ local function process(level,spec,text,n,rulethickness,rulecolor,offset,default_          end          if d then              if trace_structure then -                report_chemistry("%s > %s => definition: %s (%s snippets)",level,step,n,#d) +                report_chemistry("level %a, step %a, definition %a, snippets %a",level,step,n,#d)              end              for i=1,#d do                  local di = d[i] @@ -356,8 +355,8 @@ local function process(level,spec,text,n,rulethickness,rulecolor,offset,default_              local factor, osign, operation, special, index, upto, set, text = lpegmatch(pattern,step)              if trace_structure then                  local set = set and concat(set," ") or "-" -                report_chemistry("%s > %s => factor: %s, osign: %s operation: %s, special: %s, index: %s, upto: %s, set: %s, text: %s", -                    level,step,factor or "",osign or "",operation or "-",special and special ~= "" or "-",index or "-",upto or "-",set or "-",text or "-") +                report_chemistry("level %a, step %a, factor %a, osign %a, operation %a, special %a, index %a, upto %a, set %a, text %a", +                    level,step,factor,osign,operation,special,index,upto,set,text)              end              if operation == "rulecolor" then                  local t = text @@ -438,8 +437,7 @@ local function process(level,spec,text,n,rulethickness,rulecolor,offset,default_                              for i=ns,1,-1 do                                  local si = set[i]                                  if si > ms then -                                    report_chemistry("%s > operation %s: limited to %s steps, ignoring %s", -                                        level,operation,ms,si) +                                    report_chemistry("level %a, operation %a, max nofsteps %a, ignoring %a",level,operation,ms,si)                                      set[i] = nil                                      ns = ns - 1                                  else @@ -453,8 +451,7 @@ local function process(level,spec,text,n,rulethickness,rulecolor,offset,default_                              for i=1,ns do                                  local si = set[i]                                  if si > ms then -                                    report_chemistry("%s > operation %s: limited to %s steps, ignoring %s", -                                        level,operation,ms,si) +                                    report_chemistry("level %a, operation %a, max nofsteps %a, ignoring %a",level,operation,ms,si)                                      set[i] = nil                                  else                                      nt = nt + 1 @@ -589,8 +586,7 @@ local function process(level,spec,text,n,rulethickness,rulecolor,offset,default_                  elseif what == "fixed" then                      m = m + 1 ; metacode[m] = f_transform(operation,variant,rulethickness,rulecolor)                  elseif trace_structure then -                    report_chemistry("%s > warning: undefined operation %s ignored here", -                        level, operation or "") +                    report_chemistry("level %a, ignoring undefined operation %s",level,operation)                  end              end          end @@ -614,7 +610,7 @@ function chemistry.start(settings)      --      align = settings.symalign or "auto"      if trace_structure then -        report_chemistry("scale: %s, rotation: %s, width: %s, height: %s, l: %s, r: %s, t: %s, b: %s", scale, rotation, width, height, l, r, t, b) +        report_chemistry("scale %a, rotation %a, width %a, height %a, l: %a, r: %a, t: %a, b: %a",scale,rotation,width,height,l,r,t,b)          report_chemistry("symalign: %s", align)      end      if align ~= "" then align = "." .. align end diff --git a/tex/context/base/cldf-ini.lua b/tex/context/base/cldf-ini.lua index f4b8ece4c..2e2283d90 100644 --- a/tex/context/base/cldf-ini.lua +++ b/tex/context/base/cldf-ini.lua @@ -82,7 +82,7 @@ end  local function _flush_f_(n)      local sn = _stack_f_[n]      if not sn then -        report_cld("data with id %s cannot be found on stack",n) +        report_cld("data with id %a cannot be found on stack",n)      else          local tn = type(sn)          if tn == "function" then @@ -106,7 +106,7 @@ end  local function _flush_n_(n)      local sn = _stack_n_[n]      if not sn then -        report_cld("data with id %s cannot be found on stack",n) +        report_cld("data with id %a cannot be found on stack",n)      elseif texcount["@@trialtypesetting"] == 0 then  -- @@trialtypesetting is private!          writenode(sn)          _stack_n_[n] = nil @@ -374,7 +374,7 @@ local function writer(parent,command,first,...) -- already optimized before call              if typ == "string" or typ == "number" then                  flush(currentcatcodes,ti)              else -- node.write -                report_context("error: invalid use of direct in '%s', only strings and numbers can be flushed directly, not '%s'",command,typ) +                report_context("error: invalid use of direct in %a, only strings and numbers can be flushed directly, not %a",command,typ)              end              direct = false          elseif ti == nil then @@ -452,7 +452,7 @@ local function writer(parent,command,first,...) -- already optimized before call          elseif isnode(ti) then -- slow              flush(currentcatcodes,"{\\cldn{",_store_n_(ti),"}}")          else -            report_context("error: '%s' gets a weird argument '%s'",command,tostring(ti)) +            report_context("error: %a gets a weird argument %a",command,ti)          end      end  end @@ -572,7 +572,7 @@ local function caller(parent,f,a,...)           -- writenode(f)              flush(currentcatcodes,"\\cldn{",_store_n_(f),"}")          else -            report_context("error: 'context' gets a weird argument '%s'",tostring(f)) +            report_context("error: %a gets a weird argument %a","context",f)          end      end  end @@ -807,19 +807,19 @@ function context.runfile(filename)          local ok = dofile(foundname)          if type(ok) == "function" then              if trace_cld then -                report_context("begin of file '%s' (function call)",foundname) +                report_context("begin of file %a (function call)",foundname)              end              ok()              if trace_cld then -                report_context("end of file '%s' (function call)",foundname) +                report_context("end of file %a (function call)",foundname)              end          elseif ok then -            report_context("file '%s' is processed and returns true",foundname) +            report_context("file %a is processed and returns true",foundname)          else -            report_context("file '%s' is processed and returns nothing",foundname) +            report_context("file %a is processed and returns nothing",foundname)          end      else -        report_context("unknown file '%s'",filename) +        report_context("unknown file %a",filename)      end  end @@ -943,10 +943,10 @@ local function caller(parent,f,a,...)              if f then                  flush(currentcatcodes,mpdrawing,"{^^M}")              else -                report_context("warning: 'metafun' gets argument 'false' which is currently unsupported") +                report_context("warning: %a gets argument 'false' which is currently unsupported","metafun")              end          else -            report_context("error: 'metafun' gets a weird argument '%s'",tostring(f)) +            report_context("error: %a gets a weird argument %a","metafun",tostring(f))          end      end  end diff --git a/tex/context/base/colo-icc.lua b/tex/context/base/colo-icc.lua index 4ab28eb68..157a03198 100644 --- a/tex/context/base/colo-icc.lua +++ b/tex/context/base/colo-icc.lua @@ -27,11 +27,11 @@ function colors.iccprofile(filename,verbose)          end      end      if fullname == "" then -        return nil, false, format("profile '%s' cannot be found",filename) +        return nil, false, format("profile %a cannot be found",filename)      end      local f = io.open(fullname,"rb")      if not f then -        return nil, false, format("profile '%s'cannot be loaded",fullname) +        return nil, false, format("profile %a cannot be loaded",fullname)      end      local header =  {          size               = readnumber(f,4), @@ -99,7 +99,7 @@ function colors.iccprofile(filename,verbose)                  }              else                  if verbose then -                    report_colors("ignoring tag '%s' or type '%s' in profile '%s'",tag,variant,fullname) +                    report_colors("ignoring tag %a or type %a in profile %a",tag,variant,fullname)                  end                  tags[tag] = nil              end @@ -112,7 +112,7 @@ function colors.iccprofile(filename,verbose)          header   = header,          tags     = tags,      } -    return profile, true, format("profile '%s' loaded",fullname) +    return profile, true, format("profile %a loaded",fullname)  end  --~ local profile, error, message = colors.iccprofile("ussheetfedcoated.icc") diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua index 29cce70f0..c94058b11 100644 --- a/tex/context/base/colo-ini.lua +++ b/tex/context/base/colo-ini.lua @@ -71,12 +71,12 @@ local function definecolor(name, ca, global)      if ca and ca > 0 then          if global then              if trace_define then -                report_colors("define global color '%s' with attribute: %s",name,ca) +                report_colors("define global color %a with attribute %a",name,ca)              end              context.colordefagc(name,ca)          else              if trace_define then -                report_colors("define local color '%s' with attribute: %s",name,ca) +                report_colors("define local color %a with attribute %a",name,ca)              end              context.colordefalc(name,ca)          end @@ -94,12 +94,12 @@ local function inheritcolor(name, ca, global)      if ca and ca ~= "" then          if global then              if trace_define then -                report_colors("inherit global color '%s' with attribute: %s",name,ca) +                report_colors("inherit global color %a with attribute %a",name,ca)              end              context.colordeffgc(name,ca) -- some day we will set the macro directly          else              if trace_define then -                report_colors("inherit local color '%s' with attribute: %s",name,ca) +                report_colors("inherit local color %a with attribute %a",name,ca)              end              context.colordefflc(name,ca)          end @@ -117,12 +117,12 @@ local function definetransparent(name, ta, global)      if ta and ta > 0 then          if global then              if trace_define then -                report_colors("define global transparency '%s' with attribute: %s",name,ta) +                report_colors("define global transparency %a with attribute %a",name,ta)              end              context.colordefagt(name,ta)          else              if trace_define then -                report_colors("define local transparency '%s' with attribute: %s",name,ta) +                report_colors("define local transparency %a with attribute %a",name,ta)              end              context.colordefalt(name,ta)          end @@ -139,12 +139,12 @@ local function inherittransparent(name, ta, global)      if ta and ta ~= "" then          if global then              if trace_define then -                report_colors("inherit global transparency '%s' with attribute: %s",name,ta) +                report_colors("inherit global transparency %a with attribute %a",name,ta)              end              context.colordeffgt(name,ta)          else              if trace_define then -                report_colors("inherit local transparency '%s' with attribute: %s",name,ta) +                report_colors("inherit local transparency %a with attribute %a",name,ta)              end              context.colordefflt(name,ta)          end @@ -181,8 +181,7 @@ local gray_okay, rgb_okay, cmyk_okay, spot_okay, multichannel_okay, forced = tru  function colors.forcesupport(gray,rgb,cmyk,spot,multichannel) -- pdfx driven      gray_okay, rgb_okay, cmyk_okay, spot_okay, multichannel_okay, forced = gray, rgb, cmyk, spot, multichannel, true -    report_colors("supported models: gray=%s, rgb=%s, cmyk=%s, spot=%s",      -- multichannel=%s -        tostring(gray), tostring(rgb), tostring(cmyk), tostring(spot)) -- tostring(multichannel) +    report_colors("supported models: gray %a, rgb %a, cmyk %a, spot %a",gray,rgb,cmyk,spot) -- multichannel=%l multichannel  end  local function forcedmodel(model) -- delayed till the backend but mp directly @@ -719,7 +718,7 @@ end  local function failure(name)   -- context.showmessage("colors",5,name) -    report_colors("unknown: library '%s'",name) +    report_colors("unknown library %a",name)  end  function colors.usecolors(name) diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 1434b8eee..2b1c391f4 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@  %C therefore copyrighted by \PRAGMA. See mreadme.pdf for  %C details. -\newcontextversion{2013.03.11 00:17} +\newcontextversion{2013.03.13 00:08}  %D This file is loaded at runtime, thereby providing an  %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 8340b5c60..d11b7b2ed 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@  %C therefore copyrighted by \PRAGMA. See mreadme.pdf for  %C details. -\newcontextversion{2013.03.11 00:17} +\newcontextversion{2013.03.13 00:08}  %D This file is loaded at runtime, thereby providing an excellent place for  %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdfBinary files differ index a0d46f708..584c1e534 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.pngBinary files differ index 2bdeb57b6..258c09218 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 8bc5bdd52..345374b06 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@  %D your styles an modules.  \edef\contextformat {\jobname} -\edef\contextversion{2013.03.11 00:17} +\edef\contextversion{2013.03.13 00:08}  %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 6fa8db9ff..57ac8edbc 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@  %D up and the dependencies are more consistent.  \edef\contextformat {\jobname} -\edef\contextversion{2013.03.11 00:17} +\edef\contextversion{2013.03.13 00:08}  %D For those who want to use this: diff --git a/tex/context/base/core-ctx.lua b/tex/context/base/core-ctx.lua index ba62d1e20..33662731e 100644 --- a/tex/context/base/core-ctx.lua +++ b/tex/context/base/core-ctx.lua @@ -198,7 +198,7 @@ function ctxrunner.load(ctxname)                      pattern       = findpattern,                      preprocessors = preprocessors,                  } -                report_prepfiles("step %s, pattern: %q, preprocessor: %q",noftreatments,findpattern,concat(preprocessors," ")) +                report_prepfiles("step %s, pattern %a, preprocessor: %a",noftreatments,findpattern,preprocessors)               end          end      end @@ -261,13 +261,13 @@ function ctxrunner.load(ctxname)                  end                  if lfs.isfile(newfile) then                      file.syncmtimes(filename,newfile) -                    report_prepfiles("%q is converted to %q",filename,newfile) +                    report_prepfiles("%a is converted to %a",filename,newfile)                  else -                    report_prepfiles("%q is not converted to %q",filename,newfile) +                    report_prepfiles("%a is not converted to %a",filename,newfile)                      newfile = filename                  end              elseif lfs.isfile(newfile) then -                report_prepfiles("%q is already converted to %q",filename,newfile) +                report_prepfiles("%a is already converted to %a",filename,newfile)              end          else              newfile = filename diff --git a/tex/context/base/core-dat.lua b/tex/context/base/core-dat.lua index d81f11a28..826d3a675 100644 --- a/tex/context/base/core-dat.lua +++ b/tex/context/base/core-dat.lua @@ -23,9 +23,8 @@ local report_pagestate = logs.reporter("pagestate")  local allocate = utilities.storage.allocate  local settings_to_hash = utilities.parsers.settings_to_hash -local format = string.format  local texcount = tex.count - +local formatters = string.formatters  local v_yes = interfaces.variables.yes  local new_latelua = nodes.pool.latelua @@ -89,10 +88,10 @@ local function setdata(settings)          data.order = index          data.realpage = texcount.realpageno          if trace_datasets then -            report_dataset("delayed: name %s, tag %s, index %s",name,tag,index) +            report_dataset("action %a, name %a, tag %a, index %a","assign delayed",name,tag,index)          end      elseif trace_datasets then -        report_dataset("immediate: name %s, tag %s",name,tag) +        report_dataset("action %a, name %a, tag %a","assign immediate",name,tag)      end      return name, tag, data  end @@ -108,7 +107,7 @@ function datasets.extend(name,tag)      t.realpage = realpage      t.order = order      if trace_datasets then -        report_dataset("flushed: name %s, tag %s, page %s, index %s, order",name,tag,t.index or 0,order,realpage) +        report_dataset("action %a, name %a, tag %a, page %a, index %a","flush by order",name,tag,t.index or 0,order,realpage)      end  end @@ -116,7 +115,7 @@ function datasets.getdata(name,tag,key,default)      local t = collected[name]      if t == nil then          if trace_datasets then -            report_dataset("unknown: name %s",name) +            report_dataset("error: unknown dataset, name %a",name)          end      elseif type(t) ~= "table" then          return t @@ -124,7 +123,7 @@ function datasets.getdata(name,tag,key,default)          t = t[tag] or t[tonumber(tag)]          if not t then              if trace_datasets then -                report_dataset("unknown: name %s, tag %s",name,tag) +                report_dataset("error: unknown dataset, name %a, tag %a",name,tag)              end          elseif key then              return t[key] or default @@ -141,9 +140,9 @@ function commands.setdataset(settings)      if settings.delay ~= v_yes then          --      elseif type(tag) == "number" then -        context(new_latelua(format("job.datasets.extend(%q,%i)",name,tag))) +        context(new_latelua(formatters["job.datasets.extend(%q,%i)"](name,tag)))      else -        context(new_latelua(format("job.datasets.extend(%q,%q)",name,tag))) +        context(new_latelua(formatters["job.datasets.extend(%q,%q)"](name,tag)))      end  end @@ -151,7 +150,7 @@ function commands.datasetvariable(name,tag,key)      local t = collected[name]      if t == nil then          if trace_datasets then -            report_dataset("unknown: name %s (not passed to tex)",name) +            report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name) -- no tag          end      elseif type(t) ~= "table" then          context(tostring(t)) @@ -159,14 +158,14 @@ function commands.datasetvariable(name,tag,key)          t = t and (t[tag] or t[tonumber(tag)])          if not t then              if trace_datasets then -                report_dataset("unknown: name %s with tag %s (not passed to tex)",name,tag) +                report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name,tag)              end          elseif type(t) == "table" then              local s = t[key]              if type(s) ~= "table" then                  context(tostring(s))              elseif trace_datasets then -                report_dataset("table: name %s, tag %s (not passed to tex)",name,tag) +                report_dataset("error: unknown dataset, name %a, tag %a, not passed to tex",name,tag)              end          end      end @@ -212,7 +211,7 @@ local function setstate(settings)      local data = realpage      list[tag] = data      if trace_pagestates then -        report_pagestate("setting: name %s, tag %s, preset %s",name,tag,realpage) +        report_pagestate("action %a, name %a, tag %a, preset %a","set",name,tag,realpage)      end      return name, tag, data  end @@ -222,7 +221,7 @@ pagestates.setstate = setstate  function pagestates.extend(name,tag)      local realpage = texcount.realpageno      if trace_pagestates then -        report_pagestate("synchronizing: name %s, tag %s, preset %s",name,tag,realpage) +        report_pagestate("action %a, name %a, tag %a, preset %a","synchronize",name,tag,realpage)      end      tobesaved[name][tag] = realpage  end @@ -234,10 +233,10 @@ function pagestates.realpage(name,tag,default)          if t then              return tonumber(t or default)          elseif trace_pagestates then -            report_pagestate("unknown: name %s, tag %s",name,tag) +            report_pagestate("error: unknown dataset, name %a, tag %a",name,tag)          end      elseif trace_pagestates then -        report_pagestate("unknown: name %s",name) +        report_pagestate("error: unknown dataset, name %a, tag %a",name) -- nil      end      return default  end @@ -245,9 +244,9 @@ end  function commands.setpagestate(settings)      local name, tag, data = setstate(settings)      if type(tag) == "number" then -        context(new_latelua(format("job.pagestates.extend(%q,%i)",name,tag))) +        context(new_latelua(formatters["job.pagestates.extend(%q,%i)"](name,tag)))      else -        context(new_latelua(format("job.pagestates.extend(%q,%q)",name,tag))) +        context(new_latelua(formatters["job.pagestates.extend(%q,%q)"](name,tag)))      end  end diff --git a/tex/context/base/core-sys.lua b/tex/context/base/core-sys.lua index e25c9b8f1..a790be19e 100644 --- a/tex/context/base/core-sys.lua +++ b/tex/context/base/core-sys.lua @@ -82,7 +82,7 @@ function environment.initializefilenames() -- commands.updatefilenames(jobname,f      environment.filename          = filename      environment.suffix            = suffix -    report_files("jobname: %s, input: %s, result: %s",jobfilename,inputfilename,outputfilename) +    report_files("jobname %a, input %a, result %a",jobfilename,inputfilename,outputfilename)      function environment.initializefilenames() end  end @@ -91,8 +91,8 @@ statistics.register("result saved in file", function()      -- suffix will be fetched from backend      local outputfilename = environment.outputfilename or environment.jobname or tex.jobname or "<unset>"      if tex.pdfoutput > 0 then -        return format( "%s.%s, compresslevel %s, objectcompreslevel %s",outputfilename,"pdf",tex.pdfcompresslevel, tex.pdfobjcompresslevel) +        return format("%s.%s, compresslevel %s, objectcompreslevel %s",outputfilename,"pdf",tex.pdfcompresslevel, tex.pdfobjcompresslevel)      else -        return format( "%s.%s",outputfilename,"dvi") -- hard to imagine +        return format("%s.%s",outputfilename,"dvi") -- hard to imagine      end  end) diff --git a/tex/context/base/data-aux.lua b/tex/context/base/data-aux.lua index 058033afe..b969e6070 100644 --- a/tex/context/base/data-aux.lua +++ b/tex/context/base/data-aux.lua @@ -20,7 +20,7 @@ function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per      newname = file.addsuffix(newname,"lua")      local oldscript = resolvers.cleanpath(oldname)      if trace_locating then -        report_scripts("to be replaced old script %s", oldscript) +        report_scripts("to be replaced old script %a", oldscript)      end      local newscripts = resolvers.findfiles(newname) or { }      if #newscripts == 0 then @@ -31,7 +31,7 @@ function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per          for i=1,#newscripts do              local newscript = resolvers.cleanpath(newscripts[i])              if trace_locating then -                report_scripts("checking new script %s", newscript) +                report_scripts("checking new script %a", newscript)              end              if oldscript == newscript then                  if trace_locating then @@ -39,7 +39,7 @@ function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per                  end              elseif not find(newscript,scriptpath) then                  if trace_locating then -                    report_scripts("new script should come from %s",scriptpath) +                    report_scripts("new script should come from %a",scriptpath)                  end              elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then                  if trace_locating then diff --git a/tex/context/base/data-con.lua b/tex/context/base/data-con.lua index ed4f2dec0..354c6807d 100644 --- a/tex/context/base/data-con.lua +++ b/tex/context/base/data-con.lua @@ -31,12 +31,6 @@ containers.usecache = true  local report_containers = logs.reporter("resolvers","containers") -local function report(container,tag,name) -    if trace_cache or trace_containers then -        report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid') -    end -end -  local allocated = { }  local mt = { @@ -99,13 +93,17 @@ function containers.read(container,name)      if not stored and container.enabled and caches and containers.usecache then          stored = caches.loaddata(container.readables,name)          if stored and stored.cache_version == container.version then -            report(container,"loaded",name) +            if trace_cache or trace_containers then +                report_containers("action %a, category %a, name %a","load",container.subcategory,name) +            end          else              stored = nil          end          storage[name] = stored      elseif stored then -        report(container,"reusing",name) +        if trace_cache or trace_containers then +            report_containers("action %a, category %a, name %a","reuse",container.subcategory,name) +        end      end      return stored  end @@ -117,10 +115,14 @@ function containers.write(container, name, data)              local unique, shared = data.unique, data.shared              data.unique, data.shared = nil, nil              caches.savedata(container.writable, name, data) -            report(container,"saved",name) +            if trace_cache or trace_containers then +                report_containers("action %a, category %a, name %a","save",container.subcategory,name) +            end              data.unique, data.shared = unique, shared          end -        report(container,"stored",name) +        if trace_cache or trace_containers then +            report_containers("action %a, category %a, name %a","store",container.subcategory,name) +        end          container.storage[name] = data      end      return data diff --git a/tex/context/base/data-exp.lua b/tex/context/base/data-exp.lua index 550b61689..90659e57e 100644 --- a/tex/context/base/data-exp.lua +++ b/tex/context/base/data-exp.lua @@ -85,7 +85,7 @@ local replacer_1 = lpeg.replacer { { ",}", ",@}" }, { "{,", "{@," }, }  local function splitpathexpr(str, newlist, validate) -- I couldn't resist lpegging it (nice exercise).      if trace_expansions then -        report_expansions("expanding variable '%s'",str) +        report_expansions("expanding variable %a",str)      end      local t, ok, done = newlist or { }, false, false      local n = #t @@ -246,7 +246,7 @@ local function splitconfigurationpath(str) -- beware, this can be either a path                      end                  end                  if trace_expansions then -                    report_expansions("splitting path specification '%s'",str) +                    report_expansions("splitting path specification %a",str)                      for k=1,noffound do                          report_expansions("% 4i: %s",k,found[k])                      end @@ -364,13 +364,13 @@ function resolvers.scanfiles(path,branch,usecache)          local files = fullcache[realpath]          if files then              if trace_locating then -                report_expansions("using caches scan of path '%s', branch '%s'",path,branch or path) +                report_expansions("using caches scan of path %a, branch %a",path,branch or path)              end              return files          end      end      if trace_locating then -        report_expansions("scanning path '%s', branch '%s'",path,branch or path) +        report_expansions("scanning path %a, branch %a",path,branch or path)      end      local files, n, m, r = scan({ },realpath .. '/',"",0,0,0)      files.__path__        = path -- can be selfautoparent:texmf-whatever @@ -436,13 +436,13 @@ function resolvers.simplescanfiles(path,branch,usecache)          end          if files then              if trace_locating then -                report_expansions("using caches scan of path '%s', branch '%s'",path,branch or path) +                report_expansions("using caches scan of path %a, branch %a",path,branch or path)              end              return files          end      end      if trace_locating then -        report_expansions("scanning path '%s', branch '%s'",path,branch or path) +        report_expansions("scanning path %a, branch %a",path,branch or path)      end      local files = simplescan({ },realpath .. '/',"")      if trace_locating then diff --git a/tex/context/base/data-fil.lua b/tex/context/base/data-fil.lua index 2030e5423..09129e03c 100644 --- a/tex/context/base/data-fil.lua +++ b/tex/context/base/data-fil.lua @@ -22,11 +22,11 @@ function locators.file(specification)      local realname = resolvers.resolve(name) -- no shortcut      if realname and realname ~= '' and lfs.isdir(realname) then          if trace_locating then -            report_files("file locator '%s' found as '%s'",name,realname) +            report_files("file locator %a found as %a",name,realname)          end          resolvers.appendhash('file',name,true) -- cache      elseif trace_locating then -        report_files("file locator '%s' not found",name) +        report_files("file locator %a not found",name)      end  end @@ -50,12 +50,12 @@ function finders.file(specification,filetype)      local foundname = resolvers.findfile(filename,filetype)      if foundname and foundname ~= "" then          if trace_locating then -            report_files("file finder: '%s' found",filename) +            report_files("file finder: %a found",filename)          end          return foundname      else          if trace_locating then -            report_files("file finder: %s' not found",filename) +            report_files("file finder: %a not found",filename)          end          return finders.notfound()      end @@ -76,13 +76,13 @@ function openers.file(specification,filetype)          local f = io.open(filename,"r")          if f then              if trace_locating then -                report_files("file opener, '%s' opened",filename) +                report_files("file opener: %a opened",filename)              end              return openers.helpers.textopener("file",filename,f)          end      end      if trace_locating then -        report_files("file opener, '%s' not found",filename) +        report_files("file opener: %a not found",filename)      end      return openers.notfound()  end @@ -94,7 +94,7 @@ function loaders.file(specification,filetype)          if f then              logs.show_load(filename)              if trace_locating then -                report_files("file loader, '%s' loaded",filename) +                report_files("file loader: %a loaded",filename)              end              local s = f:read("*a") -- io.readall(f) is faster but we never have large files here              if checkgarbage then @@ -107,7 +107,7 @@ function loaders.file(specification,filetype)          end      end      if trace_locating then -        report_files("file loader, '%s' not found",filename) +        report_files("file loader: %a not found",filename)      end      return loaders.notfound()  end diff --git a/tex/context/base/data-ini.lua b/tex/context/base/data-ini.lua index cad3eac14..201c6a2d7 100644 --- a/tex/context/base/data-ini.lua +++ b/tex/context/base/data-ini.lua @@ -135,13 +135,13 @@ do                          if lfs.chdir(p) then                              local pp = lfs.currentdir()                              if trace_locating and p ~= pp then -                                report_initialization("following symlink '%s' to '%s'",p,pp) +                                report_initialization("following symlink %a to %a",p,pp)                              end                              ownpath = pp                              lfs.chdir(olddir)                          else                              if trace_locating then -                                report_initialization("unable to check path '%s'",p) +                                report_initialization("unable to check path %a",p)                              end                              ownpath =  p                          end @@ -152,9 +152,9 @@ do          end          if not ownpath or ownpath == "" then              ownpath = "." -            report_initialization("forcing fallback ownpath .") +            report_initialization("forcing fallback to ownpath %a",ownpath)          elseif trace_locating then -            report_initialization("using ownpath '%s'",ownpath) +            report_initialization("using ownpath %a",ownpath)          end      end diff --git a/tex/context/base/data-lua.lua b/tex/context/base/data-lua.lua index 9e7e7b657..2725c149f 100644 --- a/tex/context/base/data-lua.lua +++ b/tex/context/base/data-lua.lua @@ -77,17 +77,17 @@ local function loadedbyformat(name,rawname,suffixes,islib)      local trace  = helpers.trace      local report = helpers.report      if trace then -        report("! locating %q as %q using formats %q",rawname,name,concat(suffixes)) +        report("! locating %a as %a using formats %a",rawname,name,suffixes)      end      for i=1,#suffixes do -- so we use findfile and not a lookup loop          local format = suffixes[i]          local resolved = resolvers.findfile(name,format) or ""          if trace then -            report("! checking for %q' using format %q",name,format) +            report("! checking for %a using format %a",name,format)          end          if resolved ~= "" then              if trace then -                report("! lib %q located on %q",name,resolved) +                report("! lib %a located on %a",name,resolved)              end              if islib then                  return loadedaslib(resolved,rawname) diff --git a/tex/context/base/data-met.lua b/tex/context/base/data-met.lua index 5437d9a29..28c73e460 100644 --- a/tex/context/base/data-met.lua +++ b/tex/context/base/data-met.lua @@ -59,41 +59,41 @@ local function methodhandler(what,first,...) -- filename can be nil or false              local resolver = namespace and namespace[scheme]              if resolver then                  if trace_methods then -                    report_methods("resolver: method=%s, how=%s, scheme=%s, argument=%s",what,how,scheme,first) +                    report_methods("resolving, method %a, how %a, handler %a, argument %a",what,how,scheme,first)                  end                  return resolver(specification,...)              else                  resolver = namespace.default or namespace.file                  if resolver then                      if trace_methods then -                        report_methods("resolver: method=%s, how=%s, default, argument=%s",what,how,first) +                        report_methods("resolving, method %a, how %a, handler %a, argument %a",what,how,"default",first)                      end                      return resolver(specification,...)                  elseif trace_methods then -                    report_methods("resolver: method=%s, how=%s, no handler",what,how) +                    report_methods("resolving, method %a, how %a, handler %a, argument %a",what,how,"unset")                  end              end          elseif how == "tag" then              local resolver = namespace and namespace[first]              if resolver then                  if trace_methods then -                    report_methods("resolver: method=%s, how=%s, tag=%s",what,how,first) +                    report_methods("resolving, method %a, how %a, tag %a",what,how,first)                  end                  return resolver(...)              else                  resolver = namespace.default or namespace.file                  if resolver then                      if trace_methods then -                        report_methods("resolver: method=%s, how=%s, default",what,how) +                        report_methods("resolving, method %a, how %a, tag %a",what,how,"default")                      end                      return resolver(...)                  elseif trace_methods then -                    report_methods("resolver: method=%s, how=%s, unknown",what,how) +                    report_methods("resolving, method %a, how %a, tag %a",what,how,"unset")                  end              end          end      else -        report_methods("resolver: method=%s, unknown",what) +        report_methods("resolving, invalid method %a")      end  end diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index 02ef35f5f..0e87aeb78 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -14,7 +14,7 @@ if not modules then modules = { } end modules ['data-res'] = {  -- todo: cache:/// home:/// selfautoparent:/// (sometime end 2012) -local format, gsub, find, lower, upper, match, gmatch = string.format, string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch +local gsub, find, lower, upper, match, gmatch = string.gsub, string.find, string.lower, string.upper, string.match, string.gmatch  local concat, insert, sortedkeys = table.concat, table.insert, table.sortedkeys  local next, type, rawget = next, type, rawget  local os = os @@ -22,6 +22,7 @@ local os = os  local P, S, R, C, Cc, Cs, Ct, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct, lpeg.Carg  local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns +local formatters        = string.formatters  local filedirname       = file.dirname  local filebasename      = file.basename  local suffixonly        = file.suffixonly @@ -316,15 +317,11 @@ local function reportcriticalvariables(cnfspec)          for i=1,#resolvers.criticalvars do              local k = resolvers.criticalvars[i]              local v = resolvers.getenv(k) or "unknown" -- this one will not resolve ! -            report_resolving("variable '%s' set to '%s'",k,v) +            report_resolving("variable %a set to %a",k,v)          end          report_resolving()          if cnfspec then -            if type(cnfspec) == "table" then -                report_resolving("using configuration specification '%s'",concat(cnfspec,",")) -            else -                report_resolving("using configuration specification '%s'",cnfspec) -            end +            report_resolving("using configuration specification %a",type(cnfspec) == "table" and concat(cnfspec,",") or cnfspec)          end          report_resolving()      end @@ -350,10 +347,10 @@ local function identify_configuration_files()              if lfs.isfile(realname) then                  specification[#specification+1] = filename                  if trace_locating then -                    report_resolving("found configuration file '%s'",realname) +                    report_resolving("found configuration file %a",realname)                  end              elseif trace_locating then -                report_resolving("unknown configuration file '%s'",realname) +                report_resolving("unknown configuration file %a",realname)              end          end          if trace_locating then @@ -385,7 +382,7 @@ local function load_configuration_files()                      if blob then                          local parentdata = blob()                          if parentdata then -                            report_resolving("loading configuration file '%s'",filename) +                            report_resolving("loading configuration file %a",filename)                              data = table.merged(parentdata,data)                          end                      end @@ -393,7 +390,7 @@ local function load_configuration_files()                  data = data and data.content                  if data then                      if trace_locating then -                        report_resolving("loading configuration file '%s'",filename) +                        report_resolving("loading configuration file %a",filename)                          report_resolving()                      end                      local variables = data.variables or { } @@ -404,7 +401,7 @@ local function load_configuration_files()                              initializesetter(filename,k,v)                          elseif variables[k] == nil then                              if trace_locating and not warning then -                                report_resolving("variables like '%s' in configuration file '%s' should move to the 'variables' subtable", +                                report_resolving("variables like %a in configuration file %a should move to the 'variables' subtable",                                      k,resolvers.resolve(filename))                                  warning = true                              end @@ -436,13 +433,13 @@ local function load_configuration_files()                  else                      if trace_locating then -                        report_resolving("skipping configuration file '%s' (no content)",filename) +                        report_resolving("skipping configuration file %a (no content)",filename)                      end                      setups[pathname] = { }                      instance.loaderror = true                  end              elseif trace_locating then -                report_resolving("skipping configuration file '%s' (no valid format)",filename) +                report_resolving("skipping configuration file %a (no valid format)",filename)              end              instance.order[#instance.order+1] = instance.setups[pathname]              if instance.loaderror then @@ -487,9 +484,9 @@ local function locate_file_databases()                  end                  if trace_locating then                      if runtime then -                        report_resolving("locating list of '%s' (runtime) (%s)",path,stripped) +                        report_resolving("locating list of %a (runtime) (%s)",path,stripped)                      else -                        report_resolving("locating list of '%s' (cached)",path) +                        report_resolving("locating list of %a (cached)",path)                      end                  end                  methodhandler('locators',stripped) @@ -522,11 +519,11 @@ local function save_file_databases() -- will become cachers              local content = instance.files[cachename]              caches.collapsecontent(content)              if trace_locating then -                report_resolving("saving tree '%s'",cachename) +                report_resolving("saving tree %a",cachename)              end              caches.savecontent(cachename,"files",content)          elseif trace_locating then -            report_resolving("not saving runtime tree '%s'",cachename) +            report_resolving("not saving runtime tree %a",cachename)          end      end  end @@ -536,30 +533,30 @@ function resolvers.renew(hashname)          local expanded = resolvers.expansion(hashname) or ""          if expanded ~= "" then              if trace_locating then -                report_resolving("identifying tree '%s' from '%s'",expanded,hashname) +                report_resolving("identifying tree %a from %a",expanded,hashname)              end              hashname = expanded          else              if trace_locating then -                report_resolving("identifying tree '%s'",hashname) +                report_resolving("identifying tree %a",hashname)              end          end          local realpath = resolvers.resolve(hashname)          if lfs.isdir(realpath) then              if trace_locating then -                report_resolving("using path '%s'",realpath) +                report_resolving("using path %a",realpath)              end              methodhandler('generators',hashname)              -- could be shared              local content = instance.files[hashname]              caches.collapsecontent(content)              if trace_locating then -                report_resolving("saving tree '%s'",hashname) +                report_resolving("saving tree %a",hashname)              end              caches.savecontent(hashname,"files",content)              -- till here          else -            report_resolving("invalid path '%s'",realpath) +            report_resolving("invalid path %a",realpath)          end      end  end @@ -584,7 +581,7 @@ function resolvers.appendhash(type,name,cache)      -- safeguard ... tricky as it's actually a bug when seen twice      if not instance.hashed[name] then          if trace_locating then -            report_resolving("hash '%s' appended",name) +            report_resolving("hash %a appended",name)          end          insert(instance.hashes, { type = type, name = name, cache = cache } )          instance.hashed[name] = cache @@ -595,7 +592,7 @@ function resolvers.prependhash(type,name,cache)      -- safeguard ... tricky as it's actually a bug when seen twice      if not instance.hashed[name] then          if trace_locating then -            report_resolving("hash '%s' prepended",name) +            report_resolving("hash %a prepended",name)          end          insert(instance.hashes, 1, { type = type, name = name, cache = cache } )          instance.hashed[name] = cache @@ -840,9 +837,9 @@ local function isreadable(name)      local readable = lfs.isfile(name) -- not file.is_readable(name) asit can be a dir      if trace_detail then          if readable then -            report_resolving("file '%s' is readable",name) +            report_resolving("file %a is readable",name)          else -            report_resolving("file '%s' is not readable", name) +            report_resolving("file %a is not readable", name)          end      end      return readable @@ -856,7 +853,7 @@ local function collect_files(names)      for k=1,#names do          local fname = names[k]          if trace_detail then -            report_resolving("checking name '%s'",fname) +            report_resolving("checking name %a",fname)          end          local bname = filebasename(fname)          local dname = filedirname(fname) @@ -873,7 +870,7 @@ local function collect_files(names)              local files = blobpath and instance.files[blobpath]              if files then                  if trace_detail then -                    report_resolving("deep checking '%s' (%s)",blobpath,bname) +                    report_resolving("deep checking %a (%s)",blobpath,bname)                  end                  local blobfile = files[bname]                  if not blobfile then @@ -893,7 +890,7 @@ local function collect_files(names)                              local search  = filejoin(blobroot,blobfile,bname)                              local result  = methodhandler('concatinators',hash.type,blobroot,blobfile,bname)                              if trace_detail then -                                report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) +                                report_resolving("match: variant %a, search %a, result %a",variant,search,result)                              end                              noffiles = noffiles + 1                              filelist[noffiles] = { variant, search, result } @@ -907,7 +904,7 @@ local function collect_files(names)                                  local search  = filejoin(blobroot,vv,bname)                                  local result  = methodhandler('concatinators',hash.type,blobroot,vv,bname)                                  if trace_detail then -                                    report_resolving("match: variant '%s', search '%s', result '%s'",variant,search,result) +                                    report_resolving("match: variant %a, search %a, result %a",variant,search,result)                                  end                                  noffiles = noffiles + 1                                  filelist[noffiles] = { variant, search, result } @@ -916,7 +913,7 @@ local function collect_files(names)                      end                  end              elseif trace_locating then -                report_resolving("no match in '%s' (%s)",blobpath,bname) +                report_resolving("no match in %a (%s)",blobpath,bname)              end          end      end @@ -978,13 +975,13 @@ local function find_analyze(filename,askedformat,allresults)                  wantedfiles[#wantedfiles+1] = forcedname                  filetype = resolvers.formatofsuffix(forcedname)                  if trace_locating then -                    report_resolving("forcing filetype '%s'",filetype) +                    report_resolving("forcing filetype %a",filetype)                  end              end          else              filetype = resolvers.formatofsuffix(filename)              if trace_locating then -                report_resolving("using suffix based filetype '%s'",filetype) +                report_resolving("using suffix based filetype %a",filetype)              end          end      else @@ -998,7 +995,7 @@ local function find_analyze(filename,askedformat,allresults)          end          filetype = askedformat          if trace_locating then -            report_resolving("using given filetype '%s'",filetype) +            report_resolving("using given filetype %a",filetype)          end      end      return filetype, wantedfiles @@ -1007,7 +1004,7 @@ end  local function find_direct(filename,allresults)      if not dangerous[askedformat] and isreadable(filename) then          if trace_detail then -            report_resolving("file '%s' found directly",filename) +            report_resolving("file %a found directly",filename)          end          return "direct", { filename }      end @@ -1016,7 +1013,7 @@ end  local function find_wildcard(filename,allresults)      if find(filename,'%*') then          if trace_locating then -            report_resolving("checking wildcard '%s'", filename) +            report_resolving("checking wildcard %a", filename)          end          local method, result = resolvers.findwildcardfiles(filename)          if result then @@ -1030,16 +1027,16 @@ local function find_qualified(filename,allresults) -- this one will be split too          return      end      if trace_locating then -        report_resolving("checking qualified name '%s'", filename) +        report_resolving("checking qualified name %a", filename)      end      if isreadable(filename) then          if trace_detail then -            report_resolving("qualified file '%s' found", filename) +            report_resolving("qualified file %a found", filename)          end          return "qualified", { filename }      end      if trace_detail then -        report_resolving("locating qualified file '%s'", filename) +        report_resolving("locating qualified file %a", filename)      end      local forcedname, suffix = "", suffixonly(filename)      if suffix == "" then -- why @@ -1050,7 +1047,7 @@ local function find_qualified(filename,allresults) -- this one will be split too                  forcedname = filename .. "." .. s                  if isreadable(forcedname) then                      if trace_locating then -                        report_resolving("no suffix, forcing format filetype '%s'", s) +                        report_resolving("no suffix, forcing format filetype %a", s)                      end                      return "qualified", { forcedname }                  end @@ -1114,7 +1111,7 @@ end  local function check_subpath(fname)      if isreadable(fname) then          if trace_detail then -            report_resolving("found '%s' by deep scanning",fname) +            report_resolving("found %a by deep scanning",fname)          end          return fname      end @@ -1134,7 +1131,7 @@ local function find_intree(filename,filetype,wantedfiles,allresults)              end          end          if trace_detail then -            report_resolving("checking filename '%s'",filename) +            report_resolving("checking filename %a",filename)          end          local result = { }          for k=1,#pathlist do @@ -1150,7 +1147,7 @@ local function find_intree(filename,filetype,wantedfiles,allresults)                  -- compare list entries with permitted pattern -- /xx /xx//                  local expression = makepathexpression(pathname)                  if trace_detail then -                    report_resolving("using pattern '%s' for path '%s'",expression,pathname) +                    report_resolving("using pattern %a for path %a",expression,pathname)                  end                  for k=1,#filelist do                      local fl = filelist[k] @@ -1162,16 +1159,16 @@ local function find_intree(filename,filetype,wantedfiles,allresults)                          done = true                          if allresults then                              if trace_detail then -                                report_resolving("match to '%s' in hash for file '%s' and path '%s', continue scanning",expression,f,d) +                                report_resolving("match to %a in hash for file %a and path %a, continue scanning",expression,f,d)                              end                          else                              if trace_detail then -                                report_resolving("match to '%s' in hash for file '%s' and path '%s', quit scanning",expression,f,d) +                                report_resolving("match to %a in hash for file %a and path %a, quit scanning",expression,f,d)                              end                              break                          end                      elseif trace_detail then -                        report_resolving("no match to '%s' in hash for file '%s' and path '%s'",expression,f,d) +                        report_resolving("no match to %a in hash for file %a and path %a",expression,f,d)                      end                  end              end @@ -1256,7 +1253,7 @@ end  local function find_onpath(filename,filetype,wantedfiles,allresults)      if trace_detail then -        report_resolving("checking filename '%s', filetype '%s', wanted files '%s'",filename, filetype or '?',concat(wantedfiles," | ")) +        report_resolving("checking filename %a, filetype %a, wanted files %a",filename,filetype,concat(wantedfiles," | "))      end      local result = { }      for k=1,#wantedfiles do @@ -1309,7 +1306,7 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste                          result[#result+1] = c                          done[c] = true                      end -                    status[#status+1] = format("%-10s: %s",method,c) +                    status[#status+1] = formatters["%-10s: %s"](method,c)                  end              end          end @@ -1320,11 +1317,11 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste      else          local method, result, stamp, filetype, wantedfiles          if instance.remember then -            stamp = format("%s--%s", filename, askedformat) +            stamp = formatters["%s--%s"](filename,askedformat)              result = stamp and instance.found[stamp]              if result then                  if trace_locating then -                    report_resolving("remembered file '%s'",filename) +                    report_resolving("remembered file %a",filename)                  end                  return result              end @@ -1355,7 +1352,7 @@ collect_instance_files = function(filename,askedformat,allresults) -- uses neste          end          if stamp then              if trace_locating then -                report_resolving("remembering file '%s'",filename) +                report_resolving("remembering file %a",filename)              end              instance.found[stamp] = result          end diff --git a/tex/context/base/data-sch.lua b/tex/context/base/data-sch.lua index 7eb254557..41b941c5a 100644 --- a/tex/context/base/data-sch.lua +++ b/tex/context/base/data-sch.lua @@ -46,7 +46,7 @@ directives.register("schemes.cleanmethod", function(v) cleaner = cleaners[v] or  function resolvers.schemes.cleanname(specification)      local hash = cleaner(specification)      if trace_schemes then -        report_schemes("hashing %s to %s",specification.original,hash) +        report_schemes("hashing %a to %a",specification.original,hash)      end      return hash  end @@ -70,13 +70,13 @@ local function fetch(specification)              local handler = handlers[scheme]              if handler then                  if trace_schemes then -                    report_schemes("fetching '%s', protocol '%s', method 'built-in'",original,scheme) +                    report_schemes("fetching %a, protocol %a, method %a",original,scheme,"built-in")                  end                  logs.flush()                  handler(specification,cachename)              else                  if trace_schemes then -                    report_schemes("fetching '%s', protocol '%s', method 'curl'",original,scheme) +                    report_schemes("fetching %a, protocol %a, method %a",original,scheme,"curl")                  end                  logs.flush()                  runcurl(original,cachename) @@ -85,19 +85,19 @@ local function fetch(specification)          if io.exists(cachename) then              cached[original] = cachename              if trace_schemes then -                report_schemes("using cached '%s', protocol '%s', cachename '%s'",original,scheme,cachename) +                report_schemes("using cached %a, protocol %a, cachename %a",original,scheme,cachename)              end          else              cached[original] = ""              if trace_schemes then -                report_schemes("using missing '%s', protocol '%s'",original,scheme) +                report_schemes("using missing %a, protocol %a",original,scheme)              end          end          loaded[scheme] = loaded[scheme] + 1          statistics.stoptiming(schemes)      else          if trace_schemes then -            report_schemes("reusing '%s', protocol '%s'",original,scheme) +            report_schemes("reusing %a, protocol %a",original,scheme)          end          reused[scheme] = reused[scheme] + 1      end diff --git a/tex/context/base/data-tex.lua b/tex/context/base/data-tex.lua index 6ba742cce..f5c986d77 100644 --- a/tex/context/base/data-tex.lua +++ b/tex/context/base/data-tex.lua @@ -73,7 +73,7 @@ function helpers.textopener(tag,filename,filehandle,coding)      if type(lines) == "string" then          local coding = coding or utffiletype(lines) -- so we can signal no regime          if trace_locating then -            report_tex("%s opener, '%s' opened using method '%s'",tag,filename,coding) +            report_tex("%a opener: %a opened using method %a",tag,filename,coding)          end          if coding == "utf-16-be" then              lines = utf.utf16_to_utf8_be(lines) @@ -91,7 +91,7 @@ function helpers.textopener(tag,filename,filehandle,coding)              lines = splitlines(lines)          end      elseif trace_locating then -        report_tex("%s opener, '%s' opened",tag,filename) +        report_tex("%a opener: %a opened",tag,filename)      end      local noflines = #lines      if lines[noflines] == "" then -- maybe some special check is needed @@ -105,7 +105,7 @@ function helpers.textopener(tag,filename,filehandle,coding)          currentline = 0,          close       = function()              if trace_locating then -                report_tex("%s closer, '%s' closed",tag,filename) +                report_tex("%a closer: %a closed",tag,filename)              end              logs.show_close(filename)              remove(inputstack) @@ -167,7 +167,7 @@ local function installhandler(namespace,what,where,func)      if where == "before" or where == "after" then          sequencers.appendaction(namespace,where,func)      else -        report_tex("installing input %s handlers in %s is not possible",what,tostring(where)) +        report_tex("installing input %a handlers in %a is not possible",what,tostring(where))      end  end @@ -176,8 +176,8 @@ function resolvers.installinputfilehandler(...) installhandler(helpers.textfilea  -- local basename = file.basename  -- resolvers.installinputlinehandler(function(str,filename,linenumber,noflines) ---     report_tex("[lc] file: %s, line: %s of %s, length: %s",basename(filename),linenumber,noflines,#str) +--     report_tex("[lc] file %a, line %a of %a, length %a",basename(filename),linenumber,noflines,#str)  -- end)  -- resolvers.installinputfilehandler(function(str,filename) ---     report_tex("[fc] file: %s, length: %s",basename(filename),#str) +--     report_tex("[fc] file %a, length %a",basename(filename),#str)  -- end) diff --git a/tex/context/base/data-tmf.lua b/tex/context/base/data-tmf.lua index 75dcdd956..c52225193 100644 --- a/tex/context/base/data-tmf.lua +++ b/tex/context/base/data-tmf.lua @@ -30,11 +30,11 @@ function resolvers.load_tree(tree,resolve)          local newpath = file.join(newtree,"bin")          if not lfs.isdir(newtree) then -            report_tds("no '%s' under tree %s",texos,tree) +            report_tds("no %a under tree %a",texos,tree)              os.exit()          end          if not lfs.isdir(newpath) then -            report_tds("no '%s/bin' under tree %s",texos,tree) +            report_tds("no '%s/bin' under tree %a",texos,tree)              os.exit()          end @@ -65,9 +65,9 @@ function resolvers.load_tree(tree,resolve)          setenv('TEXMFCNF',       resolvers.luacnfspec,true) -- already resolved          setenv('PATH',           newpath .. io.pathseparator .. getenv('PATH')) -        report_tds("changing from root '%s' to '%s'",oldroot,newroot) -        report_tds("prepending '%s' to PATH",newpath) -        report_tds("setting TEXMFCNF to '%s'",resolvers.luacnfspec) +        report_tds("changing from root %a to %a",oldroot,newroot) +        report_tds("prepending %a to PATH",newpath) +        report_tds("setting TEXMFCNF to %a",resolvers.luacnfspec)          report_tds()      end  end diff --git a/tex/context/base/data-tmp.lua b/tex/context/base/data-tmp.lua index c71002f2b..6246bfb61 100644 --- a/tex/context/base/data-tmp.lua +++ b/tex/context/base/data-tmp.lua @@ -93,7 +93,7 @@ local function identify()                          if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then                              mkdirs(cachepath)                              if isdir(cachepath) and is_writable(cachepath) then -                                report_caches("created: %s",cachepath) +                                report_caches("path %a created",cachepath)                                  writable = cachepath                                  readables[#readables+1] = cachepath                              end @@ -152,9 +152,9 @@ local function identify()      -- end      if trace_cache then          for i=1,#readables do -            report_caches("using readable path '%s' (order %s)",readables[i],i) +            report_caches("using readable path %a (order %s)",readables[i],i)          end -        report_caches("using writable path '%s'",writable) +        report_caches("using writable path %a",writable)      end      identify = function()          return writable, readables @@ -169,10 +169,10 @@ function caches.usedpaths()          for i=1,#readables do              local readable = readables[i]              if usedreadables[i] or readable == writable then -                result[#result+1] = format("readable: '%s' (order %s)",readable,i) +                result[#result+1] = format("readable: %a (order %s)",readable,i)              end          end -        result[#result+1] = format("writable: '%s'",writable) +        result[#result+1] = format("writable: %a",writable)          return result      else          return writable @@ -188,7 +188,7 @@ function caches.hashed(tree)      tree = lower(tree)      local hash = md5.hex(tree)      if trace_cache or trace_locating then -        report_caches("hashing tree %s, hash %s",tree,hash) +        report_caches("hashing tree %a, hash %a",tree,hash)      end      return hash  end @@ -340,20 +340,20 @@ function caches.loadcontent(cachename,dataname)                  if data.version == resolvers.cacheversion then                      content_state[#content_state+1] = data.uuid                      if trace_locating then -                        report_resolvers("loading '%s' for '%s' from '%s'",dataname,cachename,filename) +                        report_resolvers("loading %a for %a from %a",dataname,cachename,filename)                      end                      return data.content                  else -                    report_resolvers("skipping '%s' for '%s' from '%s' (version mismatch)",dataname,cachename,filename) +                    report_resolvers("skipping %a for %a from %a (version mismatch)",dataname,cachename,filename)                  end              else -                report_resolvers("skipping '%s' for '%s' from '%s' (datatype mismatch)",dataname,cachename,filename) +                report_resolvers("skipping %a for %a from %a (datatype mismatch)",dataname,cachename,filename)              end          elseif trace_locating then -            report_resolvers("skipping '%s' for '%s' from '%s' (no content)",dataname,cachename,filename) +            report_resolvers("skipping %a for %a from %a (no content)",dataname,cachename,filename)          end      elseif trace_locating then -        report_resolvers("skipping '%s' for '%s' from '%s' (invalid file)",dataname,cachename,filename) +        report_resolvers("skipping %a for %a from %a (invalid file)",dataname,cachename,filename)      end  end @@ -372,7 +372,7 @@ function caches.savecontent(cachename,dataname,content)      local luaname = addsuffix(filename,luasuffixes.lua)      local lucname = addsuffix(filename,luasuffixes.luc)      if trace_locating then -        report_resolvers("preparing '%s' for '%s'",dataname,cachename) +        report_resolvers("preparing %a for %a",dataname,cachename)      end      local data = {          type    = dataname, @@ -386,20 +386,20 @@ function caches.savecontent(cachename,dataname,content)      local ok = io.savedata(luaname,serialize(data,true))      if ok then          if trace_locating then -            report_resolvers("category '%s', cachename '%s' saved in '%s'",dataname,cachename,luaname) +            report_resolvers("category %a, cachename %a saved in %a",dataname,cachename,luaname)          end          if utilities.lua.compile(luaname,lucname) then              if trace_locating then -                report_resolvers("'%s' compiled to '%s'",dataname,lucname) +                report_resolvers("%a compiled to %a",dataname,lucname)              end              return true          else              if trace_locating then -                report_resolvers("compiling failed for '%s', deleting file '%s'",dataname,lucname) +                report_resolvers("compiling failed for %a, deleting file %a",dataname,lucname)              end              os.remove(lucname)          end      elseif trace_locating then -        report_resolvers("unable to save '%s' in '%s' (access error)",dataname,luaname) +        report_resolvers("unable to save %a in %a (access error)",dataname,luaname)      end  end diff --git a/tex/context/base/data-tre.lua b/tex/context/base/data-tre.lua index 1b916bf26..0a8b00d9b 100644 --- a/tex/context/base/data-tre.lua +++ b/tex/context/base/data-tre.lua @@ -51,18 +51,18 @@ function resolvers.locators.tree(specification)      local realname = resolvers.resolve(name) -- no shortcut      if realname and realname ~= '' and lfs.isdir(realname) then          if trace_locating then -            report_trees("locator '%s' found",realname) +            report_trees("locator %a found",realname)          end          resolvers.appendhash('tree',name,false) -- don't cache      elseif trace_locating then -        report_trees("locator '%s' not found",name) +        report_trees("locator %a not found",name)      end  end  function resolvers.hashers.tree(specification)      local name = specification.filename      if trace_locating then -        report_trees("analysing '%s'",name) +        report_trees("analysing %a",name)      end      resolvers.methodhandler("hashers",name) diff --git a/tex/context/base/data-use.lua b/tex/context/base/data-use.lua index fb6798900..9c15263bb 100644 --- a/tex/context/base/data-use.lua +++ b/tex/context/base/data-use.lua @@ -35,7 +35,7 @@ function resolvers.automount(usecache)                              -- skip                          elseif find(line,"^zip://") then                              if trace_locating then -                                report_mounts("mounting %s",line) +                                report_mounts("mounting %a",line)                              end                              table.insert(resolvers.automounted,line)                              resolvers.usezipfile(line) diff --git a/tex/context/base/data-vir.lua b/tex/context/base/data-vir.lua index dff780fc7..e5bf35fa7 100644 --- a/tex/context/base/data-vir.lua +++ b/tex/context/base/data-vir.lua @@ -27,7 +27,7 @@ function savers.virtual(specification,content)      local path = specification.path      local filename = format(template,path ~= "" and path or "virtualfile",n)      if trace_virtual then -        report_virtual("saver: file '%s' saved",filename) +        report_virtual("saver: file %a saved",filename)      end      data[filename] = content      return filename @@ -38,12 +38,12 @@ function finders.virtual(specification)      local d = data[original]      if d then          if trace_virtual then -            report_virtual("finder: file '%s' found",original) +            report_virtual("finder: file %a found",original)          end          return original      else          if trace_virtual then -            report_virtual("finder: unknown file '%s'",original) +            report_virtual("finder: unknown file %a",original)          end          return finders.notfound()      end @@ -54,14 +54,14 @@ function openers.virtual(specification)      local d = data[original]      if d then          if trace_virtual then -            report_virtual("opener, file '%s' opened",original) +            report_virtual("opener: file %a opened",original)          end          data[original] = nil -- when we comment this we can have error messages          -- With utf-8 we signal that no regime is to be applied!          return openers.helpers.textopener("virtual",original,d,"utf-8")      else          if trace_virtual then -            report_virtual("opener, file '%s' not found",original) +            report_virtual("opener: file %a not found",original)          end          return openers.notfound()      end @@ -72,13 +72,13 @@ function loaders.virtual(specification)      local d = data[original]      if d then          if trace_virtual then -            report_virtual("loader, file '%s' loaded",original) +            report_virtual("loader: file %a loaded",original)          end          data[original] = nil          return true, d, #d      end      if trace_virtual then -        report_virtual("loader, file '%s' not loaded",original) +        report_virtual("loader: file %a not loaded",original)      end      return loaders.notfound()  end diff --git a/tex/context/base/data-zip.lua b/tex/context/base/data-zip.lua index 7e8ea3a39..5db69670c 100644 --- a/tex/context/base/data-zip.lua +++ b/tex/context/base/data-zip.lua @@ -83,9 +83,9 @@ function resolvers.locators.zip(specification)      local zipfile = archive and archive ~= "" and zip.openarchive(archive) -- tricky, could be in to be initialized tree      if trace_locating then          if zipfile then -            report_zip("locator, archive '%s' found",archive) +            report_zip("locator: archive %a found",archive)          else -            report_zip("locator, archive '%s' not found",archive) +            report_zip("locator: archive %a not found",archive)          end      end  end @@ -93,7 +93,7 @@ end  function resolvers.hashers.zip(specification)      local archive = specification.filename      if trace_locating then -        report_zip("loading file '%s'",archive) +        report_zip("loading file %a",archive)      end      resolvers.usezipfile(specification.original)  end @@ -116,25 +116,25 @@ function resolvers.finders.zip(specification)              local zfile = zip.openarchive(archive)              if zfile then                  if trace_locating then -                    report_zip("finder, archive '%s' found",archive) +                    report_zip("finder: archive %a found",archive)                  end                  local dfile = zfile:open(queryname)                  if dfile then                      dfile = zfile:close()                      if trace_locating then -                        report_zip("finder, file '%s' found",queryname) +                        report_zip("finder: file %a found",queryname)                      end                      return specification.original                  elseif trace_locating then -                    report_zip("finder, file '%s' not found",queryname) +                    report_zip("finder: file %a not found",queryname)                  end              elseif trace_locating then -                report_zip("finder, unknown archive '%s'",archive) +                report_zip("finder: unknown archive %a",archive)              end          end      end      if trace_locating then -        report_zip("finder, '%s' not found",original) +        report_zip("finder: %a not found",original)      end      return resolvers.finders.notfound()  end @@ -149,24 +149,24 @@ function resolvers.openers.zip(specification)              local zfile = zip.openarchive(archive)              if zfile then                  if trace_locating then -                    report_zip("opener, archive '%s' opened",archive) +                    report_zip("opener; archive %a opened",archive)                  end                  local dfile = zfile:open(queryname)                  if dfile then                      if trace_locating then -                        report_zip("opener, file '%s' found",queryname) +                        report_zip("opener: file %a found",queryname)                      end                      return resolvers.openers.helpers.textopener('zip',original,dfile)                  elseif trace_locating then -                    report_zip("opener, file '%s' not found",queryname) +                    report_zip("opener: file %a not found",queryname)                  end              elseif trace_locating then -                report_zip("opener, unknown archive '%s'",archive) +                report_zip("opener: unknown archive %a",archive)              end          end      end      if trace_locating then -        report_zip("opener, '%s' not found",original) +        report_zip("opener: %a not found",original)      end      return resolvers.openers.notfound()  end @@ -181,27 +181,27 @@ function resolvers.loaders.zip(specification)              local zfile = zip.openarchive(archive)              if zfile then                  if trace_locating then -                    report_zip("loader, archive '%s' opened",archive) +                    report_zip("loader: archive %a opened",archive)                  end                  local dfile = zfile:open(queryname)                  if dfile then                      logs.show_load(original)                      if trace_locating then -                        report_zip("loader, file '%s' loaded",original) +                        report_zip("loader; file %a loaded",original)                      end                      local s = dfile:read("*all")                      dfile:close()                      return true, s, #s                  elseif trace_locating then -                    report_zip("loader, file '%s' not found",queryname) +                    report_zip("loader: file %a not found",queryname)                  end              elseif trace_locating then -                report_zip("loader, unknown archive '%s'",archive) +                report_zip("loader; unknown archive %a",archive)              end          end      end      if trace_locating then -        report_zip("loader, '%s' not found",original) +        report_zip("loader: %a not found",original)      end      return resolvers.openers.notfound()  end @@ -218,7 +218,7 @@ function resolvers.usezipfile(archive)              local instance = resolvers.instance              local tree = url.query(specification.query).tree or ""              if trace_locating then -                report_zip("registering, registering archive '%s'",archive) +                report_zip("registering: archive %a",archive)              end              statistics.starttiming(instance)              resolvers.prependhash('zip',archive) @@ -227,10 +227,10 @@ function resolvers.usezipfile(archive)              instance.files[archive] = resolvers.registerzipfile(z,tree)              statistics.stoptiming(instance)          elseif trace_locating then -            report_zip("registering, unknown archive '%s'",archive) +            report_zip("registering: unknown archive %a",archive)          end      elseif trace_locating then -        report_zip("registering, '%s' not found",archive) +        report_zip("registering: archive %a not found",archive)      end  end @@ -242,7 +242,7 @@ function resolvers.registerzipfile(z,tree)          filter = format("^%s/(.+)/(.-)$",tree)      end      if trace_locating then -        report_zip("registering, using filter '%s'",filter) +        report_zip("registering: using filter %a",filter)      end      local register, n = resolvers.registerfile, 0      for i in z:files() do @@ -259,6 +259,6 @@ function resolvers.registerzipfile(z,tree)              n = n + 1          end      end -    report_zip("registering, %s files registered",n) +    report_zip("registering: %s files registered",n)      return files  end diff --git a/tex/context/base/file-job.lua b/tex/context/base/file-job.lua index b5c4b2b05..780438dc8 100644 --- a/tex/context/base/file-job.lua +++ b/tex/context/base/file-job.lua @@ -162,7 +162,7 @@ end  local function startprocessing(name,notext)      if not notext then -     -- report_system("begin file %s at line %s",name,status.linenumber or 0) +     -- report_system("begin file %a at line %a",name,status.linenumber or 0)          context.dostarttextfile(name)      end  end @@ -170,14 +170,14 @@ end  local function stopprocessing(notext)      if not notext then          context.dostoptextfile() -     -- report_system("end file %s at line %s",name,status.linenumber or 0) +     -- report_system("end file %a at line %a",name,status.linenumber or 0)      end  end  --  local action  = function(name,foundname) input(foundname) end -local failure = function(name,foundname) report_jobfiles("unknown tex file %q",name) end +local failure = function(name,foundname) report_jobfiles("unknown %s file %a","tex",name) end  local function usetexfile(name,onlyonce,notext)      startprocessing(name,notext) @@ -192,7 +192,7 @@ local function usetexfile(name,onlyonce,notext)  end  local action  = function(name,foundname) dofile(foundname) end -local failure = function(name,foundname) report_jobfiles("unknown lua file %q",name) end +local failure = function(name,foundname) report_jobfiles("unknown %s file %a","lua",name) end  local function useluafile(name,onlyonce,notext)      uselibrary { @@ -205,7 +205,7 @@ local function useluafile(name,onlyonce,notext)  end  local action  = function(name,foundname) dofile(foundname) end -local failure = function(name,foundname) report_jobfiles("unknown cld file %q",name) end +local failure = function(name,foundname) report_jobfiles("unknown %s file %a","cld",name) end  local function usecldfile(name,onlyonce,notext)      startprocessing(name,notext) @@ -220,7 +220,7 @@ local function usecldfile(name,onlyonce,notext)  end  local action  = function(name,foundname) context.xmlprocess(foundname,"main","") end -local failure = function(name,foundname) report_jobfiles("unknown xml file %q",name) end +local failure = function(name,foundname) report_jobfiles("unknown %s file %a","xml",name) end  local function usexmlfile(name,onlyonce,notext)      startprocessing(name,notext) @@ -581,11 +581,11 @@ local function process(what,name)          local method = process[1]          if method == "none" then              if trace_jobfiles then -                report_jobfiles("%s : %s : ignoring %s '%s' in %s '%s'",depth,method,what,name,currenttype,topofstack(currenttype)) +                report_jobfiles("%s : %s : %s %s %a in %s %a",depth,method,"ignoring",what,name,currenttype,topofstack(currenttype))              end          elseif method == "once" and done[name] then              if trace_jobfiles then -                report_jobfiles("%s : %s : skipping %s '%s' in %s '%s'",depth,method,what,name,currenttype,topofstack(currenttype)) +                report_jobfiles("%s : %s : %s %s %a in %s %a",depth,method,"skipping",what,name,currenttype,topofstack(currenttype))              end          else              -- keep in mind that we also handle "once" at the file level @@ -594,7 +594,7 @@ local function process(what,name)              local before = start[what]              local after  = stop [what]              if trace_jobfiles then -                report_jobfiles("%s : %s : processing %s '%s' in %s '%s'",depth,method,what,name,currenttype,topofstack(currenttype)) +                report_jobfiles("%s : %s : %s %s %a in %s %a",depth,method,"processing",what,name,currenttype,topofstack(currenttype))              end              if before then                  before() @@ -606,7 +606,7 @@ local function process(what,name)          end      else          if trace_jobfiles then -            report_jobfiles("%s : ? : ignoring %s '%s' in %s '%s'",depth,what,name,currenttype,topofstack(currenttype)) +            report_jobfiles("%s : %s : %s %s %a in %s %a",depth,"none","ignoring",what,name,currenttype,topofstack(currenttype))          end      end  end @@ -712,10 +712,10 @@ function commands.loadexamodes(filename)      end      filename = resolvers.findfile(addsuffix(filename,'ctm')) or ""      if filename ~= "" then -        report_examodes("loading %s",filename) -- todo: message system +        report_examodes("loading %a",filename) -- todo: message system          convertexamodes(io.loaddata(filename))      else -        report_examodes("no mode file %s",filename) -- todo: message system +        report_examodes("no mode file %a",filename) -- todo: message system      end  end @@ -924,7 +924,7 @@ end  function commands.doifelsecontinuewithfile(inpname)      local continue = addsuffix(inpname,"tex") == addsuffix(environment.inputfilename,"tex")      if continue then -        report_system("continuing input file %q",inpname) +        report_system("continuing input file %a",inpname)      end      commands.doifelse(continue)  end diff --git a/tex/context/base/file-lib.lua b/tex/context/base/file-lib.lua index c99c2ac41..3311321c5 100644 --- a/tex/context/base/file-lib.lua +++ b/tex/context/base/file-lib.lua @@ -18,11 +18,11 @@ local loaded          = { }  local defaultpatterns = { "%s" }  local function defaultaction(name,foundname) -    report_files("asked name: '%s', found name: '%s'",name,foundname) +    report_files("asked name %a, found name %a",name,foundname)  end  local function defaultfailure(name) -    report_files("asked name: '%s', not found",name) +    report_files("asked name %a, not found",name)  end  function commands.uselibrary(specification) -- todo; reporter diff --git a/tex/context/base/file-mod.lua b/tex/context/base/file-mod.lua index cfc60cfb7..3659d3089 100644 --- a/tex/context/base/file-mod.lua +++ b/tex/context/base/file-mod.lua @@ -43,19 +43,19 @@ local function usemodule(name,hasscheme)          -- so we only add one if missing          local fullname = file.addsuffix(name,"tex")          if trace_modules then -            report_modules("checking url: '%s'",fullname) +            report_modules("checking url %a",fullname)          end          foundname = resolvers.findtexfile(fullname) or ""      elseif file.suffix(name) ~= "" then          if trace_modules then -            report_modules("checking file: '%s'",name) +            report_modules("checking file %a",name)          end          foundname = findbyscheme("any",name) or ""      else          for i=1,#suffixes do              local fullname = file.addsuffix(name,suffixes[i])              if trace_modules then -                report_modules("checking file: '%s'",fullname) +                report_modules("checking file %a",fullname)              end              foundname = findbyscheme("any",fullname) or ""              if foundname ~= "" then @@ -65,7 +65,7 @@ local function usemodule(name,hasscheme)      end      if foundname ~= "" then          if trace_modules then -            report_modules("loading: '%s'",foundname) +            report_modules("loading file %a",foundname)          end          context.startreadingfile()          resolvers.jobs.usefile(foundname,true) -- once, notext @@ -88,7 +88,7 @@ function commands.usemodules(prefix,askedname,truename)          status = status + 1      else          if trace_modules then -            report_modules("locating: prefix: '%s', askedname: '%s', truename: '%s'",prefix or "", askedname or "", truename or "") +            report_modules("locating, prefix %a, askedname %a, truename %a",prefix,askedname,truename)          end          local hasscheme = url.hasscheme(truename)          if hasscheme then @@ -123,11 +123,11 @@ function commands.usemodules(prefix,askedname,truename)          end      end      if status == 0 then -        report_modules("not found: '%s'",askedname) +        report_modules("%a is not found",askedname)      elseif status == 1 then -        report_modules("loaded: '%s'",trace_modules and truename or askedname) +        report_modules("%a is loaded",trace_modules and truename or askedname)      else -        report_modules("already loaded: '%s'",trace_modules and truename or askedname) +        report_modules("%a is already loaded",trace_modules and truename or askedname)      end      modstatus[hashname] = status  end @@ -145,9 +145,13 @@ statistics.register("loaded tex modules", function()                  t[nt] = k              end          end -        local ts = nt > 0 and format(" (%s)",concat(t," ")) or "" -        local fs = nf > 0 and format(" (%s)",concat(f," ")) or "" -        return format("%s requested, %s found%s, %s missing%s",nt+nf,nt,ts,nf,fs) +        if nf == 0 then +            return format("%s requested, all found (%s)",nt,concat(t," ")) +        elseif nt == 0 then +            return format("%s requested, all missing (%s)",nf,concat(f," ")) +        else +            return format("%s requested, %s found (%s), %s missing (%s)",nt+nf,nt,concat(t," "),nf,concat(f," ")) +        end      else          return nil      end diff --git a/tex/context/base/file-res.lua b/tex/context/base/file-res.lua index 84c32b02f..8e65ba4c7 100644 --- a/tex/context/base/file-res.lua +++ b/tex/context/base/file-res.lua @@ -37,7 +37,7 @@ local function readfilename(specification,backtrack,treetoo)                  names[i] = name .. "." .. defaultsuffixes[i]              end              if trace_files then -                report_files("locating: %s, using default suffixes: %s",name,table.concat(defaultsuffixes," ")) +                report_files("locating: %s, using default suffixes: %a",name,defaultsuffixes)              end          end          for i=1,#names do diff --git a/tex/context/base/font-afm.lua b/tex/context/base/font-afm.lua index dab948b32..cb0c2438f 100644 --- a/tex/context/base/font-afm.lua +++ b/tex/context/base/font-afm.lua @@ -216,7 +216,7 @@ local function get_indexes(data,pfbname)              local glyphs = pfbdata.glyphs              if glyphs then                  if trace_loading then -                    report_afm("getting index data from %s",pfbname) +                    report_afm("getting index data from %a",pfbname)                  end                  for index, glyph in next, glyphs do                      local name = glyph.name @@ -224,21 +224,21 @@ local function get_indexes(data,pfbname)                          local char = characters[name]                          if char then                              if trace_indexing then -                                report_afm("glyph %s has index %s",name,index) +                                report_afm("glyph %a has index %a",name,index)                              end                              char.index = index                          end                      end                  end              elseif trace_loading then -                report_afm("no glyph data in pfb file %s",pfbname) +                report_afm("no glyph data in pfb file %a",pfbname)              end          elseif trace_loading then -            report_afm("no data in pfb file %s",pfbname) +            report_afm("no data in pfb file %a",pfbname)          end          fontloader.close(pfbblob)      elseif trace_loading then -        report_afm("invalid pfb file %s",pfbname) +        report_afm("invalid pfb file %a",pfbname)      end  end @@ -292,7 +292,7 @@ local function readafm(filename)          return data      else          if trace_loading then -            report_afm("no valid afm file %s",filename) +            report_afm("no valid afm file %a",filename)          end          return nil      end @@ -327,36 +327,36 @@ function afm.load(filename)              pfbtime = attr.modification or 0          end          if not data or data.size ~= size or data.time ~= time or data.pfbsize ~= pfbsize or data.pfbtime ~= pfbtime then -            report_afm( "reading %s",filename) +            report_afm("reading %a",filename)              data = readafm(filename)              if data then                  if pfbname ~= "" then                      get_indexes(data,pfbname)                  elseif trace_loading then -                    report_afm("no pfb file for %s",filename) +                    report_afm("no pfb file for %a",filename)                  end -                report_afm( "unifying %s",filename) +                report_afm("unifying %a",filename)                  unify(data,filename)                  if afm.addligatures then -                    report_afm( "add ligatures") +                    report_afm("add ligatures")                      addligatures(data)                  end                  if afm.addtexligatures then -                    report_afm( "add tex ligatures") +                    report_afm("add tex ligatures")                      addtexligatures(data)                  end                  if afm.addkerns then -                    report_afm( "add extra kerns") +                    report_afm("add extra kerns")                      addkerns(data)                  end                  normalize(data) -                report_afm( "add tounicode data") +                report_afm("add tounicode data")                  fonts.mappings.addtounicode(data,filename)                  data.size = size                  data.time = time                  data.pfbsize = pfbsize                  data.pfbtime = pfbtime -                report_afm("saving: %s in cache",name) +                report_afm("saving %a in cache",name)                  data = containers.write(afm.cache, name, data)                  data = containers.read(afm.cache,name)              end @@ -381,7 +381,7 @@ unify = function(data, filename)              if not code then                  code = private                  private = private + 1 -                report_afm("assigning private slot U+%05X for unknown glyph name %s", code, name) +                report_afm("assigning private slot %U for unknown glyph name %a",code,name)              end          end          local index = blob.index @@ -721,13 +721,13 @@ local function afmtotfm(specification)      local afmname = specification.filename or specification.name      if specification.forced == "afm" or specification.format == "afm" then -- move this one up          if trace_loading then -            report_afm("forcing afm format for %s",afmname) +            report_afm("forcing afm format for %a",afmname)          end      else          local tfmname = findbinfile(afmname,"ofm") or ""          if tfmname ~= "" then              if trace_loading then -                report_afm("fallback from afm to tfm for %s",afmname) +                report_afm("fallback from afm to tfm for %a",afmname)              end              return -- just that          end @@ -757,7 +757,7 @@ local function afmtotfm(specification)                      shared.processes = afm.setfeatures(tfmdata,features)                  end              elseif trace_loading then -                report_afm("no (valid) afm file found with name %s",afmname) +                report_afm("no (valid) afm file found with name %a",afmname)              end              tfmdata = containers.write(constructors.cache,cache_id,tfmdata)          end @@ -923,7 +923,7 @@ local function check_afm(specification,fullname)              if shortname ~= "" then                  foundname = shortname                  if trace_defining then -                    report_afm("stripping encoding prefix from filename %s",afmname) +                    report_afm("stripping encoding prefix from filename %a",afmname)                  end              end          end @@ -963,7 +963,7 @@ end  function readers.pfb(specification,method) -- only called when forced      local original = specification.specification      if trace_defining then -        report_afm("using afm reader for '%s'",original) +        report_afm("using afm reader for %a",original)      end      specification.specification = gsub(original,"%.pfb",".afm")      specification.forced = "afm" diff --git a/tex/context/base/font-chk.lua b/tex/context/base/font-chk.lua index 4bedf7ace..9e7e31aff 100644 --- a/tex/context/base/font-chk.lua +++ b/tex/context/base/font-chk.lua @@ -63,7 +63,7 @@ local function onetimemessage(font,char,message)          messages[message] = category      end      if not category[char] then -        report_fonts("char U+%05X in font '%s' with id %s: %s",char,tfmdata.properties.fullname,font,message) +        report_fonts("char %U in font %a with id %a: %s",char,tfmdata.properties.fullname,font,message)          category[char] = true      end  end diff --git a/tex/context/base/font-cid.lua b/tex/context/base/font-cid.lua index bf186d885..e4b565313 100644 --- a/tex/context/base/font-cid.lua +++ b/tex/context/base/font-cid.lua @@ -88,14 +88,14 @@ local function locate(registry,ordering,supplement)      local found    = cidmap[hashname]      if not found then          if trace_loading then -            report_otf("checking cidmap, registry: %s, ordering: %s, supplement: %s, filename: %s",registry,ordering,supplement,filename) +            report_otf("checking cidmap, registry %a, ordering %a, supplement %a, filename %a",registry,ordering,supplement,filename)          end          local fullname = resolvers.findfile(filename,'cid') or ""          if fullname ~= "" then              found = loadcidfile(fullname)              if found then                  if trace_loading then -                    report_otf("using cidmap file %s",filename) +                    report_otf("using cidmap file %a",filename)                  end                  cidmap[hashname] = found                  found.usedname = file.basename(filename) @@ -109,7 +109,7 @@ end  function cid.getmap(specification)      if not specification then -        report_otf("invalid cidinfo specification (table expected)") +        report_otf("invalid cidinfo specification, table expected")          return      end      local registry = specification.registry @@ -122,7 +122,7 @@ function cid.getmap(specification)          return found      end      if trace_loading then -        report_otf("needed cidmap, registry: %s, ordering: %s, supplement: %s",registry,ordering,supplement) +        report_otf("cidmap needed, registry %a, ordering %a, supplement %a",registry,ordering,supplement)      end      found = locate(registry,ordering,supplement)      if not found then diff --git a/tex/context/base/font-col.lua b/tex/context/base/font-col.lua index 4b96cca31..b884c1457 100644 --- a/tex/context/base/font-col.lua +++ b/tex/context/base/font-col.lua @@ -64,16 +64,12 @@ function collections.define(name,font,ranges,details)      -- todo: remap=name      local d = definitions[name]      if d then -        if name and trace_collecting then -            report_fonts("def: extending set %s using %s",name, font) -        end -    else -        if name and trace_collecting then -            report_fonts("def: defining set %s using %s",name, font) -        end          d = { }          definitions[name] = d      end +    if name and trace_collecting then +        report_fonts("extending collection %a using %a",name,font) +    end      details = settings_to_hash(details)      -- todo, combine per font start/stop as arrays      for s in gmatch(ranges,"[^, ]+") do @@ -81,12 +77,12 @@ function collections.define(name,font,ranges,details)          if start and stop then              if trace_collecting then                  if description then -                    report_fonts("def: using range %s (U+%05x-U+%05X, %s)",s,start,stop,description) +                    report_fonts("using range %a, slots %U - %U, description %a)",s,start,stop,description)                  end                  for i=1,#d do                      local di = d[i]                      if (start >= di.start and start <= di.stop) or (stop >= di.start and stop <= di.stop) then -                        report_fonts("def: overlapping ranges U+%05x-U+%05X and U+%05x-U+%05X",start,stop,di.start,di.stop) +                        report_fonts("overlapping ranges %U - %U and %U - %U",start,stop,di.start,di.stop)                      end                  end              end @@ -101,7 +97,7 @@ end  function collections.registermain(name)      local last = font.current()      if trace_collecting then -        report_fonts("def: registering font %s with name %s",last,name) +        report_fonts("registering font %a with name %a",last,name)      end      list[#list+1] = last  end @@ -111,14 +107,14 @@ function collections.clonevector(name)      local d = definitions[name]      local t = { }      if trace_collecting then -        report_fonts("def: process collection %s",name) +        report_fonts("processing collection %a",name)      end      for i=1,#d do          local f = d[i]          local id = list[i]          local start, stop = f.start, f.stop          if trace_collecting then -            report_fonts("def: remapping font %s to %s for range U+%05X - U+%05X",current,id,start,stop) +            report_fonts("remapping font %a to %a for range %U - %U",current,id,start,stop)          end          local check = toboolean(f.check or "false",true)          local force = toboolean(f.force or "true",true) @@ -151,7 +147,7 @@ function collections.clonevector(name)      end      vectors[current] = t      if trace_collecting then -        report_fonts("def: activating collection %s for font %s",name,current) +        report_fonts("activating collection %a for font %a",name,current)      end      if not enabled then          nodes.tasks.enableaction("processors","fonts.collections.process") @@ -176,7 +172,7 @@ function collections.prepare(name)      if d then          if trace_collecting then              local filename = file.basename(fontdata[current].properties.filename or "?") -            report_fonts("def: applying collection %s to %s (file: %s)",name,current,filename) +            report_fonts("applying collection %a to %a, file %a",name,current,filename)          end          list = { }          context.pushcatcodes("prt") -- context.unprotect() @@ -197,7 +193,7 @@ function collections.prepare(name)          context.popcatcodes() -- context.protect()      elseif trace_collecting then          local filename = file.basename(fontdata[current].properties.filename or "?") -        report_fonts("def: error in applying collection %s to %s (file: %s)",name,current,filename) +        report_fonts("error while applying collection %a to %a, file %a",name,current,filename)      end  end @@ -217,12 +213,12 @@ function collections.process(head) -- this way we keep feature processing                  if type(id) == "table" then                      local newid, newchar = id[1], id[2]                      if trace_collecting then -                        report_fonts("lst: remapping character %s in font %s to character %s in font %s",n.char,n.font,newchar,newid) +                        report_fonts("remapping character %a in font %a to character %a in font %a",n.char,n.font,newchar,newid)                      end                      n.font, n.char = newid, newchar                  else                      if trace_collecting then -                        report_fonts("lst: remapping font %s to %s for character %s",n.font,id,n.char) +                        report_fonts("remapping font %a to %a for character %a",n.font,id,n.char)                      end                      n.font = id                  end diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua index 58af5a04f..912935c9c 100644 --- a/tex/context/base/font-con.lua +++ b/tex/context/base/font-con.lua @@ -510,32 +510,21 @@ function constructors.scale(tfmdata,specification)      local scaledheight     = defaultheight * vdelta      local scaleddepth      = defaultdepth  * vdelta      -- -    if trace_defining then -        report_defining("scaling by (%s,%s): name '%s', fullname: '%s', filename: '%s'", -            hdelta,vdelta,name or "noname",fullname or "nofullname",filename or "nofilename") -    end -    --      local hasmath = (properties.hasmath or next(mathparameters)) and true +    --      if hasmath then -        if trace_defining then -            report_defining("math enabled for: name '%s', fullname: '%s', filename: '%s'", -                name or "noname",fullname or "nofullname",filename or "nofilename") -        end          constructors.assignmathparameters(target,tfmdata) -- does scaling and whatever is needed          properties.hasmath    = true          target.nomath         = false          target.MathConstants  = target.mathparameters      else -        if trace_defining then -            report_defining("math disabled for: name '%s', fullname: '%s', filename: '%s'", -                name or "noname",fullname or "nofullname",filename or "nofilename") -        end          properties.hasmath    = false          target.nomath         = true          target.mathparameters = nil -- nop      end      -- -    local italickey = "italic" +    local italickey  = "italic" +    local useitalics = true -- something context      --      -- some context specific trickery (this will move to a plugin)      -- @@ -546,26 +535,26 @@ function constructors.scale(tfmdata,specification)       -- if properties.mathitalics then       --     italickey = "italic_correction"       --     if trace_defining then -     --         report_defining("math italics disabled for: name '%s', fullname: '%s', filename: '%s'", -     --             name or "noname",fullname or "nofullname",filename or "nofilename") +     --         report_defining("math italics disabled for font %a, fullname %a, filename %a",name,fullname,filename)       --     end       -- end          autoitalicamount = false -- new -    else -        if properties.textitalics then -            italickey = "italic_correction" -            if trace_defining then -                report_defining("text italics disabled for: name '%s', fullname: '%s', filename: '%s'", -                    name or "noname",fullname or "nofullname",filename or "nofilename") -            end -            if properties.delaytextitalics then -                autoitalicamount = false -            end +    elseif properties.textitalics then +        italickey = "italic_correction" +        useitalics = false +        if properties.delaytextitalics then +            autoitalicamount = false          end      end      --      -- end of context specific trickery      -- +    if trace_defining then +        report_defining("defining tfm, name %a, fullname %a, filename %a, hscale %a, vscale %a, math %a, italics %a", +            name,fullname,filename,hdelta,vdelta, +            hasmath and "enabled" or "disabled",useitalics and "enabled" or "disabled") +    end +    --      constructors.beforecopyingcharacters(target,tfmdata)      --      local sharedkerns = { } @@ -647,9 +636,6 @@ function constructors.scale(tfmdata,specification)          if touni then              chr.tounicode = touni          end -    --  if trace_scaling then -    --    report_defining("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or "",index or 0,description.name or '-',description.class or '-') -    --  end          if hasquality then              -- we could move these calculations elsewhere (saves calculations)              local ve = character.expansion_factor @@ -688,9 +674,6 @@ function constructors.scale(tfmdata,specification)              local vn = character.next              if vn then                  chr.next = vn -             -- if character.vert_variants or character.horiz_variants then -             --     report_defining("glyph U+%05X has combination of next, vert_variants and horiz_variants",index) -             -- end              else                  local vv = character.vert_variants                  if vv then @@ -1040,7 +1023,7 @@ function constructors.setname(tfmdata,specification) -- todo: get specification          if specname then              tfmdata.properties.name = specname              if trace_defining then -                report_otf("overloaded fontname: '%s'",specname) +                report_otf("overloaded fontname %a",specname)              end          end      end @@ -1054,10 +1037,10 @@ function constructors.checkedfilename(data)              askedfilename = resolvers.resolve(askedfilename) -- no shortcut              foundfilename = resolvers.findbinfile(askedfilename,"") or ""              if foundfilename == "" then -                report_defining("source file '%s' is not found",askedfilename) +                report_defining("source file %a is not found",askedfilename)                  foundfilename = resolvers.findbinfile(file.basename(askedfilename),"") or ""                  if foundfilename ~= "" then -                    report_defining("using source file '%s' (cache mismatch)",foundfilename) +                    report_defining("using source file %a due to cache mismatch",foundfilename)                  end              end          end @@ -1083,7 +1066,7 @@ local locations = { }  local function setindeed(mode,target,group,name,action,position)      local t = target[mode]      if not t then -        report_defining("fatal error in setting feature '%s', group '%s', mode '%s'",name or "?",group or "?",mode) +        report_defining("fatal error in setting feature %a, group %a, mode %a",name,group,mode)          os.exit()      elseif position then          -- todo: remove existing @@ -1103,12 +1086,12 @@ end  local function set(group,name,target,source)      target = target[group]      if not target then -        report_defining("fatal target error in setting feature '%s', group '%s'",name or "?",group or "?") +        report_defining("fatal target error in setting feature %a, group %a",name,group)          os.exit()      end      local source = source[group]      if not source then -        report_defining("fatal source error in setting feature '%s', group '%s'",name or "?",group or "?") +        report_defining("fatal source error in setting feature %a, group %a",name,group)          os.exit()      end      local node     = source.node @@ -1252,8 +1235,8 @@ function constructors.initializefeatures(what,tfmdata,features,trace,report)                      else                          local action = step.action                          if trace then -                            report("initializing feature %s to %s for mode %s for font %s",feature, -                                tostring(value),mode or 'unknown', tfmdata.properties.fullname or 'unknown') +                            report("initializing feature %a to %a for mode %a for font %a",feature, +                                value,mode,tfmdata.properties.fullname)                          end                          action(tfmdata,value,features) -- can set mode (e.g. goodies) so it can trigger a restart                          if mode ~= properties.mode or mode ~= features.mode then @@ -1303,8 +1286,7 @@ function constructors.collectprocessors(what,tfmdata,features,trace,report)                  if features[feature] then                      local action = step.action                      if trace then -                        report("installing feature processor %s for mode %s for font %s",feature, -                            mode or 'unknown', tfmdata.properties.fullname or 'unknown') +                        report("installing feature processor %a for mode %a for font %a",feature,mode,tfmdata.properties.fullname)                      end                      if action then                          nofprocesses = nofprocesses + 1 @@ -1313,8 +1295,7 @@ function constructors.collectprocessors(what,tfmdata,features,trace,report)                  end              end          elseif trace then -            report("no feature processors for mode %s for font %s", -                mode or 'unknown', tfmdata.properties.fullname or 'unknown') +            report("no feature processors for mode %a for font %a",mode,tfmdata.properties.fullname)          end      end      return processes @@ -1337,8 +1318,7 @@ function constructors.applymanipulators(what,tfmdata,features,trace,report)                  if value then                      local action = step.action                      if trace then -                        report("applying feature manipulator %s for mode %s for font %s",feature, -                            mode or 'unknown', tfmdata.properties.fullname or 'unknown') +                        report("applying feature manipulator %a for mode %a for font %a",feature,mode,tfmdata.properties.fullname)                      end                      if action then                          action(tfmdata,feature,value) diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index 611da4c97..a9fba145f 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -304,7 +304,7 @@ local function checkedscript(tfmdata,resources,features)          script = latn and "latn" or "dflt"      end      if trace_automode then -        report_defining("auto script mode: using script '%s' in font '%s'",script,file.basename(tfmdata.properties.name)) +        report_defining("auto script mode, using script %a in font %a",script,file.basename(tfmdata.properties.name))      end      features.script = script      return script @@ -329,13 +329,15 @@ local function checkedmode(tfmdata,resources,features)                                  if found then                                      -- more than one lookup                                      if trace_automode then -                                        report_defining("forcing node mode in font %s for feature %s, script %s, language %s (multiple lookups)",file.basename(tfmdata.properties.name),feature,script,language) +                                        report_defining("forcing mode %a, font %a, feature %a, script %a, language %a, %s", +                                            "node",file.basename(tfmdata.properties.name),feature,script,language,"multiple lookups")                                      end                                      features.mode = "node"                                      return "node"                                  elseif needsnodemode[sequence.type] then                                      if trace_automode then -                                        report_defining("forcing node mode in font %s for feature %s, script %s, language %s (no base support)",file.basename(tfmdata.properties.name),feature,script,language) +                                        report_defining("forcing mode %a, font %a, feature %a, script %a, language %a, %s", +                                            "node",file.basename(tfmdata.properties.name),feature,script,language,"no base support")                                      end                                      features.mode = "node"                                      return "node" @@ -372,7 +374,7 @@ local function modechecker(tfmdata,features,mode) -- we cannot adapt features as              mode = checkedmode(tfmdata,resources,features)          end      else -        report_features("missing resources for font''%s'",file.basename(tfmdata.properties.name)) +        report_features("missing resources for font %a",file.basename(tfmdata.properties.name))      end      return mode  end @@ -829,7 +831,7 @@ function commands.definefont_one(str)      local fullname, size = lpegmatch(splitpattern,str)      local lookup, name, sub, method, detail = getspecification(fullname)      if not name then -        report_defining("strange definition '%s'",str) +        report_defining("strange definition %a",str)          setdefaultfontname()      elseif name == "unknown" then          setdefaultfontname() @@ -872,7 +874,7 @@ end  function commands.definefont_two(global,cs,str,size,inheritancemode,classfeatures,fontfeatures,classfallbacks,fontfallbacks,          mathsize,textsize,relativeid,classgoodies,goodies,classdesignsize,fontdesignsize)      if trace_defining then -        report_defining("start stage two: %s (%s)",str,size) +        report_defining("start stage two: %s (size %s)",str,size)      end      -- name is now resolved and size is scaled cf sa/mo      local lookup, name, sub, method, detail = getspecification(str or "") @@ -881,7 +883,7 @@ function commands.definefont_two(global,cs,str,size,inheritancemode,classfeature      local designname = designsizefilename(name,designsize,size)      if designname and designname ~= "" then          if trace_defining or trace_designsize then -            report_defining("remapping name: %s, specification: %s, size: %s => designsize: %s",name,designsize,size,designname) +            report_defining("remapping name %a, specification %a, size %a, designsize %a",name,designsize,size,designname)          end          -- we don't catch detail here          local o_lookup, o_name, o_sub, o_method, o_detail = getspecification(designname) @@ -966,12 +968,12 @@ function commands.definefont_two(global,cs,str,size,inheritancemode,classfeature      --      local lastfontid = 0      if not tfmdata then -        report_defining("unable to define %s as [%s]",name,nice_cs(cs)) +        report_defining("unable to define %a as %a",name,nice_cs(cs))          lastfontid = -1          letvaluerelax(cs) -- otherwise the current definition takes the previous one      elseif type(tfmdata) == "number" then          if trace_defining then -            report_defining("reusing %s with id %s as [%s] (features: %s/%s, fallbacks: %s/%s, goodies: %s/%s, designsize: %s/%s)", +            report_defining("reusing %s, id %a, target %a, features %a / %a, fallbacks %a / %a, goodies %a / %a, designsize %a / %a",                  name,tfmdata,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,classgoodies,goodies,classdesignsize,fontdesignsize)          end          csnames[tfmdata] = specification.cs @@ -997,7 +999,7 @@ function commands.definefont_two(global,cs,str,size,inheritancemode,classfeature          constructors.cleanuptable(tfmdata)          constructors.finalize(tfmdata)          if trace_defining then -            report_defining("defining %s with id %s as [%s] (features: %s/%s, fallbacks: %s/%s)", +            report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a",                  name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks)          end          -- resolved (when designsize is used): @@ -1169,7 +1171,7 @@ function mappings.loadfile(name)      name = file.addsuffix(name,"map")      if not loaded[name] then          if trace_mapfiles then -            report_mapfiles("loading map file '%s'",name) +            report_mapfiles("loading map file %a",name)          end          pdf.mapfile(name)          loaded[name] = true @@ -1187,7 +1189,7 @@ function mappings.loadline(how,line)      end      if not loaded[how] then          if trace_mapfiles then -            report_mapfiles("processing map line '%s'",line) +            report_mapfiles("processing map line %a",line)          end          pdf.mapline(how)          loaded[how] = true @@ -1237,7 +1239,7 @@ function loggers.reportdefinedfonts()                  properties.psname   or "",                  properties.fullname or "",              } -            report_status("%s: %s",properties.name,concat(sortedkeys(data)," ")) +            report_status("%s: % t",properties.name,sortedkeys(data))          end          formatcolumns(t,"  ")          report_status() @@ -1414,7 +1416,7 @@ function commands.showchardata(n)          end          local chr = tfmdata.characters[n]          if chr then -            report_status("%s @ %s => U%05X => %s => %s",tfmdata.properties.fullname,tfmdata.parameters.size,n,utfchar(n),serialize(chr,false)) +            report_status("%s @ %s => %U => %c => %s",tfmdata.properties.fullname,tfmdata.parameters.size,n,n,serialize(chr,false))          end      end  end diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua index 8d4fd25fc..5dbd1f0fd 100644 --- a/tex/context/base/font-def.lua +++ b/tex/context/base/font-def.lua @@ -126,14 +126,13 @@ end  local function makespecification(specification,lookup,name,sub,method,detail,size)      size = size or 655360 -    if trace_defining then -        report_defining("%s -> lookup: %s, name: %s, sub: %s, method: %s, detail: %s", -            specification, lookup ~= "" and lookup or "[file]", name ~= "" and name or "-", -            sub ~= "" and sub or "-", method ~= "" and method or "-", detail ~= "" and detail or "-") -    end      if not lookup or lookup == "" then          lookup = definers.defaultlookup      end +    if trace_defining then +        report_defining("specification %a, lookup %a, name %a, sub %a, method %a, detail %a", +            specification, lookup, name, sub, method, detail) +    end      local t = {          lookup        = lookup,        -- forced type          specification = specification, -- full specification @@ -297,7 +296,7 @@ function definers.loadfont(specification)              local reader = readers[lower(forced)]              tfmdata = reader and reader(specification)              if not tfmdata then -                report_defining("forced type %s of %s not found",forced,specification.name) +                report_defining("forced type %a of %a not found",forced,specification.name)              end          else              local sequence = readers.sequence -- can be overloaded so only a shortcut here @@ -305,7 +304,7 @@ function definers.loadfont(specification)                  local reader = sequence[s]                  if readers[reader] then -- we skip not loaded readers                      if trace_defining then -                        report_defining("trying (reader sequence driven) type %s for %s with file %s",reader,specification.name,specification.filename or "unknown") +                        report_defining("trying (reader sequence driven) type %a for %a with file %a",reader,specification.name,specification.filename)                      end                      tfmdata = readers[reader](specification)                      if tfmdata then @@ -324,7 +323,7 @@ function definers.loadfont(specification)          end      end      if not tfmdata then -        report_defining("font with asked name '%s' is not found using lookup '%s'",specification.name,specification.lookup) +        report_defining("font with asked name %a is not found using lookup %a",specification.name,specification.lookup)      end      return tfmdata  end @@ -385,7 +384,7 @@ function definers.register(tfmdata,id)          if not internalized[hash] then              internalized[hash] = id              if trace_defining then -                report_defining("registering font, id: %s, hash: %s",id or "?",hash or "?") +                report_defining("registering font, id %s, hash %a",id,hash)              end              fontdata[id] = tfmdata          end @@ -414,7 +413,6 @@ function definers.read(specification,size,id) -- id can be optional, name can al              if trace_defining then                  report_defining("loaded and hashed: %s",hash)              end -        --~ constructors.checkvirtualid(tfmdata) -- interferes              tfmdata.properties.hash = hash              if id then                  definers.register(tfmdata,id) @@ -427,19 +425,13 @@ function definers.read(specification,size,id) -- id can be optional, name can al      end      lastdefined = tfmdata or id -- todo ! ! ! ! !      if not tfmdata then -- or id? -        report_defining( "unknown font %s, loading aborted",specification.name) +        report_defining( "unknown font %a, loading aborted",specification.name)      elseif trace_defining and type(tfmdata) == "table" then          local properties = tfmdata.properties or { }          local parameters = tfmdata.parameters or { } -        report_defining("using %s font with id %s, name:%s size:%s bytes:%s encoding:%s fullname:%s filename:%s", -                       properties.format        or "unknown", -                       id                       or "?", -                       properties.name          or "?", -                       parameters.size          or "default", -                       properties.encodingbytes or "?", -                       properties.encodingname  or "unicode", -                       properties.fullname      or "?", -         file.basename(properties.filename      or "?")) +        report_defining("using %s font with id %a, name %a, size %a, bytes %a, encoding %a, fullname %a, filename %a", +            properties.format, id, properties.name, parameters.size, properties.encodingbytes, +            properties.encodingname, properties.fullname, file.basename(properties.filename))      end      statistics.stoptiming(fonts)      return tfmdata diff --git a/tex/context/base/font-enh.lua b/tex/context/base/font-enh.lua index b846f51fa..65bbe7bd9 100644 --- a/tex/context/base/font-enh.lua +++ b/tex/context/base/font-enh.lua @@ -44,7 +44,7 @@ local registerotffeature = otffeatures.register  --             for newcode, oldcode in next, data.unicodes do  --                 if newcode ~= oldcode then  --                     if trace_defining then ---                         report_defining("reencoding U+%05X to U+%05X",oldcode,newcode) +--                         report_defining("reencoding %U to %U",oldcode,newcode)  --                     end  --                     characters[newcode] = original[oldcode]  --                 end @@ -72,7 +72,7 @@ local registerotffeature = otffeatures.register  --         for k,v in next, vector do  --             if k ~= v then  --                 if trace_defining then ---                     report_defining("remapping U+%05X to U+%05X",k,v) +--                     report_defining("remapping %U to %U",k,v)  --                 end  --                 local c = original[k]  --                 characters[v] = c @@ -152,7 +152,7 @@ local function initializeunicoding(tfmdata)                  end              end              if trace_defining then -                report_defining("aliasing glyph '%s' from U+%05X to U+%05X",name,oldcode,newcode) +                report_defining("aliasing glyph %a from %U to %U",name,oldcode,newcode)              end          end      end diff --git a/tex/context/base/font-ext.lua b/tex/context/base/font-ext.lua index e23abd701..4dae48015 100644 --- a/tex/context/base/font-ext.lua +++ b/tex/context/base/font-ext.lua @@ -110,7 +110,7 @@ local function initializeexpansion(tfmdata,value)                  local step    = class.step    or 0                  local factor  = class.factor  or 1                  if trace_expansion then -                    report_expansions("setting class %s, vector: %s, factor: %s, stretch: %s, shrink: %s, step: %s", +                    report_expansions("setting class %a, vector %a, factor %a, stretch %a, shrink %a, step %a",                          value,class.vector,factor,stretch,shrink,step)                  end                  tfmdata.parameters.expansion = { @@ -143,10 +143,10 @@ local function initializeexpansion(tfmdata,value)                      end                  end              elseif trace_expansion then -                report_expansions("unknown vector '%s' in class '%s",class.vector,value) +                report_expansions("unknown vector %a in class %a",class.vector,value)              end          elseif trace_expansion then -            report_expansions("unknown class '%s'",value) +            report_expansions("unknown class %a",value)          end      end  end @@ -348,14 +348,14 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd)                  local data = lookuphash[lookup]                  if data then                      if trace_protrusion then -                        report_protrusions("setting left using lfbd lookup '%s'",lookup) +                        report_protrusions("setting left using lfbd lookup %a",lookup)                      end                      for k, v in next, data do                      --  local p = - v[3] / descriptions[k].width-- or 1 ~= 0 too but the same                          local p = - (v[1] / 1000) * factor * left                          characters[k].left_protruding = p                          if trace_protrusion then -                            report_protrusions("lfbd -> %s -> U+%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) +                            report_protrusions("lfbd -> %s -> %C -> %0.03f (% t)",lookup,k,p,v)                          end                      end                      done = true @@ -371,14 +371,14 @@ local function map_opbd_onto_protrusion(tfmdata,value,opbd)                  local data = lookuphash[lookup]                  if data then                      if trace_protrusion then -                        report_protrusions("setting right using rtbd lookup '%s'",lookup) +                        report_protrusions("setting right using rtbd lookup %a",lookup)                      end                      for k, v in next, data do                      --  local p = v[3] / descriptions[k].width -- or 3                          local p = (v[1] / 1000) * factor * right                          characters[k].right_protruding = p                          if trace_protrusion then -                            report_protrusions("rtbd -> %s -> U+%05X (%s) -> %0.03f (%s)",lookup,k,utfchar(k),p,concat(v," ")) +                            report_protrusions("rtbd -> %s -> %C -> %0.03f (% t)",lookup,k,p,v)                          end                      end                  end @@ -410,7 +410,7 @@ local function initializeprotrusion(tfmdata,value)                      local left   = class.left   or 1                      local right  = class.right  or 1                      if trace_protrusion then -                        report_protrusions("setting class %s, vector: %s, factor: %s, left: %s, right: %s", +                        report_protrusions("setting class %a, vector %a, factor %a, left %a, right %a",                              value,class.vector,factor,left,right)                      end                      local data = characters.data @@ -451,10 +451,10 @@ local function initializeprotrusion(tfmdata,value)                          end                      end                  elseif trace_protrusion then -                    report_protrusions("unknown vector '%s' in class '%s",class.vector,value) +                    report_protrusions("unknown vector %a in class %a",class.vector,value)                  end              elseif trace_protrusion then -                report_protrusions("unknown class '%s'",value) +                report_protrusions("unknown class %a",value)              end          end      end diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua index c7a13775a..48e2167e6 100644 --- a/tex/context/base/font-fbk.lua +++ b/tex/context/base/font-fbk.lua @@ -106,7 +106,7 @@ local function composecharacters(tfmdata)                              end                              if charsacc then                                  if trace_combining_define then -                                    report_combining("%s (U+%05X) = %s (U+%05X) + %s (U+%05X)",utfchar(i),i,utfchar(chr),chr,utfchar(acc),acc) +                                    report_combining("composed %C, base %C, accent %C",i,chr,acc)                                  end                                  local acc_t = cache[acc]                                  if not acc_t then @@ -139,7 +139,7 @@ local function composecharacters(tfmdata)                                                      local dx = cx - ax                                                      local dy = cy - ay                                                      if trace_combining_define then -                                                        report_combining("building U+%05X (%s) from U+%05X (%s) and U+%05X (%s)",i,utfchar(i),chr,utfchar(chr),acc,utfchar(acc)) +                                                        report_combining("building %C from %C and %C",i,chr,acc)                                                          report_combining("  boundingbox:")                                                          report_combining("    chr: %3i %3i %3i %3i",unpack(cb))                                                          report_combining("    acc: %3i %3i %3i %3i",unpack(ab)) @@ -222,7 +222,7 @@ local function composecharacters(tfmdata)                                  end                              else                                  if trace_combining_define then -                                    report_combining("%s (U+%05X) = %s (U+%05X) (simplified)",utfchar(i),i,utfchar(chr),chr) +                                    report_combining("%C becomes simplfied %C",i,chr)                                  end                                  t.commands = { chr_t } -- else index mess                              end diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua index 68a2317ab..810d49eea 100644 --- a/tex/context/base/font-gds.lua +++ b/tex/context/base/font-gds.lua @@ -47,7 +47,7 @@ function fontgoodies.report(what,trace,goodies)      if trace_goodies or trace then          local whatever = goodies[what]          if whatever then -            report_goodies("goodie '%s' found in '%s'",what,goodies.name) +            report_goodies("goodie %a found in %a",what,goodies.name)          end      end  end @@ -67,10 +67,10 @@ local function loadgoodies(filename) -- maybe a merge is better          else              goodies = dofile(fullname) or false              if not goodies then -                report_goodies("goodie file '%s' is invalid",fullname) +                report_goodies("goodie file %a is invalid",fullname)                  return nil              elseif trace_goodies then -                report_goodies("goodie file '%s' is loaded",fullname) +                report_goodies("goodie file %a is loaded",fullname)              end              goodies.name = goodies.name or "no name"              for name, fnc in next, list do @@ -102,7 +102,7 @@ local function setgoodies(tfmdata,value)          local ok = loadgoodies(filename)          if ok then              if trace_goodies then -                report_goodies("assigning goodie '%s'",filename) +                report_goodies("assigning goodie %a",filename)              end              goodies[#goodies+1] = ok          end @@ -145,7 +145,7 @@ local function prepare_features(goodies,name,set)          local n, s = fonts.specifiers.presetcontext(fullname,"",ff)          goodies.featuresets[name] = s -- set          if trace_goodies then -            report_goodies("feature set '%s' gets number %s and name '%s'",name,n,fullname) +            report_goodies("feature set %a gets number %a and name %a",name,n,fullname)          end          return n      end @@ -158,7 +158,7 @@ local function initialize(goodies,tfmdata)      local goodiesname = goodies.name      if featuresets then          if trace_goodies then -            report_goodies("checking featuresets in '%s'",goodies.name) +            report_goodies("checking featuresets in %a",goodies.name)          end          for name, set in next, featuresets do              prepare_features(goodies,name,set) @@ -485,7 +485,7 @@ local function initialize(tfmdata)                  mathitalics = mathitalics[file.nameonly(properties.name)] or mathitalics                  if mathitalics then                      if trace_goodies then -                        report_goodies("loading mathitalics for font '%s'",properties.name) +                        report_goodies("loading mathitalics for font %a",properties.name)                      end                      local corrections   = mathitalics.corrections                      local defaultfactor = mathitalics.defaultfactor @@ -510,7 +510,7 @@ local function initialize(tfmdata)                                  properties.mathitalics = disableengine                              end                              if trace_goodies then -                                report_goodies("assigning mathitalics for font '%s'",properties.name) +                                report_goodies("assigning mathitalics for font %a",properties.name)                              end                              local mathitalics = properties.mathitalics                              local quad        = parameters.quad diff --git a/tex/context/base/font-log.lua b/tex/context/base/font-log.lua index 8bc12a215..773108e44 100644 --- a/tex/context/base/font-log.lua +++ b/tex/context/base/font-log.lua @@ -43,7 +43,7 @@ function loggers.onetimemessage(font,char,message,reporter)          if not reporter then              reporter = report_defining          end -        reporter("char U+%05X in font '%s' with id %s: %s",char,tfmdata.properties.fullname,font,message) +        reporter("char %U in font %a with id %s: %s",char,tfmdata.properties.fullname,font,message)          category[char] = true      end  end @@ -52,7 +52,7 @@ function loggers.register(tfmdata,source,specification) -- save file name in spe      if tfmdata and specification and specification.specification then          local name = lower(specification.name)          if trace_defining and not usedfonts[name] then -            report_defining("registering %s as %s (used: %s)",file.basename(specification.name),source,file.basename(specification.filename)) +            report_defining("registering %a as %a, used %a",file.basename(specification.name),source,file.basename(specification.filename))          end          specification.source = source       -- loadedfonts[lower(specification.specification)] = specification @@ -75,6 +75,6 @@ statistics.register("loaded fonts", function()                  t[n] = basename(name)              end          end -        return (n > 0 and format("%s files: %s",n,concat(t," "))) or "none" +        return n > 0 and format("%s files: %s",n,concat(t," ")) or "none"      end  end) diff --git a/tex/context/base/font-lua.lua b/tex/context/base/font-lua.lua index 48ce3c2f5..6fbbcf17e 100644 --- a/tex/context/base/font-lua.lua +++ b/tex/context/base/font-lua.lua @@ -31,7 +31,7 @@ readers.check_lua = check_lua  function readers.lua(specification)      local original = specification.specification      if trace_defining then -        report_lua("using lua reader for '%s'",original) +        report_lua("using lua reader for %a",original)      end      local fullname = specification.filename or ""      if fullname == "" then diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua index f9e52c10a..29b9ecd35 100644 --- a/tex/context/base/font-map.lua +++ b/tex/context/base/font-map.lua @@ -33,7 +33,7 @@ local function loadlumtable(filename) -- will move to font goodies      local lumfile = resolvers.findfile(lumname,"map") or ""      if lumfile ~= "" and lfs.isfile(lumfile) then          if trace_loading or trace_mapping then -            report_fonts("enhance: loading %s ",lumfile) +            report_fonts("loading map table %a",lumfile)          end          lumunic = dofile(lumfile)          return lumunic, lumfile @@ -86,7 +86,7 @@ local function tounicode16(unicode)      elseif unicode < 0x1FFFFFFFFF then          return format("%04X%04X",floor(unicode/1024),unicode%1024+0xDC00)      else -        report_fonts("can't convert %s into tounicode",unicode) +        report_fonts("can't convert %a into tounicode",unicode)      end  end @@ -99,7 +99,7 @@ local function tounicode16sequence(unicodes)          elseif unicode < 0x1FFFFFFFFF then              t[l] = format("%04X%04X",floor(unicode/1024),unicode%1024+0xDC00)          else -            report_fonts ("can't convert %s into tounicode",unicode) +            report_fonts ("can't convert %a into tounicode",unicode)          end      end      return concat(t) @@ -302,13 +302,13 @@ function mappings.addtounicode(data,filename)              local index = glyph.index              local toun  = tounicode[index]              if toun then -                report_fonts("internal: 0x%05X, name: %s, unicode: U+%05X, tounicode: %s",index,name,unic,toun) +                report_fonts("internal slot %U, name %a, unicode %U, tounicode %a",index,name,unic,toun)              else -                report_fonts("internal: 0x%05X, name: %s, unicode: U+%05X",index,name,unic) +                report_fonts("internal slot %U, name %a, unicode %U",index,name,unic)              end          end      end      if trace_loading and (ns > 0 or nl > 0) then -        report_fonts("enhance: %s tounicode entries added (%s ligatures)",nl+ns, ns) +        report_fonts("%s tounicode entries added, ligatures %s",nl+ns,ns)      end  end diff --git a/tex/context/base/font-ota.lua b/tex/context/base/font-ota.lua index 61081cb9b..a13d3bc2c 100644 --- a/tex/context/base/font-ota.lua +++ b/tex/context/base/font-ota.lua @@ -287,7 +287,7 @@ local arab_warned = { }  local function warning(current,what)      local char = current.char      if not arab_warned[char] then -        log.report("analyze","arab: character %s (U+%05X) has no %s class", char, char, what) +        log.report("analyze","arab: character %C has no %a class",char,what)          arab_warned[char] = true      end  end diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua index c37058d34..c38d1909a 100644 --- a/tex/context/base/font-otb.lua +++ b/tex/context/base/font-otb.lua @@ -33,49 +33,71 @@ otf.defaultbasealternate     = "none" -- first last  local wildcard               = "*"  local default                = "dflt" +local formatters             = string.formatters +local f_unicode              = formatters["%U"] +local f_uniname              = formatters["%U (%s)"] +local f_unilist              = formatters["% t (% t)"] +  local function gref(descriptions,n)      if type(n) == "number" then          local name = descriptions[n].name          if name then -            return format("U+%05X (%s)",n,name) +            return f_uniname(n,name)          else -            return format("U+%05X") +            return f_unicode(n)          end      elseif n then          local num, nam = { }, { } -        for i=2,#n do -- first is likely a key +        for i=2,#n do              local ni = n[i] -            num[i-1] = format("U+%05X",ni) -            nam[i-1] = descriptions[ni].name or "?" -        end -        return format("%s (%s)",concat(num," "), concat(nam," ")) +            if tonumber(ni) then -- first is likely a key +                local di = descriptions[ni] +                num[i] = f_unicode(ni) +                nam[i] = di and di.name or "-" +            end +        return f_unilist(num,nam)      else -        return "?" +        return "<error in base mode tracing>"      end  end  local function cref(feature,lookupname)      if lookupname then -        return format("feature %s, lookup %s",feature,lookupname) +        return format("feature %a, lookup %a",feature,lookupname)      else -        return format("feature %s",feature) +        return format("feature %a",feature)      end  end  local function report_alternate(feature,lookupname,descriptions,unicode,replacement,value,comment) -    report_prepare("%s: base alternate %s => %s (%s => %s)",cref(feature,lookupname), -        gref(descriptions,unicode),replacement and gref(descriptions,replacement) or "-", -        tostring(value),comment) +    report_prepare("%s: base alternate %s => %s (%S => %S)", +        cref(feature,lookupname), +        gref(descriptions,unicode), +        replacement and gref(descriptions,replacement), +        value, +        comment)  end  local function report_substitution(feature,lookupname,descriptions,unicode,substitution) -    report_prepare("%s: base substitution %s => %s",cref(feature,lookupname), -        gref(descriptions,unicode),gref(descriptions,substitution)) +    report_prepare("%s: base substitution %s => %S", +        cref(feature,lookupname), +        gref(descriptions,unicode), +        gref(descriptions,substitution))  end  local function report_ligature(feature,lookupname,descriptions,unicode,ligature) -    report_prepare("%s: base ligature %s => %s",cref(feature,lookupname), -        gref(descriptions,ligature),gref(descriptions,unicode)) +    report_prepare("%s: base ligature %s => %S", +        cref(feature,lookupname), +        gref(descriptions,ligature), +        gref(descriptions,unicode)) +end + +local function report_kern(feature,lookupname,descriptions,unicode,otherunicode,value) +    report_prepare("%s: base kern %s + %s => %S", +        cref(feature,lookupname), +        gref(descriptions,unicode), +        gref(descriptions,otherunicode), +        value)  end  local basemethods = { } @@ -108,7 +130,7 @@ local function registerbasehash(tfmdata)      end      properties.basehash = base      properties.fullname = properties.fullname .. "-" .. base - -- report_prepare("fullname base hash: '%s', featureset '%s'",tfmdata.properties.fullname,hash) + -- report_prepare("fullname base hash '%a, featureset %a",tfmdata.properties.fullname,hash)      applied = { }  end @@ -355,15 +377,13 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist                                  newkerns = { [otherunicode] = value }                                  done = true                                  if traceindeed then -                                    report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), -                                        gref(descriptions,unicode),gref(descriptions,otherunicode),value) +                                    report_kern(feature,lookup,descriptions,unicode,otherunicode,value)                                  end                              elseif not newkerns[otherunicode] then -- first wins                                  newkerns[otherunicode] = value                                  done = true                                  if traceindeed then -                                    report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), -                                        gref(descriptions,unicode),gref(descriptions,otherunicode),value) +                                    report_kern(feature,lookup,descriptions,unicode,otherunicode,value)                                  end                              end                          end @@ -413,7 +433,7 @@ local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,don              local character = characters[preceding]              if not character then                  if trace_baseinit then -                    report_prepare("weird ligature in lookup %s: U+%05X (%s), preceding U+%05X (%s)",lookupname,v,utfchar(v),preceding,utfchar(preceding)) +                    report_prepare("weird ligature in lookup %a, current %C, preceding %C",lookupname,v,preceding)                  end                  character = makefake(tfmdata,name,present)              end @@ -544,8 +564,7 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist                  for otherunicode, kern in next, data do                      if not kerns[otherunicode] and kern ~= 0 then                          kerns[otherunicode] = kern -                        report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), -                            gref(descriptions,unicode),gref(descriptions,otherunicode),kern) +                        report_kern(feature,lookup,descriptions,unicode,otherunicode,kern)                      end                  end              else @@ -612,7 +631,7 @@ local function featuresinitializer(tfmdata,value)              registerbasehash(tfmdata)          end          if trace_preparing then -            report_prepare("preparation time is %0.3f seconds for %s",os.clock()-t,tfmdata.properties.fullname or "?") +            report_prepare("preparation time is %0.3f seconds for %a",os.clock()-t,tfmdata.properties.fullname)          end      end  end diff --git a/tex/context/base/font-otc.lua b/tex/context/base/font-otc.lua index 980c6f637..a87dcadf8 100644 --- a/tex/context/base/font-otc.lua +++ b/tex/context/base/font-otc.lua @@ -165,7 +165,7 @@ local function addfeature(data,feature,specifications)              end          end          if trace_loading then -            report_otf("enhance: registering feature '%s', %s glyphs affected, %s glyphs skipped",feature,done,skip) +            report_otf("registering feature %a, affected glyphs %a, skipped glyphs %a",feature,done,skip)          end      end  end diff --git a/tex/context/base/font-otd.lua b/tex/context/base/font-otd.lua index cedc66a72..9ff16ffd5 100644 --- a/tex/context/base/font-otd.lua +++ b/tex/context/base/font-otd.lua @@ -89,7 +89,7 @@ function otf.setdynamics(font,attribute)              set.mode = "node" -- really needed              dsla = otf.setfeatures(tfmdata,set)              if trace_dynamics then -                report_otf("setting dynamics %s: attribute %s, script %s, language %s, set: %s",contextnumbers[attribute],attribute,script,language,sequenced(set)) +                report_otf("setting dynamics %s: attribute %a, script %a, language %a, set %a",contextnumbers[attribute],attribute,script,language,set)              end              -- we need to restore some values              properties.script   = s_script @@ -99,7 +99,7 @@ function otf.setdynamics(font,attribute)              -- end of restore              dynamics[script][language][attribute] = dsla -- cache          elseif trace_dynamics then -         -- report_otf("using dynamics %s: attribute %s, script %s, language %s",contextnumbers[attribute],attribute,script,language) +         -- report_otf("using dynamics %s: attribute %a, script %a, language %a",contextnumbers[attribute],attribute,script,language)          end          return dsla      end diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 80a17aaca..8270f3410 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -89,7 +89,7 @@ registerdirective("fonts.otf.loader.forcenotdef",   function(v) forcenotdef   =  local function load_featurefile(raw,featurefile)      if featurefile and featurefile ~= "" then          if trace_loading then -            report_otf("featurefile: %s", featurefile) +            report_otf("using featurefile %a", featurefile)          end          fontloader.apply_featurefile(raw, featurefile)      end @@ -99,7 +99,7 @@ local function showfeatureorder(rawdata,filename)      local sequences = rawdata.resources.sequences      if sequences and #sequences > 0 then          if trace_loading then -            report_otf("font %s has %s sequences",filename,#sequences) +            report_otf("font %a has %s sequences",filename,#sequences)              report_otf(" ")          end          for nos=1,#sequences do @@ -109,7 +109,7 @@ local function showfeatureorder(rawdata,filename)              local subtables = sequence.subtables or { "no-subtables" }              local features  = sequence.features              if trace_loading then -                report_otf("%3i  %-15s  %-20s  [%s]",nos,name,typ,concat(subtables,",")) +                report_otf("%3i  %-15s  %-20s  [% t]",nos,name,typ,subtables)              end              if features then                  for feature, scripts in next, features do @@ -120,14 +120,14 @@ local function showfeatureorder(rawdata,filename)                              for language, _ in next, languages do                                  ttt[#ttt+1] = language                              end -                            tt[#tt+1] = format("[%s: %s]",script,concat(ttt," ")) +                            tt[#tt+1] = formatters["[%s: % t]"](script,ttt)                          end                          if trace_loading then -                            report_otf("       %s: %s",feature,concat(tt," ")) +                            report_otf("       %s: % t",feature,tt)                          end                      else                          if trace_loading then -                            report_otf("       %s: %s",feature,tostring(scripts)) +                            report_otf("       %s: %S",feature,scripts)                          end                      end                  end @@ -137,7 +137,7 @@ local function showfeatureorder(rawdata,filename)              report_otf("\n")          end      elseif trace_loading then -        report_otf("font %s has no sequences",filename) +        report_otf("font %a has no sequences",filename)      end  end @@ -252,19 +252,19 @@ local function enhance(name,data,filename,raw)      local enhancer = actions[name]      if enhancer then          if trace_loading then -            report_otf("enhance: %s (%s)",name,filename) +            report_otf("apply enhancement %a to file %a",name,filename)              ioflush()          end          enhancer(data,filename,raw) -    elseif trace_loading then -     -- report_otf("enhance: %s is undefined",name) +    else +        -- no message as we can have private ones      end  end  function enhancers.apply(data,filename,raw)      local basename = file.basename(lower(filename))      if trace_loading then -        report_otf("start enhancing: %s",filename) +        report_otf("%s enhancing file %a","start",filename)      end      ioflush() -- we want instant messages      for e=1,#ordered_enhancers do @@ -289,7 +289,7 @@ function enhancers.apply(data,filename,raw)          ioflush() -- we want instant messages      end      if trace_loading then -        report_otf("stop enhancing") +        report_otf("%s enhancing file %a","stop",filename)      end      ioflush() -- we want instant messages  end @@ -310,7 +310,7 @@ end  function patches.report(fmt,...)      if trace_loading then -        report_otf("patching: " ..fmt,...) +        report_otf("patching: %s",formatters[fmt](...))      end  end @@ -319,7 +319,8 @@ function enhancers.register(what,action) -- only already registered can be overl  end  function otf.load(filename,format,sub,featurefile) -    local name = file.basename(file.removesuffix(filename)) +    local base = file.basename(file.removesuffix(filename)) +    local name = file.removesuffix(base)      local attr = lfs.attributes(filename)      local size = attr and attr.size or 0      local time = attr and attr.modification or 0 @@ -340,7 +341,7 @@ function otf.load(filename,format,sub,featurefile)          for s in gmatch(featurefile,"[^,]+") do              local name = resolvers.findfile(file.addsuffix(s,'fea'),'fea') or ""              if name == "" then -                report_otf("loading: no featurefile '%s'",s) +                report_otf("loading error, no featurefile %a",s)              else                  local attr = lfs.attributes(name)                  featurefiles[#featurefiles+1] = { @@ -357,7 +358,7 @@ function otf.load(filename,format,sub,featurefile)      local data = containers.read(otf.cache,hash)      local reload = not data or data.size ~= size or data.time ~= time      if forceload then -        report_otf("loading: forced reload due to hard coded flag") +        report_otf("forced reload of %a due to hard coded flag",filename)          reload = true      end      if not reload then @@ -378,11 +379,11 @@ function otf.load(filename,format,sub,featurefile)              reload = true          end          if reload then -           report_otf("loading: forced reload due to changed featurefile specification: %s",featurefile or "--") +           report_otf("loading: forced reload due to changed featurefile specification %a",featurefile)          end       end       if reload then -        report_otf("loading: %s (hash: %s)",filename,hash) +        report_otf("loading %a, hash %a",filename,hash)          local fontdata, messages          if sub then              fontdata, messages = fontloader.open(filename,sub) @@ -397,11 +398,11 @@ function otf.load(filename,format,sub,featurefile)                  report_otf("warning: %s",messages)              else                  for m=1,#messages do -                    report_otf("warning: %s",tostring(messages[m])) +                    report_otf("warning: %S",messages[m])                  end              end          else -            report_otf("font loaded okay") +            report_otf("loading done")          end          if fontdata then              if featurefiles then @@ -462,14 +463,14 @@ function otf.load(filename,format,sub,featurefile)                  enhance("pack",data,filename,nil)                  stoptiming(packtime)              end -            report_otf("saving in cache: %s",filename) +            report_otf("saving %a in cache",filename)              data = containers.write(otf.cache, hash, data)              if cleanup > 1 then                  collectgarbage("collect")              end              stoptiming(data)              if elapsedtime then -- not in generic -                report_otf("preprocessing and caching took %s seconds (packtime: %s)", +                report_otf("preprocessing and caching time %s, packtime %s",                      elapsedtime(data),packdata and elapsedtime(packtime) or 0)              end              fontloader.close(fontdata) -- free memory @@ -482,12 +483,12 @@ function otf.load(filename,format,sub,featurefile)              end          else              data = nil -            report_otf("loading failed (file read error)") +            report_otf("loading failed due to read error")          end      end      if data then          if trace_defining then -            report_otf("loading from cache: %s",hash) +            report_otf("loading from cache using hash %a",hash)          end          enhance("unpack",data,filename,nil,false)          enhance("add dimensions",data,filename,nil,false) @@ -527,13 +528,14 @@ actions["add dimensions"] = function(data,filename)          local defaultwidth  = resources.defaultwidth  or 0          local defaultheight = resources.defaultheight or 0          local defaultdepth  = resources.defaultdepth  or 0 +        local basename      = trace_markwidth and file.basename(filename)          if usemetatables then              for _, d in next, descriptions do                  local wd = d.width                  if not wd then                      d.width = defaultwidth                  elseif trace_markwidth and wd ~= 0 and d.class == "mark" then -                    report_otf("mark with width %s (%s) in %s",wd,d.name or "<noname>",file.basename(filename)) +                    report_otf("mark %a with width %b found in %s",d.name or "<noname>",wd,basename)                   -- d.width  = -wd                  end                  setmetatable(d,mt) @@ -544,7 +546,7 @@ actions["add dimensions"] = function(data,filename)                  if not wd then                      d.width = defaultwidth                  elseif trace_markwidth and wd ~= 0 and d.class == "mark" then -                    report_otf("mark with width %s (%s) in %s",wd,d.name or "<noname>",file.basename(filename)) +                    report_otf("mark %a with width %b found in %s",d.name or "<noname>",wd,basename)                   -- d.width  = -wd                  end               -- if forcenotdef and not d.name then @@ -648,7 +650,7 @@ actions["prepare glyphs"] = function(data,filename,raw)                                  unicode = private                                  unicodes[name] = private                                  if trace_private then -                                    report_otf("enhance: glyph %s at index 0x%04X is moved to private unicode slot U+%05X",name,index,private) +                                    report_otf("glyph %a at index %H is moved to private unicode slot %U",name,index,private)                                  end                                  private = private + 1                                  nofnames = nofnames + 1 @@ -672,7 +674,7 @@ actions["prepare glyphs"] = function(data,filename,raw)                              descriptions[unicode] = description                          else -                         -- report_otf("potential problem: glyph 0x%04X is used but empty",index) +                         -- report_otf("potential problem: glyph %U is used but empty",index)                          end                      end                  end @@ -680,10 +682,10 @@ actions["prepare glyphs"] = function(data,filename,raw)                      report_otf("cid font remapped, %s unicode points, %s symbolic names, %s glyphs",nofunicodes, nofnames, nofunicodes+nofnames)                  end              elseif trace_loading then -                report_otf("unable to remap cid font, missing cid file for %s",filename) +                report_otf("unable to remap cid font, missing cid file for %a",filename)              end          elseif trace_loading then -            report_otf("font %s has no glyphs",filename) +            report_otf("font %a has no glyphs",filename)          end      else @@ -697,7 +699,7 @@ actions["prepare glyphs"] = function(data,filename,raw)                      unicode = private                      unicodes[name] = private                      if trace_private then -                        report_otf("enhance: glyph %s at index 0x%04X is moved to private unicode slot U+%05X",name,index,private) +                        report_otf("glyph %a at index %H is moved to private unicode slot %U",name,index,private)                      end                      private = private + 1                  else @@ -740,7 +742,7 @@ actions["prepare glyphs"] = function(data,filename,raw)                      end                  end              else -                report_otf("potential problem: glyph 0x%04X is used but empty",index) +                report_otf("potential problem: glyph %U is used but empty",index)              end          end @@ -772,22 +774,22 @@ actions["check encoding"] = function(data,filename,raw)      if find(encname,"unicode") then -- unicodebmp, unicodefull, ...          if trace_loading then -            report_otf("checking embedded unicode map '%s'",encname) +            report_otf("checking embedded unicode map %a",encname)          end          for unicode, index in next, unicodetoindex do -- altuni already covers this              if unicode <= criterium and not descriptions[unicode] then                  local parent = indices[index] -- why nil?                  if parent then -                    report_otf("weird, unicode U+%05X points to U+%05X with index 0x%04X",unicode,parent,index) +                    report_otf("weird, unicode %U points to %U with index %H",unicode,parent,index)                  else -                    report_otf("weird, unicode U+%05X points to nowhere with index 0x%04X",unicode,index) +                    report_otf("weird, unicode %U points to nowhere with index %H",unicode,index)                  end              end          end      elseif properties.cidinfo then -        report_otf("warning: no unicode map, used cidmap '%s'",properties.cidinfo.usedname or "?") +        report_otf("warning: no unicode map, used cidmap %a",properties.cidinfo.usedname)      else -        report_otf("warning: non unicode map '%s', only using glyph unicode data",encname or "whatever") +        report_otf("warning: non unicode map %a, only using glyph unicode data",encname or "whatever")      end      if mapdata then @@ -829,7 +831,7 @@ actions["add duplicates"] = function(data,filename,raw)                      -- todo: lookups etc                  end                  if trace_loading then -                    report_otf("duplicating U+%05X to U+%05X with index 0x%04X (%s kerns)",unicode,u,description.index,n) +                    report_otf("duplicating %U to %U with index %H (%s kerns)",unicode,u,description.index,n)                  end              end          end @@ -1342,7 +1344,7 @@ local function check_variants(unicode,the_variants,splitter,unicodes)          for i=1,#glyphs do              local g = glyphs[i]              if done[g] then -                report_otf("skipping cyclic reference U+%05X in math variant U+%05X",g,unicode) +                report_otf("skipping cyclic reference %U in math variant %U",g,unicode)              else                  if n == 0 then                      n = 1 @@ -1458,7 +1460,7 @@ actions["reorganize glyph kerns"] = function(data,filename,raw)                              end                          end                      elseif trace_loading then -                        report_otf("problems with unicode %s of kern %s of glyph U+%05X",name,k,unicode) +                        report_otf("problems with unicode %a of kern %a of glyph %U",name,k,unicode)                      end                  end              end @@ -1546,7 +1548,7 @@ actions["merge kern classes"] = function(data,filename,raw)                                                      lookupkerns[second_unicode] = kern                                                  end                                              elseif trace_loading then -                                                report_otf("no glyph data for U+%05X", first_unicode) +                                                report_otf("no glyph data for %U", first_unicode)                                              end                                          end                                      end @@ -1624,7 +1626,7 @@ actions["reorganize glyph lookups"] = function(data,filename,raw)                      if not lt then                          lookuptypes[tag] = lookuptype                      elseif lt ~= lookuptype then -                        report_otf("conflicting lookuptypes: %s => %s and %s",tag,lt,lookuptype) +                        report_otf("conflicting lookuptypes, %a points to %a and %a",tag,lt,lookuptype)                      end                      if lookuptype == "ligature" then                          lookuplist[l] = { lpegmatch(splitter,specification.components) } @@ -1781,7 +1783,7 @@ local function copytotfm(data,cache_id)                          for i=1,#variants do                              local un = variants[i]                           -- if done[un] then -                         --  -- report_otf("skipping cyclic reference U+%05X in math variant U+%05X",un,unicode) +                         --  -- report_otf("skipping cyclic reference %U in math variant %U",un,unicode)                           -- else                                  c.next = un                                  c = characters[un] @@ -1800,7 +1802,7 @@ local function copytotfm(data,cache_id)                          for i=1,#variants do                              local un = variants[i]                           -- if done[un] then -                         --  -- report_otf("skipping cyclic reference U+%05X in math variant U+%05X",un,unicode) +                         --  -- report_otf("skipping cyclic reference %U in math variant %U",un,unicode)                           -- else                                  c.next = un                                  c = characters[un] diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index cfdbdbaca..b6ee5a475 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -271,42 +271,47 @@ local function logwarning(...)      report_direct(...)  end -local function gref(n) +local formatters = string.formatters +local f_unicode  = formatters["%U"] +local f_uniname  = formatters["%U (%s)"] +local f_unilist  = formatters["% t (% t)"] + +local function gref(n) -- currently the same as in font-otb      if type(n) == "number" then          local description = descriptions[n]          local name = description and description.name          if name then -            return format("U+%05X (%s)",n,name) +            return f_uniname(n,name)          else -            return format("U+%05X",n) +            return f_unicode(n)          end -    elseif not n then -        return "<error in tracing>" -    else +    elseif n then          local num, nam = { }, { }          for i=1,#n do              local ni = n[i]              if tonumber(ni) then -- later we will start at 2                  local di = descriptions[ni] -                num[i] = format("U+%05X",ni) -                nam[i] = di and di.name or "?" +                num[i] = f_unicode(ni) +                nam[i] = di and di.name or "-"              end          end -        return format("%s (%s)",concat(num," "), concat(nam," ")) +        return f_unilist(num,nam) +    else +        return "<error in node mode tracing>"      end  end  local function cref(kind,chainname,chainlookupname,lookupname,index)      if index then -        return format("feature %s, chain %s, sub %s, lookup %s, index %s",kind,chainname,chainlookupname,lookupname,index) +        return formatters["feature %a, chain %a, sub %a, lookup %a, index %a"](kind,chainname,chainlookupname,lookupname,index)      elseif lookupname then -        return format("feature %s, chain %s, sub %s, lookup %s",kind,chainname or "?",chainlookupname or "?",lookupname) +        return formatters["feature %a, chain %a, sub %a, lookup %a"](kind,chainname,chainlookupname,lookupname)      elseif chainlookupname then -        return format("feature %s, chain %s, sub %s",kind,chainname or "?",chainlookupname) +        return formatters["feature %a, chain %a, sub %a"](kind,chainname,chainlookupname)      elseif chainname then -        return format("feature %s, chain %s",kind,chainname) +        return formatters["feature %a, chain %a"](kind,chainname)      else -        return format("feature %s",kind) +        return formatters["feature %a"](kind)      end  end @@ -2215,7 +2220,7 @@ elseif id == math_code then                                              rlmode = rlparmode                                          end                                          if trace_directions then -                                            report_process("directions after txtdir %s: txtdir=%s:%s, parmode=%s, txtmode=%s",dir,topstack,newdir or "unset",rlparmode,rlmode) +                                            report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir)                                          end                                      elseif subtype == localpar_code then                                          local dir = start.dir @@ -2228,12 +2233,12 @@ elseif id == math_code then                                          end                                          rlmode = rlparmode                                          if trace_directions then -                                            report_process("directions after pardir %s: parmode=%s, txtmode=%s",dir,rlparmode,rlmode) +                                            report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode)                                          end                                      end                                      start = start.next -elseif id == math_code then -    start = endofmath(start).next +                                elseif id == math_code then +                                    start = endofmath(start).next                                  else                                      start = start.next                                  end @@ -2295,7 +2300,7 @@ elseif id == math_code then                                          rlmode = rlparmode                                      end                                      if trace_directions then -                                        report_process("directions after txtdir %s: txtdir=%s:%s, parmode=%s, txtmode=%s",dir,topstack,newdir or "unset",rlparmode,rlmode) +                                        report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir)                                      end                                  elseif subtype == localpar_code then                                      local dir = start.dir @@ -2308,12 +2313,12 @@ elseif id == math_code then                                      end                                      rlmode = rlparmode                                      if trace_directions then -                                        report_process("directions after pardir %s: parmode=%s, txtmode=%s",dir,rlparmode,rlmode) +                                        report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode)                                      end                                  end                                  start = start.next -elseif id == math_code then -    start = endofmath(start).next +                            elseif id == math_code then +                                start = endofmath(start).next                              else                                  start = start.next                              end @@ -2491,10 +2496,10 @@ local function prepare_contextchains(tfmdata)                      local format = lookupdata.format                      local validformat = valid[format]                      if not validformat then -                        report_prepare("unsupported format %s",format) +                        report_prepare("unsupported format %a",format)                      elseif not validformat[lookuptype] then                          -- todo: dejavu-serif has one (but i need to see what use it has) -                        report_prepare("unsupported %s %s for %s",format,lookuptype,lookupname) +                        report_prepare("unsupported format %a, lookuptype %a, lookupname %a",format,lookuptype,lookupname)                      else                          local contexts = lookuphash[lookupname]                          if not contexts then @@ -2550,7 +2555,7 @@ local function prepare_contextchains(tfmdata)                      -- no rules                  end              else -                report_prepare("missing lookuptype for %s",lookupname) +                report_prepare("missing lookuptype for lookupname %a",lookupname)              end          end      end @@ -2571,7 +2576,7 @@ local function featuresinitializer(tfmdata,value)              prepare_lookups(tfmdata)              properties.initialized = true              if trace_preparing then -                report_prepare("preparation time is %0.3f seconds for %s",os.clock()-starttime,tfmdata.properties.fullname or "?") +                report_prepare("preparation time is %0.3f seconds for %a",os.clock()-starttime,tfmdata.properties.fullname)              end          end      end diff --git a/tex/context/base/font-ott.lua b/tex/context/base/font-ott.lua index 5605474ed..c5430a828 100644 --- a/tex/context/base/font-ott.lua +++ b/tex/context/base/font-ott.lua @@ -711,7 +711,7 @@ setmetatableindex(scripts, function(t,k)          if v then              return v          elseif acceptscripts then -            report_checks("registering extra script: %s",k) +            report_checks("registering extra script %a",k)              rawset(t,k,k)              return k          end @@ -734,7 +734,7 @@ setmetatableindex(languages, function(t,k)          if v then              return v          elseif acceptlanguages then -            report_checks("registering extra languages: %s",k) +            report_checks("registering extra language %a",k)              rawset(t,k,k)              return k          end @@ -853,7 +853,7 @@ function otf.features.normalize(features)                  local uk = usedfeatures[key]                  local uv = uk[value]                  if uv then -                 -- report_checks("feature value %q first seen at %q",value,key) +                 -- report_checks("feature value %a first seen at %a",value,key)                  else                      if type(value) == "string" then                          local b = is_boolean(value) diff --git a/tex/context/base/font-pat.lua b/tex/context/base/font-pat.lua index 172dc3e94..3ad37641c 100644 --- a/tex/context/base/font-pat.lua +++ b/tex/context/base/font-pat.lua @@ -24,7 +24,7 @@ local function patch(data,filename)      if data.design_size == 0 then          local ds = match(file.basename(lower(filename)),"(%d+)")          if ds then -            report("design size (%s)",ds) +            report("font %a has design size %a",filename,ds)              data.design_size = tonumber(ds) * 10          end      end @@ -44,7 +44,7 @@ local function patch(data,filename)          for k=1,#gpos do              local v = gpos[k]              if not v.features and v.type == "gpos_mark2mark" then -                report("mkmk feature (name: %s)", v.name or "?") +                report("mkmk feature, name %a", v.name)                  v.features = {                      {                          scripts = { diff --git a/tex/context/base/font-sol.lua b/tex/context/base/font-sol.lua index 874a485cc..3114e3847 100644 --- a/tex/context/base/font-sol.lua +++ b/tex/context/base/font-sol.lua @@ -212,10 +212,10 @@ local function convert(featuresets,name,list)                  nofnumbers = nofnumbers + 1                  numbers[nofnumbers] = fn                  if trace_goodies or trace_optimize then -                    report_solutions("solution %s of '%s' uses feature '%s' with number %s",i,name,feature,fn) +                    report_solutions("solution %a of %a uses feature %a with number %s",i,name,feature,fn)                  end              else -                report_solutions("solution %s has an invalid feature reference '%s'",i,name,tostring(feature)) +                report_solutions("solution %a has an invalid feature reference %a",i,name,tostring(feature))              end          end          return nofnumbers > 0 and numbers @@ -228,7 +228,7 @@ local function initialize(goodies)          local featuresets = goodies.featuresets          local goodiesname = goodies.name          if trace_goodies or trace_optimize then -            report_solutions("checking solutions in '%s'",goodiesname) +            report_solutions("checking solutions in %a",goodiesname)          end          for name, set in next, solutions do              set.less = convert(featuresets,name,set.less) @@ -286,7 +286,7 @@ function splitters.define(name,settings)          end      end      if trace_optimize then -        report_solutions("defining solutions '%s', less: '%s', more: '%s'",name,concat(less_set or {}," "),concat(more_set or {}," ")) +        report_solutions("defining solutions %a, less %a, more %a",name,concat(less_set or {}," "),concat(more_set or {}," "))      end      local nofsolutions = #solutions + 1      local t = { @@ -353,7 +353,7 @@ function splitters.split(head)              font      = font          }          if trace_split then -            report_splitters("cached %4i: font: %s, attribute: %s, direction: %s, word: %s", +            report_splitters("cached %4i: font %a, attribute %a, direction %a, word %a",                  n, font, attribute, nodes_to_utf(list,true), rlmode and "r2l" or "l2r")          end          cache[n] = c @@ -468,7 +468,7 @@ local function collect_words(list) -- can be made faster for attributes                      if id == disc_code then                          report_splitters("skipped: disc node")                      else -                        report_splitters("skipped: %s",utfchar(current.char)) +                        report_splitters("skipped: %C",current.char)                      end                  end              elseif id == kern_code and (current.subtype == fontkern_code or current[a_fontkern]) then @@ -485,7 +485,7 @@ local function collect_words(list) -- can be made faster for attributes                  first = nil                  if id == disc_node then                      if trace_split then -                        report_splitters("skipped disc node") +                        report_splitters("skipped: disc node")                      end                  end              end @@ -501,9 +501,9 @@ local function collect_words(list) -- can be made faster for attributes                  local n, f, l = w[1], w[2], w[3]                  local c = cache[n]                  if c then -                    report_splitters("found %4i: word: %s, cached: %s",n,nodes_to_utf(f,true,true,l),nodes_to_utf(c.original,true)) +                    report_splitters("found %4i: word %a, cached %a",n,nodes_to_utf(f,true,true,l),nodes_to_utf(c.original,true))                  else -                    report_splitters("found %4i: word: %s, not in cache",n,nodes_to_utf(f,true,true,l)) +                    report_splitters("found %4i: word %a, not in cache",n,nodes_to_utf(f,true,true,l))                  end              end          end @@ -587,7 +587,7 @@ local function doit(word,list,best,width,badness,line,set,listdir)                          first = processes[i](first,font,featurenumber)                      end                  else -                    report_solutions("fatal error, no dynamics for font %s",font) +                    report_solutions("fatal error, no dynamics for font %a",font)                  end                  first = inject_kerns(first)                  if first.id == whatsit_code then @@ -609,7 +609,7 @@ local function doit(word,list,best,width,badness,line,set,listdir)                  local temp, b = repack_hlist(list,width,'exactly',listdir)                  if b > badness then                      if trace_optimize then -                        report_optimizers("line %s, badness before: %s, after: %s, criterium: %s -> quit",line,badness,b,criterium) +                        report_optimizers("line %a, badness before %a, after %a, criterium %a, verdict %a",line,badness,b,criterium,"quit")                      end                      -- remove last insert                      prev.next = h @@ -624,7 +624,7 @@ local function doit(word,list,best,width,badness,line,set,listdir)                      free_nodelist(first)                  else                      if trace_optimize then -                        report_optimizers("line %s, badness before: %s, after: %s, criterium: %s -> continue",line,badness,b,criterium) +                        report_optimizers("line %a, badness before: %a, after %a, criterium %a, verdict %a",line,badness,b,criterium,"continue")                      end                      -- free old h->t                      t.next = nil @@ -712,7 +712,7 @@ local function show_quality(current,what,line)      local sign   = current.glue_sign      local order  = current.glue_order      local amount = set * ((sign == 2 and -1) or 1) -    report_optimizers("line %s, %s, amount %s, set %s, sign %s (%s), order %s",line,what,amount,set,sign,how,order) +    report_optimizers("line %a, category %a, amount %a, set %a, sign %a, how %a, order %a",line,what,amount,set,sign,how,order)  end  function splitters.optimize(head) @@ -734,34 +734,33 @@ function splitters.optimize(head)      local tex_hbadness, tex_hfuzz = tex.hbadness, tex.hfuzz      tex.hbadness, tex.hfuzz = 10000, number.maxdimen      if trace_optimize then -        report_optimizers("preroll: %s, variant: %s, preroll criterium: %s, cache size: %s", -            tostring(preroll),variant,criterium,nc) +        report_optimizers("preroll %a, variant %a, criterium %a, cache size %a",preroll,variant,criterium,nc)      end      for current in traverse_ids(hlist_code,head) do       -- report_splitters("before: [%s] => %s",current.dir,nodes.tosequence(current.list,nil))          line = line + 1          local sign, dir, list, width = current.glue_sign, current.dir, current.list, current.width -if not encapsulate and list.id == glyph_code then -    -- nasty .. we always assume a prev being there .. future luatex will always have a leftskip set - -- current.list, list = insert_node_before(list,list,new_glue(0)) -    current.list, list = insert_node_before(list,list,new_leftskip(0)) -end +        if not encapsulate and list.id == glyph_code then +            -- nasty .. we always assume a prev being there .. future luatex will always have a leftskip set +         -- current.list, list = insert_node_before(list,list,new_glue(0)) +            current.list, list = insert_node_before(list,list,new_leftskip(0)) +        end          local temp, badness = repack_hlist(list,width,'exactly',dir) -- it would be nice if the badness was stored in the node          if badness > 0 then              if sign == 0 then                  if trace_optimize then -                    report_optimizers("line %s, badness %s, okay",line,badness) +                    report_optimizers("line %a, badness %a, outcome %a, verdict %a",line,badness,"okay","okay")                  end              else                  local set, max                  if sign == 1 then                      if trace_optimize then -                        report_optimizers("line %s, badness %s, underfull, trying more",line,badness) +                        report_optimizers("line %a, badness %a, outcome %a, verdict %a",line,badness,"underfull","trying more")                      end                      set, max = "more", max_more                  else                      if trace_optimize then -                        report_optimizers("line %s, badness %s, overfull, trying less",line,badness) +                        report_optimizers("line %a, badness %a, outcome %a, verdict %a",line,badness,"overfull","trying less")                      end                      set, max = "less", max_less                  end @@ -779,7 +778,7 @@ end                              local temp, done, changes, b = optimize(words,base,j,width,badness,line,set,dir)                              base = temp                              if trace_optimize then -                                report_optimizers("line %s, alternative: %s.%s, changes: %s, badness %s",line,i,j,changes,b) +                                report_optimizers("line %a, alternative %a.%a, changes %a, badness %a",line,i,j,changes,b)                              end                              bb = b                              if b <= criterium then @@ -806,7 +805,7 @@ end                      local temp, done, changes, b = optimize(words,list,best,width,badness,line,set,dir)                      current.list = temp                      if trace_optimize then -                        report_optimizers("line %s, alternative: %s, changes: %s, badness %s",line,best,changes,b) +                        report_optimizers("line %a, alternative %a, changes %a, badness %a",line,best,changes,b)                      end                      if done then                          if b <= criterium then -- was == 0 @@ -818,7 +817,7 @@ end              end          else              if trace_optimize then -                report_optimizers("line %s, not bad enough",line) +                report_optimizers("line %a, verdict %a",line,"not bad enough")              end          end          -- we pack inside the outer hpack and that way keep the original wd/ht/dp as bonus diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index 63564f4f9..3436465f5 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -187,13 +187,13 @@ function names.splitspec(askedname)      width   = width   and lpegmatch(widths,  width)   or width      variant = variant and lpegmatch(variants,variant) or variant      if trace_names then -        report_names("requested name '%s' split in name '%s', weight '%s', style '%s', width '%s' and variant '%s'", -            askedname,name or '',weight or '',style or '',width or '',variant or '') +        report_names("requested name %a split in name %a, weight %a, style %a, width %a and variant %a", +            askedname,name,weight,style,width,variant)      end      if not weight or not weight or not width or not variant then          weight, style, width, variant = weight or "normal", style or "normal", width or "normal", variant or "normal"          if trace_names then -            report_names("request '%s' normalized to '%s-%s-%s-%s-%s'", +            report_names("request %a normalized to '%s-%s-%s-%s-%s'",                  askedname,name,weight,style,width,variant)          end      end @@ -287,7 +287,7 @@ function names.getpaths(trace)              local v = resolvers.cleanpath(t[i])              v = gsub(v,"/+$","") -- not needed any more              local key = lower(v) -            report_names("adding path from %s: %s",where,v) +            report_names("%a specifies path %a",where,v)              if not hash[key] then                  r = r + 1                  result[r] = v @@ -316,7 +316,7 @@ function names.getpaths(trace)              end              if name ~= "" and lfs.isfile(name) then                  if trace_names then -                    report_names("loading fontconfig file: %s",name) +                    report_names("%s fontconfig file %a","loading",name)                  end                  local xmldata = xml.load(name)                  -- begin of untested mess @@ -329,11 +329,11 @@ function names.getpaths(trace)                      end                      if lfs.isfile(incname) then                          if trace_names then -                            report_names("merging included fontconfig file: %s",incname) +                            report_names("%s fontconfig file %a","merging included",incname)                          end                          return io.loaddata(incname)                      elseif trace_names then -                        report_names("ignoring included fontconfig file: %s",incname) +                        report_names("%s fontconfig file: %a","ignoring included",incname)                      end                  end)                  -- end of untested mess @@ -389,7 +389,7 @@ local function walk_tree(pathlist,suffix,identify)              path = resolvers.cleanpath(path .. "/")              path = gsub(path,"/+","/")              local pattern = path .. "**." .. suffix -- ** forces recurse -            report_names( "globbing path %s",pattern) +            report_names("globbing path %a",pattern)              local t = dir.glob(pattern)              sort(t,sorter)              for j=1,#t do @@ -608,12 +608,12 @@ local function checkduplicate(where) -- fails on "Romantik" but that's a border          local nv = #v          if nv > 1 then              if trace_warnings then -                report_names( "double lookup: %s => %s",k,concat(v," | ")) +                report_names("lookup %a clashes with %a",k,v)              end              n = n + nv          end      end -    report_names( "%s double lookups in %s",n,where) +    report_names("%a double lookups in %a",n,where)  end  local function checkduplicates() @@ -679,20 +679,20 @@ local function analyzefiles()          if done[name] then              -- already done (avoid otf afm clash)              if trace_names then -                report_names("%s font %s already done",suffix,completename) +                report_names("%s font %a already done",suffix,completename)              end              nofduplicates = nofduplicates + 1              nofskipped = nofskipped + 1          elseif not io.exists(completename) then              -- weird error              if trace_names then -                report_names("%s font %s does not really exist",suffix,completename) +                report_names("%s font %a does not really exist",suffix,completename)              end              nofskipped = nofskipped + 1          elseif not file.is_qualified_path(completename) and resolvers.findfile(completename,suffix) == "" then              -- not locateble by backend anyway              if trace_names then -                report_names("%s font %s cannot be found by backend",suffix,completename) +                report_names("%s font %a cannot be found by backend",suffix,completename)              end              nofskipped = nofskipped + 1          else @@ -700,7 +700,7 @@ local function analyzefiles()                  for i=1,#skip_paths do                      if find(basepath,skip_paths[i]) then                          if trace_names then -                            report_names("rejecting path of %s font %s",suffix,completename) +                            report_names("rejecting path of %s font %a",suffix,completename)                          end                          nofskipped = nofskipped + 1                          return @@ -712,7 +712,7 @@ local function analyzefiles()                      if find(basename,skip_names[i]) then                          done[name] = true                          if trace_names then -                            report_names("rejecting name of %s font %s",suffix,completename) +                            report_names("rejecting name of %s font %a",suffix,completename)                          end                          nofskipped = nofskipped + 1                          return @@ -720,7 +720,7 @@ local function analyzefiles()                  end              end              if trace_names then -                report_names("identifying %s font %s",suffix,completename) +                report_names("identifying %s font %a",suffix,completename)              end              local result, message = filters[lower(suffix)](completename)              if result then @@ -738,11 +738,11 @@ local function analyzefiles()                   -- end                  end                  if trace_warnings and message and message ~= "" then -                    report_names("warning when identifying %s font %s: %s",suffix,completename,message) +                    report_names("warning when identifying %s font %a, %s",suffix,completename,message)                  end              elseif trace_warnings then                  nofskipped = nofskipped + 1 -                report_names("error when identifying %s font %s: %s",suffix,completename,message or "unknown") +                report_names("error when identifying %s font %a, %s",suffix,completename,message or "unknown")              end              done[name] = true          end @@ -755,19 +755,19 @@ local function analyzefiles()              local t = os.gettimeofday() -- use elapser              nofread, nofskipped, nofduplicates = 0, 0, 0              suffix = lower(suffix) -            report_names( "identifying %s font files with suffix %s",what,suffix) +            report_names("identifying %s font files with suffix %a",what,suffix)              method(suffix)              suffix = upper(suffix) -            report_names( "identifying %s font files with suffix %s",what,suffix) +            report_names("identifying %s font files with suffix %a",what,suffix)              method(suffix)              totalnofread, totalnofskipped, totalnofduplicates = totalnofread + nofread, totalnofskipped + nofskipped, totalnofduplicates + nofduplicates              local elapsed = os.gettimeofday() - t -            report_names( "%s %s files identified, %s skipped, %s duplicates, %s hash entries added, runtime %0.3f seconds",nofread,what,nofskipped,nofduplicates,nofread-nofskipped,elapsed) +            report_names("%s %s files identified, %s skipped, %s duplicates, %s hash entries added, runtime %0.3f seconds",nofread,what,nofskipped,nofduplicates,nofread-nofskipped,elapsed)          end          logs.flush()      end      if not trace_warnings then -        report_names( "warnings are disabled (tracker 'fonts.warnings')") +        report_names("warnings are disabled (tracker 'fonts.warnings')")      end      traverse("tree", function(suffix) -- TEXTREE only          resolvers.dowithfilesintree(".*%." .. suffix .. "$", function(method,root,path,name) @@ -779,10 +779,10 @@ local function analyzefiles()              end          end, function(blobtype,blobpath,pattern)              blobpath = resolvers.resolve(blobpath) -- no shortcut -            report_names( "scanning %s for %s files",blobpath,suffix) +            report_names("scanning path %a for %s files",blobpath,suffix)          end, function(blobtype,blobpath,pattern,total,checked,done)              blobpath = resolvers.resolve(blobpath) -- no shortcut -            report_names( "%s entries found, %s %s files checked, %s okay",total,checked,suffix,done) +            report_names("%s entries found, %s %s files checked, %s okay",total,checked,suffix,done)          end)      end)      if texconfig.kpse_init then @@ -820,7 +820,7 @@ local function rejectclashes() -- just to be sure, so no explicit afm will be fo              local fnd, fnm = used[f], s.filename              if fnd then                  if trace_warnings then -                    report_names( "fontname '%s' clashes, rejecting '%s' in favor of '%s'",f,fnm,fnd) +                    report_names("fontname %a clashes, %a rejected in favor of %a",f,fnm,fnd)                  end              else                  used[f] = fnm @@ -834,7 +834,7 @@ local function rejectclashes() -- just to be sure, so no explicit afm will be fo      end      local d = #specifications - #okay      if d > 0 then -        report_names( "%s files rejected due to clashes",d) +        report_names("%s files rejected due to clashes",d)      end      names.data.specifications = okay  end @@ -1005,7 +1005,7 @@ local function foundname(name,sub) -- sub is not used currently          local found = mappings[l][name]          if found then              if trace_names then -                report_names("resolved via direct name match: '%s'",name) +                report_names("resolved via direct name match: %a",name)              end              return found          end @@ -1015,7 +1015,7 @@ local function foundname(name,sub) -- sub is not used currently          local found, fname = fuzzy(mappings[l],sorted_mappings[l],name,sub)          if found then              if trace_names then -                report_names("resolved via fuzzy name match: '%s' => '%s'",name,fname) +                report_names("resolved via fuzzy name match: %a onto %a",name,fname)              end              return found          end @@ -1025,7 +1025,7 @@ local function foundname(name,sub) -- sub is not used currently          local found = fallbacks[l][name]          if found then              if trace_names then -                report_names("resolved via direct fallback match: '%s'",name) +                report_names("resolved via direct fallback match: %a",name)              end              return found          end @@ -1035,13 +1035,13 @@ local function foundname(name,sub) -- sub is not used currently          local found, fname = fuzzy(sorted_mappings[l],sorted_fallbacks[l],name,sub)          if found then              if trace_names then -                report_names("resolved via fuzzy fallback match: '%s' => '%s'",name,fname) +                report_names("resolved via fuzzy fallback match: %a onto %a",name,fname)              end              return found          end      end      if trace_names then -        report_names("font with name '%s' cannot be found",name) +        report_names("font with name %a cannot be found",name)      end  end @@ -1291,36 +1291,34 @@ local function collect(stage,found,done,name,weight,style,width,variant,all)      strictname = "^".. name -- to be checked      local family = families[name]      if trace_names then -        report_names("resolving name '%s', weight '%s', style '%s', width '%s', variant '%s'", -            name or "?",tostring(weight),tostring(style),tostring(width),tostring(variant)) +        report_names("resolving name %a, weight %a, style %a, width %a, variant %a",name,weight,style,width,variant)      end -    --~ print(name,serialize(family))      if weight and weight ~= "" then          if style and style ~= "" then              if width and width ~= "" then                  if variant and variant ~= "" then                      if trace_names then -                        report_names("resolving stage %s, name '%s', weight '%s', style '%s', width '%s', variant '%s'",stage,name,weight,style,width,variant) +                        report_names("resolving stage %s, name %a, weight %a, style %a, width %a, variant %a",stage,name,weight,style,width,variant)                      end                      s_collect_weight_style_width_variant(found,done,all,weight,style,width,variant,family)                      m_collect_weight_style_width_variant(found,done,all,weight,style,width,variant,families,sorted,strictname)                  else                      if trace_names then -                        report_names("resolving stage %s, name '%s', weight '%s', style '%s', width '%s'",stage,name,weight,style,width) +                        report_names("resolving stage %s, name %a, weight %a, style %a, width %a",stage,name,weight,style,width)                      end                      s_collect_weight_style_width(found,done,all,weight,style,width,family)                      m_collect_weight_style_width(found,done,all,weight,style,width,families,sorted,strictname)                  end              else                  if trace_names then -                    report_names("resolving stage %s, name '%s', weight '%s', style '%s'",stage,name,weight,style) +                    report_names("resolving stage %s, name %a, weight %a, style %a",stage,name,weight,style)                  end                  s_collect_weight_style(found,done,all,weight,style,family)                  m_collect_weight_style(found,done,all,weight,style,families,sorted,strictname)              end          else              if trace_names then -                report_names("resolving stage %s, name '%s', weight '%s'",stage,name,weight) +                report_names("resolving stage %s, name %a, weight %a",stage,name,weight)              end              s_collect_weight(found,done,all,weight,family)              m_collect_weight(found,done,all,weight,families,sorted,strictname) @@ -1328,26 +1326,26 @@ local function collect(stage,found,done,name,weight,style,width,variant,all)      elseif style and style ~= "" then          if width and width ~= "" then              if trace_names then -                report_names("resolving stage %s, name '%s', style '%s', width '%s'",stage,name,style,width) +                report_names("resolving stage %s, name %a, style %a, width %a",stage,name,style,width)              end              s_collect_style_width(found,done,all,style,width,family)              m_collect_style_width(found,done,all,style,width,families,sorted,strictname)          else              if trace_names then -                report_names("resolving stage %s, name '%s', style '%s'",stage,name,style) +                report_names("resolving stage %s, name %a, style %a",stage,name,style)              end              s_collect_style(found,done,all,style,family)              m_collect_style(found,done,all,style,families,sorted,strictname)          end      elseif width and width ~= "" then          if trace_names then -            report_names("resolving stage %s, name '%s', width '%s'",stage,name,width) +            report_names("resolving stage %s, name %a, width %a",stage,name,width)          end          s_collect_width(found,done,all,width,family)          m_collect_width(found,done,all,width,families,sorted,strictname)      else          if trace_names then -            report_names("resolving stage %s, name '%s'",stage,name) +            report_names("resolving stage %s, name %a",stage,name)          end          s_collect(found,done,all,family)          m_collect(found,done,all,families,sorted,strictname) @@ -1383,11 +1381,11 @@ local function heuristic(name,weight,style,width,variant,all) -- todo: fallbacks          if nf then              local t = { }              for i=1,nf do -                t[i] = format("'%s'",found[i].fontname) +                t[i] = format("%a",found[i].fontname)              end -            report_names("name '%s' resolved to %s instances: %s",name,nf,concat(t," ")) +            report_names("name %a resolved to %s instances: %s",name,nf,concat(t," "))          else -            report_names("name '%s' unresolved",name) +            report_names("name %a unresolved",name)          end      end      if all then @@ -1538,7 +1536,7 @@ function names.lookup(pattern,name,reload) -- todo: find              lookups = families[pattern]          end          if trace_names then -            report_names("starting with %s lookups for '%s'",#lookups,pattern) +            report_names("starting with %s lookups for %a",#lookups,pattern)          end          if lookups then              for key, value in gmatch(pattern,"([^=,]+)=([^=,]+)") do @@ -1562,7 +1560,7 @@ function names.lookup(pattern,name,reload) -- todo: find                      end                  end                  if trace_names then -                    report_names("%s matches for key '%s' with value '%s'",#t,key,value) +                    report_names("%s matches for key %a with value %a",#t,key,value)                  end                  lookups = t              end @@ -1656,19 +1654,19 @@ end  function names.resolvespec(askedname,sub) -- overloads previous definition      local name, weight, style, width, variant = names.splitspec(askedname)      if trace_specifications then -        report_names("resolving specification: %s -> name=%s, weight=%s, style=%s, width=%s, variant=%s",askedname,name,weight,style,width,variant) +        report_names("resolving specification: %a to name=%s, weight=%s, style=%s, width=%s, variant=%s",askedname,name,weight,style,width,variant)      end      local found = names.registered(name,weight,style,width,variant)      if found and found.filename then          if trace_specifications then -            report_names("resolved by registered names: %s -> %s",askedname,found.filename) +            report_names("resolved by registered names: %a to %s",askedname,found.filename)          end          return found.filename, found.subname, found.rawname      else          found = names.specification(name,weight,style,width,variant)          if found and found.filename then              if trace_specifications then -                report_names("resolved by font database: %s -> %s",askedname,found.filename) +                report_names("resolved by font database: %a to %s",askedname,found.filename)              end              return found.filename, found.subfont and found.rawname          end diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua index 53ef8dd99..316b947a3 100644 --- a/tex/context/base/font-tfm.lua +++ b/tex/context/base/font-tfm.lua @@ -57,7 +57,7 @@ local function read_from_tfm(specification)      local filename = specification.filename      local size     = specification.size      if trace_defining then -        report_defining("loading tfm file %s at size %s",filename,size) +        report_defining("loading tfm file %a at size %s",filename,size)      end      local tfmdata = font.read_tfm(filename,size) -- not cached, fast enough      if tfmdata then @@ -132,7 +132,7 @@ local function check_tfm(specification,fullname) -- we could split up like afm/o          specification.format   = "ofm"          return read_from_tfm(specification)      elseif trace_defining then -        report_defining("loading tfm with name %s fails",specification.name) +        report_defining("loading tfm with name %a fails",specification.name)      end  end diff --git a/tex/context/base/font-vf.lua b/tex/context/base/font-vf.lua index 34d74d93f..1fe6dd71c 100644 --- a/tex/context/base/font-vf.lua +++ b/tex/context/base/font-vf.lua @@ -32,18 +32,18 @@ function vf.find(name)          local format = fonts.loggers.format(name)          if format == 'tfm' or format == 'ofm' then              if trace_defining then -                report_defining("locating vf for %s",name) +                report_defining("locating vf for %a",name)              end              return findbinfile(name,"ovf")          else              if trace_defining then -                report_defining("vf for %s is already taken care of",name) +                report_defining("vf for %a is already taken care of",name)              end              return nil -- ""          end      else          if trace_defining then -            report_defining("locating vf for %s",name) +            report_defining("locating vf for %a",name)          end          return findbinfile(name,"ovf")      end diff --git a/tex/context/base/grph-fil.lua b/tex/context/base/grph-fil.lua index 9cdda13e0..3449f1779 100644 --- a/tex/context/base/grph-fil.lua +++ b/tex/context/base/grph-fil.lua @@ -39,7 +39,7 @@ function jobfiles.run(name,action)      local newchecksum = file.checksum(name)      if jobfiles.forcerun or not oldchecksum or oldchecksum ~= newchecksum then          if trace_run then -            report_run("processing file, changes in '%s', processing forced",name) +            report_run("processing file, changes in %a, processing forced",name)          end          local ta = type(action)          if ta == "function" then @@ -47,10 +47,10 @@ function jobfiles.run(name,action)          elseif ta == "string" and action ~= "" then              os.execute(action)          else -            report_run("processing file, no action given for processing '%s'",name) +            report_run("processing file, no action given for processing %a",name)          end      elseif trace_run then -        report_run("processing file, no changes in '%s', not processed",name) +        report_run("processing file, no changes in %a, not processed",name)      end      tobesaved[name] = newchecksum  end diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua index ef03f24e0..d28b63fcf 100644 --- a/tex/context/base/grph-inc.lua +++ b/tex/context/base/grph-inc.lua @@ -90,12 +90,12 @@ function img.check(figure)              if height > maxdimen then                  figure.height = maxdimen                  figure.width  = width * maxdimen/height -                report_inclusion("limiting natural dimensions of %q (height)",figure.filename or "?") +                report_inclusion("limiting natural dimensions of %a (%s)",figure.filename,"height")              end          elseif width > maxdimen then              figure.width  = maxdimen              figure.height = height * maxdimen/width -            report_inclusion("limiting natural dimensions of %q (width)",figure.filename or "?") +            report_inclusion("limiting natural dimensions of %a (%s)",figure.filename,"width")          end          return figure      end @@ -241,7 +241,7 @@ function figures.setorder(list) -- can be table or string                  done[l] = true              end          end -        report_inclusion("lookup order: %s",concat(figures_order," ")) +        report_inclusion("lookup order % a",figures_order)      else          -- invalid list      end @@ -258,7 +258,7 @@ function figures.guess(filename)                  if lpegmatch(pattern.pattern,str) then                      local format = pattern.format                      if trace_figures then -                        report_inclusion("file %q has format %s",filename,format) +                        report_inclusion("file %a has format %a",filename,format)                      end                      return format                  end @@ -354,8 +354,8 @@ function figures.setpaths(locationset,pathlist)      last_pathlist = pathlist      figures.paths = figure_paths      if trace_figures then -        report_inclusion("locations: %s",last_locationset) -        report_inclusion("path list: %s",concat(figure_paths, " ")) +        report_inclusion("using locations %a",last_locationset) +        report_inclusion("using paths % a",figure_paths)      end  end @@ -492,12 +492,12 @@ local function forbiddenname(filename)      local expandedfullname = collapsepath(filename,true)      local expandedinputname = collapsepath(file.addsuffix(environment.jobfilename,environment.jobfilesuffix),true)      if expandedfullname == expandedinputname then -        report_inclusion("skipping graphic with same name as input filename (%s), enforce suffix",expandedinputname) +        report_inclusion("skipping graphic with same name as input filename %a, enforce suffix",expandedinputname)          return true      end      local expandedoutputname = collapsepath(codeinjections.getoutputfilename(),true)      if expandedfullname == expandedoutputname then -        report_inclusion("skipping graphic with same name as output filename (%s), enforce suffix",expandedoutputname) +        report_inclusion("skipping graphic with same name as output filename %a, enforce suffix",expandedoutputname)          return true      end  end @@ -523,11 +523,10 @@ local function register(askedname,specification)                  newformat = defaultformat              end              if trace_conversion then -                report_inclusion("checking conversion of '%s' (%s): old format '%s', new format '%s', conversion '%s', resolution '%s'", +                report_inclusion("checking conversion of %a, fullname %a, old format %a, new format %a, conversion %a, resolution %a",                      askedname,specification.fullname,format,newformat,conversion or "default",resolution or "default")              end              -- quick hack -         -- local converter = (newformat ~= format) and converters[format]              local converter = (newformat ~= format or resolution) and converters[format]              if converter then                  if converter[newformat] then @@ -542,7 +541,7 @@ local function register(askedname,specification)                      end                  end              elseif trace_conversion then -                report_inclusion("no converter for '%s' -> '%s'",format,newformat) +                report_inclusion("no converter for %a to %a",format,newformat)              end              if converter then                  local oldname = specification.fullname @@ -566,7 +565,7 @@ local function register(askedname,specification)                  end                  if not file.is_writable(newpath) then                      if trace_conversion then -                        report_inclusion("path '%s'is not writable, forcing conversion path '.' ",newpath) +                        report_inclusion("path %a is not writable, forcing conversion path %a",newpath,".")                      end                      newpath = "."                  end @@ -602,12 +601,12 @@ local function register(askedname,specification)                  local newtime = lfs.attributes(newname,'modification') or 0                  if newtime == 0 or oldtime > newtime then                      if trace_conversion then -                        report_inclusion("converting '%s' (%s) from '%s' to '%s'",askedname,oldname,format,newformat) +                        report_inclusion("converting %a (%a) from %a to %a",askedname,oldname,format,newformat)                      end                      converter(oldname,newname,resolution or "")                  else                      if trace_conversion then -                        report_inclusion("no need to convert '%s' (%s) from '%s' to '%s'",askedname,oldname,format,newformat) +                        report_inclusion("no need to convert %a (%a) from %a to %a",askedname,oldname,format,newformat)                      end                  end                  if io.exists(newname) and io.size(newname) > 0 then @@ -623,7 +622,7 @@ local function register(askedname,specification)                          local suffix = file.suffix(newformat)                          if figures_suffixes[suffix] then                              if trace_figures then -                                report_inclusion("using suffix '%s' as format for '%s'",suffix,format) +                                report_inclusion("using suffix %a as format for %a",suffix,format)                              end                              format = suffix                          end @@ -638,15 +637,15 @@ local function register(askedname,specification)          if not found then              specification.found = false              if trace_figures then -                report_inclusion("format not supported: %s",format) +                report_inclusion("format %a is not supported",format)              end          else              specification.found = true              if trace_figures then                  if validtypes[format] then -- format? -                    report_inclusion("format natively supported by backend: %s",format) +                    report_inclusion("format %a natively supported by backend",format)                  else -                    report_inclusion("format supported by output file format: %s",format) +                    report_inclusion("format %a supported by output file format",format)                  end              end          end @@ -693,7 +692,7 @@ local function locate(request) -- name, format, cache          local foundname = resolvers.findbinfile(askedname)          if not foundname or not lfs.isfile(foundname) then -- foundname can be dummy              if trace_figures then -                report_inclusion("strategy: unresolved url: %s",askedname) +                report_inclusion("unknown url %a",askedname)              end              -- url not found              return register(askedname) @@ -702,13 +701,13 @@ local function locate(request) -- name, format, cache          local guessedformat = figures.guess(foundname)          if askedformat ~= guessedformat then              if trace_figures then -                report_inclusion("strategy: resolved url: %s, unknown format",askedname) +                report_inclusion("url %a has unknown format",askedname)              end              -- url found, but wrong format              return register(askedname)          else              if trace_figures then -                report_inclusion("strategy: resolved url: %s -> %s",askedname,foundname) +                report_inclusion("url %a is resolved to %a",askedname,foundname)              end              return register(askedname, {                  askedname  = askedname, @@ -727,7 +726,7 @@ local function locate(request) -- name, format, cache      if askedformat ~= "" then          askedformat = lower(askedformat)          if trace_figures then -            report_inclusion("strategy: forced format %s",askedformat) +            report_inclusion("forcing format %a",askedformat)          end          local format = figures_suffixes[askedformat]          if not format then @@ -755,7 +754,7 @@ local function locate(request) -- name, format, cache                  return register(askedname)              end          elseif trace_figures then -            report_inclusion("strategy: unknown format %s",askedformat) +            report_inclusion("unknown format %a",askedformat)          end          if askedpath then              -- path and type given, todo: strip pieces of path @@ -805,7 +804,7 @@ local function locate(request) -- name, format, cache          end      elseif askedpath then          if trace_figures then -            report_inclusion("strategy: rootbased path") +            report_inclusion("using rootbased path")          end          for i=1,#figures_order do              local format = figures_order[i] @@ -829,7 +828,7 @@ local function locate(request) -- name, format, cache      else          if figures.preferquality then              if trace_figures then -                report_inclusion("strategy: unknown format, prefer quality") +                report_inclusion("unknown format, quality preferred")              end              for j=1,#figures_order do                  local format = figures_order[j] @@ -844,7 +843,7 @@ local function locate(request) -- name, format, cache                          local isfile = url.hashed(check).scheme == "file"                          if not isfile then                              if trace_figures then -                                report_inclusion("warning: skipping path %s",path) +                                report_inclusion("warning: skipping path %a",path)                              end                          else                              local foundname, quitscanning, forcedformat = figures.exists(check,format,resolve_too) -- true) @@ -864,7 +863,7 @@ local function locate(request) -- name, format, cache              end          else -- 'location'              if trace_figures then -                report_inclusion("strategy: unknown format, prefer path") +                report_inclusion("unknown format, using path strategy")              end              for i=1,#figure_paths do                  local path = figure_paths[i] @@ -891,7 +890,7 @@ local function locate(request) -- name, format, cache          end          if figures.defaultsearch then              if trace_figures then -                report_inclusion("strategy: default tex path") +                report_inclusion("using default tex path")              end              for j=1,#figures_order do                  local format = figures_order[j] @@ -1008,9 +1007,9 @@ function existers.generic(askedname,resolve)      end      if trace_figures then          if result then -            report_inclusion("found: %s -> %s",askedname,result) +            report_inclusion("%a resolved to %a",askedname,result)          else -            report_inclusion("not found: %s",askedname) +            report_inclusion("%a cannot be resolved",askedname)          end      end      return result @@ -1047,11 +1046,11 @@ function checkers.generic(data)          figure, data = f or figure, d or data          figures_loaded[hash] = figure          if trace_conversion then -            report_inclusion("new graphic, hash: %s",hash) +            report_inclusion("new graphic, using hash %a",hash)          end      else          if trace_conversion then -            report_inclusion("existing graphic, hash: %s",hash) +            report_inclusion("existing graphic, using hash %a",hash)          end      end      if figure then @@ -1141,7 +1140,7 @@ function checkers.mov(data)      dr.width, dr.height = width, height      du.width, du.height, du.foundname = width, height, foundname      if trace_inclusion then -        report_inclusion("including movie '%s': width %s, height %s",foundname,width,height) +        report_inclusion("including movie %a, width %p, height %p",foundname,width,height)      end      -- we need to push the node.write in between ... we could make a shared helper for this      context.startfoundexternalfigure(width .. "sp",height .. "sp") @@ -1229,9 +1228,9 @@ function existers.auto(askedname)      local name = gsub(askedname, ".auto$", "")      local format = figures.guess(name)      if format then -        report_inclusion("format guess for %q: %s",name,format) +        report_inclusion("format guess %a for %a",format,name)      else -        report_inclusion("format guess for %q is not possible",name) +        report_inclusion("format guess for %a is not possible",name)      end      return format and name, true, format  end @@ -1264,13 +1263,13 @@ local function runprogram(binary,argument,variables)          argument = concat(argument," ") -- for old times sake      end      if not os.which(binary) then -        report_inclusion("program '%s' is not installed, not running: %s",binary,command) +        report_inclusion("program %a is not installed, not running command: %s",binary,command)      elseif not argument or argument == "" then -        report_inclusion("nothing to run %q",binary) +        report_inclusion("nothing to run, unknown program %a",binary)      else -        local command = format("%q %s",binary,replacetemplate(longtostring(argument),variables)) +        local command = format([["%s" %s]],binary,replacetemplate(longtostring(argument),variables))          if trace_conversion or trace_programs then -            report_inclusion("running: %s",command) +            report_inclusion("running command: %s",command)          end          os.spawn(command)      end @@ -1455,7 +1454,7 @@ function bases.use(basename)                  xml.registerns("rlx","http://www.pragma-ade.com/schemas/rlx") -- we should be able to do this per xml file              end              if trace_bases then -                report_inclusion("registering base '%s'",basename) +                report_inclusion("registering base %a",basename)              end          end      end @@ -1463,7 +1462,7 @@ end  local function bases_find(basename,askedlabel)      if trace_bases then -        report_inclusion("checking for '%s' in base '%s'",askedlabel,basename) +        report_inclusion("checking for %a in base %a",askedlabel,basename)      end      basename = file.addsuffix(basename,"xml")      local t = bases_found[askedlabel] @@ -1479,7 +1478,7 @@ local function bases_find(basename,askedlabel)                      base[2] = xmlfile                      base[3] = xml.load(xmlfile)                      if trace_bases then -                        report_inclusion("base '%s' loaded",xmlfile) +                        report_inclusion("base %a loaded",xmlfile)                      end                      break                  end @@ -1498,13 +1497,13 @@ local function bases_find(basename,askedlabel)                      }                      bases_found[askedlabel] = t                      if trace_bases then -                        report_inclusion("figure '%s' found in base '%s'",askedlabel,base[2]) +                        report_inclusion("figure %a found in base %a",askedlabel,base[2])                      end                      return t                  end              end              if trace_bases and not t then -                report_inclusion("figure '%s' not found in base '%s'",askedlabel,base[2]) +                report_inclusion("figure %a not found in base %a",askedlabel,base[2])              end          end      end diff --git a/tex/context/base/grph-u3d.lua b/tex/context/base/grph-u3d.lua index 529cd6188..6961c5503 100644 --- a/tex/context/base/grph-u3d.lua +++ b/tex/context/base/grph-u3d.lua @@ -27,7 +27,7 @@ function figures.checkers.u3d(data)      dr.width, dr.height = width, height      du.width, du.height, du.foundname = width, height, foundname      if trace_inclusion then -        report_u3d("including u3d '%s': width %s, height %s",foundname,width,height) +        report_u3d("including u3d %a, width %p, height %p",foundname,width,height)      end      context.startfoundexternalfigure(width .. "sp",height .. "sp")      context(function() diff --git a/tex/context/base/grph-wnd.lua b/tex/context/base/grph-wnd.lua index 0ea3f8c43..ebb9b1169 100644 --- a/tex/context/base/grph-wnd.lua +++ b/tex/context/base/grph-wnd.lua @@ -20,7 +20,7 @@ local function togray(oldname,newname)      if lfs.isfile(oldname) then          require("gmwand")          if trace_conversion then -            report_wand("converting '%s' to '%s' using gmwand",oldname,newname) +            report_wand("converting %a to %a using gmwand",oldname,newname)          end          gmwand.InitializeMagick("./") -- What does this path do?          local wand = gmwand.NewMagickWand() @@ -29,7 +29,7 @@ local function togray(oldname,newname)          gmwand.MagickWriteImages(wand,newname,1)          gmwand.DestroyMagickWand(wand)      else -        report_wand("unable to convert '%s' to '%s' using gmwand",oldname,newname) +        report_wand("unable to convert %a to %a using gmwand",oldname,newname)      end  end @@ -39,7 +39,7 @@ for i=1,#formats do      local oldformat = formats[i]      local newformat = "gray." .. oldformat      if trace_conversion then -        report_wand("installing converter: %s -> %s",oldformat,newformat) +        report_wand("installing converter for %a to %a",oldformat,newformat)      end      converters[oldformat]            = converters[oldformat] or { }      converters[oldformat][newformat] = togray diff --git a/tex/context/base/java-ini.lua b/tex/context/base/java-ini.lua index b431a965c..e9328737a 100644 --- a/tex/context/base/java-ini.lua +++ b/tex/context/base/java-ini.lua @@ -34,7 +34,7 @@ local preambled = { }  local function storefunction(s,preamble)      if trace_javascript then -        report_javascripts("found: function '%s'",s) +        report_javascripts("found function %a",s)      end      functions[s] = preamble  end @@ -73,7 +73,7 @@ function javascripts.storepreamble(str) -- now later          preambles[n] = { name, used, script }          preambled[name] = n          if trace_javascript then -            report_javascripts("stored: preamble '%s', state '%s', order '%s'",name,used,n) +            report_javascripts("stored preamble %a, state %a, order %a",name,used,n)          end          lpegmatch(parsefunctions,script,1,n)      end @@ -85,7 +85,7 @@ function javascripts.setpreamble(name,script) -- now later          preambles[n] = { name, "now", script }          preambled[name] = n          if trace_javascript then -            report_javascripts("adapted: preamble '%s', state '%s', order '%s'",name,"now",n) +            report_javascripts("adapted preamble %a, state %a, order %a",name,"now",n)          end          lpegmatch(parsefunctions,script,1,n)      end @@ -97,14 +97,14 @@ function javascripts.addtopreamble(name,script)          if p then              preambles[p] = { "now", preambles[p] .. " ;\n" .. script }              if trace_javascript then -                report_javascripts("extended: preamble '%s', state '%s', order '%s'",name,"now",p) +                report_javascripts("extended preamble %a, state %a, order %a",name,"now",p)              end          else              local n = #preambles + 1              preambles[n] = { name, "now", script }              preambled[name] = n              if trace_javascript then -                report_javascripts("stored: preamble '%s', state '%s', order '%s'",name,"now",n) +                report_javascripts("stored preamble %a, state %a, order %a",name,"now",n)              end              lpegmatch(parsefunctions,script,1,n)          end @@ -119,7 +119,7 @@ function javascripts.usepreamblenow(name) -- now later              if not preambled[somename] then                  preambles[preambled[somename]][2] = "now"                  if trace_javascript then -                    report_javascripts("used: preamble '%s', state '%s', order '%s'",somename,"now","auto") +                    report_javascripts("used preamble %a, state %a, order %a",somename,"now","auto")                  end              end          end @@ -140,15 +140,15 @@ function javascripts.code(name,arguments)                  preambles[p][2] = "now"                  if trace_javascript and not reported[name] then                      reported[name] = true -                    report_javascripts("used: code '%s', preamble '%s'",name,u) +                    report_javascripts("used code %a, preamble %a",name,u)                  end              elseif trace_javascript and not reported[name] then                  reported[name] = true -                report_javascripts("used: code '%s'",name) +                report_javascripts("used code %a",name)              end          elseif trace_javascript and not reported[name] then              reported[name] = true -            report_javascripts("used: code '%s'",name) +            report_javascripts("used code %a",name)          end          used = true          return code @@ -158,7 +158,7 @@ function javascripts.code(name,arguments)          used = true          if trace_javascript and not reported[name] then              reported[name] = true -            report_javascripts("used: function '%s'",name) +            report_javascripts("used function %a",name)          end          preambles[f][2] = "now" -- automatically tag preambles that define the function (as later)          if arguments then @@ -180,7 +180,7 @@ function javascripts.flushpreambles()              local preamble = preambles[i]              if preamble[2] == "now" then                  if trace_javascript then -                    report_javascripts("flushed: preamble '%s'",preamble[1]) +                    report_javascripts("flushed preamble %a",preamble[1])                  end                  t[#t+1] = { preamble[1], preamble[3] }              end @@ -195,13 +195,13 @@ local function action(name,foundname)      context.startnointerference()      context.startreadingfile()      context.input(foundname) -    status_javascripts("loaded: library '%s'",name) +    status_javascripts("loaded: library %a",name)      context.stopreadingfile()      context.stopnointerference()  end  local function failure(name) -    report_javascripts("unknown: library '%s'",name) +    report_javascripts("unknown library %a",name)  end  function javascripts.usescripts(name) diff --git a/tex/context/base/l-lua.lua b/tex/context/base/l-lua.lua index 9ac8192b0..24a788bec 100644 --- a/tex/context/base/l-lua.lua +++ b/tex/context/base/l-lua.lua @@ -215,7 +215,7 @@ function package.extralibpath(...)              local path = cleanpath(paths[i])              if not libhash[path] then                  if trace then -                    report("! extra lua path '%s'",path) +                    report("! extra lua path: %s",path)                  end                  libextras[#libextras+1] = path                  libpaths [#libpaths +1] = path @@ -236,7 +236,7 @@ function package.extraclibpath(...)              local path = cleanpath(paths[i])              if not clibhash[path] then                  if trace then -                    report("! extra lib path '%s'",path) +                    report("! extra lib path: %s",path)                  end                  clibextras[#clibextras+1] = path                  clibpaths [#clibpaths +1] = path diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua index c33cd195b..830b05b81 100644 --- a/tex/context/base/l-table.lua +++ b/tex/context/base/l-table.lua @@ -1272,9 +1272,20 @@ function table.reverse(t)      end  end -function table.sequenced(t,sep) -- hash only -    if t then -        local s, n = { }, 0 +function table.sequenced(t,sep,simple) -- hash only +    if not t then +        return "" +    end +    local n = #t +    local s = { } +    if n > 0 then +        -- indexed +        for i=1,n do +            s[i] = tostring(t[i]) +        end +    else +        -- hashed +        n = 0          for k, v in sortedhash(t) do              if simple then                  if v == true then @@ -1289,10 +1300,8 @@ function table.sequenced(t,sep) -- hash only                  s[n] = k .. "=" .. tostring(v)              end          end -        return concat(s, sep or " | ") -    else -        return ""      end +    return concat(s,sep or " | ")  end  function table.print(t,...) diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua index 02a33c181..4dcfd2f36 100644 --- a/tex/context/base/lang-ini.lua +++ b/tex/context/base/lang-ini.lua @@ -96,7 +96,7 @@ local function loaddefinitions(tag,specification)      local definitions = settings_to_array(specification.patterns or "")      if #definitions > 0 then          if trace_patterns then -            report_initialization("pattern specification for language '%s': %s",tag,specification.patterns) +            report_initialization("pattern specification for language %a: %s",tag,specification.patterns)          end          local dataused, ok = data.used, false          for i=1,#definitions do @@ -105,7 +105,7 @@ local function loaddefinitions(tag,specification)                  -- error              elseif definition == "reset" then -- interfaces.variables.reset                  if trace_patterns then -                    report_initialization("clearing patterns for language '%s'",tag) +                    report_initialization("clearing patterns for language %a",tag)                  end                  instance:clear_patterns()              elseif not dataused[definition] then @@ -114,7 +114,7 @@ local function loaddefinitions(tag,specification)                  local fullname = resolvers.findfile(filename) or ""                  if fullname ~= "" then                      if trace_patterns then -                        report_initialization("loading definition '%s' for language '%s' from '%s'",definition,tag,fullname) +                        report_initialization("loading definition %a for language %a from %a",definition,tag,fullname)                      end                      local defs = dofile(fullname) -- use regular loader instead                      if defs then -- todo: version test @@ -122,18 +122,18 @@ local function loaddefinitions(tag,specification)                          instance:patterns   (defs.patterns   and defs.patterns  .data or "")                          instance:hyphenation(defs.exceptions and defs.exceptions.data or "")                      else -                        report_initialization("invalid definition '%s' for language '%s' in '%s'",definition,tag,filename) +                        report_initialization("invalid definition %a for language %a in %a",definition,tag,filename)                      end                  elseif trace_patterns then -                    report_initialization("invalid definition '%s' for language '%s' in '%s'",definition,tag,filename) +                    report_initialization("invalid definition %a for language %a in %a",definition,tag,filename)                  end              elseif trace_patterns then -                report_initialization("definition '%s' for language '%s' already loaded",definition,tag) +                report_initialization("definition %a for language %a already loaded",definition,tag)              end          end          return ok      elseif trace_patterns then -        report_initialization("no definitions for language '%s'",tag) +        report_initialization("no definitions for language %a",tag)      end      statistics.stoptiming(languages)  end @@ -145,7 +145,7 @@ local noflanguages = storage.shared.noflanguages  function languages.define(tag,parent)      noflanguages = noflanguages + 1      if trace_patterns then -        report_initialization("assigning number %s to %s",noflanguages,tag) +        report_initialization("assigning number %a to %a",noflanguages,tag)      end      numbers[noflanguages] = tag      registered[tag] = { @@ -223,14 +223,14 @@ else          if l then              if l.dirty then                  if trace_patterns then -                    report_initialization("checking patterns for %s (%s)",tag,default) +                    report_initialization("checking patterns for %a with default %a",tag,default)                  end                  -- patterns is already resolved to parent patterns if applicable                  if patterns and patterns ~= "" then                      if l.patterns ~= patterns then                          l.patterns = patterns                          if trace_patterns then -                            report_initialization("loading patterns for '%s' using specification '%s'",tag,patterns) +                            report_initialization("loading patterns for %a using specification %a",tag,patterns)                          end                          loaddefinitions(tag,l)                      else @@ -239,13 +239,13 @@ else                  elseif l.patterns == "" then                      l.patterns = tag                      if trace_patterns then -                        report_initialization("loading patterns for '%s' using tag",tag) +                        report_initialization("loading patterns for %a using tag",tag)                      end                      local ok = loaddefinitions(tag,l)                      if not ok and tag ~= default then                          l.patterns = default                          if trace_patterns then -                            report_initialization("loading patterns for '%s' using default",tag) +                            report_initialization("loading patterns for %a using default",tag)                          end                          loaddefinitions(tag,l)                      end @@ -373,12 +373,12 @@ end)  --~     local ok = fullname ~= ""  --~     if ok then  --~         if trace_patterns then ---~             report_initialization("filtering %s for language '%s' from '%s'",target,tag,fullname) +--~             report_initialization("filtering %s for language %a from %a",target,tag,fullname)  --~         end  --~         lang[target](data,filter(fullname) or "")  --~     else  --~         if trace_patterns then ---~             report_initialization("no %s for language '%s' in '%s'",target,tag,filename or "?") +--~             report_initialization("no %s for language %a in %a",target,tag,filename)  --~         end  --~         lang[target](instance,"")  --~     end diff --git a/tex/context/base/lang-lab.lua b/tex/context/base/lang-lab.lua index 568964251..aba068296 100644 --- a/tex/context/base/lang-lab.lua +++ b/tex/context/base/lang-lab.lua @@ -93,12 +93,12 @@ local function definelanguagelabels(data,class,tag,rawtag)          elseif type(text) == "table" then              contextsprint(prtcatcodes,"\\setlabeltextpair{",class,"}{",language,"}{",tag,"}{",text[1],"}{",text[2],"}")              if trace_labels then -                report_labels("language '%s', defining label '%s' as '%s' and '%s'",language,rawtag,text[1],text[2]) +                report_labels("language %a, defining label %a as %a and %a",language,rawtag,text[1],text[2])              end          else              contextsprint(prtcatcodes,"\\setlabeltextpair{",class,"}{",language,"}{",tag,"}{",text,"}{}")              if trace_labels then -                report_labels("language '%s', defining label '%s' as '%s'",language,rawtag,text) +                report_labels("language %a, defining label %a as %a",language,rawtag,text)              end          end      end @@ -107,7 +107,7 @@ end  function labels.define(class,name,prefixed)      local list = languages.data.labels[name]      if list then -        report_labels("defining label set '%s'",name) +        report_labels("defining label set %a",name)          for tag, data in next, list do              if data.hidden then                  -- skip @@ -135,25 +135,24 @@ function labels.define(class,name,prefixed)              end          end      else -        report_labels("unknown label set '%s'",name) +        report_labels("unknown label set %a",name)      end  end ---~ function labels.check() ---~     for category, list in next, languages.data.labels do ---~         for tag, specification in next, list do ---~             for language, text in next, specification.labels do ---~                 if type(text) == "string" and find(text,",") then ---~                     report_labels("label with comma: category '%s', language '%s', tag '%s', text '%s'", ---~                         category, language, tag, text) ---~                 end ---~             end ---~         end ---~     end ---~ end ---~ ---~ labels.check() - +-- function labels.check() +--     for category, list in next, languages.data.labels do +--         for tag, specification in next, list do +--             for language, text in next, specification.labels do +--                 if type(text) == "string" and find(text,",") then +--                     report_labels("warning: label with comma found, category %a, language %a, tag %a, text %a", +--                         category, language, tag, text) +--                 end +--             end +--         end +--     end +-- end +-- +-- labels.check()  -- interface diff --git a/tex/context/base/lang-wrd.lua b/tex/context/base/lang-wrd.lua index c093d11d7..06a2311a6 100644 --- a/tex/context/base/lang-wrd.lua +++ b/tex/context/base/lang-wrd.lua @@ -60,7 +60,7 @@ local loaded = { } -- we share lists  function words.load(tag,filename)      local fullname = resolvers.findfile(filename,'other text file') or ""      if fullname ~= "" then -        report_words("loading word file '%s'",fullname) +        report_words("loading word file %a",fullname)          statistics.starttiming(languages)          local list = loaded[fullname]          if not list then @@ -72,7 +72,7 @@ function words.load(tag,filename)          wordsdata[tag] = list          statistics.stoptiming(languages)      else -        report_words("missing word file '%s'",filename) +        report_words("missing word file %a",filename)      end  end @@ -307,7 +307,7 @@ local function dumpusedwords()      if dumpthem then          collected.threshold = words.threshold          dumpname = dumpname or file.addsuffix(tex.jobname,"words") -        report_words("saving list of used words in '%s'",dumpname) +        report_words("saving list of used words in %a",dumpname)          io.savedata(dumpname,table.serialize(collected,true))       -- table.tofile(dumpname,list,true)      end diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index aee2c4edf..96bb85c5f 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -150,7 +150,7 @@ local function link(url,filename,destination,page,actions)                  }              }          elseif trace_references then -            report_reference("invalid page reference: %s",tostring(page)) +            report_reference("invalid page reference %a",page)          end      end      return false @@ -234,7 +234,7 @@ local function use_normal_annotations()      local function reference(width,height,depth,prerolled) -- keep this one          if prerolled then              if trace_references then -                report_reference("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) +                report_reference("width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled)              end              return pdfannotation_node(width,height,depth,prerolled)          end @@ -275,7 +275,7 @@ local function use_shared_annotations()      local function reference(width,height,depth,prerolled)          if prerolled then              if trace_references then -                report_reference("w=%s, h=%s, d=%s, a=%s",width,height,depth,prerolled) +                report_reference("width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled)              end              local luacode = format("_bpnf_(%s,%s,%s,'%s')",width,height,depth,prerolled)              return latelua_node(luacode) @@ -323,7 +323,7 @@ function nodeinjections.destination(width,height,depth,name,view)      if not done[name] then          done[name] = true          if trace_destinations then -            report_destination("w=%s, h=%s, d=%s, n=%s, v=%s",width,height,depth,name,view or "no view") +            report_destination("width %p, height %p, depth %p, name %a, view %a",width,height,depth,name,view)          end          return pdfdestination_node(width,height,depth,name,view) -- can be begin/end node      end @@ -414,7 +414,7 @@ function specials.internal(var,actions) -- better resolve in strc-ref  --~ inspect(v)      if not v then          -- error -        report_reference("no internal reference '%s'",i or "?") +        report_reference("no internal reference %a",i)      elseif getinnermethod() == "names" then          -- named          return link(nil,nil,"aut:"..i,v.references.realpage,actions) @@ -492,17 +492,17 @@ end  -- sections ---~ function specials.section(var,actions) ---~     local sectionname = var.operation ---~     local destination = var.arguments ---~     local internal    = structures.sections.internalreference(sectionname,destination) ---~     if internal then ---~         var.special   = "internal" ---~         var.operation = internal ---~         var.arguments = nil ---~         specials.internal(var,actions) ---~     end ---~ end +-- function specials.section(var,actions) +--     local sectionname = var.operation +--     local destination = var.arguments +--     local internal    = structures.sections.internalreference(sectionname,destination) +--     if internal then +--         var.special   = "internal" +--         var.operation = internal +--         var.arguments = nil +--         specials.internal(var,actions) +--     end +-- end  specials.section = specials.internal -- specials.section just need to have a value as it's checked @@ -687,7 +687,7 @@ local function build(levels,start,parent,method)              return i, n, first, last          elseif level == startlevel then              if trace_bookmarks then -                report_bookmark("%3i %s%s %s",reference.realpage,rep("  ",level-1),(open and "+") or "-",title) +                report_bookmark("%3i %w%s %s",reference.realpage,(level-1)*2,(open and "+") or "-",title)              end              local prev = child              child = pdfreserveobject() diff --git a/tex/context/base/lpdf-col.lua b/tex/context/base/lpdf-col.lua index 4936b37c9..0109ca602 100644 --- a/tex/context/base/lpdf-col.lua +++ b/tex/context/base/lpdf-col.lua @@ -235,7 +235,7 @@ local function registersomespotcolor(name,noffractions,names,p,colorspace,range,                  if sn then                      colorants[name] = pdfreference(sn)                  else -                    report_color("unknown colorant %s, using black instead",name or n) +                    report_color("unknown colorant %a, using black instead",name or n)                      name = "Black"                  end              end diff --git a/tex/context/base/lpdf-epa.lua b/tex/context/base/lpdf-epa.lua index 93e494a31..dc7cef310 100644 --- a/tex/context/base/lpdf-epa.lua +++ b/tex/context/base/lpdf-epa.lua @@ -35,17 +35,21 @@ local function makenamespace(filename)  end  local function add_link(x,y,w,h,destination,what) +    x = x .. "bp" +    y = y .. "bp" +    w = w .. "bp" +    h = h .. "bp"      if trace_links then -        report_link("dx: % 4i, dy: % 4i, wd: % 4i, ht: % 4i, destination: %s, type: %s",x,y,w,h,destination,what) +        report_link("destination %a, type %a, dx %s, dy %s, wd %s, ht %s",destination,what,x,y,w,h)      end      local locationspec = { -- predefining saves time -        x      = x .. "bp", -        y      = y .. "bp", +        x      = x, +        y      = y,          preset = "leftbottom",      }      local buttonspec = { -        width  = w .. "bp", -        height = h .. "bp", +        width  = w, +        height = h,          offset = variables.overlay,          frame  = trace_links and variables.on or variables.off,      } @@ -152,23 +156,23 @@ function codeinjections.mergereferences(specification)                                  elseif linktype == "URI" then                                      link_uri(x,y,w,h,document,annotation)                                  elseif trace_links then -                                    report_link("unsupported link annotation %q",linktype) +                                    report_link("unsupported link annotation %a",linktype)                                  end                              else                                  report_link("mising link annotation")                              end                          elseif trace_links then -                            report_link("unsupported annotation %q",subtype) +                            report_link("unsupported annotation %a",subtype)                          end                      elseif trace_links then -                        report_link("broken annotation, index: %i",i) +                        report_link("broken annotation, index %a",i)                      end                  end                  context.flushlayer { "epdflinks" }               -- context("\\gdef\\figurereference{%s}",reference) -- global                  context.setgvalue("figurereference",reference) -- global                  if trace_links then -                    report_link("setting figure reference to %q",reference) +                    report_link("setting figure reference to %a",reference)                  end                  specification.reference = reference                  return namespace @@ -200,7 +204,7 @@ function codeinjections.mergeviewerlayers(specification)                          local tag = namespace .. gsub(layer," ",":")                          local title = tag                          if trace_links then -                            report_link("using layer %q",tag) +                            report_link("using layer %a",tag)                          end                          attributes.viewerlayers.define { -- also does some cleaning                              tag       = tag, -- todo: #3A or so @@ -211,7 +215,7 @@ function codeinjections.mergeviewerlayers(specification)                          }                          codeinjections.useviewerlayer(tag)                      elseif trace_links then -                        report_link("broken layer, index: %i",i) +                        report_link("broken layer, index %a",i)                      end                  end              end diff --git a/tex/context/base/lpdf-fld.lua b/tex/context/base/lpdf-fld.lua index 30052538d..a9b9fd72d 100644 --- a/tex/context/base/lpdf-fld.lua +++ b/tex/context/base/lpdf-fld.lua @@ -302,8 +302,8 @@ local function fieldsurrounding(specification)      -- we could test for colorvalue being 1 (black) and omit it then      local colorcode = lpdf.color(3,colorvalue) -- we force an rgb color space      if trace_fields then -        report_fields("fontcode : %s %s @ %s => %s => %s",fontstyle,fontalternative,fontsize,tag,fontcode) -        report_fields("colorcode: %s => %s",colorvalue,colorcode) +        report_fields("using font, style %a, alternative %a, size %p, tag %a, code %a",fontstyle,fontalternative,fontsize,tag,fontcode) +        report_fields("using color, value %a, code %a",colorvalue,colorcode)      end      local stream = pdfstream {          pdfconstant(tag), @@ -685,7 +685,7 @@ function codeinjections.definefield(specification)          local fieldtype = specification.type          if not fieldtype then              if trace_fields then -                report_fields("invalid definition of '%s': unknown type",n) +                report_fields("invalid definition for %a, unknown type",n)              end          elseif fieldtype == "radio" then              local values = specification.values @@ -696,10 +696,10 @@ function codeinjections.definefield(specification)                  end                  fields[n] = specification                  if trace_fields then -                    report_fields("defining '%s' as radio",n or "?") +                    report_fields("defining %a as type %a",n,"radio")                  end              elseif trace_fields then -                report_fields("invalid definition of radio '%s': missing values",n) +                report_fields("invalid definition of radio %a, missing values",n)              end          elseif fieldtype == "sub" then              -- not in main field list ! @@ -711,16 +711,16 @@ function codeinjections.definefield(specification)                  end                  if trace_fields then                      local p = radios[n] and radios[n].parent -                    report_fields("defining '%s' as sub of radio '%s'",n or "?",p or "?") +                    report_fields("defining %a as type sub of radio %a",n,p)                  end              elseif trace_fields then -                report_fields("invalid definition of radio sub '%s': no parent",n) +                report_fields("invalid definition of radio sub %a, no parent given",n)              end              predefinesymbols(specification)          elseif fieldtype == "text" or fieldtype == "line" then              fields[n] = specification              if trace_fields then -                report_fields("defining '%s' as %s",n,fieldtype) +                report_fields("defining %a as type %a",n,fieldtype)              end              if specification.values ~= "" and specification.default == "" then                  specification.default, specification.values = specification.values, nil @@ -728,12 +728,12 @@ function codeinjections.definefield(specification)          else              fields[n] = specification              if trace_fields then -                report_fields("defining '%s' as %s",n,fieldtype) +                report_fields("defining %a as type %a",n,fieldtype)              end              predefinesymbols(specification)          end      elseif trace_fields then -        report_fields("invalid definition of '%s': already defined",n) +        report_fields("invalid definition for %a, already defined",n)      end  end @@ -741,14 +741,14 @@ function codeinjections.clonefield(specification) -- obsolete      local p, c, v = specification.parent, specification.children, specification.alternative      if not p or not c then          if trace_fields then -            report_fields("invalid clone: children: '%s', parent '%s', alternative: '%s'",c or "?",p or "?", v or "?") +            report_fields("invalid clone, children %a, parent %a, alternative %a",c,p,v)          end          return      end      local x = fields[p] or radios[p]      if not x then          if trace_fields then -            report_fields("cloning: unknown parent '%s'",p) +            report_fields("invalid clone, unknown parent %a",p)          end          return      end @@ -756,11 +756,11 @@ function codeinjections.clonefield(specification) -- obsolete          local f, r, c = fields[n], radios[n], clones[n]          if f or r or c then              if trace_fields then -                report_fields("already cloned: child: '%s', parent '%s', alternative: '%s'",n,p,v or "?") +                report_fields("already cloned, child %a, parent %a, alternative %a",n,p,v)              end          else              if trace_fields then -                report_fields("cloning: child: '%s', parent '%s', alternative: '%s'",n,p,v or "?") +                report_fields("cloning, child %a, parent %a, alternative %a",n,p,v)              end              clones[n] = specification              predefinesymbols(specification) @@ -879,7 +879,7 @@ local methods = { }  function nodeinjections.typesetfield(name,specification)      local field = fields[name] or radios[name] or clones[name]      if not field then -        report_fields( "unknown child '%s'",name) +        report_fields( "unknown child %a",name)          -- unknown field          return      end @@ -891,7 +891,7 @@ function nodeinjections.typesetfield(name,specification)      if method then          return method(name,specification,alternative)      else -        report_fields( "unknown method '%s' for child '%s'",field.type,name) +        report_fields( "unknown method %a for child %a",field.type,name)      end  end @@ -952,7 +952,7 @@ local function makelinechild(name,specification)          parent = fields[field.parent]          if not parent.pobj then              if trace_fields then -                report_fields("forcing parent text '%s'",parent.name) +                report_fields("forcing parent text %a",parent.name)              end              makelineparent(parent,specification)          end @@ -961,13 +961,13 @@ local function makelinechild(name,specification)          field = parent          if not parent.pobj then              if trace_fields then -                report_fields("using parent text '%s'",name) +                report_fields("using parent text %a",name)              end              makelineparent(parent,specification)          end      end      if trace_fields then -        report_fields("using child text '%s'",name) +        report_fields("using child text %a",name)      end      local d = pdfdictionary {          Subtype = pdf_widget, @@ -1010,7 +1010,7 @@ local function makechoicechild(name,specification)          parent = fields[field.parent]          if not parent.pobj then              if trace_fields then -                report_fields("forcing parent choice '%s'",parent.name) +                report_fields("forcing parent choice %a",parent.name)              end              makechoiceparent(parent,specification,extras)          end @@ -1019,13 +1019,13 @@ local function makechoicechild(name,specification)          field = parent          if not parent.pobj then              if trace_fields then -                report_fields("using parent choice '%s'",name) +                report_fields("using parent choice %a",name)              end              makechoiceparent(parent,specification,extras)          end      end      if trace_fields then -        report_fields("using child choice '%s'",name) +        report_fields("using child choice %a",name)      end      local d = pdfdictionary {          Subtype = pdf_widget, @@ -1068,7 +1068,7 @@ local function makecheckchild(name,specification)          parent = fields[field.parent]          if not parent.pobj then              if trace_fields then -                report_fields("forcing parent check '%s'",parent.name) +                report_fields("forcing parent check %a",parent.name)              end              makecheckparent(parent,specification,extras)          end @@ -1077,13 +1077,13 @@ local function makecheckchild(name,specification)          field = parent          if not parent.pobj then              if trace_fields then -                report_fields("using parent check '%s'",name) +                report_fields("using parent check %a",name)              end              makecheckparent(parent,specification,extras)          end      end      if trace_fields then -        report_fields("using child check '%s'",name) +        report_fields("using child check %a",name)      end      local d = pdfdictionary {          Subtype = pdf_widget, @@ -1134,7 +1134,7 @@ local function makepushchild(name,specification)          parent = fields[field.parent]          if not parent.pobj then              if trace_fields then -                report_fields("forcing parent push '%s'",parent.name) +                report_fields("forcing parent push %a",parent.name)              end              makepushparent(parent,specification)          end @@ -1143,13 +1143,13 @@ local function makepushchild(name,specification)          field = parent          if not parent.pobj then              if trace_fields then -                report_fields("using parent push '%s'",name) +                report_fields("using parent push %a",name)              end              makepushparent(parent,specification)          end      end      if trace_fields then -        report_fields("using child push '%s'",name) +        report_fields("using child push %a",name)      end      local fontsymbol = specification.fontsymbol      local d = pdfdictionary { @@ -1198,26 +1198,26 @@ end  --         parent = fields[field.parent]  --         if not parent.pobj then  --             if trace_fields then ---                 report_fields("forcing parent radio '%s'",parent.name) +--                 report_fields("forcing parent radio %a",parent.name)  --             end  --             makeradioparent(parent,parent)  --         end  --     else  --         field = radios[name]  --         if not field then ---             report_fields("there is some problem with field '%s'",name) +--             report_fields("there is some problem with field %a",name)  --             return nil  --         end  --         parent = fields[field.parent]  --         if not parent.pobj then  --             if trace_fields then ---                 report_fields("using parent radio '%s'",name) +--                 report_fields("using parent radio %a",name)  --             end  --             makeradioparent(parent,parent)  --         end  --     end  --     if trace_fields then ---         report_fields("using child radio '%s' with values '%s' and default '%s'",name,field.values or "?",field.default or "?") +--         report_fields("using child radio %a with values %a and default %a",name,field.values,field.default)  --     end  --     local fontsymbol = specification.fontsymbol  -- fontsymbol="star" @@ -1256,26 +1256,26 @@ local function makeradiochild(name,specification)          parent = fields[field.parent]          if not parent.pobj then              if trace_fields then -                report_fields("forcing parent radio '%s'",parent.name) +                report_fields("forcing parent radio %a",parent.name)              end              makeradioparent(parent,parent)          end      else          field = radios[name]          if not field then -            report_fields("there is some problem with field '%s'",name) +            report_fields("there is some problem with field %a",name)              return nil          end          parent = fields[field.parent]          if not parent.pobj then              if trace_fields then -                report_fields("using parent radio '%s'",name) +                report_fields("using parent radio %a",name)              end              makeradioparent(parent,parent)          end      end      if trace_fields then -        report_fields("using child radio '%s' with values '%s' and default '%s'",name,field.values or "?",field.default or "?") +        report_fields("using child radio %a with values %a and default %a",name,field.values,field.default)      end      local fontsymbol = specification.fontsymbol   -- fontsymbol = "circle" diff --git a/tex/context/base/lpdf-fmt.lua b/tex/context/base/lpdf-fmt.lua index 859a489ef..94c005f65 100644 --- a/tex/context/base/lpdf-fmt.lua +++ b/tex/context/base/lpdf-fmt.lua @@ -387,16 +387,16 @@ local function loadprofile(name,filename)              end              if profile then                  if next(profile) then -                    report_backend("profile specification '%s' loaded from '%s'",name,filename) +                    report_backend("profile specification %a loaded from %a",name,filename)                      return profile                  elseif trace_format then -                    report_backend("profile specification '%s' loaded from '%s' but empty",name,filename) +                    report_backend("profile specification %a loaded from %a but empty",name,filename)                  end                  return false              end          end      end -    report_backend("profile specification '%s' not found in '%s'",name,concat(filenames, ", ")) +    report_backend("profile specification %a not found in %a",name,concat(filenames, ", "))  end  local function urls(url) @@ -436,20 +436,20 @@ local function handleinternalprofile(s,include)                  local fullname = locatefile(filename)                  local channel = channels[colorspace] or nil                  if fullname == "" then -                    report_backend("error, couldn't locate profile '%s'",filename) +                    report_backend("error, couldn't locate profile %a",filename)                  elseif not channel then -                    report_backend("error, couldn't resolve channel entry for colorspace '%s'",colorspace) +                    report_backend("error, couldn't resolve channel entry for colorspace %a",colorspace)                  else                      profile = pdfflushstreamfileobject(fullname,pdfdictionary{ N = channel },false) -- uncompressed                      internalprofiles[tag] = profile                      if trace_format then -                        report_backend("including '%s' color profile from '%s'",colorspace,fullname) +                        report_backend("including %a color profile from %a",colorspace,fullname)                      end                  end              else                  internalprofiles[tag] = true                  if trace_format then -                    report_backend("not including '%s' color profile '%s'",colorspace,filename) +                    report_backend("not including %a color profile %a",colorspace,filename)                  end              end          end @@ -508,7 +508,7 @@ local function handledefaultprofile(s,spec) -- specification          local tag = profilename(filename)          local n = internalprofiles[tag] -- or externalprofiles[tag]          if n == true then -- not internalized -            report_backend("no default profile '%s' for colorspace '%s'",filename,colorspace) +            report_backend("no default profile %a for colorspace %a",filename,colorspace)          elseif n then              local a = pdfarray {                  pdfconstant("ICCBased"), @@ -517,12 +517,12 @@ local function handledefaultprofile(s,spec) -- specification               -- used in page /Resources, so this must be inserted at runtime              lpdf.adddocumentcolorspace(prefixes[colorspace],pdfreference(pdfflushobject(a)))              loadeddefaults[colorspace] = true -            report_backend("setting '%s' as default '%s' color space",filename,colorspace) +            report_backend("setting %a as default %a color space",filename,colorspace)          else -            report_backend("no default profile '%s' for colorspace '%s'",filename,colorspace) +            report_backend("no default profile %a for colorspace %a",filename,colorspace)          end      elseif trace_format then -        report_backend("a default '%s' colorspace is already in use",colorspace) +        report_backend("a default %a colorspace is already in use",colorspace)      end  end @@ -549,18 +549,18 @@ local function handleoutputintent(s,spec)              elseif external and external ~= true then                  d.DestOutputProfileRef = pdfreference(external)              else -                report_backend("omitting reference to profile for intent '%s'",name) +                report_backend("omitting reference to profile for intent %a",name)              end              intents[#intents+1] = pdfreference(pdfflushobject(pdfdictionary(d)))              if trace_format then -                report_backend("setting output intent to '%s' with id '%s' (entry %s)",name,id,#intents) +                report_backend("setting output intent to %a with id %a for entry %a",name,id,#intents)              end          else -            report_backend("invalid output intent '%s'",name) +            report_backend("invalid output intent %a",name)          end          loadedintents[name] = true      elseif trace_format then -        report_backend("an output intent with name '%s' is already in use",name) +        report_backend("an output intent with name %a is already in use",name)      end  end @@ -571,7 +571,7 @@ local function handleiccprofile(message,spec,name,filename,how,options,alwaysinc              local name = list[i]              local profile = loadprofile(name,filename)              if trace_format then -                report_backend("handling %s '%s'",message,name) +                report_backend("handling %s %a",message,name)              end              if profile then                  if formatspecification.cmyk_colors then @@ -597,22 +597,22 @@ local function handleiccprofile(message,spec,name,filename,how,options,alwaysinc                  end                  if external then                      if trace_format then -                        report_backend("handling external profiles cf. '%s'",name) +                        report_backend("handling external profiles cf. %a",name)                      end                      handleexternalprofile(profile,false)                  else                      if trace_format then -                        report_backend("handling internal profiles cf. '%s'",name) +                        report_backend("handling internal profiles cf. %a",name)                      end                      if internal then                          handleinternalprofile(profile,always or include)                      else -                        report_backend("no profile inclusion for '%s'",formatname) +                        report_backend("no profile inclusion for %a",formatname)                      end                  end                  how(profile,spec)              elseif trace_format then -                report_backend("unknown profile '%s'",name) +                report_backend("unknown profile %a",name)              end          end      end @@ -638,7 +638,7 @@ function codeinjections.setformat(s)          if spec then              formatspecification = spec              formatname = spec.format_name -            report_backend("setting format to '%s'",formatname) +            report_backend("setting format to %a",formatname)              local xmp_file = formatspecification.xmp_file or ""              if xmp_file == "" then                  -- weird error @@ -705,15 +705,15 @@ function codeinjections.setformat(s)                  for k, v in table.sortedhash(formats.default) do                      local v = formatspecification[k]                      if type(v) ~= "function" then -                        report_backend("%s = %s",k,tostring(v or false)) +                        report_backend("%a = %a",k,v or false)                      end                  end              end              function codeinjections.setformat(noname) -                report_backend("error, format is already set to '%s', ignoring '%s'",formatname,noname.format) +                report_backend("error, format is already set to %a, ignoring %a",formatname,noname.format)              end          else -            report_backend("error, format '%s' is not supported",format) +            report_backend("error, format %a is not supported",format)          end      elseif level then          texset("global","pdfcompresslevel",level) diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index bdecf63c2..0b1473d2f 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -364,10 +364,10 @@ function lpdf.reserveobject(name)          if name then              names[name] = r              if trace_objects then -                report_objects("reserving number %s under name '%s'",r,name) +                report_objects("reserving number %a under name %a",r,name)              end          elseif trace_objects then -            report_objects("reserving number %s",r) +            report_objects("reserving number %a",r)          end          return r      end @@ -397,15 +397,15 @@ function lpdf.flushobject(name,data)          if named then              if not trace_objects then              elseif trace_detail then -                report_objects("flushing data to reserved object with name '%s' -> %s",name,tostring(data)) +                report_objects("flushing data to reserved object with name %a, data: %S",name,data)              else -                report_objects("flushing data to reserved object with name '%s'",name) +                report_objects("flushing data to reserved object with name %a",name)              end              return pdfimmediateobject(named,tostring(data))          else              if not trace_objects then              elseif trace_detail then -                report_objects("flushing data to reserved object with number %s -> %s",name,tostring(data)) +                report_objects("flushing data to reserved object with number %s, data: %S",name,data)              else                  report_objects("flushing data to reserved object with number %s",name)              end @@ -413,7 +413,7 @@ function lpdf.flushobject(name,data)          end      else          if trace_objects and trace_detail then -            report_objects("flushing data -> %s",tostring(name)) +            report_objects("flushing data: %S",name)          end          return pdfimmediateobject(tostring(name))      end @@ -436,7 +436,7 @@ end  function lpdf.flushstreamfileobject(filename,dict,compressed) -- default compressed      if trace_objects then -        report_objects("flushing stream file object '%s'",filename) +        report_objects("flushing stream file object %a",filename)      end      local dtype = type(dict)      return pdfdeferredobject { @@ -569,7 +569,7 @@ end  local function run(where,what)      if trace_finalizers then -        report_finalizing("start backend: category=%s, n=%s",what,#where) +        report_finalizing("start backend, category %a, n %a",what,#where)      end      for i=1,#where do          local w = where[i] @@ -625,12 +625,12 @@ callbacks.register("finish_pdffile", lpdf.finalizedocument)  local function trace_set(what,key)      if trace_resources then -        report_finalizing("setting key '%s' in '%s'",key,what) +        report_finalizing("setting key %a in %a",key,what)      end  end  local function trace_flush(what)      if trace_resources then -        report_finalizing("flushing '%s'",what) +        report_finalizing("flushing %a",what)      end  end diff --git a/tex/context/base/lpdf-swf.lua b/tex/context/base/lpdf-swf.lua index d3c2b41da..12c80036f 100644 --- a/tex/context/base/lpdf-swf.lua +++ b/tex/context/base/lpdf-swf.lua @@ -111,7 +111,7 @@ local function insertswf(spec)              prefix = format("^%s/",string.topattern(root))          end          if prefix and trace_swf then -            report_swf("using strip pattern '%s'",prefix) +            report_swf("using strip pattern %a",prefix)          end          local function add(fullname,strip)              local filename = gsub(fullname,"^%./","") @@ -124,7 +124,7 @@ local function insertswf(spec)              names[#names+1] = pdfstring(filename)              names[#names+1] = embeddedreference              if trace_swf then -                report_swf("embedding file '%s' as '%s'",fullname,usedname) +                report_swf("embedding file %a as %a",fullname,usedname)              end          end          relativepaths = resources.relativepaths @@ -135,7 +135,7 @@ local function insertswf(spec)              for i=1,#relativepaths do                  local relativepath = relativepaths[i]                  if trace_swf then -                    report_swf("checking path '%s' relative to '%s'",relativepath,root) +                    report_swf("checking path %a relative to %a",relativepath,root)                  end                  local path = file.join(root == "" and "." or root,relativepath)                  local files = dir.glob(path .. "/**") @@ -152,7 +152,7 @@ local function insertswf(spec)              for i=1,#paths do                  local path = paths[i]                  if trace_swf then -                    report_swf("checking path '%s'",path) +                    report_swf("checking path %a",path)                  end                  local files = dir.glob(path .. "/**")                  for i=1,#files do diff --git a/tex/context/base/lpdf-tag.lua b/tex/context/base/lpdf-tag.lua index 2763633c2..8cdb5f6a4 100644 --- a/tex/context/base/lpdf-tag.lua +++ b/tex/context/base/lpdf-tag.lua @@ -268,7 +268,7 @@ function nodeinjections.addtags(head)              local attr, id, start, stop = range[1], range[2], range[3], range[4]              local tags = taglist[attr]              if tags then -- not ok ... only first lines -                report_tags("%s => %s : %05i %s",tosequence(start,start),tosequence(stop,stop),attr,concat(tags," ")) +                report_tags("%s => %s : %05i % t",tosequence(start,start),tosequence(stop,stop),attr,tags)              end          end      end diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua index 13940be9c..9ea4744f1 100644 --- a/tex/context/base/lpdf-wid.lua +++ b/tex/context/base/lpdf-wid.lua @@ -185,7 +185,7 @@ local function flushembeddedfiles()          local e = pdfarray()          for tag, reference in next, filestreams do              if not reference then -                report_attachment("unreferenced file: tag '%s'",tag) +                report_attachment("unreferenced file, tag %a",tag)              elseif referenced[tag] == "hidden" then                  e[#e+1] = pdfstring(tag)                  e[#e+1] = reference -- already a reference @@ -279,13 +279,13 @@ function nodeinjections.attachfile(specification)      else          filename = specification.file          if not filename or filename == "" then -            report_attachment("missing file specification: registered '%s', using registered instead",registered) +            report_attachment("no file specified, using registered %a instead",registered)              filename = registered              specification.file = registered          end          local foundname = resolvers.findbinfile(filename) or ""          if foundname == "" or not lfs.isfile(foundname) then -            report_attachment("invalid file specification: registered '%s', filename '%s'",registered,filename) +            report_attachment("invalid filename %a, ignoring registered %a",filename,registered)              return nil          else              specification.foundname = foundname @@ -317,7 +317,7 @@ function nodeinjections.attachfile(specification)          attachments[registered] = aref      end      if not aref then -        report_attachment("skipping: registered '%s'",registered) +        report_attachment("skipping attachment, registered %a",registered)          -- already reported      elseif specification.method == v_hidden then          referenced[hash] = "hidden" @@ -595,7 +595,7 @@ end  local function insertrenderingobject(specification) -- todo      local label = specification.label      if not mf[label] then -        report_media("todo: unknown medium '%s'",label or "?") +        report_media("unknown medium, label %a",label)          local clip = pdfdictionary { -- does  not work that well one level up              Type = pdfconstant("MediaClip"),              S    = pdfconstant("MCD"), diff --git a/tex/context/base/lpdf-xmp.lua b/tex/context/base/lpdf-xmp.lua index 02d37342b..fbdea8815 100644 --- a/tex/context/base/lpdf-xmp.lua +++ b/tex/context/base/lpdf-xmp.lua @@ -83,7 +83,7 @@ local xmp, xmpfile, xmpname = nil, nil, "lpdf-pdx.xml"  local function setxmpfile(name)      if xmp then -        report_xmp("discarding loaded file '%s'",xmpfile) +        report_xmp("discarding loaded file %a",xmpfile)          xmp = nil      end      xmpfile = name ~= "" and name @@ -102,7 +102,7 @@ local function valid_xmp()              xmpfile = resolvers.findfile(xmpname) or ""          end          if xmpfile ~= "" then -            report_xmp("using file '%s'",xmpfile) +            report_xmp("using file %a",xmpfile)          end          local xmpdata = (xmpfile ~= "" and io.loaddata(xmpfile)) or ""          xmp = xml.convert(xmpdata) @@ -126,7 +126,7 @@ function lpdf.addtoinfo(tag,pdfvalue,strvalue)      addtoinfo(tag,pdfvalue)      local value = strvalue or gsub(tostring(pdfvalue),"^%((.*)%)$","%1") -- hack      if trace_info then -        report_info("set '%s' to '%s'",tag,value) +        report_info("set %a to %a",tag,value)      end      addxmpinfo(tag,value)  end diff --git a/tex/context/base/luat-cbk.lua b/tex/context/base/luat-cbk.lua index 6c37307ca..b59978f6d 100644 --- a/tex/context/base/luat-cbk.lua +++ b/tex/context/base/luat-cbk.lua @@ -83,11 +83,11 @@ if trace_calls then  end  local function frozen_message(what,name) -    report_callbacks("not %s frozen '%s' (%s)",what,name,frozen[name]) +    report_callbacks("not %s frozen %a (%s)",what,name,frozen[name])  end  local function frozen_callback(name) -    return nil, format("callback '%s' is frozen (%s)",name,frozen[name]) +    return nil, format("callback '%s' is frozen (%s)",name,frozen[name]) -- no formatter yet  end  local function state(name) diff --git a/tex/context/base/luat-env.lua b/tex/context/base/luat-env.lua index 058e161d5..e741bca6a 100644 --- a/tex/context/base/luat-env.lua +++ b/tex/context/base/luat-env.lua @@ -93,14 +93,14 @@ function environment.luafilechunk(filename,silent) -- used for loading lua bytec      if fullname and fullname ~= "" then          local data = luautilities.loadedluacode(fullname,strippable,filename) -- can be overloaded          if trace_locating then -            report_lua("loading file %s%s", fullname, not data and " failed" or "") +            report_lua("loading file %a %s",fullname,not data and "failed" or "succeeded")          elseif not silent then              texio.write("<",data and "+ " or "- ",fullname,">")          end          return data      else          if trace_locating then -            report_lua("unknown file %s", filename) +            report_lua("unknown file %a",filename)          end          return nil      end @@ -122,7 +122,7 @@ function environment.loadluafile(filename, version)      local fullname = (lucname and environment.luafile(lucname)) or ""      if fullname ~= "" then          if trace_locating then -            report_lua("loading %s", fullname) +            report_lua("loading %a",fullname)          end          -- maybe: package.loaded[file.nameonly(fullname)] = true          chunk = loadfile(fullname) -- this way we don't need a file exists check @@ -141,7 +141,7 @@ function environment.loadluafile(filename, version)                  return true              else                  if trace_locating then -                    report_lua("version mismatch for %s: lua=%s, luc=%s", filename, v, version) +                    report_lua("version mismatch for %a, lua version %a, luc version %a",filename,v,version)                  end                  environment.loadluafile(filename)              end @@ -152,12 +152,12 @@ function environment.loadluafile(filename, version)      fullname = (luaname and environment.luafile(luaname)) or ""      if fullname ~= "" then          if trace_locating then -            report_lua("loading %s", fullname) +            report_lua("loading %a",fullname)          end          chunk = loadfile(fullname) -- this way we don't need a file exists check          if not chunk then              if trace_locating then -                report_lua("unknown file %s", filename) +                report_lua("unknown file %a",filename)              end          else              assert(chunk)() diff --git a/tex/context/base/luat-fio.lua b/tex/context/base/luat-fio.lua index d194928dd..2f00914d3 100644 --- a/tex/context/base/luat-fio.lua +++ b/tex/context/base/luat-fio.lua @@ -98,7 +98,7 @@ luatex.registerstopactions(function()          report_system("start used files")          logs.newline()          for i=1,#foundintrees do -            report_files("%4i: %s",i,sequenced(foundintrees[i])) +            report_files("%4i: % t",i,foundintrees[i])          end          logs.newline()          report_system("stop used files") diff --git a/tex/context/base/luat-fmt.lua b/tex/context/base/luat-fmt.lua index af34fe8ce..20a4a8fcd 100644 --- a/tex/context/base/luat-fmt.lua +++ b/tex/context/base/luat-fmt.lua @@ -37,7 +37,7 @@ function environment.make_format(name)      if path ~= "" then          lfs.chdir(path)      end -    report_format("format path: %s",dir.current()) +    report_format("using format path %a",dir.current())      -- check source file      local texsourcename = file.addsuffix(name,"mkiv")      local fulltexsourcename = resolvers.findfile(texsourcename,"tex") or "" @@ -46,11 +46,11 @@ function environment.make_format(name)          fulltexsourcename = resolvers.findfile(texsourcename,"tex") or ""      end      if fulltexsourcename == "" then -        report_format("no tex source file with name: %s (mkiv or tex)",name) +        report_format("no tex source file with name %a (mkiv or tex)",name)          lfs.chdir(olddir)          return      else -        report_format("using tex source file: %s",fulltexsourcename) +        report_format("using tex source file %a",fulltexsourcename)      end      local texsourcepath = dir.expandname(file.dirname(fulltexsourcename)) -- really needed      -- check specification @@ -61,7 +61,7 @@ function environment.make_format(name)          fullspecificationname = resolvers.findfile(specificationname,"tex") or ""      end      if fullspecificationname == "" then -        report_format("unknown stub specification: %s",specificationname) +        report_format("unknown stub specification %a",specificationname)          lfs.chdir(olddir)          return      end @@ -72,23 +72,23 @@ function environment.make_format(name)      if type(usedlualibs) == "string" then          usedluastub = file.join(file.dirname(fullspecificationname),usedlualibs)      elseif type(usedlualibs) == "table" then -        report_format("using stub specification: %s",fullspecificationname) +        report_format("using stub specification %a",fullspecificationname)          local texbasename = file.basename(name)          local luastubname = file.addsuffix(texbasename,luasuffixes.lua)          local lucstubname = file.addsuffix(texbasename,luasuffixes.luc)          -- pack libraries in stub -        report_format("creating initialization file: %s",luastubname) +        report_format("creating initialization file %a",luastubname)          utilities.merger.selfcreate(usedlualibs,specificationpath,luastubname)          -- compile stub file (does not save that much as we don't use this stub at startup any more)          if utilities.lua.compile(luastubname,lucstubname) and lfs.isfile(lucstubname) then -            report_format("using compiled initialization file: %s",lucstubname) +            report_format("using compiled initialization file %a",lucstubname)              usedluastub = lucstubname          else -            report_format("using uncompiled initialization file: %s",luastubname) +            report_format("using uncompiled initialization file %a",luastubname)              usedluastub = luastubname          end      else -        report_format("invalid stub specification: %s",fullspecificationname) +        report_format("invalid stub specification %a",fullspecificationname)          lfs.chdir(olddir)          return      end @@ -98,12 +98,12 @@ function environment.make_format(name)      os.spawn(command)      -- remove related mem files      local pattern = file.removesuffix(file.basename(usedluastub)).."-*.mem" - -- report_format("removing related mplib format with pattern '%s'", pattern) + -- report_format("removing related mplib format with pattern %a", pattern)      local mp = dir.glob(pattern)      if mp then          for i=1,#mp do              local name = mp[i] -            report_format("removing related mplib format %s", file.basename(name)) +            report_format("removing related mplib format %a", file.basename(name))              os.remove(name)          end      end @@ -120,7 +120,7 @@ function environment.run_format(name,data,more)          end          fmtname = resolvers.cleanpath(fmtname)          if fmtname == "" then -            report_format("no format with name: %s",name) +            report_format("no format with name %a",name)          else              local barename = file.removesuffix(name) -- expanded name              local luaname = file.addsuffix(barename,"luc") @@ -128,8 +128,8 @@ function environment.run_format(name,data,more)                  luaname = file.addsuffix(barename,"lua")              end              if not lfs.isfile(luaname) then -                report_format("using format name: %s",fmtname) -                report_format("no luc/lua with name: %s",barename) +                report_format("using format name %a",fmtname) +                report_format("no luc/lua file with name %a",barename)              else                  local command = format("%s %s --fmt=%s --lua=%s %s %s",engine,primaryflags(),quoted(barename),quoted(luaname),quoted(data),more ~= "" and quoted(more) or "")                  report_format("running command: %s",command) diff --git a/tex/context/base/luat-iop.lua b/tex/context/base/luat-iop.lua index 5512b258e..52f14683e 100644 --- a/tex/context/base/luat-iop.lua +++ b/tex/context/base/luat-iop.lua @@ -47,7 +47,7 @@ local function protect(ruleset,proc)          elseif match(ruleset,name) then              return proc(name,...)          else -            report_limiter("no access permitted: %s",name) +            report_limiter("no access permitted for %a",name)              return nil, name .. ": no access permitted"          end      end @@ -126,7 +126,7 @@ local function i_register(v)              local protect = i_limiter.protect              i_opener = protect(i_opener)              i_limited = true -            report_limiter("input mode: %s",v) +            report_limiter("input mode set to %a",v)          end      end  end @@ -138,7 +138,7 @@ local function o_register(v)              local protect = o_limiter.protect              o_opener = protect(o_opener)              o_limited = true -            report_limiter("output mode: %s",v) +            report_limiter("output mode set to %a",v)          end      end  end diff --git a/tex/context/base/luat-lib.mkiv b/tex/context/base/luat-lib.mkiv index b9ccd8b11..948a9bc8d 100644 --- a/tex/context/base/luat-lib.mkiv +++ b/tex/context/base/luat-lib.mkiv @@ -19,7 +19,7 @@  \registerctxluafile{util-pck}{1.001}  \registerctxluafile{util-seq}{1.001}  %registerctxluafile{util-mrg}{1.001} % not needed in context itself, only mtxrun -\registerctxluafile{util-lua}{1.001} +%registerctxluafile{util-lua}{1.001} % moved  \registerctxluafile{util-prs}{1.001}  \registerctxluafile{util-fmt}{1.001}  \registerctxluafile{util-deb}{1.001} % could also be done in trac-deb.mkiv @@ -29,6 +29,7 @@  \registerctxluafile{trac-set}{1.001}  \registerctxluafile{trac-log}{1.001}  %registerctxluafile{trac-pro}{1.001} +\registerctxluafile{util-lua}{1.001}  \registerctxluafile{util-tpl}{1.001} % needs tracker diff --git a/tex/context/base/luat-mac.lua b/tex/context/base/luat-mac.lua index e7f96359a..6a9401227 100644 --- a/tex/context/base/luat-mac.lua +++ b/tex/context/base/luat-mac.lua @@ -209,7 +209,7 @@ end  --         local oldsize = #str  --         str = lpegmatch(parser,str,1,true) or str  --         pushtarget("log") ---         report_macros("processed mkvi file %q, delta %s",filename,oldsize-#str) +--         report_macros("processed mkvi file %a, delta %s",filename,oldsize-#str)  --         poptarget("log")  --     end  --     return str @@ -225,7 +225,7 @@ function processors.mkvi(str,filename)      local oldsize = #str      str = lpegmatch(parser,str,1,true) or str      pushtarget("log") -    report_macros("processed mkvi file %q, delta %s",filename,oldsize-#str) +    report_macros("processed mkvi file %a, delta %s",filename,oldsize-#str)      poptarget("log")      return str  end @@ -240,7 +240,7 @@ function processors.mkix(str,filename) -- we could intercept earlier so that cac      local oldsize = #str      str = convertlmxstring(str,document.variables,false) or str      pushtarget("log") -    report_macros("processed mkix file %q, delta %s",filename,oldsize-#str) +    report_macros("processed mkix file %a, delta %s",filename,oldsize-#str)      poptarget("log")      return str  end @@ -256,7 +256,7 @@ function processors.mkxi(str,filename)      str = convertlmxstring(str,document.variables,false) or str      str = lpegmatch(parser,str,1,true) or str      pushtarget("log") -    report_macros("processed mkxi file %q, delta %s",filename,oldsize-#str) +    report_macros("processed mkxi file %a, delta %s",filename,oldsize-#str)      poptarget("log")      return str  end @@ -277,7 +277,7 @@ function macros.processmkvi(str,filename)          local oldsize = #str          str = lpegmatch(parser,str,1,true) or str          pushtarget("log") -        report_macros("processed mkvi file %q, delta %s",filename,oldsize-#str) +        report_macros("processed mkvi file %a, delta %s",filename,oldsize-#str)          poptarget("log")      end      return str @@ -307,7 +307,7 @@ if resolvers.schemes then              else                  local result = lpegmatch(parser,str,1,true) or str                  pushtarget("log") -                report_macros("processed scheme '%s', delta %s",filename,#str-#result) +                report_macros("processed scheme %a, delta %s",filename,#str-#result)                  poptarget("log")                  io.savedata(cachename,result)              end diff --git a/tex/context/base/luat-run.lua b/tex/context/base/luat-run.lua index bcd9e2bdc..4f65370bb 100644 --- a/tex/context/base/luat-run.lua +++ b/tex/context/base/luat-run.lua @@ -107,7 +107,7 @@ function luatex.registertempfile(name,extrasuffix)          name = name .. ".mkiv-tmp" -- maybe just .tmp      end      if trace_temp_files and not tempfiles[name] then -        report_tempfiles("registering temporary file: %s",name) +        report_tempfiles("registering temporary file %a",name)      end      tempfiles[name] = true      return name @@ -116,7 +116,7 @@ end  function luatex.cleanuptempfiles()      for name, _ in next, tempfiles do          if trace_temp_files then -            report_tempfiles("removing temporary file: %s",name) +            report_tempfiles("removing temporary file %a",name)          end          os.remove(name)      end diff --git a/tex/context/base/luat-sto.lua b/tex/context/base/luat-sto.lua index 6ebfbab98..67653da6a 100644 --- a/tex/context/base/luat-sto.lua +++ b/tex/context/base/luat-sto.lua @@ -44,7 +44,7 @@ function storage.register(...)      if d then          storage.mark(d)      else -        report_storage("fatal error: invalid storage '%s'",t[1]) +        report_storage("fatal error: invalid storage %a",t[1])          os.exit()      end      data[#data+1] = t @@ -72,7 +72,7 @@ local function dump()          end          c = c + 1 ; code[c] = serialize(original,name)          if trace_storage then -            report_storage('saving %s in slot %s (%s bytes)',message,max,#code[c]) +            report_storage('saving %a in slot %a, size %s',message,max,#code[c])          end          -- we don't need tracing in such tables          bytecode[max] = strippedloadstring(concat(code,"\n"),storage.strip,format("slot %s (%s)",max,name)) diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua index 053e49303..0fffe261a 100644 --- a/tex/context/base/lxml-aux.lua +++ b/tex/context/base/lxml-aux.lua @@ -26,7 +26,7 @@ local gmatch, gsub, format, find, strip = string.gmatch, string.gsub, string.for  local utfbyte = utf.byte  local function report(what,pattern,c,e) -    report_xml("%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern) +    report_xml("%s element %a, root %a, position %a, index %a, pattern %a",what,xmlname(e),xmlname(e.__p__),c,e.ni,pattern)  end  local function withelements(e,handle,depth) diff --git a/tex/context/base/lxml-dir.lua b/tex/context/base/lxml-dir.lua index 00375193f..22a7ba3bb 100644 --- a/tex/context/base/lxml-dir.lua +++ b/tex/context/base/lxml-dir.lua @@ -60,9 +60,9 @@ local function load_setup(filename)                  valid = valid + 1              end          end -        report_lxml("%s directives found in '%s', %s valid",#collection,filename,valid) +        report_lxml("%s directives found in %a, valid %s",#collection,filename,valid)      else -        report_lxml("no directives found in '%s'",filename) +        report_lxml("no directives found in %a",filename)      end  end diff --git a/tex/context/base/lxml-ent.lua b/tex/context/base/lxml-ent.lua index 14b758f1c..a5c5bc389 100644 --- a/tex/context/base/lxml-ent.lua +++ b/tex/context/base/lxml-ent.lua @@ -35,7 +35,7 @@ local entities = xml.entities  -- maybe some day properties  function xml.registerentity(key,value)      entities[key] = value      if trace_entities then -        report_xml("registering entity '%s' as: %s",key,value) +        report_xml("registering entity %a as %a",key,value)      end  end diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua index 2be648075..51ab321b9 100644 --- a/tex/context/base/lxml-lpt.lua +++ b/tex/context/base/lxml-lpt.lua @@ -83,7 +83,7 @@ local function fallback (t, name)      if fn then          t[name] = fn      else -        report_lpath("unknown sub finalizer '%s'",tostring(name)) +        report_lpath("unknown sub finalizer %a",name)          fn = function() end      end      return fn @@ -871,7 +871,7 @@ lpath = function (pattern) -- the gain of caching is rather minimal                  local np = #parsed                  if np == 0 then                      parsed = { pattern = pattern, register_self, state = "parsing error" } -                    report_lpath("parsing error in '%s'",pattern) +                    report_lpath("parsing error in pattern: %s",pattern)                      lshow(parsed)                  else                      -- we could have done this with a more complex parser but this @@ -1190,7 +1190,7 @@ end  -- user interface  local function traverse(root,pattern,handle) -    report_lpath("use 'xml.selection' instead for '%s'",pattern) + -- report_lpath("use 'xml.selection' instead for pattern: %s",pattern)      local collected = applylpath(root,pattern)      if collected then          for c=1,#collected do @@ -1231,7 +1231,7 @@ local function dofunction(collected,fnc,...)                  f(collected[c],...)              end          else -            report_lpath("unknown function '%s'",fnc) +            report_lpath("unknown function %a",fnc)          end      end  end @@ -1435,7 +1435,7 @@ end  function xml.inspect(collection,pattern)      pattern = pattern or "."      for e in xml.collected(collection,pattern or ".") do -        report_lpath("pattern %q\n\n%s\n",pattern,xml.tostring(e)) +        report_lpath("pattern: %s\n\n%s\n",pattern,xml.tostring(e))      end  end diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua index 3fdf6d8ff..216dc16e8 100644 --- a/tex/context/base/lxml-tab.lua +++ b/tex/context/base/lxml-tab.lua @@ -278,7 +278,7 @@ local reported_attribute_errors = { }  local function attribute_value_error(str)      if not reported_attribute_errors[str] then -        report_xml("invalid attribute value: %q",str) +        report_xml("invalid attribute value %a",str)          reported_attribute_errors[str] = true          at._error_ = str      end @@ -287,7 +287,7 @@ end  local function attribute_specification_error(str)      if not reported_attribute_errors[str] then -        report_xml("invalid attribute specification: %q",str) +        report_xml("invalid attribute specification %a",str)          reported_attribute_errors[str] = true          at._error_ = str      end @@ -392,14 +392,14 @@ local function handle_hex_entity(str)          h = unify_predefined and predefined_unified[n]          if h then              if trace_entities then -                report_xml("utfize, converting hex entity &#x%s; into %s",str,h) +                report_xml("utfize, converting hex entity &#x%s; into %a",str,h)              end          elseif utfize then              h = (n and utfchar(n)) or xml.unknown_hex_entity(str) or ""              if not n then                  report_xml("utfize, ignoring hex entity &#x%s;",str)              elseif trace_entities then -                report_xml("utfize, converting hex entity &#x%s; into %s",str,h) +                report_xml("utfize, converting hex entity &#x%s; into %a",str,h)              end          else              if trace_entities then @@ -419,14 +419,14 @@ local function handle_dec_entity(str)          d = unify_predefined and predefined_unified[n]          if d then              if trace_entities then -                report_xml("utfize, converting dec entity &#%s; into %s",str,d) +                report_xml("utfize, converting dec entity &#%s; into %a",str,d)              end          elseif utfize then              d = (n and utfchar(n)) or placeholders.unknown_dec_entity(str) or ""              if not n then                  report_xml("utfize, ignoring dec entity &#%s;",str)              elseif trace_entities then -                report_xml("utfize, converting dec entity &#%s; into %s",str,d) +                report_xml("utfize, converting dec entity &#%s; into %a",str,d)              end          else              if trace_entities then @@ -448,7 +448,7 @@ local function handle_any_entity(str)              a = resolve_predefined and predefined_simplified[str]              if a then                  if trace_entities then -                    report_xml("resolved entity &%s; -> %s (predefined)",str,a) +                    report_xml("resolving entity &%s; to predefined %a",str,a)                  end              else                  if type(resolve) == "function" then @@ -459,13 +459,13 @@ local function handle_any_entity(str)                  if a then                      if type(a) == "function" then                          if trace_entities then -                            report_xml("expanding entity &%s; (function)",str) +                            report_xml("expanding entity &%s; to function call",str)                          end                          a = a(str) or ""                      end                      a = lpegmatch(parsedentity,a) or a -- for nested                      if trace_entities then -                        report_xml("resolved entity &%s; -> %s (internal)",str,a) +                        report_xml("resolving entity &%s; to internal %a",str,a)                      end                  else                      local unknown_any_entity = placeholders.unknown_any_entity @@ -474,7 +474,7 @@ local function handle_any_entity(str)                      end                      if a then                          if trace_entities then -                            report_xml("resolved entity &%s; -> %s (external)",str,a) +                            report_xml("resolving entity &%s; to external %s",str,a)                          end                      else                          if trace_entities then @@ -491,7 +491,7 @@ local function handle_any_entity(str)              acache[str] = a          elseif trace_entities then              if not acache[str] then -                report_xml("converting entity &%s; into %s",str,a) +                report_xml("converting entity &%s; to %a",str,a)                  acache[str] = a              end          end @@ -504,7 +504,7 @@ local function handle_any_entity(str)                  -- one of the predefined                  acache[str] = a                  if trace_entities then -                    report_xml("entity &%s; becomes %s",str,tostring(a)) +                    report_xml("entity &%s; becomes %a",str,a)                  end              elseif str == "" then                  if trace_entities then @@ -526,7 +526,7 @@ local function handle_any_entity(str)  end  local function handle_end_entity(chr) -    report_xml("error in entity, %q found instead of ';'",chr) +    report_xml("error in entity, %a found instead of %a",chr,";")  end  local space            = S(' \r\n\t') diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index 8a57ed54e..30d264c4e 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -26,6 +26,8 @@ local lxml = lxml  local catcodenumbers = catcodes.numbers  local ctxcatcodes    = catcodenumbers.ctxcatcodes -- todo: use different method  local notcatcodes    = catcodenumbers.notcatcodes -- todo: use different method + +local context        = context  local contextsprint  = context.sprint             -- with catcodes (here we use fast variants, but with option for tracing)  local xmlelements, xmlcollected, xmlsetproperty = xml.elements, xml.collected, xml.setproperty @@ -68,14 +70,14 @@ local parsedentity = xml.parsedentitylpeg  function lxml.registerentity(key,value)      texentities[key] = value      if trace_entities then -        report_xml("registering tex entity '%s' as: %s",key,value) +        report_xml("registering tex entity %a as %a",key,value)      end  end  function lxml.resolvedentity(str)      if forceraw then          if trace_entities then -            report_xml("passing entity '%s' as &%s;",str,str) +            report_xml("passing entity %a as &%s;",str,str)          end          context("&%s;",str)      else @@ -84,12 +86,12 @@ function lxml.resolvedentity(str)              local te = type(e)              if te == "function" then                  if trace_entities then -                    report_xml("passing entity '%s' using function",str) +                    report_xml("passing entity %a using function",str)                  end                  e(str)              elseif e then                  if trace_entities then -                    report_xml("passing entity '%s' as '%s'using ctxcatcodes",str,e) +                    report_xml("passing entity %a as %a using %a",str,e,"ctxcatcodes")                  end                  context(e)              end @@ -103,7 +105,7 @@ function lxml.resolvedentity(str)              end              if e then                  if trace_entities then -                    report_xml("passing entity '%s' as '%s' using notcatcodes",str,e) +                    report_xml("passing entity %a as %a using %a",str,e,"notcatcodes")                  end                  contextsprint(notcatcodes,e)                  return @@ -114,18 +116,18 @@ function lxml.resolvedentity(str)          local chr, err = lpegmatch(parsedentity,str)          if chr then              if trace_entities then -                report_xml("passing entity '%s' as '%s' using ctxcatcodes",str,chr) +                report_xml("passing entity %a as %a using %a",str,chr,"ctxcatcodes")              end              context(chr)          elseif err then              if trace_entities then -                report_xml("passing faulty entity '%s' as '%s'",str,err) +                report_xml("passing faulty entity %a as %a",str,err)              end              context(err)          else              local tag = upperchars(str)              if trace_entities then -                report_xml("passing entity '%s' to \\xmle using tag '%s'",str,tag) +                report_xml("passing entity %a to \\xmle using tag %a",str,tag)              end              context.xmle(str,tag) -- we need to use our own upper          end @@ -259,16 +261,16 @@ local function getid(id, qualified)                                  return root                              end                          elseif trace_access then -                            report_lxml("'%s' has no index entry '%s'",d,i) +                            report_lxml("%a has no index entry %a",d,i)                          end                      elseif trace_access then -                        report_lxml("'%s' has no index",d) +                        report_lxml("%a has no index",d)                      end                  elseif trace_access then -                    report_lxml("'%s' is not loaded",d) +                    report_lxml("%a is not loaded",d)                  end              elseif trace_access then -                report_lxml("'%s' is not loaded",i) +                report_lxml("%a is not loaded",i)              end          end      elseif trace_access then @@ -318,7 +320,7 @@ local function addindex(name,check_sum,force)          root.index = index          root.maxindex = maxindex          if trace_access then -            report_lxml("%s indexed, %s nodes",tostring(name),maxindex) +            report_lxml("indexed entries %a, found nodes %a",tostring(name),maxindex)          end      end  end @@ -413,7 +415,7 @@ end  function lxml.load(id,filename,compress,entities)      filename = commands.preparedfile(filename) -- not commands!      if trace_loading then -        report_lxml("loading file %q as %q",filename,id) +        report_lxml("loading file %a as %a",filename,id)      end      noffiles, nofconverted = noffiles + 1, nofconverted + 1   -- local xmltable = xml.load(filename) @@ -443,7 +445,7 @@ function lxml.include(id,pattern,attribute,recurse)                  end              end              if trace_loading then -                report_lxml("including file: %s",filename) +                report_lxml("including file %a",filename)              end              noffiles, nofconverted = noffiles + 1, nofconverted + 1              return resolvers.loadtexfile(filename) or "" @@ -499,7 +501,7 @@ end  local function tex_comment(e,handlers)      if trace_comments then -        report_lxml("comment: %s",e.dt[1]) +        report_lxml("comment %a",e.dt[1])      end  end @@ -526,7 +528,7 @@ local function tex_element(e,handlers)               -- faster than context.xmlw                  contextsprint(ctxcatcodes,"\\xmlw{",command,"}{",rootname,"::",ix,"}")              else -                report_lxml( "fatal error: no index for '%s'",command) +                report_lxml("fatal error: no index for %a",command)                  contextsprint(ctxcatcodes,"\\xmlw{",command,"}{",ix or 0,"}")              end          elseif tc == "function" then @@ -818,49 +820,27 @@ function lxml.installsetup(what,document,setup,where)      end      if what == 1 then          if trace_loading then -            report_lxml("prepending setup %s for %s",setup,document) +            report_lxml("prepending setup %a for %a",setup,document)          end          insert(sd,1,setup)      elseif what == 2 then          if trace_loading then -            report_lxml("appending setup %s for %s",setup,document) +            report_lxml("appending setup %a for %a",setup,document)          end          insert(sd,setup)      elseif what == 3 then          if trace_loading then -            report_lxml("inserting setup %s for %s before %s",setup,document,where) +            report_lxml("inserting setup %a for %a before %a",setup,document,where)          end          insertbeforevalue(sd,setup,where)      elseif what == 4 then          if trace_loading then -            report_lxml("inserting setup %s for %s after %s",setup,document,where) +            report_lxml("inserting setup %a for %a after %a",setup,document,where)          end          insertaftervalue(sd,setup,where)      end  end --- function lxml.flushsetups(id,...) ---     local done, list = { }, { ... } ---     for i=1,#list do ---         local document = list[i] ---         local sd = setups[document] ---         if sd then ---             for k=1,#sd do ---                 local v= sd[k] ---                 if not done[v] then ---                     if trace_loading then ---                         report_lxml("applying setup %02i = %s to %s",k,v,document) ---                     end ---                     contextsprint(ctxcatcodes,"\\xmlsetup{",id,"}{",v,"}") ---                     done[v] = true ---                 end ---             end ---         elseif trace_loading then ---             report_lxml("no setups for %s",document) ---         end ---     end --- end -  function lxml.flushsetups(id,...)      local done = { }      for i=1,select("#",...) do @@ -871,21 +851,21 @@ function lxml.flushsetups(id,...)                  local v= sd[k]                  if not done[v] then                      if trace_loading then -                        report_lxml("applying setup %02i = %s to %s",k,v,document) +                        report_lxml("applying setup %02i : %a to %a",k,v,document)                      end                      contextsprint(ctxcatcodes,"\\xmlsetup{",id,"}{",v,"}")                      done[v] = true                  end              end          elseif trace_loading then -            report_lxml("no setups for %s",document) +            report_lxml("no setups for %a",document)          end      end  end  function lxml.resetsetups(document)      if trace_loading then -        report_lxml("resetting all setups for %s",document) +        report_lxml("resetting all setups for %a",document)      end      setups[document] = { }  end @@ -896,7 +876,7 @@ function lxml.removesetup(document,setup)          for i=1,#s do              if s[i] == setup then                  if trace_loading then -                    report_lxml("removing setup %s for %s",setup,document) +                    report_lxml("removing setup %a for %a",setup,document)                  end                  remove(t,i)                  break @@ -947,10 +927,10 @@ function lxml.setsetup(id,pattern,setup)                      end                  end              elseif trace_setups then -                report_lxml("zero lpath matches for %s",pattern) +                report_lxml("%s lpath matches for pattern: %s","zero",pattern)              end          elseif trace_setups then -            report_lxml("no lpath matches for %s",pattern) +            report_lxml("%s lpath matches for pattern: %s","no",pattern)          end      else          local a, b = match(setup,"^(.+:)([%*%-])$") @@ -999,10 +979,10 @@ function lxml.setsetup(id,pattern,setup)                          end                      end                  elseif trace_setups then -                    report_lxml("zero lpath matches for %s",pattern) +                    report_lxml("%s lpath matches for pattern: %s","zero",pattern)                  end              elseif trace_setups then -                report_lxml("no lpath matches for %s",pattern) +                report_lxml("%s lpath matches for pattern: %s","no",pattern)              end          else              local collected = xmlapplylpath(getid(id),pattern) @@ -1026,10 +1006,10 @@ function lxml.setsetup(id,pattern,setup)                          end                      end                  elseif trace_setups then -                    report_lxml("zero lpath matches for %s",pattern) +                    report_lxml("%s lpath matches for pattern: %s","zero",pattern)                  end              elseif trace_setups then -                report_lxml("no lpath matches for %s",pattern) +                report_lxml("%s lpath matches for pattern: %s","no",pattern)              end          end      end diff --git a/tex/context/base/m-chart.lua b/tex/context/base/m-chart.lua index a5201fc98..c4da2eb63 100644 --- a/tex/context/base/m-chart.lua +++ b/tex/context/base/m-chart.lua @@ -854,7 +854,7 @@ local function splitchart(chart)      local delta_x = splitsettings.dx or 0      local delta_y = splitsettings.dy or 0      -- -    report_chart("spliting %q: from (%s,%s) upto (%s,%s) into (%s,%s) with overlap (%s,%s)", +    report_chart("spliting %a from (%s,%s) upto (%s,%s) into (%s,%s) with overlap (%s,%s)",          name,from_x,from_y,to_x,to_y,step_x,step_y,delta_x,delta_y)      --      local part_x = 0 @@ -876,7 +876,7 @@ local function splitchart(chart)                  last_y = to_y              end              -- -            report_chart("part (%s,%s) of %q: (%s,%s) -> (%s,%s)",part_x,part_y,name,first_x,first_y,last_x,last_y) +            report_chart("part (%s,%s) of %a is split from (%s,%s) -> (%s,%s)",part_x,part_y,name,first_x,first_y,last_x,last_y)              local x, y, nx, ny = first_x, first_y, last_x - first_x + 1,last_y - first_y + 1              context.beforeFLOWsplit()              context.handleFLOWsplit(function() diff --git a/tex/context/base/math-act.lua b/tex/context/base/math-act.lua index 51a06a087..bfc229a92 100644 --- a/tex/context/base/math-act.lua +++ b/tex/context/base/math-act.lua @@ -56,9 +56,6 @@ local how = {  function mathematics.scaleparameters(target,original)      if not target.properties.math_is_scaled then -     -- print("\n",target.properties.fontname) -     -- print(original.mathparameters.DisplayOperatorMinHeight) -     -- print(target.mathparameters.DisplayOperatorMinHeight)          local mathparameters = target.mathparameters          if mathparameters and next(mathparameters) then              local parameters = target.parameters @@ -76,13 +73,9 @@ function mathematics.scaleparameters(target,original)                  else                      value = value * factor                  end -             -- if name == "DisplayOperatorMinHeight" then -             --     report_math("f: %s, p: %s, h: %s, b: %s, a: %s",target.properties.fontname,name,h or "scaled",mathparameters[name],value) -             -- end -                mathparameters[name] = value +               mathparameters[name] = value              end          end -     -- print(mathparameters.DisplayOperatorMinHeight)          target.properties.math_is_scaled = true      end  end @@ -123,12 +116,12 @@ function mathematics.overloadparameters(target,original)                  local parameters  = mathematics and mathematics.parameters                  if parameters then                      if trace_defining then -                        report_math("overloading math parameters in '%s' @ %s",target.properties.fullname,target.parameters.size) +                        report_math("overloading math parameters in %a @ %p",target.properties.fullname,target.parameters.size)                      end                      for name, value in next, parameters do                          local tvalue = type(value)                          if tvalue == "string" then -                            report_math("comment for math parameter '%s': %s",name,value) +                            report_math("comment for math parameter %a: %s",name,value)                          else                              local oldvalue = mathparameters[name]                              local newvalue = oldvalue @@ -141,10 +134,10 @@ function mathematics.overloadparameters(target,original)                                      newvalue = nil                                  end                                  if trace_defining and oldvalue ~= newvalue then -                                    report_math("overloading math parameter '%s': %s => %s",name,tostring(oldvalue),tostring(newvalue)) +                                    report_math("overloading math parameter %a: %S => %S",name,oldvalue,newvalue)                                  end                              else -                                report_math("invalid math parameter '%s'",name) +                                report_math("invalid math parameter %a",name)                              end                              mathparameters[name] = newvalue                          end @@ -168,7 +161,7 @@ local function applytweaks(when,target,original)                  tweaks = tweaks[when]                  if tweaks then                      if trace_defining then -                        report_math("tweaking math of '%s' @ %s (%s)",target.properties.fullname,target.parameters.size,when) +                        report_math("tweaking math of %a @ %p (%s)",target.properties.fullname,target.parameters.size,when)                      end                      for i=1,#tweaks do                          local tweak= tweaks[i] diff --git a/tex/context/base/math-ext.lua b/tex/context/base/math-ext.lua index a3133d07a..b00d6cde2 100644 --- a/tex/context/base/math-ext.lua +++ b/tex/context/base/math-ext.lua @@ -25,12 +25,12 @@ local chardata     = characters.data  function extras.add(unicode,t) -- todo: if already stored ...      local min, max = mathematics.extrabase, mathematics.privatebase - 1   -- if mathdata[unicode] or chardata[unicode] then - --     report_math("extra U+%05X overloads existing character",unicode) + --     report_math("extra %U overloads existing character",unicode)   -- end      if unicode >= min and unicode <= max then          mathdata[unicode], chardata[unicode] = t, t      else -        report_math("extra U+%05X should be in range U+%05X - U+%05X",unicode,min,max) +        report_math("extra %U should be in range %U - %U",unicode,min,max)      end  end @@ -59,9 +59,9 @@ function extras.copy(target,original)              end              if not extrachar then                  if trace_virtual then -                    report_math("extra U+%05X in %s at is not mapped (class: %s, name: %s)", +                    report_math("extra %U in %a at %p with class %a and name %a is not mapped",                          unicode,basename(properties.fullname),parameters.size, -                        extradesc.mathclass or "?", extradesc.mathname or "?") +                        extradesc.mathclass,extradesc.mathname)                  end              elseif not extrachar.next then                  local nextused = false @@ -82,20 +82,20 @@ function extras.copy(target,original)                  end                  if trace_virtual then                      if nextused then -                        report_math("extra U+%05X in %s at %s maps onto U+%05X (class: %s, name: %s) with next U+%05X", +                        report_math("extra %U in %a at %p with class %a and name %a maps onto %U with next %U",                              unicode,basename(properties.fullname),parameters.size,charused, -                            extradesc.mathclass or "?",extradesc.mathname or "?", nextused) +                            extradesc.mathclass,extradesc.mathname,nextused)                      else -                        report_math("extra U+%05X in %s at %s maps onto U+%05X (class: %s, name: %s) with no next", +                        report_math("extra %U in %a at %p with class %a and name %a maps onto %U with no next",                              unicode,basename(properties.fullname),parameters.size,charused, -                            extradesc.mathclass or "?",extradesc.mathname or "?") +                            extradesc.mathclass,extradesc.mathname)                      end                  end              else                  if trace_virtual then -                    report_math("extra U+%05X in %s at %s maps onto U+%05X (class: %s, name: %s)", -- own next +                    report_math("extra %U in %a at %p with class %a and name %a maps onto %U with no next", -- own next                          unicode,basename(properties.fullname),parameters.size,charused, -                        extradesc.mathclass or "?",extradesc.mathname or "?") +                        extradesc.mathclass,extradesc.mathname)                  end              end          end diff --git a/tex/context/base/math-fbk.lua b/tex/context/base/math-fbk.lua index 565bead1d..eebc4e4e7 100644 --- a/tex/context/base/math-fbk.lua +++ b/tex/context/base/math-fbk.lua @@ -116,7 +116,7 @@ textid = self                  end                  if trace_fallbacks then                      if characters[k] then -                        report_fallbacks("extending font %q with U+%05X",target.properties.fullname,k) +                        report_fallbacks("extending font %a with %U",target.properties.fullname,k)                      end                  end              end diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua index 1602b387e..314d2ed05 100644 --- a/tex/context/base/math-ini.lua +++ b/tex/context/base/math-ini.lua @@ -215,11 +215,11 @@ end  local function report(class,family,unicode,name)      local nametype = type(name)      if nametype == "string" then -        report_math("%s:%s %s U+%05X (%s) => %s",classname,class,family,unicode,utfchar(unicode),name) +        report_math("class name %a, class %a, family %a, char %C, name %a",classname,class,family,unicode,name)      elseif nametype == "number" then -        report_math("%s:%s %s U+%05X (%s) => U+%05X",classname,class,family,unicode,utfchar(unicode),name) +        report_math("class name %a, class %a, family %a, char %C, number %U",classname,class,family,unicode,name)      else -        report_math("%s:%s %s U+%05X (%s)", classname,class,family,unicode,utfchar(unicode)) +        report_math("class name %a, class %a, family %a, char %C", classname,class,family,unicode)      end  end @@ -295,9 +295,9 @@ function mathematics.define(family)                  if trace_defining then                      report(class,family,unicode,name)                  end -if setcode then -                setmathcharacter(class,family,unicode) -end +                if setcode then +                    setmathcharacter(class,family,unicode) +                end              else                  name = name or character.contextname                  if name then @@ -310,9 +310,9 @@ end                          report(class,family,unicode,character.adobename)                      end                  end -if setcode then -                setmathcharacter(class,family,unicode,unicode) -end +                if setcode then +                    setmathcharacter(class,family,unicode,unicode) +                end              end          end      end diff --git a/tex/context/base/math-map.lua b/tex/context/base/math-map.lua index f2ef7e8ae..05d63552c 100644 --- a/tex/context/base/math-map.lua +++ b/tex/context/base/math-map.lua @@ -568,7 +568,7 @@ function mathematics.remapalphabets(char,mathalphabet,mathgreek)                  local alphabet = r and r.alphabet or "regular"                  local style = r and r.style or "tf"                  if trace_greek then -                    report_remapping("before: char: %05X, alphabet: %s %s, lcgreek: %s, ucgreek: %s",char,alphabet,style,remapping[lc].what,remapping[uc].what) +                    report_remapping("greek before, char %C, alphabet %a %a, lcgreek %a, ucgreek %a",char,alphabet,style,remapping[lc].what,remapping[uc].what)                  end                  local s = remapping[islc or isuc][style]                  if s then @@ -576,7 +576,7 @@ function mathematics.remapalphabets(char,mathalphabet,mathgreek)                      mathalphabet, style = data and data.attribute or mathalphabet, s                  end                  if trace_greek then -                    report_remapping("after : char: %05X, alphabet: %s %s, lcgreek: %s, ucgreek: %s",char,alphabet,style,remapping[lc].what,remapping[uc].what) +                    report_remapping("greek after, char %C, alphabet %a %a, lcgreek %a, ucgreek %a",char,alphabet,style,remapping[lc].what,remapping[uc].what)                  end              end          end diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 2e97750a1..1656f79f6 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -125,17 +125,15 @@ local function process(start,what,n,parent)      while start do          local id = start.id          if trace_processing then -            local margin = rep("  ",n or 0) -            local detail = tostring(start)              if id == math_noad then -                report_processing("%s%s (class: %s)",margin,detail,noadcodes[start.subtype] or "?") +                report_processing("%w%S, class %a",n*2,start,noadcodes[start.subtype])              elseif id == math_char then                  local char = start.char                  local fam = start.fam                  local font = font_of_family(fam) -                report_processing("%s%s (family: %s, font: %s, char: %s, shape: %s)",margin,detail,fam,font,char,utfchar(char)) +                report_processing("%w%S, family %a, font %a, char %a, shape %c",n*2,start,fam,font,char,char)              else -                report_processing("%s%s",margin,detail) +                report_processing("%w%S",n*2,start)              end          end          local proc = what[id] @@ -192,9 +190,9 @@ end  local function processnoads(head,actions,banner)      if trace_processing then -        report_processing("start '%s'",banner) +        report_processing("start %a",banner)          process(head,actions) -        report_processing("stop '%s'",banner) +        report_processing("stop %a",banner)      else          process(head,actions)      end @@ -237,21 +235,18 @@ families[math_char] = function(pointer)                      pointer[a_exportstatus] = char                      pointer.char = bold                      if trace_families then -                        report_families("replacing U+%05X (%s) by bold U+%05X (%s), family %s (%s) becomes %s (%s)", -                            char,utfchar(char),bold,utfchar(bold),a,familymap[a],newa,familymap[newa]) +                        report_families("replacing %C by bold %C, family %s with remap %s becomes %s  with remap %s",char,bold,a,familymap[a],newa,familymap[newa])                      end                  else                      if trace_families then -                        report_families("no bold replacement for U+%05X (%s), family %s (%s) becomes %s (%s)", -                            char,utfchar(char),a,familymap[a],newa,familymap[newa]) +                        report_families("no bold replacement for %C, family %s with remap %s becomes %s  with remap %s",char,a,familymap[a],newa,familymap[newa])                      end                  end                  pointer.fam = newa              else                  if trace_families then                      local char = pointer.char -                    report_families("family of U+%05X (%s) becomes %s (%s)", -                        char,utfchar(char),a,familymap[a]) +                    report_families("family of %C becomes %s with remap %s",char,a,familymap[a])                  end                  pointer.fam = a              end @@ -294,7 +289,7 @@ local a_mathgreek    = attributes.private("mathgreek")  processors.relocate = { }  local function report_remap(tag,id,old,new,extra) -    report_remapping("remapping %s in font %s from U+%05X (%s) to U+%05X (%s)%s",tag,id,old,utfchar(old),new,utfchar(new),extra or "") +    report_remapping("remapping %s in font %s from %C to %C%s",tag,id,old,new,extra)  end  local remapalphabets    = mathematics.remapalphabets @@ -679,7 +674,7 @@ local function collapsepair(pointer,what,n,parent) -- todo: switch to turn in on                                      local characters = fontcharacters[id]                                      if characters and characters[newchar] then                                          if trace_collapsing then -                                            report_collapsing("U+%05X + U+%05X => U+%05X",current_char,next_char,newchar) +                                            report_collapsing("%U + %U => %U",current_char,next_char,newchar)                                          end                                          current_nucleus.char = newchar                                          local next_next_noad = next_noad.next @@ -744,7 +739,7 @@ local function replace(pointer,what,n,parent)                  nextnucleus.char = s                  replaced[char] = (replaced[char] or 0) + 1                  if trace_normalizing then -                    report_normalizing("superscript: U+05X (%s) => U+05X (%s)",char,utfchar(char),s,utfchar(s)) +                    report_normalizing("superscript %C becomes %C",char,s)                  end              else                  local s = subscripts[char] @@ -760,7 +755,7 @@ local function replace(pointer,what,n,parent)                      nextnucleus.char = s                      replaced[char] = (replaced[char] or 0) + 1                      if trace_normalizing then -                        report_normalizing("subscript: U+05X (%s) => U+05X (%s)",char,utfchar(char),s,utfchar(s)) +                        report_normalizing("subscript %C becomes %C",char,s)                      end                  else                      break @@ -831,7 +826,7 @@ local function initializemathalternates(tfmdata)              local alternates = mathgoodies and mathgoodies.alternates              if alternates then                  if trace_goodies then -                    report_goodies("loading alternates for font '%s'",tfmdata.properties.name) +                    report_goodies("loading alternates for font %a",tfmdata.properties.name)                  end                  local lastattribute, attributes = 0, { }                  for k, v in next, alternates do @@ -883,7 +878,7 @@ alternate[math_char] = function(pointer)              local alt = getalternate(tfmdata,pointer.char,what.feature,what.value)              if alt then                  if trace_alternates then -                    report_alternates("alternate %s, value: %s, replacing glyph 0x%05X by glyph 0x%05X", +                    report_alternates("alternate %a, value %a, replacing glyph %U by glyph %U",                          tostring(what.feature),tostring(what.value),pointer.char,alt)                  end                  pointer.char = alt @@ -1022,24 +1017,21 @@ italics[math_char] = function(pointer,what,n,parent)                      if sup then                          parent.sup = insert_kern(sup,italic_kern(correction,font))                          if trace_italics then -                            report_italics("method %s: adding %s italic correction for upper limit of %s (0x%05X)", -                                method,topoints(correction),utfchar(char),char) +                            report_italics("method %a, adding %p italic correction for upper limit of %C",method,correction,char)                          end                      end                      if sub then                          local correction = - correction                          parent.sub = insert_kern(sub,italic_kern(correction,font))                          if trace_italics then -                            report_italics("method %s: adding %s italic correction for lower limit of %s (0x%05X)", -                                method,topoints(correction),utfchar(char),char) +                            report_italics("method %a, adding %p italic correction for lower limit of %C",method,correction,char)                          end                      end                  else                      if sup then                          parent.sup = insert_kern(sup,italic_kern(correction,font))                          if trace_italics then -                            report_italics("method %s: adding %s italic correction before superscript after %s (0x%05X)", -                                method,topoints(correction),utfchar(char),char) +                            report_italics("method %a, adding %p italic correction before superscript after %C",method,correction,char)                          end                      end                  end @@ -1048,8 +1040,7 @@ italics[math_char] = function(pointer,what,n,parent)                  if not next_noad then                      if n== 1 then -- only at the outer level .. will become an option (always,endonly,none)                          if trace_italics then -                            report_italics("method %s: adding %s italic correction between %s (0x%05X) and end math", -                            method,topoints(correction),utfchar(char),char) +                            report_italics("method %a, adding %p italic correction between %C and end math",method,correctio,char)                          end                          insert_node_after(parent,parent,italic_kern(correction,font))                      end @@ -1063,26 +1054,22 @@ italics[math_char] = function(pointer,what,n,parent)                              local visual = next_data.visual                              if visual == "it" or visual == "bi" then                               -- if trace_italics then -                             --     report_italics("method %s: skipping %s italic correction between italic %s (0x%05X) and italic %s (0x%05X)", -                             --         method,topoints(correction),utfchar(char),char,utfchar(next_char),next_char) +                             --     report_italics("method %a, skipping %p italic correction between italic %C and italic %C",method,correction,char,next_char)                               -- end                              else                                  local category = next_data.category                                  if category == "nd" or category == "ll" or category == "lu" then                                      if trace_italics then -                                        report_italics("method %s: adding %s italic correction between italic %s (0x%05X) and non italic %s (0x%05X)", -                                            method,topoints(correction),utfchar(char),char,utfchar(next_char),next_char) +                                        report_italics("method %a, adding %p italic correction between italic %C and non italic %C",method,correction,char,next_char)                                      end                                      insert_node_after(parent,parent,italic_kern(correction,font))                               -- elseif next_data.height > (fontexheights[font]/2) then                               --     if trace_italics then -                             --         report_italics("method %s: adding %s italic correction between %s (0x%05X) and ascending %s (0x%05X)", -                             --             method,topoints(correction),utfchar(char),char,utfchar(next_char),next_char) +                             --         report_italics("method %a, adding %p italic correction between %C and ascending %C",method,correction,char,next_char)                               --     end                               --     insert_node_after(parent,parent,italic_kern(correction,font))                               -- elseif trace_italics then -                             --  -- report_italics("method %s: skipping %s italic correction between %s (0x%05X) and %s (0x%05X)", -                             --  --     method,topoints(correction),utfchar(char),char,utfchar(next_char),next_char) +                             --  -- report_italics("method %a, skipping %p italic correction between %C and %C",method,correction,char,next_char)                                  end                              end                          end @@ -1166,11 +1153,11 @@ variants[math_char] = function(pointer,what,n,parent) -- also set export value                      pointer.char = variant                      pointer[a_exportstatus] = char -- we don't export the variant as it's visual markup                      if trace_variants then -                        report_variants("variant (U+%05X,U+%05X) replaced by U+%05X",char,selector,variant) +                        report_variants("variant (%U,%U) replaced by %U",char,selector,variant)                      end                  else                      if trace_variants then -                        report_variants("no variant (U+%05X,U+%05X)",char,selector) +                        report_variants("no variant (%U,%U)",char,selector)                      end                  end                  next.prev = pointer @@ -1192,16 +1179,16 @@ function builders.kernel.mlist_to_hlist(head,style,penalties)      return mlist_to_hlist(head,style,penalties), true  end ---~ function builders.kernel.mlist_to_hlist(head,style,penalties) ---~     print("!!!!!!! BEFORE",penalties) ---~     for n in node.traverse(head) do print(n) end ---~     print("!!!!!!!") ---~     head = mlist_to_hlist(head,style,penalties) ---~     print("!!!!!!! AFTER") ---~     for n in node.traverse(head) do print(n) end ---~     print("!!!!!!!") ---~     return head, true ---~ end +-- function builders.kernel.mlist_to_hlist(head,style,penalties) +--     print("!!!!!!! BEFORE",penalties) +--     for n in node.traverse(head) do print(n) end +--     print("!!!!!!!") +--     head = mlist_to_hlist(head,style,penalties) +--     print("!!!!!!! AFTER") +--     for n in node.traverse(head) do print(n) end +--     print("!!!!!!!") +--     return head, true +-- end  tasks.new {      name      = "math", diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index 418b9cc1b..b169ec5e5 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -205,7 +205,7 @@ local function raise(main,characters,id,size,unicode,private,n) -- this is a rea      local raised = characters[private]      if raised then          if not done[unicode] then -            report_virtual("temporary too large U+%05X due to issues in luatex backend",unicode) +            report_virtual("temporary too large %U due to issues in luatex backend",unicode)              done[unicode] = true          end          local up = 0.85 * main.parameters.x_height @@ -524,7 +524,7 @@ local reverse  = { } -- index -> unicode  setmetatableindex(reverse, function(t,name)      if trace_virtual then -        report_virtual("initializing math vector '%s'",name) +        report_virtual("initializing math vector %a",name)      end      local m, r = mathencodings[name], { }      for u, i in next, m do @@ -545,7 +545,7 @@ function vfmath.define(specification,set,goodies)          local ssname = ss.name          if add_optional and ss.optional then              if trace_virtual then -                report_virtual("loading font %s subfont %s with name %s at %s is skipped",name,s,ssname,size) +                report_virtual("loading font %a subfont %s with name %a at %p is skipped",name,s,ssname,size)              end          else              if ss.features then @@ -559,14 +559,14 @@ function vfmath.define(specification,set,goodies)              if alreadyloaded then                  f, id = alreadyloaded.f, alreadyloaded.id                  if trace_virtual then -                    report_virtual("loading font %s subfont %s with name %s is reused",name,s,ssname) +                    report_virtual("loading font %a subfont %s with name %a is reused",name,s,ssname)                  end              else                  f, id = fonts.constructors.readanddefine(ssname,size)                  names[ssname] = { f = f, id = id }              end              if not f or id == 0 then -                report_virtual("loading font %s subfont %s with name %s at %s is skipped, not found",name,s,ssname,size) +                report_virtual("loading font %a subfont %s with name %a at %p is skipped, not found",name,s,ssname,size)              else                  n = n + 1                  okset[n] = ss @@ -576,7 +576,7 @@ function vfmath.define(specification,set,goodies)                      shared[n] = { }                  end                  if trace_virtual then -                    report_virtual("loading font %s subfont %s with name %s at %s as id %s using encoding %s",name,s,ssname,size,id,ss.vector or "none") +                    report_virtual("loading font %a subfont %s with name %a at %p as id %s using encoding %p",name,s,ssname,size,id,ss.vector)                  end                  if not ss.checked then                      ss.checked = true @@ -591,10 +591,10 @@ function vfmath.define(specification,set,goodies)                                  u = u and u[index]                                  if u then                                      if trace_virtual then -                                        report_virtual("resolving name %s to %s",index,u) +                                        report_virtual("resolving name %a to %s",index,u) -- maybe more detail for u                                      end                                  else -                                    report_virtual("unable to resolve name %s",index) +                                    report_virtual("unable to resolve name %a",index)                                  end                                  vector[unicode] = u                              end @@ -636,7 +636,7 @@ function vfmath.define(specification,set,goodies)              characters[unicode] = character          end      else -        report_virtual("font %s has no characters",name) +        report_virtual("font %a has no characters",name)      end      --      if parent.parameters then @@ -644,7 +644,7 @@ function vfmath.define(specification,set,goodies)              parameters[key] = value          end      else -        report_virtual("font %s has no parameters",name) +        report_virtual("font %a has no parameters",name)      end      --      local description = { name = "<unset>" } @@ -686,7 +686,7 @@ function vfmath.define(specification,set,goodies)          else              local newparameters = fs.parameters              if not newparameters then -                report_virtual("font %s, no parameters set",name) +                report_virtual("no parameters set in font %a",name)              elseif ss.extension then                  mathparameters.math_x_height          = newparameters.x_height or 0        -- math_x_height          : height of x                  mathparameters.default_rule_thickness = newparameters[ 8]      or 0        -- default_rule_thickness : thickness of \over bars @@ -695,7 +695,7 @@ function vfmath.define(specification,set,goodies)                  mathparameters.big_op_spacing3        = newparameters[11]      or 0        -- big_op_spacing3        : minimum baselineskip above displayed op                  mathparameters.big_op_spacing4        = newparameters[12]      or 0        -- big_op_spacing4        : minimum baselineskip below displayed op                  mathparameters.big_op_spacing5        = newparameters[13]      or 0        -- big_op_spacing5        : padding above and below displayed limits -            --  report_virtual("loading and virtualizing font %s at size %s, setting ex parameters",name,size) +            --  report_virtual("loading and virtualizing font %a at size %p, setting ex parameters",name,size)              elseif ss.parameters then                  mathparameters.x_height      = newparameters.x_height or mathparameters.x_height                  mathparameters.x_height      = mathparameters.x_height or fp.x_height or 0 -- x_height               : height of x @@ -714,7 +714,7 @@ function vfmath.define(specification,set,goodies)                  mathparameters.delim1        = newparameters[20] or 0                      -- delim1                 : size of \atopwithdelims delimiters in display styles                  mathparameters.delim2        = newparameters[21] or 0                      -- delim2                 : size of \atopwithdelims delimiters in non-displays                  mathparameters.axis_height   = newparameters[22] or 0                      -- axis_height            : height of fraction lines above the baseline -            --  report_virtual("loading and virtualizing font %s at size %s, setting sy parameters",name,size) +            --  report_virtual("loading and virtualizing font %a at size %p, setting sy parameters",name,size)              end              local vectorname = ss.vector              if vectorname then @@ -736,9 +736,9 @@ function vfmath.define(specification,set,goodies)                              local ru = rv[unicode]                              if not ru then                                  if trace_virtual then -                                    report_virtual("unicode point U+%05X has no index %04X in vector %s for font %s",unicode,index,vectorname,fontname) +                                    report_virtual("unicode slot %U has no index %H in vector %a for font %a",unicode,index,vectorname,fontname)                                  elseif not already_reported then -                                    report_virtual("the mapping is incomplete for '%s' at %s",name,number.topoints(size)) +                                    report_virtual("the mapping is incomplete for %a at %p",name,size)                                      already_reported = true                                  end                                  rv[unicode] = true @@ -896,7 +896,7 @@ function vfmath.define(specification,set,goodies)                          end                      end                  else -                    report_virtual("error in loading %s: problematic vector %s",name,vectorname) +                    report_virtual("error in loading %a, problematic vector %a",name,vectorname)                  end              end              mathematics.extras.copy(main) --not needed here (yet) @@ -908,7 +908,6 @@ function vfmath.define(specification,set,goodies)          size = size,      }      -- --- inspect(characters[0x0221A])      --      main.mathparameters = mathparameters -- still traditional ones      vfmath.addmissing(main,#fontlist,size) @@ -920,7 +919,7 @@ function vfmath.define(specification,set,goodies)      main.MathConstants = main.mathparameters -- we directly pass it to TeX (bypasses the scaler) so this is needed      --      if trace_virtual or trace_timings then -        report_virtual("loading and virtualizing font %s at size %s took %0.3f seconds",name,size,os.clock()-start) +        report_virtual("loading and virtualizing font %a at size %p took %0.3f seconds",name,size,os.clock()-start)      end      --      return main diff --git a/tex/context/base/meta-ini.lua b/tex/context/base/meta-ini.lua index 05433121e..713ba3d5d 100644 --- a/tex/context/base/meta-ini.lua +++ b/tex/context/base/meta-ini.lua @@ -23,14 +23,14 @@ local status_metapost = logs.messenger("metapost")  local patterns = { "meta-imp-%s.mkiv", "meta-imp-%s.tex", "meta-%s.mkiv", "meta-%s.tex" } -- we are compatible  local function action(name,foundname) -    status_metapost("loaded: library '%s'",name) +    status_metapost("library %a is loaded",name)      context.startreadingfile()      context.input(foundname)      context.stopreadingfile()  end  local function failure(name) -    report_metapost("unknown: library '%s'",name) +    report_metapost("library %a is unknown or invalid",name)  end  function commands.useMPlibrary(name) diff --git a/tex/context/base/meta-pdf.lua b/tex/context/base/meta-pdf.lua index 7046f5311..0287b8265 100644 --- a/tex/context/base/meta-pdf.lua +++ b/tex/context/base/meta-pdf.lua @@ -549,7 +549,7 @@ function mptopdf.convertmpstopdf(name)          resetall()          statistics.stoptiming(mptopdf)      else -        report_mptopdf("file '%s' not found",name) +        report_mptopdf("file %a not found",name)      end  end diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua index 205dbd35a..963309951 100644 --- a/tex/context/base/mlib-pdf.lua +++ b/tex/context/base/mlib-pdf.lua @@ -88,7 +88,7 @@ function metapost.flushliteral(d)          literal.data = savedliterals[d]          write_node(literal)      else -        report_metapost("problem flushing literal %s",d) +        report_metapost("problem flushing literal %a",d)      end  end diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua index 3a6f0dc77..93bddc2dd 100644 --- a/tex/context/base/mlib-pps.lua +++ b/tex/context/base/mlib-pps.lua @@ -230,7 +230,7 @@ local function freeboxes()            -- texbox[scratchbox] = tn            -- texbox[scratchbox] = nil -- this frees too              if trace_textexts then -                report_textexts("freeing %s",n) +                report_textexts("freeing box %s",n)              end          end      end @@ -254,7 +254,7 @@ end  function metapost.gettext(box,slot)      texbox[box] = copy_list(textexts[slot])      if trace_textexts then -        report_textexts("putting %s in box %s",slot,box) +        report_textexts("putting text %s in box %s",slot,box)      end   -- textexts[slot] = nil -- no, pictures can be placed several times  end @@ -495,7 +495,7 @@ function metapost.textextsdata()          if box then              local wd, ht, dp = box.width/factor, box.height/factor, box.depth/factor              if trace_textexts then -                report_textexts("passed data %s: (%0.4f,%0.4f,%0.4f)",n,wd,ht,dp) +                report_textexts("passed data item %s: (%p,%p,%p)",n,wd,ht,dp)              end              nt = nt + 1              t[nt] = f_text_data(n,wd,n,ht,n,dp) @@ -582,7 +582,7 @@ function metapost.graphic_base_pass(specification)      end      if method == 1 or (method == 2 and (done_1 or done_2 or done_3)) then          if trace_runs then -            report_metapost("first run of job %s (asked: %s)",nofruns,tostring(askedfig)) +            report_metapost("first run of job %s, asked figure %a",nofruns,askedfig)          end       -- first true means: trialrun, second true means: avoid extra run if no multipass          local flushed = metapost.process(mpx, { @@ -609,7 +609,7 @@ function metapost.graphic_base_pass(specification)          end      else          if trace_runs then -            report_metapost("running job %s (asked: %s)",nofruns,tostring(askedfig)) +            report_metapost("running job %s, asked figure %a",nofruns,askedfig)          end          metapost.process(mpx, {              preamble, @@ -626,7 +626,7 @@ end  function metapost.graphic_extra_pass(askedfig)      if trace_runs then -        report_metapost("second run of job %s (asked: %s)",nofruns,tostring(askedfig)) +        report_metapost("second run of job %s, asked figure %a",nofruns,askedfig)      end      local askedfig, wrappit = checkaskedfig(askedfig)      metapost.process(current_format, { @@ -822,9 +822,6 @@ local function tx_analyze(object,prescript) -- todo: hash content and reuse them          local n = tx_hash[h] -- todo: hashed variant with s (nicer for similar labels)          if not n then              tx_last = tx_last + 1 -         -- if trace_textexts then -         --     report_textexts("setting %s %s (first pass)",tx_stage,tx_number) -         -- end              if not c then                  -- no color              elseif #c == 1 then @@ -852,12 +849,12 @@ local function tx_analyze(object,prescript) -- todo: hash content and reuse them              texslots[textrial] = tx_last              texorder[tx_number] = tx_last              if trace_textexts then -                report_textexts("stage: %s, usage: %s, number: %s, new: %s, hash: %s",tx_stage,textrial,tx_number,tx_last,h) +                report_textexts("stage %a, usage %a, number %a, new %a, hash %a",tx_stage,textrial,tx_number,tx_last,h)              end          else              texslots[textrial] = n              if trace_textexts then -                report_textexts("stage: %s, usage: %s, number: %s, old: %s, hash: %s",tx_stage,textrial,tx_number,n,h) +                report_textexts("stage %a, usage %a, number %a, new %a, hash %a",tx_stage,textrial,tx_number,n,h)              end          end      elseif tx_stage == "extra" then @@ -866,15 +863,12 @@ local function tx_analyze(object,prescript) -- todo: hash content and reuse them          if not texorder[tx_number] then              local s = object.postscript or ""              tx_last = tx_last + 1 -         -- if trace_textexts then -         --     report_textexts("setting %s %s (first pass)",tx_stage,tx_number) -         -- end              context.MPLIBsettext(tx_last,s)              metapost.multipass = true              texslots[textrial] = tx_last              texorder[tx_number] = tx_last              if trace_textexts then -                report_textexts("stage: %s, usage: %s, number: %s, extra: %s",tx_stage,textrial,tx_number,tx_last) +                report_textexts("stage %a, usage %a, number %a, extra %a",tx_stage,textrial,tx_number,tx_last)              end          end      end @@ -888,11 +882,8 @@ local function tx_process(object,prescript,before,after)          if tx_stage == "final" then              texfinal = texfinal + 1              local n = texslots[texfinal] -         -- if trace_textexts then -         --     report_textexts("processing %s (second pass)",tx_number) -         -- end              if trace_textexts then -                report_textexts("stage: %s, usage: %s, number: %s, use: %s",tx_stage,texfinal,tx_number,n) +                report_textexts("stage %a, usage %a, number %a, use %a",tx_stage,texfinal,tx_number,n)              end              local sx, rx, ry, sy, tx, ty = cm(object) -- needs to be frozen outside the function              local box = textexts[n] diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua index 5adf43b46..0d7b5aa6d 100644 --- a/tex/context/base/mlib-run.lua +++ b/tex/context/base/mlib-run.lua @@ -248,7 +248,7 @@ if mplibone then   --     mpsformat = file.addsuffix(mpsformat, "mem")   --     local mpsformatfullname = caches.getfirstreadablefile(mpsformat,"formats","metapost") or ""   --     if mpsformatfullname ~= "" then - --         report_metapost("loading '%s' from '%s'", mpsinput, mpsformatfullname) + --         report_metapost("loading %a from %a", mpsinput, mpsformatfullname)   --         local mpx, result = metapost.load(mpsformatfullname)   --         if mpx then   --             local result = mpx:execute("show mp_parent_version ;") @@ -264,18 +264,18 @@ if mplibone then   --                 end   --             end   --         else - --             report_metapost("error in loading '%s' from '%s'", mpsinput, mpsformatfullname) + --             report_metapost("error in loading %a from %a", mpsinput, mpsformatfullname)   --             metapost.reporterror(result)   --         end   --     end   --     local mpsformatfullname = caches.setfirstwritablefile(mpsformat,"formats") - --     report_metapost("making '%s' into '%s'", mpsinput, mpsformatfullname) + --     report_metapost("making %a into %a", mpsinput, mpsformatfullname)   --     metapost.make(mpsinput,mpsformatfullname,mpsversion) -- somehow return ... fails here   --     if lfs.isfile(mpsformatfullname) then - --         report_metapost("loading '%s' from '%s'", mpsinput, mpsformatfullname) + --         report_metapost("loading %a from %a", mpsinput, mpsformatfullname)   --         return metapost.load(mpsformatfullname)   --     else - --         report_metapost("problems with '%s' from '%s'", mpsinput, mpsformatfullname) + --         report_metapost("problems with %a from %a", mpsinput, mpsformatfullname)   --     end   -- end @@ -302,7 +302,7 @@ else              find_file   = finder,              math_mode   = method,          } -        report_metapost("initializing number mode %q",method) +        report_metapost("initializing number mode %a",method)          local result          if not mpx then              result = { status = 99, error = "out of memory"} @@ -331,14 +331,14 @@ else              foundfile  = finder(file.replacesuffix(mpsinput,"mp")) or ""          end          if foundfile == "" then -            report_metapost("loading '%s' fails, format not found",mpsinput) +            report_metapost("loading %a fails, format not found",mpsinput)          else -            report_metapost("loading '%s': %s, using method: %s",mpsinput,foundfile,method or "default") +            report_metapost("loading %a as %a using method %a",mpsinput,foundfile,method or "default")              local mpx, result = metapost.load(foundfile,method)              if mpx then                  return mpx              else -                report_metapost("error in loading '%s'",mpsinput) +                report_metapost("error in loading %a",mpsinput)                  metapost.reporterror(result)              end          end @@ -363,7 +363,7 @@ function metapost.format(instance,name,method)      name = name or instance      local mpx = mpxformats[instance]      if not mpx then -        report_metapost("initializing instance '%s' using format '%s'",instance,name) +        report_metapost("initializing instance %a using format %a",instance,name)          mpx = metapost.checkformat(name,method)          mpxformats[instance] = mpx      end @@ -533,13 +533,13 @@ function metapost.directrun(formatname,filename,outputformat,astable,mpdata)          outputformat = "mps"      end      if not data then -        report_metapost("unknown file '%s'",filename or "?") +        report_metapost("unknown file %a",filename)      else          local mpx = metapost.checkformat(formatname)          if not mpx then -            report_metapost("unknown format '%s'",formatname or "?") +            report_metapost("unknown format %a",formatname)          else -            report_metapost("processing '%s'",(mpdata and (filename or "data")) or fullname) +            report_metapost("processing %a",(mpdata and (filename or "data")) or fullname)              local result = mpx:execute(data)              if not result then                  report_metapost("error: no result object returned") @@ -576,7 +576,7 @@ function metapost.directrun(formatname,filename,outputformat,astable,mpdata)                                  output = figures[v]:svg() -- (3) for prologues                              end                              local outname = format("%s-%s.%s",basename,v,outputformat) -                            report_metapost("saving %s bytes in '%s'",#output,outname) +                            report_metapost("saving %s bytes in %a",#output,outname)                              io.savedata(outname,output)                          end                          return #sorted diff --git a/tex/context/base/mult-aux.lua b/tex/context/base/mult-aux.lua index 911888991..3c4cbcc0f 100644 --- a/tex/context/base/mult-aux.lua +++ b/tex/context/base/mult-aux.lua @@ -25,32 +25,32 @@ local data = { }  function namespaces.define(namespace,settings)      if trace_namespaces then -        report_namespaces("installing namespace '%s' with settings '%s'",namespace,settings) +        report_namespaces("installing namespace %a with settings %a",namespace,settings)      end      if data[namespace] then -        report_namespaces("namespace '%s' is already taken",namespace) +        report_namespaces("namespace %a is already taken",namespace)      end      if #namespace < 2 then -        report_namespaces("namespace '%s' should have more than 1 character",namespace) +        report_namespaces("namespace %a should have more than 1 character",namespace)      end      local ns = { }      data[namespace] = ns      utilities.parsers.settings_to_hash(settings,ns)      local name = ns.name      if not name or name == "" then -        report_namespaces("provide a (command) name in namespace '%s'",namespace) +        report_namespaces("provide a (command) name in namespace %a",namespace)      end      local self = "\\" .. prefix .. namespace      context.unprotect()   -- context.installnamespace(namespace)      context("\\def\\%s%s{%s%s}",prefix,namespace,meaning,namespace) -- or context.setvalue      if trace_namespaces then -        report_namespaces("using namespace '%s' for '%s'",namespace,name) +        report_namespaces("using namespace %a for %a",namespace,name)      end      local parent = ns.parent or ""      if parent ~= "" then          if trace_namespaces then -            report_namespaces("namespace '%s' for '%s' uses parent '%s'",namespace,name,parent) +            report_namespaces("namespace %a for %a uses parent %a",namespace,name,parent)          end          if not find(parent,"\\") then              parent = "\\" .. prefix .. parent @@ -59,60 +59,60 @@ function namespaces.define(namespace,settings)      end      context.installparameterhandler(self,name)      if trace_namespaces then -        report_namespaces("installing parameter handler for '%s'",name) +        report_namespaces("installing parameter handler for %a",name)      end      context.installparameterhashhandler(self,name)      if trace_namespaces then -        report_namespaces("installing parameterhash handler for '%s'",name) +        report_namespaces("installing parameterhash handler for %a",name)      end      local style = ns.style      if style == v_yes then          context.installstyleandcolorhandler(self,name)          if trace_namespaces then -            report_namespaces("installing attribute handler for '%s'",name) +            report_namespaces("installing attribute handler for %a",name)          end      end      local command = ns.command      if command == v_yes then          context.installdefinehandler(self,name,parent)          if trace_namespaces then -            report_namespaces("installing definition command for '%s' (single)",name) +            report_namespaces("installing definition  command for %a (single)",name)          end      elseif command == v_list then          context.installdefinehandler(self,name,parent)          if trace_namespaces then -            report_namespaces("installing definition command for '%s' (multiple)",name) +            report_namespaces("installing definition command for %a (multiple)",name)          end      end      local setup = ns.setup      if setup == v_yes then          context.installsetuphandler(self,name)          if trace_namespaces then -            report_namespaces("installing setup command for '%s' (single)",name) +            report_namespaces("installing setup command for %a (%s)",name,"single")          end      elseif setup == v_list then          context.installsetuphandler(self,name)          if trace_namespaces then -            report_namespaces("installing setup command for '%s' (multiple)",name) +            report_namespaces("installing setup command for %a (%s)",name,"multiple")          end      end      local set = ns.set      if set == v_yes then          context.installparametersethandler(self,name)          if trace_namespaces then -            report_namespaces("installing set/let/reset command for '%s' (single)",name) +            report_namespaces("installing set/let/reset command for %a (%s)",name,"single")          end      elseif set == v_list then          context.installparametersethandler(self,name)          if trace_namespaces then -            report_namespaces("installing set/let/reset command for '%s' (multiple)",name) +            report_namespaces("installing set/let/reset command for %a (%s)",name,"multiple")          end      end      local frame = ns.frame      if frame == v_yes then          context.installinheritedframed(name)          if trace_namespaces then -            report_namespaces("installing framed command for '%s'",name) +            report_namespaces("installing framed command for %a",name)          end      end      context.protect() diff --git a/tex/context/base/mult-chk.lua b/tex/context/base/mult-chk.lua index e3908ad40..33995ddcc 100644 --- a/tex/context/base/mult-chk.lua +++ b/tex/context/base/mult-chk.lua @@ -23,7 +23,7 @@ interfaces.syntax = allocate {  }  function interfaces.invalidkey(category,key) -    report_interface("invalid key '%s' for '%s' in line %s",key,category,tex.inputlineno) +    report_interface("invalid key %a for %a in line %s",key,category,tex.inputlineno)  end  function interfaces.setvalidkeys(category,list) diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua index d5a4d6f08..2e431d364 100644 --- a/tex/context/base/node-aux.lua +++ b/tex/context/base/node-aux.lua @@ -328,11 +328,7 @@ local function link(list,currentfont,currentattr,head,tail)                  report_error("weird node type in list at index %s:",i)                  for i=1,#list do                      local l = list[i] -                    if l.id == attributelist_code then -                        report_error("%3i: ! %s",i,tostring(l)) -                    else -                        report_error("%3i: > %s",i,tostring(l)) -                    end +                    report_error("%3i: %s %S",i,l.id == attributelist_code and "!" or ">",l)                  end                  os.exit()              else diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua index e96c6e5fe..acaf9407a 100644 --- a/tex/context/base/node-inj.lua +++ b/tex/context/base/node-inj.lua @@ -119,7 +119,7 @@ index = #mb + 1              start[a_markdone] = index              return dx, dy, bound          else -            report_injections("possible problem, U+%05X is base mark without data (id: %s)",base.char,bound) +            report_injections("possible problem, %U is base mark without data (id %a)",base.char,bound)          end      end  --     index = index or 1 @@ -147,38 +147,38 @@ local function trace(head)              local cb = n[a_cursbase]              local cc = n[a_curscurs]              local char = n.char -            report_injections("char U+%05X, font %s, glyph %s",char,n.font,utfchar(char)) +            report_injections("font %s, char %U, glyph %c",char,n.font,char)              if kp then                  local k = kerns[kp]                  if k[3] then -                    report_injections("  pairkern: dir=%s, x=%s, y=%s, w=%s, h=%s",dir(k[1]),k[2] or "?",k[3] or "?",k[4] or "?",k[5] or "?") +                    report_injections("  pairkern: dir %a, x %p, y %p, w %p, h %p",dir(k[1]),k[2],k[3],k[4],k[5])                  else -                    report_injections("  kern: dir=%s, dx=%s",dir(k[1]),k[2] or "?") +                    report_injections("  kern: dir %a, dx %p",dir(k[1]),k[2])                  end              end              if mb then -                report_injections("  markbase: bound=%s",mb) +                report_injections("  markbase: bound %a",mb)              end              if mm then                  local m = marks[mm]                  if mb then                      local m = m[mb]                      if m then -                        report_injections("  markmark: bound=%s, index=%s, dx=%s, dy=%s",mm,md or "?",m[1] or "?",m[2] or "?") +                        report_injections("  markmark: bound %a, index %a, dx %p, dy %p",mm,md,m[1],m[2])                      else -                        report_injections("  markmark: bound=%s, missing index",mm) +                        report_injections("  markmark: bound %a, missing index",mm)                      end                  else                      m = m[1] -                    report_injections("  markmark: bound=%s, dx=%s, dy=%s",mm,m and m[1] or "?",m and m[2] or "?") +                    report_injections("  markmark: bound %a, dx %p, dy %p",mm,m and m[1],m and m[2])                  end              end              if cb then -                report_injections("  cursbase: bound=%s",cb) +                report_injections("  cursbase: bound %a",cb)              end              if cc then                  local c = cursives[cc] -                report_injections("  curscurs: bound=%s, dir=%s, dx=%s, dy=%s",cc,dir(c[1]),c[2] or "?",c[3] or "?") +                report_injections("  curscurs: bound %a, dir %a, dx %p, dy %p",cc,dir(c[1]),c[2],c[3])              end          end      end diff --git a/tex/context/base/node-mig.lua b/tex/context/base/node-mig.lua index 14a9885ba..9fc35a048 100644 --- a/tex/context/base/node-mig.lua +++ b/tex/context/base/node-mig.lua @@ -68,7 +68,7 @@ function nodes.handlers.migrate(head,where)      local done = false      if head then          if trace_migrations then -            report_nodes("migration sweep '%s'",where) +            report_nodes("migration sweep %a",where)          end          local current = head          while current do @@ -90,7 +90,7 @@ function nodes.handlers.migrate(head,where)                  if first then                      t_inserts, t_marks = t_inserts + ni, t_marks + nm                      if trace_migrations and (ni > 0 or nm > 0) then -                        report_nodes("sweep %s, container %s, %s inserts and %s marks migrated outwards during '%s'", +                        report_nodes("sweep %a, container %a, %s inserts and %s marks migrated outwards during %a",                              t_sweeps,nodecodes[id],ni,nm,where)                      end                      -- inserts after head diff --git a/tex/context/base/node-pro.lua b/tex/context/base/node-pro.lua index adca502db..ab5b77f90 100644 --- a/tex/context/base/node-pro.lua +++ b/tex/context/base/node-pro.lua @@ -56,9 +56,9 @@ local function tracer(what,state,head,groupcode,before,after,show)      end      n = n + 1      if show then -        report_nodes("%s %s: %s, group: %s, nodes: %s -> %s, string: %s",what,n,state,groupcode,before,after,reconstruct(head)) +        report_nodes("%s: location %a, state %a, group %a, # before %a, # after %s, stream: %s",what,n,state,groupcode,before,after,reconstruct(head))      else -        report_nodes("%s %s: %s, group: %s, nodes: %s -> %s",what,n,state,groupcode,before,after) +        report_nodes("%s: location %a, state %a, group %a, # before %a, # after %s",what,n,state,groupcode,before,after)      end  end diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua index f39d29ae3..05e365979 100644 --- a/tex/context/base/node-ref.lua +++ b/tex/context/base/node-ref.lua @@ -110,14 +110,14 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t      if result and resolved then          if head == first then              if trace_backend then -                report_area("head: %04i %s %s %s => w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",tosequence(first,last,true),width,height,depth,resolved) +                report_area("head: %04i %s %s %s => w=%p, h=%p, d=%p, c=%s",reference,pardir or "---",txtdir or "----",tosequence(first,last,true),width,height,depth,resolved)              end              result.next = first              first.prev = result              return result, last          else              if trace_backend then -                report_area("middle: %04i %s %s => w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",tosequence(first,last,true),width,height,depth,resolved) +                report_area("middle: %04i %s %s => w=%p, h=%p, d=%p, c=%s",reference,pardir or "---",txtdir or "----",tosequence(first,last,true),width,height,depth,resolved)              end              local prev = first.prev              if prev then @@ -182,7 +182,7 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir)      -- todo: only when width is ok      if result and resolved then          if trace_backend then -            report_area("box: %04i %s %s: w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",width,height,depth,resolved) +            report_area("box: %04i %s %s: w=%p, h=%p, d=%p, c=%s",reference,pardir or "---",txtdir or "----",width,height,depth,resolved)          end          if not first then              current.list = result @@ -429,11 +429,11 @@ local function colorize(width,height,depth,n,reference,what)      end      if width == 0 then          -- probably a strut as placeholder -        report_area("%s %s has no horizontal dimensions: width=%s, height=%s, depth=%s",what,reference,width,height,depth) +        report_area("%s %s has no %s dimensions, width %p, height %p, depth %p",what,reference,"horizontal",width,height,depth)          width = 65536      end      if height + depth <= 0 then -        report_area("%s %s has no vertical dimensions: width=%s, height=%s, depth=%s",what,reference,n,width,height,depth) +        report_area("%s %s has no %s dimensions, width %p, height %p, depth %p",what,reference,"vertical",width,height,depth)          height = 65536/2          depth  = height      end @@ -493,7 +493,7 @@ local function makereference(width,height,depth,reference)      local sr = stack[reference]      if sr then          if trace_references then -            report_reference("resolving attribute %s",reference) +            report_reference("resolving attribute %a",reference)          end          local resolved, ht, dp, set, n = sr[1], sr[2], sr[3], sr[4], sr[5]          if ht then @@ -521,10 +521,10 @@ local function makereference(width,height,depth,reference)              if cleanupreferences then stack[reference] = nil end              return result, resolved          elseif trace_references then -            report_reference("unable to resolve annotation %s",reference) +            report_reference("unable to resolve annotation %a",reference)          end      elseif trace_references then -        report_reference("unable to resolve attribute %s",reference) +        report_reference("unable to resolve attribute %a",reference)      end  end @@ -560,7 +560,7 @@ local function makedestination(width,height,depth,reference)      local sr = stack[reference]      if sr then          if trace_destinations then -            report_destination("resolving attribute %s",reference) +            report_destination("resolving attribute %a",reference)          end          local resolved, ht, dp, name, view = sr[1], sr[2], sr[3], sr[4], sr[5]          if ht then @@ -606,7 +606,7 @@ local function makedestination(width,height,depth,reference)          if cleanupdestinations then stack[reference] = nil end          return result, resolved      elseif trace_destinations then -        report_destination("unable to resolve attribute %s",reference) +        report_destination("unable to resolve attribute %a",reference)      end  end diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua index 5ac93da70..b651c1fa3 100644 --- a/tex/context/base/node-res.lua +++ b/tex/context/base/node-res.lua @@ -258,7 +258,7 @@ function pool.leftmarginkern(glyph,width)      if not glyph then          report_nodes("invalid pointer to left margin glyph node")      elseif glyph.id ~= glyph_code then -        report_nodes("invalid node type %s for left margin glyph node",nodecodes[glyph]) +        report_nodes("invalid node type %a for %s margin glyph node",nodecodes[glyph],"left")      else          n.glyph = glyph      end @@ -273,7 +273,7 @@ function pool.rightmarginkern(glyph,width)      if not glyph then          report_nodes("invalid pointer to right margin glyph node")      elseif glyph.id ~= glyph_code then -        report_nodes("invalid node type %s for right margin glyph node",nodecodes[p]) +        report_nodes("invalid node type %a for %s margin glyph node",nodecodes[p],"right")      else          n.glyph = glyph      end diff --git a/tex/context/base/node-rul.lua b/tex/context/base/node-rul.lua index c7b7b7be9..bac042353 100644 --- a/tex/context/base/node-rul.lua +++ b/tex/context/base/node-rul.lua @@ -247,7 +247,7 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a              local before = n_tosequence(f,l,true)              f, l = striprange(f,l)              local after = n_tosequence(f,l,true) -            report_ruled("range stripper: %s -> %s",before,after) +            report_ruled("range stripper, before %a, after %a",before,after)          else              f, l = striprange(f,l)          end @@ -317,9 +317,8 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a              insert_node_after(head,r,k)          end          if trace_ruled then -            report_ruled("level: %s, width: %i, height: %i, depth: %i, nodes: %s, text: %s", +            report_ruled("level %a, width %p, height %p, depth %p, nodes %a, text %a",                  level,w,ht,dp,n_tostring(f,l),n_tosequence(f,l,true)) -             -- level,r.width,r.height,r.depth,n_tostring(f,l),n_tosequence(f,l,true))          end      end      return head @@ -376,7 +375,7 @@ local function flush_shifted(head,first,last,data,level,parent,strip) -- not tha      local raise = data.dy * dimenfactor(data.unit,fontdata[first.font])      list.shift, list.height, list.depth = raise, height, depth      if trace_shifted then -        report_shifted("width: %s, nodes: %s, text: %s",width,n_tostring(first,last),n_tosequence(first,last,true)) +        report_shifted("width %p, nodes %a, text %a",width,n_tostring(first,last),n_tosequence(first,last,true))      end      return head  end diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua index 3538b5e34..c7f50b1aa 100644 --- a/tex/context/base/node-tra.lua +++ b/tex/context/base/node-tra.lua @@ -48,10 +48,12 @@ local hpack_node_list = node.hpack  local free_node_list  = node.flush_list  local traverse_nodes  = node.traverse  local traverse_by_id  = node.traverse_id +local count_nodes     = nodes.count  local nodecodes       = nodes.nodecodes  local whatcodes       = nodes.whatcodes  local skipcodes       = nodes.skipcodes +local fillcodes       = nodes.fillcodes  local glyph_code      = nodecodes.glyph  local hlist_code      = nodecodes.hlist @@ -61,6 +63,7 @@ local glue_code       = nodecodes.glue  local kern_code       = nodecodes.kern  local rule_code       = nodecodes.rule  local whatsit_code    = nodecodes.whatsit +local spec_code       = nodecodes.glue_spec  local localpar_code   = whatcodes.localpar  local dir_code        = whatcodes.dir @@ -69,6 +72,9 @@ local nodepool        = nodes.pool  local new_glyph       = nodepool.glyph +local dimenfactors    = number.dimenfactors +local formatters      = string.formatters +  function char_tracers.collect(head,list,tag,n)      local fontdata = fonts.hashes.identifiers      n = n or 0 @@ -121,6 +127,8 @@ function char_tracers.string(t)      return concat(tt,"")  end +local f_unicode = formatters["%U"] +  function char_tracers.unicodes(t,decimal)      local tt = { }      for i=1,#t do @@ -130,7 +138,7 @@ function char_tracers.unicodes(t,decimal)          elseif decimal then              tt[i] = n          else -            tt[i] = format("U+%04X",n) +            tt[i] = f_unicode(n)          end      end      return concat(tt," ") @@ -145,7 +153,7 @@ function char_tracers.indices(t,decimal)          elseif decimal then              tt[i] = n          else -            tt[i] = format("U+%04X",n) +            tt[i] = f_unicode(n)          end      end      return concat(tt," ") @@ -240,12 +248,12 @@ function step_tracers.features()                      -- private                  elseif type(value) == "boolean" then                      if value then -                        t[#t+1] = format("%s=yes",feature) +                        t[#t+1] = formatters["%s=yes"](feature)                      else                          -- skip                      end                  else -                    t[#t+1] = format("%s=%s",feature,value) +                    t[#t+1] = formatters["%s=%s"](feature,value)                  end              end              if #t > 0 then @@ -331,7 +339,7 @@ function step_tracers.register(head)  end  function step_tracers.message(str,...) -    str = format(str,...) +    str = format(str,...) -- maybe: formatters[str](...)      if collecting then          local n = #collection + 1          local m = messages[n] @@ -355,13 +363,13 @@ end  function nodes.handlers.checkglyphs(head,message)      local t = { }      for g in traverse_by_id(glyph_code,head) do -        t[#t+1] = format("U+%04X:%s",g.char,g.subtype) +        t[#t+1] = formatters["%U:%s"](g.char,g.subtype)      end      if #t > 0 then          if message and message ~= "" then -            report_nodes("%s, %s glyphs: %s",message,#t,concat(t," ")) +            report_nodes("%s, %s glyphs: % t",message,#t,t)          else -            report_nodes("%s glyphs: %s",#t,concat(t," ")) +            report_nodes("%s glyphs: % t",#t,t)          end      end      return false @@ -376,10 +384,12 @@ function nodes.handlers.checkforleaks(sparse)      end      node.flush_list(q)      for k, v in next, l do -        write_nl(format("%s * %s", v, k)) +        write_nl(formatters["%s * %s"](v,k))      end  end +local f_sequence = formatters["U+%04X:%s"] +  local function tosequence(start,stop,compact)      if start then          local t = { } @@ -394,7 +404,7 @@ local function tosequence(start,stop,compact)                          t[#t+1] = utfchar(c)                      end                  else -                    t[#t+1] = format("U+%04X:%s",c,utfchar(c)) +                    t[#t+1] = f_sequence(c,utfchar(c))                  end              elseif id == whatsit_code and start.subtype == localpar_code or start.subtype == dir_code then                  t[#t+1] = "[" .. start.dir .. "]" @@ -430,19 +440,7 @@ end  nodes.tosequence = tosequence  function nodes.report(t,done) -    if done then -        if status.output_active then -            report_nodes("output, changed, %s nodes",nodes.count(t)) -        else -            write_nl("nodes","normal, changed, %s nodes",nodes.count(t)) -        end -    else -        if status.output_active then -            report_nodes("output, unchanged, %s nodes",nodes.count(t)) -        else -            write_nl("nodes","normal, unchanged, %s nodes",nodes.count(t)) -        end -    end +    report_nodes("output %a, %changed %a, %s nodes",status.output_active,done,count_nodes(t))  end  function nodes.packlist(head) @@ -463,9 +461,9 @@ function nodes.idstostring(head,tail)              last_n = last_n + 1          else              if last_n > 1 then -                t[#t+1] = format("[%s*%s]",last_n,nodecodes[last_id] or "?") +                t[#t+1] = formatters["[%s*%s]"](last_n,nodecodes[last_id] or "?")              else -                t[#t+1] = format("[%s]",nodecodes[last_id] or "?") +                t[#t+1] = formatters["[%s]"](nodecodes[last_id] or "?")              end              last_id, last_n = id, 1          end @@ -476,47 +474,47 @@ function nodes.idstostring(head,tail)      if not last_id then          t[#t+1] = "no nodes"      elseif last_n > 1 then -        t[#t+1] = format("[%s*%s]",last_n,nodecodes[last_id] or "?") +        t[#t+1] = formatters["[%s*%s]"](last_n,nodecodes[last_id] or "?")      else -        t[#t+1] = format("[%s]",nodecodes[last_id] or "?") +        t[#t+1] = formatters["[%s]"](nodecodes[last_id] or "?")      end      return concat(t," ")  end ---~ function nodes.xidstostring(head,tail) -- only for special tracing of backlinks ---~     local n = head ---~     while n.next do ---~         n = n.next ---~     end ---~     local t, last_id, last_n = { }, nil, 0 ---~     while n do ---~         local id = n.id ---~         if not last_id then ---~             last_id, last_n = id, 1 ---~         elseif last_id == id then ---~             last_n = last_n + 1 ---~         else ---~             if last_n > 1 then ---~                 t[#t+1] = format("[%s*%s]",last_n,nodecodes[last_id] or "?") ---~             else ---~                 t[#t+1] = format("[%s]",nodecodes[last_id] or "?") ---~             end ---~             last_id, last_n = id, 1 ---~         end ---~         if n == head then ---~             break ---~         end ---~         n = n.prev ---~     end ---~     if not last_id then ---~         t[#t+1] = "no nodes" ---~     elseif last_n > 1 then ---~         t[#t+1] = format("[%s*%s]",last_n,nodecodes[last_id] or "?") ---~     else ---~         t[#t+1] = format("[%s]",nodecodes[last_id] or "?") ---~     end ---~     return table.concat(table.reversed(t)," ") ---~ end +-- function nodes.xidstostring(head,tail) -- only for special tracing of backlinks +--     local n = head +--     while n.next do +--         n = n.next +--     end +--     local t, last_id, last_n = { }, nil, 0 +--     while n do +--         local id = n.id +--         if not last_id then +--             last_id, last_n = id, 1 +--         elseif last_id == id then +--             last_n = last_n + 1 +--         else +--             if last_n > 1 then +--                 t[#t+1] = formatters["[%s*%s]"](last_n,nodecodes[last_id] or "?") +--             else +--                 t[#t+1] = formatters["[%s]"](nodecodes[last_id] or "?") +--             end +--             last_id, last_n = id, 1 +--         end +--         if n == head then +--             break +--         end +--         n = n.prev +--     end +--     if not last_id then +--         t[#t+1] = "no nodes" +--     elseif last_n > 1 then +--         t[#t+1] = formatters["[%s*%s]"](last_n,nodecodes[last_id] or "?") +--     else +--         t[#t+1] = formatters["[%s]"](nodecodes[last_id] or "?") +--     end +--     return table.concat(table.reversed(t)," ") +-- end  local function showsimplelist(h,depth,n)      while h do @@ -553,7 +551,7 @@ local function listtoutf(h,joiner,textonly,last)              end          elseif id == disc_code then              local pre, rep, pos = h.pre, h.replace, h.post -            w[#w+1] = format("[%s|%s|%s]", +            w[#w+1] = formatters["[%s|%s|%s]"] (                  pre and listtoutf(pre,joiner,textonly) or "",                  rep and listtoutf(rep,joiner,textonly) or "",                  mid and listtoutf(mid,joiner,textonly) or "" @@ -658,33 +656,127 @@ function nodes.toutf(list,stopcriterium)      return concat(result)  end --- this will move elsewhere - -local ptfactor = number.dimenfactors.pt -local bpfactor = number.dimenfactors.bp +local ptfactor = dimenfactors.pt +local bpfactor = dimenfactors.bp  local stripper = lpeg.patterns.stripzeros +-- start redefinition +-- +-- -- if fmt then +-- --     return formatters[fmt](n*dimenfactors[unit],unit) +-- -- else +-- --     return match(formatters["%.20f"](n*dimenfactors[unit]),"(.-0?)0*$") .. unit +-- -- end +-- +-- redefined: + +local dimenfactors = number.dimenfactors + +local function numbertodimen(d,unit,fmt,strip) +    if not d then +        local str = formatters[fmt](0,unit) +        return strip and lpegmatch(stripper,str) or str +    end +    local t = type(d) +    if t == 'string' then +        return d +    end +    if unit == true then +        unit = "pt" +        fmt  = "%0.5f%s" +    else +        unit = unit or 'pt' +        if not fmt then +            fmt = "%s%s" +        elseif fmt == true then +            fmt = "%0.5f%s" +        end +    end +    if t == "number" then +        local str = formatters[fmt](d*dimenfactors[unit],unit) +        return strip and lpegmatch(stripper,str) or str +    end +    local id = node.id +    if id == kern_code then +        local str = formatters[fmt](d.width*dimenfactors[unit],unit) +        return strip and lpegmatch(stripper,str) or str +    end +    if id == glue_code then +        d = d.spec +    end +    if not d or not d.id == spec_code then +        local str = formatters[fmt](0,unit) +        return strip and lpegmatch(stripper,str) or str +    end +    local width   = d.width +    local plus    = d.stretch_order +    local minus   = d.shrink_order +    local stretch = d.stretch +    local shrink  = d.shrink +    if plus ~= 0 then +        plus = " plus " .. stretch/65536 .. fillcodes[plus] +    elseif stretch ~= 0 then +        plus = formatters[fmt](stretch*dimenfactors[unit],unit) +        plus = " plus " .. (strip and lpegmatch(stripper,plus) or plus) +    else +        plus = "" +    end +    if minus ~= 0 then +        minus = " minus " .. shrink/65536 .. fillcodes[minus] +    elseif shrink ~= 0 then +        minus = formatters[fmt](shrink*dimenfactors[unit],unit) +        minus = " minus " .. (strip and lpegmatch(stripper,minus) or minus) +    else +        minus = "" +    end +    local str = formatters[fmt](d.width*dimenfactors[unit],unit) +    return (strip and lpegmatch(stripper,str) or str) .. plus .. minus +end + +number.todimen = numbertodimen + +function number.topoints      (n,fmt) return numbertodimen(n,"pt",fmt) end +function number.toinches      (n,fmt) return numbertodimen(n,"in",fmt) end +function number.tocentimeters (n,fmt) return numbertodimen(n,"cm",fmt) end +function number.tomillimeters (n,fmt) return numbertodimen(n,"mm",fmt) end +function number.toscaledpoints(n,fmt) return numbertodimen(n,"sp",fmt) end +function number.toscaledpoints(n)     return            n .. "sp"      end +function number.tobasepoints  (n,fmt) return numbertodimen(n,"bp",fmt) end +function number.topicas       (n,fmt) return numbertodimen(n "pc",fmt) end +function number.todidots      (n,fmt) return numbertodimen(n,"dd",fmt) end +function number.tociceros     (n,fmt) return numbertodimen(n,"cc",fmt) end +function number.tonewdidots   (n,fmt) return numbertodimen(n,"nd",fmt) end +function number.tonewciceros  (n,fmt) return numbertodimen(n,"nc",fmt) end + +-- stop redefinition +  local points = function(n)      if not n or n == 0 then          return "0pt" +    elseif type(n) == "number" then +        return lpegmatch(stripper,format("%.5fpt",n*ptfactor)) -- faster than formatter      else -        return lpegmatch(stripper,format("%.5fpt",n*ptfactor)) +        return numbertodimen(n,"pt",true,true) -- also deals with nodes      end  end  local basepoints = function(n)      if not n or n == 0 then          return "0bp" +    elseif type(n) == "number" then +        return lpegmatch(stripper,format("%.5fbp",n*bpfactor)) -- faster than formatter      else -        return lpegmatch(stripper,format("%.5fbp",n*bpfactor)) +        return numbertodimen(n,"bp",true,true) -- also deals with nodes      end  end  local pts = function(n)      if not n or n == 0 then          return "0pt" +    elseif type(n) == "number" then +        return format("%.5fpt",n*ptfactor) -- faster than formatter      else -        return format("%.5fpt",n*ptfactor) +        return numbertodimen(n,"pt",true) -- also deals with nodes      end  end @@ -692,7 +784,7 @@ local nopts = function(n)      if not n or n == 0 then          return "0"      else -        return format("%.5f",n*ptfactor) +        return format("%.5f",n*ptfactor) -- faster than formatter      end  end @@ -701,14 +793,6 @@ number.basepoints = basepoints  number.pts        = pts  number.nopts      = nopts ---~ function nodes.thespec(s) ---~     local stretch_order = s.stretch_order ---~     local shrink_order = s.shrink_order ---~     local stretch_unit = (stretch_order ~= 0) and ("fi".. string.rep("l",stretch_order)) or "sp" ---~     local shrink_unit = (shrink_order ~= 0) and ("fi".. string.rep("l",shrink_order)) or "sp" ---~     return string.format("%ssp+ %ssp - %ssp",s.width,s.stretch,stretch_unit,s.shrink,shrink_unit) ---~ end -  local colors   = { }  tracers.colors = colors diff --git a/tex/context/base/node-tsk.lua b/tex/context/base/node-tsk.lua index ccaa6c6b4..596ac765a 100644 --- a/tex/context/base/node-tsk.lua +++ b/tex/context/base/node-tsk.lua @@ -60,7 +60,7 @@ end  local function valid(name)      local data = tasksdata[name]      if not data then -        report_tasks("unknown task %s",name) +        report_tasks("unknown task %a",name)      else          return data      end @@ -69,17 +69,17 @@ end  local function validgroup(name,group,what)      local data = tasksdata[name]      if not data then -        report_tasks("unknown task %s",name) +        report_tasks("unknown task %a",name)      else          local frozen = data.frozen[group]          if frozen then              if frozengroup == "no" then                  -- default              elseif frozengroup == "strict" then -                report_tasks("warning: group %s of task %s is frozen, %s applied but not supported",group,name,what) +                report_tasks("warning: group %a of task %a is frozen, %a applied but not supported",group,name,what)                  return              else -- if frozengroup == "tolerant" then -                report_tasks("warning: group %s of task %s is frozen, %s ignored",group,name,what) +                report_tasks("warning: group %a of task %a is frozen, %a ignored",group,name,what)              end          end          return data @@ -159,7 +159,7 @@ end  function tasks.showactions(name,group,action,where,kind)      local data = valid(name)      if data then -        report_tasks("task %s, list:\n%s",name,nodeprocessor(data.list)) +        report_tasks("task %a, list:\n%s",name,nodeprocessor(data.list))      end  end @@ -189,7 +189,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)                  if not runner then                      created = created + 1                      if trace_tasks then -                        report_tasks("creating runner '%s'",name) +                        report_tasks("creating runner %a",name)                      end                      runner = compile(data.list,data.processor,0)                      data.runner = runner @@ -203,7 +203,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)                  if not runner then                      created = created + 1                      if trace_tasks then -                        report_tasks("creating runner '%s' with 1 extra arguments",name) +                        report_tasks("creating runner %a with %s extra arguments",name,1)                      end                      runner = compile(data.list,data.processor,1)                      data.runner = runner @@ -217,7 +217,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)                  if not runner then                      created = created + 1                      if trace_tasks then -                        report_tasks("creating runner '%s' with 2 extra arguments",name) +                        report_tasks("creating runner %a with %s extra arguments",name,2)                      end                      runner = compile(data.list,data.processor,2)                      data.runner = runner @@ -231,7 +231,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)                  if not runner then                      created = created + 1                      if trace_tasks then -                        report_tasks("creating runner '%s' with 3 extra arguments",name) +                        report_tasks("creating runner %a with %s extra arguments",name,3)                      end                      runner = compile(data.list,data.processor,3)                      data.runner = runner @@ -245,7 +245,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)                  if not runner then                      created = created + 1                      if trace_tasks then -                        report_tasks("creating runner '%s' with 4 extra arguments",name) +                        report_tasks("creating runner %a with %s extra arguments",name,4)                      end                      runner = compile(data.list,data.processor,4)                      data.runner = runner @@ -259,7 +259,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)                  if not runner then                      created = created + 1                      if trace_tasks then -                        report_tasks("creating runner '%s' with 5 extra arguments",name) +                        report_tasks("creating runner %a with %s extra arguments",name,5)                      end                      runner = compile(data.list,data.processor,5)                      data.runner = runner @@ -273,7 +273,7 @@ function tasks.actions(name) -- we optimize for the number or arguments (no ...)                  if not runner then                      created = created + 1                      if trace_tasks then -                        report_tasks("creating runner '%s' with n extra arguments",name) +                        report_tasks("creating runner %a with %s extra arguments",name,n)                      end                      runner = compile(data.list,data.processor,"n")                      data.runner = runner diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 6bcc4da7f..7b040a400 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -1014,13 +1014,20 @@     \else       \d_framed_linewidth\zeropoint     \fi -\forgetall +   % 2013/03/12: a change of order (sizes before align +   \ifx\localwidth\v!local +     \setlocalhsize +   \fi +   % +   \forgetall % should happen after \localwidth but before align +   %     \ifx\localformat\empty       \setfalse\c_framed_has_format     \else       \settrue\c_framed_has_format       \dosetraggedcommand\localformat % not that fast     \fi +   %     \csname\??framedoffsetalternative       \ifcsname\??framedoffsetalternative\localoffset\endcsname         \localoffset @@ -1197,7 +1204,7 @@  \setvalue{\??framedwidthalternative\v!local}%    {\settrue\c_framed_has_width -   \setlocalhsize +   %\setlocalhsize     \d_framed_width\localhsize}  \setvalue{\??framedwidthalternative\s!unknown}% diff --git a/tex/context/base/page-flt.lua b/tex/context/base/page-flt.lua index c383380fb..68383f175 100644 --- a/tex/context/base/page-flt.lua +++ b/tex/context/base/page-flt.lua @@ -112,12 +112,12 @@ function floats.save(which,data)          insert(stack,t)          setcount("global","savednoffloats",#stacks[default])          if trace_floats then -            report_floats("saving %s float %s in slot %s (%i,%i,%i)",which,noffloats,#stack,w,h,d) +            report_floats("%s, category %a, number %a, slot %a, width %p, height %p, depth %p","saving",which,noffloats,#stack,w,h,d)          else              interfaces.showmessage("floatblocks",2,noffloats)          end      else -        report_floats("unable to save %s float %s (empty)",which,noffloats) +        report_floats("ignoring empty, category %a, number %a",which,noffloats)      end  end @@ -132,7 +132,7 @@ function floats.resave(which)          insert(stack,1,last)          setcount("global","savednoffloats",#stacks[default])          if trace_floats then -            report_floats("resaving %s float %s in slot %s (%i,%i,%i)",which,noffloats,#stack,w,h,d) +            report_floats("%s, category %a, number %a, slot %a width %p, height %p, depth %p","resaving",which,noffloats,#stack,w,h,d)          else              interfaces.showmessage("floatblocks",2,noffloats)          end @@ -148,7 +148,7 @@ function floats.flush(which,n,bylabel)      if t then          local w, h, d = setdimensions(b)          if trace_floats then -            report_floats("flushing %s float %s from slot %s (%i,%i,%i)",which,t.n,n,w,h,d) +            report_floats("%s, category %a, number %a, slot %a width %p, height %p, depth %p","flushing",which,t.n,n,w,h,d)          else              interfaces.showmessage("floatblocks",3,t.n)          end @@ -168,7 +168,7 @@ function floats.consult(which,n)      if t then          local w, h, d = setdimensions(b)          if trace_floats then -            report_floats("consulting %s float %s in slot %s (%i,%i,%i)",which,t.n,n,w,h,d) +            report_floats("%s, category %a, number %a, slot %a width %p, height %p, depth %p","consulting",which,t.n,n,w,h,d)          end          return t, b, n      else diff --git a/tex/context/base/page-lin.lua b/tex/context/base/page-lin.lua index 76afc6c35..e6b500e8b 100644 --- a/tex/context/base/page-lin.lua +++ b/tex/context/base/page-lin.lua @@ -128,7 +128,7 @@ function boxed.register(configuration)      last = last + 1      data[last] = configuration      if trace_numbers then -        report_lines("registering setup %s",last) +        report_lines("registering setup %a",last)      end      return last  end @@ -141,14 +141,14 @@ function boxed.setup(n,configuration)      local d = data[n]      if d then          if trace_numbers then -            report_lines("updating setup %s",n) +            report_lines("updating setup %a",n)          end          for k,v in next, configuration do              d[k] = v          end      else          if trace_numbers then -            report_lines("registering setup %s (br)",n) +            report_lines("registering setup %a (br)",n)          end          data[n] = configuration      end @@ -165,17 +165,17 @@ local function check_number(n,a,skip,sameline)          if sameline then              skipflag = 0              if trace_numbers then -                report_lines("skipping broken line number %s for setup %s: %s (%s)",#current_list,a,s,d.continue or "no") +                report_lines("skipping broken line number %s for setup %a: %s (%s)",#current_list,a,s,d.continue or "no")              end          elseif not skip and s % d.step == 0 then              skipflag, d.start = 1, s + 1 -- (d.step or 1)              if trace_numbers then -                report_lines("making number %s for setup %s: %s (%s)",#current_list,a,s,d.continue or "no") +                report_lines("making number %s for setup %a: %s (%s)",#current_list,a,s,d.continue or "no")              end          else              skipflag, d.start = 0, s + 1 -- (d.step or 1)              if trace_numbers then -                report_lines("skipping line number %s for setup %s: %s (%s)",#current_list,a,s,d.continue or "no") +                report_lines("skipping line number %s for setup %a: %s (%s)",#current_list,a,s,d.continue or "no")              end          end          context.makelinenumber(tag,skipflag,s,n.shift,n.width,leftmarginwidth(n.list),n.dir) diff --git a/tex/context/base/page-mix.lua b/tex/context/base/page-mix.lua index be87b79a7..f63989dd8 100644 --- a/tex/context/base/page-mix.lua +++ b/tex/context/base/page-mix.lua @@ -213,8 +213,8 @@ local function setsplit(specification) -- a rather large function          target = maxheight - preheight      end      if trace_state then -        report_state("cycle: %s, maxheight: %s, preheight: %s, target: %s, overflow: %s, extra: %s", -            cycle, points(maxheight),points(preheight),points(target),tostring(overflow),points(extra)) +        report_state("cycle %s, maxheight %p, preheight %p, target %p, overflow %a, extra %p", +            cycle, maxheight, preheight , target, overflow, extra)      end      local results = { }      for i=1,nofcolumns do @@ -284,8 +284,8 @@ return false                  state = "same"              end              if trace_detail then -                report_state("check  > column %s, advance: %s, total: %s, target: %s => %s (height: %s, depth: %s, skip: %s)", -                    currentcolumn,points(advance),points(total),points(target),state,points(height),points(depth),points(skip)) +                report_state("check  > column %s, advance %p, total %p, target %p => %a (height %p, depth %p, skip %p)", +                    currentcolumn,advance,total,target,state,height,depth,skip)              end              return state          else @@ -315,8 +315,8 @@ return false              end              local state = checked(advance+inserttotal+currentskips)              if trace_state then -                report_state('line   > column %s, advance: %s, insert: %s, height: %s, state: %s', -                    column,points(advance),points(inserttotal),points(height),state) +                report_state('line   > column %s, advance %p, insert %p, height %p, state %a', +                    column,advance,inserttotal,height,state)              end              if state == "quit" then                  break @@ -338,8 +338,8 @@ return false              if advance ~= 0 then                  local state = checked(advance)                  if trace_state then -                    report_state('glue   > column %s, advance: %s, height: %s, state: %s', -                        column,points(advance),points(height),state) +                    report_state('glue   > column %s, advance %p, height %p, state %a', +                        column,advance,height,state)                  end                  if state == "quit" then                      break @@ -353,8 +353,8 @@ return false              if advance ~= 0 then                  local state = checked(advance)                  if trace_state then -                    report_state('kern   > column %s, advance: %s, height: %s, state: %s', -                        column,points(advance),points(height),state) +                    report_state('kern   > column %s, advance %p, height %p, state %a', +                        column,advance,height,state)                  end                  if state == "quit" then                      break @@ -477,7 +477,7 @@ local function report_deltas(result,str)      for i=1,result.nofcolumns do          t[#t+1] = points(result.results[i].delta or 0)      end -    report_state("%s, cycles: %s, deltas: %s",str,result.cycle or 1,concat(t," | ")) +    report_state("%s, cycles %s, deltas % | t",str,result.cycle or 1,t)  end  function mixedcolumns.setsplit(specification) @@ -500,8 +500,8 @@ function mixedcolumns.setsplit(specification)                  specification.extra = cycle * step                  result = setsplit(specification) or result                  if trace_state then -                    report_state("cycle: %s.%s, original height: %s, total height: %s", -                        splitruns,cycle,points(result.originalheight),points(result.nofcolumns*result.targetheight)) +                    report_state("cycle: %s.%s, original height %p, total height %p", +                        splitruns,cycle,result.originalheight,result.nofcolumns*result.targetheight)                  end                  cycle = cycle + 1                  specification.cycle = cycle @@ -525,12 +525,12 @@ local baselineskip_code = gluecodes.baselineskip  function mixedcolumns.getsplit(result,n)      if not result then -        report_state("flush, column: %s, no result",n) +        report_state("flush, column %s, no result",n)          return      end      local r = result.results[n]      if not r then -        report_state("flush, column: %s, empty",n) +        report_state("flush, column %s, empty",n)      end      local h = r.head      if not h then @@ -540,9 +540,9 @@ function mixedcolumns.getsplit(result,n)      if trace_state then          local id = h.id          if id == hlist_code then -            report_state("flush, column: %s, top line: %s",n,nodes.toutf(h.list)) +            report_state("flush, column %s, top line: %s",n,nodes.toutf(h.list))          else -            report_state("flush, column: %s, head node: %s",n,nodecodes[id]) +            report_state("flush, column %s, head node: %s",n,nodecodes[id])          end      end diff --git a/tex/context/base/page-str.lua b/tex/context/base/page-str.lua index 48edd4cfe..f6314657f 100644 --- a/tex/context/base/page-str.lua +++ b/tex/context/base/page-str.lua @@ -74,7 +74,7 @@ function streams.collect(head,where)              dana[1] = head          end          if trace_collecting then -            report_streams("appending snippet '%s' to slot %s",name,#dana) +            report_streams("appending snippet %a to slot %s",name,#dana)          end          return nil, true      else @@ -91,7 +91,7 @@ function streams.push(thename)          if dana then              dana[#dana+1] = false              if trace_collecting then -                report_streams("pushing snippet '%s'",thename) +                report_streams("pushing snippet %a",thename)              end          end      end @@ -105,7 +105,7 @@ function streams.flush(name,copy) -- problem: we need to migrate afterwards              -- nothing to flush          elseif copy then              if trace_flushing then -                report_streams("flushing copies of %s slots of '%s'",dn,name) +                report_streams("flushing copies of %s slots of %a",dn,name)              end              for i=1,dn do                  local di = dana[i] @@ -118,7 +118,7 @@ function streams.flush(name,copy) -- problem: we need to migrate afterwards              end          else              if trace_flushing then -                report_streams("flushing %s slots of '%s'",dn,name) +                report_streams("flushing %s slots of %a",dn,name)              end              for i=1,dn do                  local di = dana[i] @@ -137,7 +137,7 @@ function streams.synchronize(list) -- this is an experiment !      list = settings_to_array(list)      local max = 0      if trace_flushing then -        report_streams("synchronizing list: %s",concat(list," ")) +        report_streams("synchronizing list: % t",list)      end      for i=1,#list do          local dana = data[list[i]] @@ -168,12 +168,12 @@ function streams.synchronize(list) -- this is an experiment !                  end                  dana[m] = vbox                  if trace_flushing then -                    report_streams("slot %s of '%s' is packed to height %s and depth %s",m,name,ht,dp) +                    report_streams("slot %s of %a is packed to height %p and depth %p",m,name,ht,dp)                  end              end          end          if trace_flushing then -            report_streams("slot %s has max height %s and max depth %s",m,height,depth) +            report_streams("slot %s has max height %p and max depth %p",m,height,depth)          end          local strutht, strutdp = texdimen.globalbodyfontstrutheight, texdimen.globalbodyfontstrutdepth          local struthtdp = strutht + strutdp @@ -189,7 +189,7 @@ function streams.synchronize(list) -- this is an experiment !                          -- actually we need to add glue and repack                          vbox.height, vbox.depth = height, depth                          if trace_flushing then -                            report_streams("slot %s of '%s' with delta (%s,%s) is compensated",m,i,delta_height,delta_depth) +                            report_streams("slot %s of %a with delta (%p,%p) is compensated",m,i,delta_height,delta_depth)                          end                      else                          -- this is not yet ok as we also need to keep an eye on vertical spacing @@ -210,7 +210,7 @@ function streams.synchronize(list) -- this is an experiment !                          vbox.list = nil                          free_node(vbox)                          if trace_flushing then -                            report_streams("slot %s:%s with delta (%s,%s) is compensated by %s lines",m,i,delta_height,delta_depth,n) +                            report_streams("slot %s:%s with delta (%p,%p) is compensated by %s lines",m,i,delta_height,delta_depth,n)                          end                      end                  end diff --git a/tex/context/base/phys-dim.lua b/tex/context/base/phys-dim.lua index ee5298c96..7b263036f 100644 --- a/tex/context/base/phys-dim.lua +++ b/tex/context/base/phys-dim.lua @@ -646,7 +646,7 @@ labels.suffixes = allocate {  local function dimpus(p,u,s)      if trace_units then -        report_units("p: [%s], u: [%s], s: [%s]",p or "?",u or "?",s or "?") +        report_units("prefix %a, unit %a, suffix %a",p,u,s)      end    --      if p ~= "" then          if u ~= ""  then @@ -683,7 +683,7 @@ end  local function dimop(o)      if trace_units then -        report_units("o: [%s]",o or "?") +        report_units("operator %a",o)      end      if o then          unitsO(o) @@ -692,7 +692,7 @@ end  local function dimsym(s)      if trace_units then -        report_units("s: [%s]",s or "?") +        report_units("symbol %a",s)      end      s = symbol_units[s] or s      if s then @@ -702,7 +702,7 @@ end  local function dimpre(p)      if trace_units then -        report_units("p: [%s]",p or "?") +        report_units("prefix [%a",p)      end      p = packaged_units[p] or p      if p then diff --git a/tex/context/base/regi-ini.lua b/tex/context/base/regi-ini.lua index f7fb20efe..d5d278b16 100644 --- a/tex/context/base/regi-ini.lua +++ b/tex/context/base/regi-ini.lua @@ -111,10 +111,10 @@ local function loadregime(mapping,regime)          for eightbit, unicode in next, data do              vector[char(eightbit)] = utfchar(unicode)          end -        report_loading("vector '%s' is loaded",regime) +        report_loading("vector %a is loaded",regime)      else          vector = false -        report_loading("vector '%s' is unknown",regime) +        report_loading("vector %a is unknown",regime)      end      mapping[regime] = vector      return vector @@ -227,14 +227,14 @@ end  local function push()      level = level + 1      if trace_translating then -        report_translating("pushing level: %s",level) +        report_translating("pushing level %s",level)      end  end  local function pop()      if level > 0 then          if trace_translating then -            report_translating("popping level: %s",level) +            report_translating("popping level %s",level)          end          level = level - 1      end @@ -263,7 +263,7 @@ local stack = { }  function commands.startregime(regime)      insert(stack,currentregime)      if trace_translating then -        report_translating("start: '%s'",regime) +        report_translating("start using %a",regime)      end      enable(regime)  end @@ -272,7 +272,7 @@ function commands.stopregime()      if #stack > 0 then          local regime = remove(stack)          if trace_translating then -            report_translating("stop: '%s'",regime) +            report_translating("stop using %a",regime)          end          enable(regime)      end diff --git a/tex/context/base/s-fonts-tables.lua b/tex/context/base/s-fonts-tables.lua index dcf189f32..3cf1286a7 100644 --- a/tex/context/base/s-fonts-tables.lua +++ b/tex/context/base/s-fonts-tables.lua @@ -121,7 +121,7 @@ local function typesettable(t,keys,synonyms,nesting,prefix)                  elseif v == "basepoints" then                      context("%sbp",tk)                  elseif v == "scaledpoints" then -                    context(number.points(tk)) +                    context("%p",tk)                  elseif v == "table" then                      context("<table>")                  else -- if v == "integerscale" then diff --git a/tex/context/base/s-inf-01.mkvi b/tex/context/base/s-inf-01.mkvi index b3f44e908..9d624c168 100644 --- a/tex/context/base/s-inf-01.mkvi +++ b/tex/context/base/s-inf-01.mkvi @@ -22,6 +22,8 @@  %D context auto:s-inf-01 --basepath=t:/texmf/tex/context/base  %D \stoptyping +% \enabletrackers[context.*] +  \startluacode      local format, gsub, find, match = string.format, string.gsub, string.find, string.match @@ -48,7 +50,8 @@          local path = document.arguments.basepath or file.dirname(resolvers.find_file("context.mkiv"),".")          local pattern = path .. "/*." .. suffix .. "$" -- avoid bla.tex~          local texfiles = dir.glob(pattern) -        for _, name in ipairs(texfiles) do +        for i=1,#texfiles do +            local name = texfiles[i]              local base = file.basename(name)              for p=1,#patterns do                  local category = match(base,patterns[p]) @@ -98,12 +101,12 @@          if next(list) then              -- already loaded          else -            for k, v in ipairs(types) do -                collect(list,v,k) +            for i=1,#types do +                collect(list,types[i],i)              end -            for category, _ in pairs(list) do +            for category in next, list do                  pattern ="{"..category.."%-" -                for suffix, t in pairs(used) do +                for suffix, t in next, used do                      local data = io.loaddata(resolvers.find_file("context."..suffix))                      if data and find(data,pattern) then                          t[category] = true @@ -124,21 +127,21 @@          context.NC()          context(category)          context.NC() -        for i, t in ipairs(types) do +        for i=1,#types do              local n, m = 0, 0 -            for k, v in pairs(list) do +            for k, v in next, list do                  local nn, mm = what[k][i], what[k][i+5]                  n = n + nn                  m = m + (mm or nn)              end -            context.Top(t,norm(max),n,m) +            context.Top(types[i],norm(max),n,m)              context.NC()          end          context.NC()          context.NR()          context.HL()          for k, v in table.sortedpairs(what) do -            local c = (what == size and comp[k]) or nope +            local c = what == size and comp[k] or nope              context.NC()              context("%s~%s~~%s~~%s",                  (used.mkii[k] and "ii") or "~~", @@ -147,8 +150,8 @@                  k              )              context.NC() -            for i, t in ipairs(types) do -                context.Bar(t,v[i],c[i],norm(v[i])) +            for i=1,#types do +                context.Bar(types[i],v[i],c[i],norm(v[i]))                  context.NC()              end              context.NR() @@ -161,8 +164,8 @@          for k, v in table.sortedpairs(what) do              local c = (what == size and comp[k]) or nope              context.StartUp(k) -            for i, t in ipairs(types) do -                context.Up(t,norm(v[i])) +            for i=1,#types do +                context.Up(types[i],norm(v[i]))              end              context.StopUp()          end diff --git a/tex/context/base/scrn-wid.lua b/tex/context/base/scrn-wid.lua index 14d58a29a..4ad46761e 100644 --- a/tex/context/base/scrn-wid.lua +++ b/tex/context/base/scrn-wid.lua @@ -75,7 +75,7 @@ function attachments.register(specification) -- beware of tag/registered mixup(t      checkbuffer(specification)      attachments[registered] = specification      if trace_attachments then -        report_attachments("registering '%s'",registered) +        report_attachments("registering %a",registered)      end      return specification  end @@ -85,7 +85,7 @@ function attachments.insert(specification)      local r = attachments[registered]      if r then          if trace_attachments then -            report_attachments("including registered '%s'",registered) +            report_attachments("including registered %a",registered)          end          for k, v in next, r do              local s = specification[k] @@ -94,7 +94,7 @@ function attachments.insert(specification)              end          end      elseif trace_attachments then -        report_attachments("including unregistered '%s'",registered) +        report_attachments("including unregistered %a",registered)      end      checkbuffer(specification)      return nodeinjections.attachfile(specification) diff --git a/tex/context/base/scrp-cjk.lua b/tex/context/base/scrp-cjk.lua index c44f42e9c..5885c9867 100644 --- a/tex/context/base/scrp-cjk.lua +++ b/tex/context/base/scrp-cjk.lua @@ -82,14 +82,14 @@ local function trace_detail(current,what)          local c_ch = current.char          if p_id == glyph_code then              local p_ch = p_id and prev.char -            report_details("[U+%05X %s %s] [%s] [U+%05X %s %s]",p_ch,utfchar(p_ch),hash[p_ch] or "unknown",what,c_ch,utfchar(c_ch),hash[c_ch] or "unknown") +            report_details("[%C %a] [%s] [%C %a]",p_ch,hash[p_ch],what,c_ch,hash[c_ch])          else -            report_details("[%s] [U+%05X %s %s]",what,c_ch,utfchar(c_ch),hash[c_ch] or "unknown") +            report_details("[%s] [%C %a]",what,c_ch,hash[c_ch])          end      else          if p_id == glyph_code then              local p_ch = p_id and prev.char -            report_details("[U+%05X %s %s] [%s]",p_ch,utfchar(p_ch),hash[p_ch] or "unknown",what) +            report_details("[%C %a] [%s]",p_ch,hash[p_ch],what)          else              report_details("[%s]",what)          end diff --git a/tex/context/base/scrp-ini.lua b/tex/context/base/scrp-ini.lua index e75a32dd2..b8f5d52d0 100644 --- a/tex/context/base/scrp-ini.lua +++ b/tex/context/base/scrp-ini.lua @@ -217,7 +217,7 @@ function scripts.installmethod(handler)      local attributes = { }      local datasets = handler.datasets      if not datasets or not datasets.default then -        report_preprocessing("missing (default) dataset in script '%s'",name) +        report_preprocessing("missing (default) dataset in script %a",name)          datasets.default = { } -- slower but an error anyway      end      for k, v in next, datasets do @@ -257,7 +257,7 @@ function scripts.installdataset(specification) -- global overload                          if p then                              defaultset = p                          else -                            report_preprocessing("dataset, unknown parent '%s' for method '%s'",parent,method) +                            report_preprocessing("dataset, unknown parent %a for method %a",parent,method)                          end                      end                      setmetatable(dataset,defaultset) @@ -270,13 +270,13 @@ function scripts.installdataset(specification) -- global overload                          datasets[name] = dataset                      end                  else -                    report_preprocessing("dataset, no default for method '%s'",method) +                    report_preprocessing("dataset, no default for method %a",method)                  end              else -                report_preprocessing("dataset, no datasets for method '%s'",method) +                report_preprocessing("dataset, no datasets for method %a",method)              end          else -            report_preprocessing("dataset, no method '%s'",method) +            report_preprocessing("dataset, no method %a",method)          end      else          report_preprocessing("dataset, invalid specification") -- maybe report table @@ -430,9 +430,9 @@ function scripts.preprocess(head)                              else                                  last = start                              end -                        --    if cjk == "chinese" or cjk == "korean" then -- we need to prevent too much ( ) processing +                         -- if cjk == "chinese" or cjk == "korean" then -- we need to prevent too much ( ) processing                                  ok = true -                        --    end +                         -- end                          elseif first then                              if ok then                                  if trace_analyzing then @@ -548,7 +548,7 @@ function autofontfeature.handler(head)                          attr = mergecontext(dynamic,name,what)                          slot[script] = attr                          if trace_scripts then -                            report_scripts("script: %s, trigger 0x%05X (%s), dynamic: %s (extended)",script,char,utfchar(char),attr) +                            report_scripts("script: %s, trigger %C, dynamic: %a, variant: %a",script,char,attr,"extended")                          end                      end                      if attr ~= 0 then @@ -562,7 +562,7 @@ function autofontfeature.handler(head)                          attr = registercontext(font,script,2)                          slot[script] = attr                          if trace_scripts then -                            report_scripts("script: %s, trigger 0x%05X (%s), dynamic: %s",script,char,utfchar(char),attr) +                            report_scripts("script: %s, trigger %C, dynamic: %s, variant: %a",script,char,attr,"normal")                          end                      end                      if attr ~= 0 then diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index 99eebf0a2..1d8ac630f 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -167,12 +167,12 @@ local function preparetables(data)              local n, nn              if k then                  if trace_tests then -                    report_sorters("simplifing character 0x%04X %s",utfbyte(k),k) +                    report_sorters("simplifing character %C",k)                  end                  local l = lower[k] or lcchars[k]                  if l then                      if trace_tests then -                        report_sorters(" 1 lower: %s",l) +                        report_sorters(" 1 lower: %C",l)                      end                      local ml = rawget(t,l)                      if ml then @@ -183,7 +183,7 @@ local function preparetables(data)                              n[nn] = ml[i] + (t.__delta or 0)                          end                          if trace_tests then -                            report_sorters(" 2 order: %s",concat(n," ")) +                            report_sorters(" 2 order: % t",n)                          end                      end                  end @@ -191,7 +191,7 @@ local function preparetables(data)                      local s = shchars[k] -- maybe all components?                      if s and s ~= k then                          if trace_tests then -                            report_sorters(" 3 shape: %s",s) +                            report_sorters(" 3 shape: %C",s)                          end                          n = { }                          nn = 0 @@ -199,7 +199,7 @@ local function preparetables(data)                              local ml = rawget(t,l)                              if ml then                                  if trace_tests then -                                    report_sorters(" 4 keep: %s",l) +                                    report_sorters(" 4 keep: %C",l)                                  end                                  if ml then                                      for i=1,#ml do @@ -211,7 +211,7 @@ local function preparetables(data)                                  l = lower[l] or lcchars[l]                                  if l then                                      if trace_tests then -                                        report_sorters(" 5 lower: %s",l) +                                        report_sorters(" 5 lower: %C",l)                                      end                                      local ml = rawget(t,l)                                      if ml then @@ -223,32 +223,34 @@ local function preparetables(data)                                  end                              end                          end -                    else -- we probably never enter this branch -                        -- fschars returns a single char ---~                         s = fschars[k] ---~                         if s and s ~= k then ---~                             if trace_tests then ---~                                 report_sorters(" 6 split: %s",s) ---~                             end ---~                             local ml = rawget(t,s) ---~                             if ml then ---~                                 n = { } ---~                                 nn = 0 ---~                                 for i=1,#ml do ---~                                     nn = nn + 1 ---~                                     n[nn] = ml[i] ---~                                 end ---~                             end ---~                         end +                    else +                     -- -- we probably never enter this branch +                     -- -- fschars returns a single char +                     -- +                     -- s = fschars[k] +                     -- if s and s ~= k then +                     --     if trace_tests then +                     --         report_sorters(" 6 split: %s",s) +                     --     end +                     --     local ml = rawget(t,s) +                     --     if ml then +                     --         n = { } +                     --         nn = 0 +                     --         for i=1,#ml do +                     --             nn = nn + 1 +                     --             n[nn] = ml[i] +                     --         end +                     --     end +                     -- end                          local b = utfbyte(k)                          n = decomposed[b] or { b }                          if trace_tests then -                            report_sorters(" 6 split: %s",utf.tostring(b)) +                            report_sorters(" 6 split: %s",utf.tostring(b)) -- todo                          end                      end                      if n then                          if trace_tests then -                            report_sorters(" 7 order: %s",concat(n," ")) +                            report_sorters(" 7 order: % t",n)                          end                      else                          n = noorder @@ -300,7 +302,7 @@ local function setlanguage(l,m,d,u)      method    = (m ~= "" and m) or data.method    or constants.defaultmethod      digits    = (d ~= "" and d) or data.digits    or constants.defaultdigits      if trace_tests then -        report_sorters("setting language '%s', method '%s', digits '%s'",language,method,digits) +        report_sorters("setting language %a, method %a, digits %a",language,method,digits)      end      replacements = data.replacements      entries      = data.entries @@ -326,12 +328,12 @@ local function setlanguage(l,m,d,u)              nofsequence = nofsequence + 1              sequence[nofsequence] = s          else -            report_sorters("invalid sorter method '%s' in '%s'",s,method) +            report_sorters("invalid sorter method %a in %a",s,method)          end      end      data.sequence = sequence      if trace_tests then -        report_sorters("using sort sequence: %s",concat(sequence," ")) +        report_sorters("using sort sequence: % t",sequence)      end      --      return data @@ -349,94 +351,6 @@ end  -- tricky: { 0, 0, 0 } vs { 0, 0, 0, 0 } => longer wins and mm, pm, zm can have them ---~ local function basicsort(sort_a,sort_b) -- todo: local # ---~     if not sort_a or not sort_b then ---~         return 0 ---~     elseif #sort_a > #sort_b then ---~         if #sort_b == 0 then ---~             return 1 ---~         else ---~             for i=1,#sort_b do ---~                 local ai, bi = sort_a[i], sort_b[i] ---~                 if ai > bi then ---~                     return  1 ---~                 elseif ai < bi then ---~                     return -1 ---~                 end ---~             end ---~             return 1 ---~         end ---~     elseif #sort_a < #sort_b then ---~         if #sort_a == 0 then ---~             return -1 ---~         else ---~             for i=1,#sort_a do ---~                 local ai, bi = sort_a[i], sort_b[i] ---~                 if ai > bi then ---~                     return  1 ---~                 elseif ai < bi then ---~                     return -1 ---~                 end ---~             end ---~             return -1 ---~         end ---~     elseif #sort_a == 0 then ---~         return 0 ---~     else ---~         for i=1,#sort_a do ---~             local ai, bi = sort_a[i], sort_b[i] ---~             if ai > bi then ---~                 return  1 ---~             elseif ai < bi then ---~                 return -1 ---~             end ---~         end ---~         return 0 ---~     end ---~ end - ---~ function comparers.basic(a,b) -- trace ea and eb ---~     local ea, eb = a.split, b.split ---~     local na, nb = #ea, #eb ---~     if na == 0 and nb == 0 then ---~         -- simple variant (single word) ---~         local result = 0 ---~         for j=1,#sequence do ---~             local m = sequence[j] ---~             result = basicsort(ea[m],eb[m]) ---~             if result ~= 0 then ---~                 return result ---~             end ---~         end ---~         return result ---~     else ---~         -- complex variant, used in register (multiple words) ---~         local result = 0 ---~         for i=1,nb < na and nb or na do ---~             local eai, ebi = ea[i], eb[i] ---~             for j=1,#sequence do ---~                 local m = sequence[j] ---~                 result = basicsort(eai[m],ebi[m]) ---~                 if result ~= 0 then ---~                     return result ---~                 end ---~             end ---~             if result ~= 0 then ---~                 return result ---~             end ---~         end ---~         if result ~= 0 then ---~             return result ---~         elseif na > nb then ---~             return 1 ---~         elseif nb > na then ---~             return -1 ---~         else ---~             return 0 ---~         end ---~     end ---~ end -  local function basicsort(sort_a,sort_b)      if sort_a and sort_b then          local na = #sort_a @@ -526,7 +440,7 @@ end  function sorters.strip(str) -- todo: only letters and such      if str and str ~= "" then -        -- todo: make a lpeg +        -- todo: make a decent lpeg          str = gsub(str,"\\[\"\'~^`]*","") -- \"e -- hm, too greedy          str = gsub(str,"\\%S*","") -- the rest          str = gsub(str,"%s","\001") -- can be option @@ -615,12 +529,12 @@ function splitters.utf(str) -- we could append m and u but this is cleaner, s is                  p_case[n] = l              end              char[n], byte[n] = sc, b -local fs = fscodes[b] or b +            local fs = fscodes[b] or b              local msc = m_mappings[sc]              if msc ~= noorder then -if not msc then -    msc = m_mappings[fs] -end +                if not msc then +                    msc = m_mappings[fs] +                end                  for i=1,#msc do                      nm = nm + 1                      m_mapping[nm] = msc[i] @@ -628,9 +542,9 @@ end              end              local zsc = z_mappings[sc]              if zsc ~= noorder then -if not zsc then -    zsc = z_mappings[fs] -end +                if not zsc then +                    zsc = z_mappings[fs] +                end                  for i=1,#zsc do                      nz = nz + 1                      z_mapping[nz] = zsc[i] @@ -638,9 +552,9 @@ end              end              local psc = p_mappings[sc]              if psc ~= noorder then -if not psc then -    psc = p_mappings[fs] -end +                if not psc then +                    psc = p_mappings[fs] +                end                  for i=1,#psc do                      np = np + 1                      p_mapping[np] = psc[i] @@ -648,24 +562,22 @@ end              end          end      end - -    -- only those needed that are part of a sequence - ---~     local b = byte[1] ---~     if b then ---~         -- we set them to the first split code (korean) ---~         local fs = fscodes[b] or b ---~         if #m_mapping == 0 then ---~             m_mapping = { m_mappings[fs][1] } ---~         end ---~         if #z_mapping == 0 then ---~             z_mapping = { z_mappings[fs][1] } ---~         end ---~         if #p_mapping == 0 then ---~             p_mapping = { p_mappings[fs][1] } ---~         end ---~     end - +    -- -- only those needed that are part of a sequence +    -- +    -- local b = byte[1] +    -- if b then +    --     -- we set them to the first split code (korean) +    --     local fs = fscodes[b] or b +    --     if #m_mapping == 0 then +    --         m_mapping = { m_mappings[fs][1] } +    --     end +    --     if #z_mapping == 0 then +    --         z_mapping = { z_mappings[fs][1] } +    --     end +    --     if #p_mapping == 0 then +    --         p_mapping = { p_mappings[fs][1] } +    --     end +    -- end      local t = {          ch = char,          uc = byte, @@ -739,7 +651,7 @@ function sorters.sort(entries,cmp)                  first = "  "              else                  s = first -                report_sorters(">> %s 0x%05X (%s 0x%05X)",first,utfbyte(first),letter,utfbyte(letter)) +                report_sorters(">> %C (%C)",first,letter)              end              report_sorters("   %s | %s",packch(entry),packuc(entry))          end diff --git a/tex/context/base/spac-ali.lua b/tex/context/base/spac-ali.lua index 744b1d810..ceb278433 100644 --- a/tex/context/base/spac-ali.lua +++ b/tex/context/base/spac-ali.lua @@ -79,15 +79,15 @@ local function handler(head,leftpage,realpageno)                          if action == 1 then                              current.list = hpack_nodes(concat_nodes{current.list,new_stretch(3)},current.width,"exactly")                              if trace_realign then -                                report_realign("flush left: align %s, page %s, realpage %s",align,pageno,realpageno) +                                report_realign("flushing left, align %a, page %a, realpage %a",align,pageno,realpageno)                              end                          elseif action == 2 then                              current.list = hpack_nodes(concat_nodes{new_stretch(3),current.list},current.width,"exactly")                              if trace_realign then -                                report_realign("flush right: align %s, page %s, realpage %s",align,pageno,realpageno) +                                report_realign("flushing right. align %a, page %a, realpage %a",align,pageno,realpageno)                              end                          elseif trace_realign then -                            report_realign("invalid: align %s, page %s, realpage %s",align,pageno,realpageno) +                            report_realign("invalid flushing, align %a, page %a, realpage %a",align,pageno,realpageno)                          end                          done = true                          nofrealigned = nofrealigned + 1 diff --git a/tex/context/base/spac-chr.lua b/tex/context/base/spac-chr.lua index 8ab7c4b8a..f7a4e32ec 100644 --- a/tex/context/base/spac-chr.lua +++ b/tex/context/base/spac-chr.lua @@ -185,7 +185,7 @@ function characters.handler(head)              local method = methods[char]              if method then                  if trace_characters then -                    report_characters("replacing character U+%04X (%s)",char,lower(chardata[char].description)) +                    report_characters("replacing character %C, description %a",char,lower(chardata[char].description))                  end                  head = method(head,current)                  head = remove_node(head,current,true) diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 50aeb82c0..1120675f1 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -22,14 +22,14 @@ if not modules then modules = { } end modules ['spac-ver'] = {  -- todo: strip baselineskip around display math  local next, type, tonumber = next, type, tonumber -local format, gmatch, concat, match, rep = string.format, string.gmatch, table.concat, string.match, string.rep +local gmatch, concat = string.gmatch, table.concat  local ceil, floor, max, min, round, abs = math.ceil, math.floor, math.max, math.min, math.round, math.abs  local texlists, texdimen, texbox = tex.lists, tex.dimen, tex.box  local lpegmatch = lpeg.match  local unpack = unpack or table.unpack -local points = number.points  local allocate = utilities.storage.allocate  local todimen = string.todimen +local formatters = string.formatters  local P, C, R, S, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc @@ -278,25 +278,24 @@ end  local function snap_hlist(where,current,method,height,depth) -- method.strut is default      local list = current.list ---~ print(table.serialize(method))      local t = trace_vsnapping and { }      if t then -        t[#t+1] = format("list content: %s",nodes.toutf(list)) -        t[#t+1] = format("parent id: %s",reference(current)) -        t[#t+1] = format("snap method: %s",method.name) -        t[#t+1] = format("specification: %s",method.specification) +        t[#t+1] = formatters["list content: %s"](nodes.toutf(list)) +        t[#t+1] = formatters["parent id: %s"](reference(current)) +        t[#t+1] = formatters["snap method: %s"](method.name) +        t[#t+1] = formatters["specification: %s"](method.specification)      end      local snapht, snapdp      if method["local"] then          -- snapping is done immediately here          snapht, snapdp = texdimen.bodyfontstrutheight, texdimen.bodyfontstrutdepth          if t then -            t[#t+1] = format("local: snapht %s snapdp %s",points(snapht),points(snapdp)) +            t[#t+1] = formatters["local: snapht %p snapdp %p"](snapht,snapdp)          end      elseif method["global"] then          snapht, snapdp = texdimen.globalbodyfontstrutheight, texdimen.globalbodyfontstrutdepth          if t then -            t[#t+1] = format("global: snapht %s snapdp %s",points(snapht),points(snapdp)) +            t[#t+1] = formatters["global: snapht %p snapdp %p"](snapht,snapdp)          end      else          -- maybe autolocal @@ -307,7 +306,7 @@ local function snap_hlist(where,current,method,height,depth) -- method.strut is              snapht, snapdp = lsnapht, lsnapdp          end          if t then -            t[#t+1] = format("auto: snapht %s snapdp %s",points(snapht),points(snapdp)) +            t[#t+1] = formatters["auto: snapht %p snapdp %p"](snapht,snapdp)          end      end      local h, d = height or current.height, depth or current.depth @@ -319,19 +318,19 @@ local function snap_hlist(where,current,method,height,depth) -- method.strut is      if method.none then          plusht, plusdp = 0, 0          if t then -            t[#t+1] = format("none: plusht 0pt plusdp 0pt") +            t[#t+1] = "none: plusht 0pt plusdp 0pt"          end      end      if method.halfline then -- extra halfline          plusht, plusdp = plusht + snaphtdp/2, plusdp + snaphtdp/2          if t then -            t[#t+1] = format("halfline: plusht %s plusdp %s",points(plusht),points(plusdp)) +            t[#t+1] = formatters["halfline: plusht %p plusdp %p"](plusht,plusdp)          end      end      if method.line then -- extra line          plusht, plusdp = plusht + snaphtdp, plusdp + snaphtdp          if t then -            t[#t+1] = format("line: plusht %s plusdp %s",points(plusht),points(plusdp)) +            t[#t+1] = formatters["line: plusht %p plusdp %p"](plusht,plusdp)          end      end @@ -351,20 +350,18 @@ local function snap_hlist(where,current,method,height,depth) -- method.strut is              if lh then                  local ht, dp = thebox.height, thebox.depth                  if t then -                    t[#t+1] = format("first line: height %s depth %s",points(lh),points(ld)) -                    t[#t+1] = format("dimensions: height %s depth %s",points(ht),points(dp)) +                    t[#t+1] = formatters["first line: height %p depth %p"](lh,ld) +                    t[#t+1] = formatters["dimensions: height %p depth %p"](ht,dp)                  end                  local delta = h - lh                  ch, cd = lh, delta + d ---~ ch = ch + plusht ---~ cd = cd + plusdp -h, d = ch, cd +                h, d = ch, cd                  local shifted = hpack_node(current.list)                  shifted.shift = delta                  current.list = shifted                  done = true                  if t then -                    t[#t+1] = format("first: height %s depth %s shift %s",points(ch),points(cd),points(delta)) +                    t[#t+1] = formatters["first: height %p depth %p shift %p"](ch,cd,delta)                  end              elseif t then                  t[#t+1] = "first: not done, no content" @@ -387,20 +384,18 @@ h, d = ch, cd              if lh then                  local ht, dp = thebox.height, thebox.depth                  if t then -                    t[#t+1] = format("last line: height %s depth %s",points(lh),points(ld)) -                    t[#t+1] = format("dimensions: height %s depth %s",points(ht),points(dp)) +                    t[#t+1] = formatters["last line: height %p depth %p" ](lh,ld) +                    t[#t+1] = formatters["dimensions: height %p depth %p"](ht,dp)                  end                  local delta = d - ld                  cd, ch = ld, delta + h ---~ ch = ch + plusht ---~ cd = cd + plusdp -h, d = ch, cd +                h, d = ch, cd                  local shifted = hpack_node(current.list)                  shifted.shift = delta                  current.list = shifted                  done = true                  if t then -                    t[#t+1] = format("last: height %s depth %s shift %s",points(ch),points(cd),points(delta)) +                    t[#t+1] = formatters["last: height %p depth %p shift %p"](ch,cd,delta)                  end              elseif t then                  t[#t+1] = "last: not done, no content" @@ -409,59 +404,48 @@ h, d = ch, cd              t[#t+1] = "last: not done, no vbox"          end      end - ---~     if done then ---~         -- first or last ---~     else      if method.minheight then -     -- ch = max(floor((h-hr*snapht)/snaphtdp),0)*snaphtdp + plusht          ch = floored((h-hr*snapht)/snaphtdp)*snaphtdp + plusht          if t then -            t[#t+1] = format("minheight: %s",points(ch)) +            t[#t+1] = formatters["minheight: %p"](ch)          end      elseif method.maxheight then -     -- ch = max(ceil((h-hr*snapht)/snaphtdp),0)*snaphtdp + plusht          ch = ceiled((h-hr*snapht)/snaphtdp)*snaphtdp + plusht          if t then -            t[#t+1] = format("maxheight: %s",points(ch)) +            t[#t+1] = formatters["maxheight: %p"](ch)          end      else          ch = plusht          if t then -            t[#t+1] = format("set height: %s",points(ch)) +            t[#t+1] = formatters["set height: %p"](ch)          end      end ---~     if done then ---~         -- first or last ---~     else      if method.mindepth then -     -- cd = max(floor((d-dr*snapdp)/snaphtdp),0)*snaphtdp + plusdp          cd = floored((d-dr*snapdp)/snaphtdp)*snaphtdp + plusdp          if t then -            t[#t+1] = format("mindepth: %s",points(cd)) +            t[#t+1] = formatters["mindepth: %p"](cd)          end      elseif method.maxdepth then -     -- cd = max(ceil((d-dr*snapdp)/snaphtdp),0)*snaphtdp + plusdp          cd = ceiled((d-dr*snapdp)/snaphtdp)*snaphtdp + plusdp          if t then -            t[#t+1] = format("maxdepth: %s",points(cd)) +            t[#t+1] = formatters["maxdepth: %p"](cd)          end      else          cd = plusdp          if t then -            t[#t+1] = format("set depth: %s",points(cd)) +            t[#t+1] = formatters["set depth: %p"](cd)          end      end      if method.top then          ch = ch + tlines * snaphtdp          if t then -            t[#t+1] = format("top height: %s",points(ch)) +            t[#t+1] = formatters["top height: %p"](ch)          end      end      if method.bottom then          cd = cd + blines * snaphtdp          if t then -            t[#t+1] = format("bottom depth: %s",points(cd)) +            t[#t+1] = formatters["bottom depth: %p"](cd)          end      end @@ -469,15 +453,13 @@ h, d = ch, cd      if offset then          -- we need to set the attr          if t then -            t[#t+1] = format("before offset: %s (width %s height %s depth %s)", -                points(offset),points(current.width),points(current.height),points(current.depth)) +            t[#t+1] = formatters["before offset: %p (width %p height %p depth %p)"](offset,current.width,current.height,current.depth)          end          local shifted = hpack_node(current.list)          shifted.shift = offset          current.list = shifted          if t then -            t[#t+1] = format("after offset: %s (width %s height %s depth %s)", -                points(offset),points(current.width),points(current.height),points(current.depth)) +            t[#t+1] = formatters["after offset: %p (width %p height %p depth %p)"](offset,current.width,current.height,current.depth)          end          shifted[a_snapmethod] = 0          current[a_snapmethod] = 0 @@ -485,25 +467,25 @@ h, d = ch, cd      if not height then          current.height = ch          if t then -            t[#t+1] = format("forced height: %s",points(ch)) +            t[#t+1] = formatters["forced height: %p"](ch)          end      end      if not depth then          current.depth = cd          if t then -            t[#t+1] = format("forced depth: %s",points(cd)) +            t[#t+1] = formatters["forced depth: %p"](cd)          end      end      local lines = (ch+cd)/snaphtdp      if t then          local original = (h+d)/snaphtdp          local whatever = (ch+cd)/(texdimen.globalbodyfontstrutheight + texdimen.globalbodyfontstrutdepth) -        t[#t+1] = format("final lines: %s -> %s (%s)",original,lines,whatever) -        t[#t+1] = format("final height: %s -> %s",points(h),points(ch)) -        t[#t+1] = format("final depth: %s -> %s",points(d),points(cd)) +        t[#t+1] = formatters["final lines: %s -> %s (%s)"](original,lines,whatever) +        t[#t+1] = formatters["final height: %p -> %p"](h,ch) +        t[#t+1] = formatters["final depth: %p -> %p"](d,cd)      end      if t then -        report_snapper("trace: %s type %s\n\t%s",where,nodecodes[current.id],concat(t,"\n\t")) +        report_snapper("trace: %s type %s\n\t%\n\tt",where,nodecodes[current.id],t)      end      return h, d, ch, cd, lines  end @@ -590,7 +572,7 @@ do -- todo: interface.variables          for s in gmatch(str,"([^ ,]+)") do              local amount, keyword, detail = lpegmatch(splitter,s) -- the comma splitter can be merged              if not keyword then -                report_vspacing("unknown directive: %s",s) +                report_vspacing("unknown directive %a",s)              else                  local mk = map[keyword]                  if mk then @@ -668,43 +650,19 @@ end  -- implementation ---~ nodes.snapvalues = { } - ---~ function nodes.setsnapvalue(n,ht,dp) ---~     nodes.snapvalues[n] = { ht, dp, ht+dp } ---~ end -  local trace_list, tracing_info, before, after = { }, false, "", "" -local stripzeros, topoints = utilities.formatters.stripzeros, number.topoints - -local function glue_to_string(glue) -    local spec = glue.spec -    local t = { points(spec.width) } -    if spec.stretch_order and spec.stretch_order ~= 0 then -        t[#t+1] = format("plus %s%s",spec.stretch/65536,fillcodes[spec.stretch_order]) -    elseif spec.stretch and spec.stretch ~= 0 then -        t[#t+1] = format("plus %s",stripzeros(topoints(spec.stretch))) -    end -    if spec.shrink_order and spec.shrink_order ~= 0 then -        t[#t+1] = format("minus %s%s",spec.shrink/65536,fillcodes[spec.shrink_order]) -    elseif spec.shrink and spec.shrink ~= 0 then -        t[#t+1] = format("minus %s",stripzeros(topoints(spec.shrink))) -    end -    return concat(t," ") -end -  local function nodes_to_string(head)      local current, t = head, { }      while current do          local id = current.id          local ty = nodecodes[id]          if id == penalty_code then -            t[#t+1] = format("%s:%s",ty,current.penalty) -        elseif id == glue_code then -            t[#t+1] = format("%s:%s",ty,glue_to_string(current)) -- stripzeros(topoints(current.spec.width))) +            t[#t+1] = formatters["%s:%s"](ty,current.penalty) +        elseif id == glue_code then -- or id == kern_code then -- to be tested +            t[#t+1] = formatters["%s:%p"](ty,current)          elseif id == kern_code then -            t[#t+1] = format("%s:%s",ty,stripzeros(topoints(current.kern))) +            t[#t+1] = formatters["%s:%p"](ty,current.kern)          else              t[#t+1] = ty          end @@ -718,24 +676,24 @@ local function reset_tracing(head)  end  local function trace_skip(str,sc,so,sp,data) -    trace_list[#trace_list+1] = { "skip", format("%s | %s | category %s | order %s | penalty %s", str, glue_to_string(data), sc or "-", so or "-", sp or "-") } +    trace_list[#trace_list+1] = { "skip", formatters["%s | %p | category %s | order %s | penalty %s"](str, data, sc or "-", so or "-", sp or "-") }      tracing_info = true  end  local function trace_natural(str,data) -    trace_list[#trace_list+1] = { "skip", format("%s | %s", str, glue_to_string(data)) } +    trace_list[#trace_list+1] = { "skip", formatters["%s | %p"](str, data) }      tracing_info = true  end  local function trace_info(message, where, what) -    trace_list[#trace_list+1] = { "info", format("%s: %s/%s",message,where,what) } +    trace_list[#trace_list+1] = { "info", formatters["%s: %s/%s"](message,where,what) }  end  local function trace_node(what)      local nt = nodecodes[what.id]      local tl = trace_list[#trace_list]      if tl and tl[1] == "node" then -        trace_list[#trace_list] = { "node", tl[2] .. " + " .. nt } +        trace_list[#trace_list] = { "node", formatters["%s + %s"](tl[2],nt) }      else          trace_list[#trace_list+1] = { "node", nt }      end @@ -743,9 +701,9 @@ end  local function trace_done(str,data)      if data.id == penalty_code then -        trace_list[#trace_list+1] = { "penalty", format("%s | %s", str, data.penalty) } +        trace_list[#trace_list+1] = { "penalty", formatters["%s | %s"](str,data.penalty) }      else -        trace_list[#trace_list+1] = { "glue", format("%s | %s", str, glue_to_string(data)) } +        trace_list[#trace_list+1] = { "glue", formatters["%s | %p"](str,data) }      end      tracing_info = true  end @@ -784,14 +742,14 @@ local splittopskip_code          = skipcodes.splittopskip  local free_glue_node = free_node  local discard, largest, force, penalty, add, disable, nowhite, goback, together = 0, 1, 2, 3, 4, 5, 6, 7, 8 ---~ local function free_glue_node(n) ---~  -- free_node(n.spec) ---~     print("before",n) ---~     logs.flush() ---~     free_node(n) ---~     print("after") ---~     logs.flush() ---~ end +-- local function free_glue_node(n) +--  -- free_node(n.spec) +--     print("before",n) +--     logs.flush() +--     free_node(n) +--     print("after") +--     logs.flush() +-- end  function vspacing.snapbox(n,how)      local sv = snapmethods[how] @@ -816,7 +774,7 @@ function vspacing.snapbox(n,how)                      local h, d, ch, cd, lines = snap_hlist("box",box,sv,ht,dp)                      box.height, box.depth = ch, cd                      if trace_vsnapping then -                        report_snapper("box list snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines): %s", +                        report_snapper("box list snapped from (%p,%p) to (%p,%p) using method %a (%s) for %a (%s lines): %s",                              h,d,ch,cd,sv.name,sv.specification,"direct",lines,listtoutf(list))                      end                      box[a_snapmethod] = 0 -- @@ -840,7 +798,7 @@ local function forced_skip(head,current,width,where,trace)          current = c      end      if trace then -        report_vspacing("inserting forced skip of %s",width) +        report_vspacing("inserting forced skip of %p",width)      end      return head, current  end @@ -882,7 +840,7 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also          parskip, ignore_parskip, ignore_following, ignore_whitespace = nil, false, false, false      end      if trace_vsnapping then -        report_snapper("global ht/dp = %s/%s, local ht/dp = %s/%s", +        report_snapper("global ht/dp = %p/%p, local ht/dp = %p/%p",              texdimen.globalbodyfontstrutheight, texdimen.globalbodyfontstrutdepth,              texdimen.bodyfontstrutheight, texdimen.bodyfontstrutdepth)      end @@ -900,7 +858,7 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also                  --  end                  elseif s == 0 then                      if trace_vsnapping then -                        report_snapper("mvl %s not snapped, already done: %s",nodecodes[id],listtoutf(list)) +                        report_snapper("mvl %a not snapped, already done: %s",nodecodes[id],listtoutf(list))                      end                  else                      local sv = snapmethods[s] @@ -910,17 +868,17 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also                              local ht, dp = current.height, current.depth                              -- assume that the box is already snapped                              if trace_vsnapping then -                                report_snapper("mvl list already snapped at (%s,%s): %s",ht,dp,listtoutf(list)) +                                report_snapper("mvl list already snapped at (%p,%p): %s",ht,dp,listtoutf(list))                              end                          else                              local h, d, ch, cd, lines = snap_hlist("mvl",current,sv)                              if trace_vsnapping then -                                report_snapper("mvl %s snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines): %s", +                                report_snapper("mvl %a snapped from (%p,%p) to (%p,%p) using method %a (%s) for %a (%s lines): %s",                                      nodecodes[id],h,d,ch,cd,sv.name,sv.specification,where,lines,listtoutf(list))                              end                          end                      elseif trace_vsnapping then -                        report_snapper("mvl %s not snapped due to unknown snap specification: %s",nodecodes[id],listtoutf(list)) +                        report_snapper("mvl %a not snapped due to unknown snap specification: %s",nodecodes[id],listtoutf(list))                      end                      current[a_snapmethod] = 0                  end @@ -931,14 +889,13 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also              flush("list")              current = current.next          elseif id == penalty_code then -            --~ natural_penalty = current.penalty -            --~ if trace then trace_done("removed penalty",current) end -            --~ head, current = remove_node(head, current, true) +         -- natural_penalty = current.penalty +         -- if trace then trace_done("removed penalty",current) end +         -- head, current = remove_node(head, current, true)              current = current.next          elseif id == kern_code then              if snap and trace_vsnapping and current.kern ~= 0 then -            --~ current.kern = 0 -                report_snapper("kern of %s (kept)",current.kern) +                report_snapper("kern of %p kept",current.kern)              end              flush("kern")              current = current.next @@ -956,7 +913,7 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also                      elseif penalty_order == so and sp > penalty_data then                          penalty_data = sp                      end -                    if trace then trace_skip('penalty in skip',sc,so,sp,current) end +                    if trace then trace_skip("penalty in skip",sc,so,sp,current) end                      head, current = remove_node(head, current, true)                  elseif not sc then  -- if not sc then                      if glue_data then @@ -1028,31 +985,30 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also                          local cs, gs = current.spec, glue_data.spec                          local cw, gw = cs.width, gs.width                          if cw > gw then -                            if trace then trace_skip('largest',sc,so,sp,current) end +                            if trace then trace_skip("largest",sc,so,sp,current) end                              free_glue_node(glue_data) -- also free spec                              head, current, glue_data = remove_node(head, current)                          else -                            if trace then trace_skip('remove smallest',sc,so,sp,current) end +                            if trace then trace_skip("remove smallest",sc,so,sp,current) end                              head, current = remove_node(head, current, true)                          end                      elseif sc == goback then -                        if trace then trace_skip('goback',sc,so,sp,current) end +                        if trace then trace_skip("goback",sc,so,sp,current) end                          free_glue_node(glue_data) -- also free spec                          head, current, glue_data = remove_node(head, current)                      elseif sc == force then                          -- last one counts, some day we can provide an accumulator and largest etc                          -- but not now -                        if trace then trace_skip('force',sc,so,sp,current) end +                        if trace then trace_skip("force",sc,so,sp,current) end                          free_glue_node(glue_data) -- also free spec                          head, current, glue_data = remove_node(head, current)                      elseif sc == penalty then -                        -- ? ? ? ? -                        if trace then trace_skip('penalty',sc,so,sp,current) end +                        if trace then trace_skip("penalty",sc,so,sp,current) end                          free_glue_node(glue_data) -- also free spec                          glue_data = nil                          head, current = remove_node(head, current, true)                      elseif sc == add then -                        if trace then trace_skip('add',sc,so,sp,current) end +                        if trace then trace_skip("add",sc,so,sp,current) end                       -- local old, new = glue_data.spec, current.spec                          local old, new = writable_spec(glue_data), current.spec                          old.width   = old.width   + new.width @@ -1139,7 +1095,7 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also                          local sv = snapmethods[s]                          local w, cw = snap_topskip(current,sv)                          if trace_vsnapping then -                            report_snapper("topskip snapped from %s to %s for '%s'",w,cw,where) +                            report_snapper("topskip snapped from %p to %p for %a",w,cw,where)                          end                      else                          if trace then trace_skip("topskip",sc,so,sp,current) end @@ -1176,10 +1132,10 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also                  --              else -- other glue                  if snap and trace_vsnapping and current.spec.writable and current.spec.width ~= 0 then -                    report_snapper("%s of %s (kept)",skipcodes[subtype],current.spec.width) +                    report_snapper("glue %p of type %a kept",current.spec.width,skipcodes[subtype])                  --~ current.spec.width = 0                  end -                if trace then trace_skip(format("some glue (%s)",subtype),sc,so,sp,current) end +                if trace then trace_skip(formatted["glue of type %a"](subtype),sc,so,sp,current) end                  flush("some glue")                  current = current.next              end @@ -1189,9 +1145,9 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also          end      end      if trace then trace_info("stop analyzing",where,what) end -    --~ if natural_penalty and (not penalty_data or natural_penalty > penalty_data) then -    --~     penalty_data = natural_penalty -    --~ end + -- if natural_penalty and (not penalty_data or natural_penalty > penalty_data) then + --     penalty_data = natural_penalty + -- end      if trace and (glue_data or penalty_data) then          trace_info("start flushing",where,what)      end @@ -1218,7 +1174,7 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also          end          show_tracing(head)          if oldhead ~= head then -            trace_info("head has been changed from '%s' to '%s'",nodecodes[oldhead.id],nodecodes[head.id]) +            trace_info("head has been changed from %a to %a",nodecodes[oldhead.id],nodecodes[head.id])          end      end      return head, true @@ -1354,19 +1310,19 @@ local actions = nodes.tasks.actions("mvlbuilders")  local function report(groupcode,head)      report_page_builder("trigger: %s",groupcode) -    report_page_builder("  vsize    : %s",points(tex.vsize)) -    report_page_builder("  pagegoal : %s",points(tex.pagegoal)) -    report_page_builder("  pagetotal: %s",points(tex.pagetotal)) +    report_page_builder("  vsize    : %p",tex.vsize) +    report_page_builder("  pagegoal : %p",tex.pagegoal) +    report_page_builder("  pagetotal: %p",tex.pagetotal)      report_page_builder("  list     : %s",head and nodeidstostring(head) or "<empty>")  end  function builders.buildpage_filter(groupcode)      local head, done = texlists.contrib_head, false --- if head and head.next and head.next.id == hlist_code and head.next.width == 1 then ---     report_page_builder("trigger otr calculations") ---     free_node_list(head) ---     head = nil --- end + -- if head and head.next and head.next.id == hlist_code and head.next.width == 1 then + --     report_page_builder("trigger otr calculations") + --     free_node_list(head) + --     head = nil + -- end      if head then          starttiming(builders)          if trace_page_builder then diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdfBinary files differ index 1a6a03c89..58f4fb5ed 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdfBinary files differ index 27eff5b32..8a63a8e83 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-bkm.lua b/tex/context/base/strc-bkm.lua index dbb7d3853..d9c268ce4 100644 --- a/tex/context/base/strc-bkm.lua +++ b/tex/context/base/strc-bkm.lua @@ -173,7 +173,7 @@ function bookmarks.flatten(levels)                      local old = lj[1]                      lj[1] = new                      if trace_bookmarks then -                        report_bookmarks("promoting entry %s from level %s to %s: %s",j,old,new,lj[2]) +                        report_bookmarks("promoting entry %a from level %a to %a: %s",j,old,new,lj[2])                      end                  end                  skip = true diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua index b9a176b5e..a25d1e1b0 100644 --- a/tex/context/base/strc-doc.lua +++ b/tex/context/base/strc-doc.lua @@ -251,8 +251,8 @@ function sections.somelevel(given)      -- normally these are passed as argument but nowadays we provide several      -- interfaces (we need this because we want to be compatible)      if trace_detail then -        report_structure("name: %s, mapped level: %s, old depth: %s, new depth: %s, reset set: %s", -            givenname, mappedlevel or "unknown", olddepth, newdepth, resetset) +        report_structure("name %a, mapped level %a, old depth %a, new depth %a, reset set %a", +            givenname,mappedlevel,olddepth,newdepth,resetset)      end      local u = given.userdata      if u then @@ -271,7 +271,7 @@ function sections.somelevel(given)          for i=olddepth+1,newdepth do              local s = tonumber(sets.get("structure:resets",data.block,saveset and saveset[i] or resetset,i))              if trace_detail then -                report_structure("new>old (%s>%s), reset set: %s, reset value: %s, current: %s",olddepth,newdepth,resetset,s or "?",numbers[i] or "?") +                report_structure("new depth %s, old depth %s, reset set %a, reset value %a, current %a",olddepth,newdepth,resetset,s,numbers[i])              end              if not s or s == 0 then                  numbers[i] = numbers[i] or 0 @@ -286,7 +286,7 @@ function sections.somelevel(given)          for i=olddepth,newdepth+1,-1 do              local s = tonumber(sets.get("structure:resets",data.block,saveset and saveset[i] or resetset,i))              if trace_detail then -                report_structure("new<old (%s<%s), reset set: %s, reset value: %s, current: %s",olddepth,newdepth,resetset,s or "?",numbers[i] or "?") +                report_structure("new depth %s, old depth %s, reset set %a, reset value %a, current %a",olddepth,newdepth,resetset,s,numbers[i])              end              if not s or s == 0 then                  numbers[i] = numbers[i] or 0 @@ -318,12 +318,12 @@ function sections.somelevel(given)              end              forced[newdepth] = nil              if trace_detail then -                report_structure("old depth: %s, new depth: %s, old n: %s, new n: %s, forced: %s",olddepth,newdepth,oldn,newn,concat(fd,"")) +                report_structure("old depth %a, new depth %a, old n %a, new n %a, forced %t",olddepth,newdepth,oldn,newn,fd)              end          else              newn = oldn + 1              if trace_detail then -                report_structure("old depth: %s, new depth: %s, old n: %s, new n: %s, increment",olddepth,newdepth,oldn,newn) +                report_structure("old depth %a, new depth %a, old n %a, new n %a, increment",olddepth,newdepth,oldn,newn)              end          end          numbers[newdepth] = newn @@ -352,7 +352,7 @@ function sections.somelevel(given)          numberdata.ownnumbers = fastcopy(ownnumbers)      end      if trace_detail then -        report_structure("name: %s, numbers: %s, own numbers: %s",givenname,concat(numberdata.numbers, " "),concat(numberdata.ownnumbers, " ")) +        report_structure("name %a, numbers % a, own numbers % a",givenname,numberdata.numbers,numberdata.ownnumbers)      end      local metadata   = given.metadata @@ -386,7 +386,7 @@ function sections.reportstructure()          elseif d.directives and d.directives.hidenumber then              report_structure("%s @ level %i : (%s) -> %s",m,depth,n,t)          else -            report_structure("%s @ level %i: %s -> %s",m,depth,n,t) +            report_structure("%s @ level %i : %s -> %s",m,depth,n,t)          end      end  end diff --git a/tex/context/base/strc-ini.lua b/tex/context/base/strc-ini.lua index 790899a21..2e30d9310 100644 --- a/tex/context/base/strc-ini.lua +++ b/tex/context/base/strc-ini.lua @@ -202,36 +202,36 @@ function helpers.title(title,metadata) -- coding is xml is rather old and not th                  -- title can contain raw xml                  local tag = tags[metadata.kind] or tags.generic                  local xmldata = format("<?xml version='1.0'?><%s>%s</%s>",tag,title,tag) -if not experiment then -                buffers.assign(tag,xmldata) -end +                if not experiment then +                    buffers.assign(tag,xmldata) +                end                  if trace_processors then                      report_processors("putting xml data in buffer: %s",xmldata) -                    report_processors("processing buffer with setup '%s' and tag '%s'",xmlsetup or "",tag) +                    report_processors("processing buffer with setup %a and tag %a",xmlsetup,tag)                  end -if experiment then -    -- the question is: will this be forgotten ... better store in a via file -    local xmltable = lxml.convert("temp",xmldata or "") -    lxml.store("temp",xmltable) -    context.xmlsetup("temp",xmlsetup or "") -else +            if experiment then +                -- the question is: will this be forgotten ... better store in a via file +                local xmltable = lxml.convert("temp",xmldata or "") +                lxml.store("temp",xmltable) +                context.xmlsetup("temp",xmlsetup or "") +            else                  context.xmlprocessbuffer("dummy",tag,xmlsetup or "") -end +            end              elseif xmlsetup then -- title is reference to node (so \xmlraw should have been used)                  if trace_processors then -                    report_processors("feeding xmlsetup '%s' using node '%s'",xmlsetup,title) +                    report_processors("feeding xmlsetup %a using node %a",xmlsetup,title)                  end                  context.xmlsetup(title,metadata.xmlsetup)              else                  local catcodes = metadata.catcodes                  if catcodes == notcatcodes or catcodes == xmlcatcodes then                      if trace_processors then -                        report_processors("cct: %s (overloads %s), txt: %s",ctxcatcodes,catcodes,title) +                        report_processors("catcodetable %a, overloads %a, text %a",ctxcatcodes,catcodes,title)                      end                      context(title) -- nasty                  else                      if trace_processors then -                        report_processors("cct: %s, txt: %s",catcodes,title) +                        report_processors("catcodetable %a, text %a",catcodes,title)                      end                      --                      -- context.sprint(catcodes,title) diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 578c0adeb..104a7b7bb 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -257,8 +257,7 @@ local function filtercollected(names, criterium, number, collected, forced, nest      end      local all = not next(names) or names[variables.all] or false      if trace_lists then -        report_lists("filtering names: %s, criterium: %s, block: %s, number: %s", -            simple_hash_to_string(names),criterium,block or "*", number or "-") +        report_lists("filtering names %a, criterium %a, block %a, number %a",names,criterium,block or "*",number)      end      if criterium == variables.intro then          -- special case, no structure yet @@ -442,18 +441,14 @@ local function filtercollected(names, criterium, number, collected, forced, nest          end      end      if trace_lists then -        if detail then -            report_lists("criterium: %s, block: %s, %s, found: %s",criterium,block or "*",detail,#result) -        else -            report_lists("criterium: %s, block: %s, found: %s",criterium,block or "*",#result) -        end +        report_lists("criterium %a, block %a, found %a, detail %a",criterium,block or "*",#result,detail)      end      if sortorder then -- experiment          local sorter = sorters[sortorder]          if sorter then              if trace_lists then -                report_lists("sorting list using method %s",sortorder) +                report_lists("sorting list using method %a",sortorder)              end              for i=1,#result do                  result[i].references.order = i diff --git a/tex/context/base/strc-mar.lua b/tex/context/base/strc-mar.lua index 1557c1956..7b3ac11e1 100644 --- a/tex/context/base/strc-mar.lua +++ b/tex/context/base/strc-mar.lua @@ -80,7 +80,7 @@ local ranges = {  local function resolve(t,k)      if k then          if trace_marks_set or trace_marks_get then -            report_marks("undefined: name=%s",k) +            report_marks("undefined mark, name %a",k)          end          local crap = { autodefined = true } -- maybe set = 0 and reset = 0          t[k] = crap @@ -140,7 +140,7 @@ function marks.synchronize(class,n,option)          local first, last = sweep(box.list,0,0)          if option == v_keep and first == 0 and last == 0 then              if trace_marks_get or trace_marks_set then -                report_marks("synchronize: class=%s, box=%s, retaining",class,n) +                report_marks("action %a, class %a, box %a","retain at synchronize",class,n)              end              -- todo: check if still valid firts/last in range              first = lasts[class] or 0 @@ -157,12 +157,12 @@ function marks.synchronize(class,n,option)                  end                  range.first, range.last = first, last                  if trace_marks_get or trace_marks_set then -                    report_marks("synchronize: class=%s, first=%s, last=%s",class,range.first,range.last) +                    report_marks("action %a, class %a, first %a, last %a","synchronize",class,range.first,range.last)                  end              end          end      elseif trace_marks_get or trace_marks_set then -        report_marks("synchronize: class=%s, box=%s, no content",class,n) +        report_marks("action %s, class %a, box %a","synchronize without content",class,n)      end  end @@ -231,7 +231,7 @@ function marks.relate(name,chain)                  children[#children+1] = name              end          elseif trace_marks_set then -            report_marks("invalid relation: name=%s, chain=%s",name,chain or "-") +            report_marks("error: invalid relation, name %a, chain %a",name,chain)          end      end  end @@ -245,7 +245,7 @@ local function resetchildren(new,name)                  local ci = children[i]                  new[ci] = false                  if trace_marks_set then -                    report_marks("reset: parent=%s, child=%s",name,ci) +                    report_marks("action %a, parent %a, child %a","reset",name,ci)                  end                  resetchildren(new,ci)              end @@ -286,9 +286,9 @@ function marks.set(name,value)          stack[topofstack] = new          if trace_marks_set then              if name == child then -                report_marks("set: name=%s, index=%s, value=%s",name,topofstack,value) +                report_marks("action %a, name %a, index %a, value %a","set",name,topofstack,value)              else -                report_marks("set: parent=%s, child=%s, index=%s, value=%s",parent,child,topofstack,value) +                report_marks("action %a, parent %a, child %a, index %a, value %a","set",parent,child,topofstack,value)              end          end          texsetattribute("global",a_marks,topofstack) @@ -298,7 +298,7 @@ end  local function reset(name)      if v_all then          if trace_marks_set then -            report_marks("reset: all") +            report_marks("action %a","reset all")          end          stack = { }          for name, dn in next, data do @@ -317,7 +317,7 @@ local function reset(name)                  dn = data[name]              end              if trace_marks_set then -                report_marks("reset: name=%s, index=%s",name,topofstack) +                report_marks("action %a, name %a, index %a","reset",name,topofstack)              end              dn.reset = topofstack              local children = dn.children @@ -373,7 +373,7 @@ local function resolve(name,first,last,strict,quitonfalse,notrace)              step, method = 1, "top-down"          end          if trace_marks_get and not notrace then -            report_marks("request: strategy=%s, name=%s, parent=%s, strict=%s",method,child,parent or "",tostring(strict or false)) +            report_marks("action %a, strategy %a, name %a, parent %a, strict %a","request",method,child,parent,strict or false)          end          if trace_marks_all and not notrace then              marks.show(first,last) @@ -382,28 +382,28 @@ local function resolve(name,first,last,strict,quitonfalse,notrace)          local s = dn.set          if first <= last and first <= r then              if trace_marks_get and not notrace then -                report_marks("reset (first case): name=%s, first=%s, last=%s, reset=%s, index=%s",name,first,last,r,first) +                report_marks("action %a, name %a, first %a, last %a, reset %a, index %a","reset first",name,first,last,r,first)              end          elseif first >= last and last <= r then              if trace_marks_get and not notrace then -                report_marks("reset (last case): name=%s, first=%s, last=%s, reset=%s, index=%s",name,first,last,r,last) +                report_marks("action %a, name %a, first %a, last %a, reset %a, index %a","reset last",name,first,last,r,last)              end          elseif not stack[first] or not stack[last] then              if trace_marks_get and not notrace then                  -- a previous or next method can give an out of range, which is valid -                report_marks("out of range: name=%s, reset=%s, index=%s",name,r,first) +                report_marks("error: out of range, name %a, reset %a, index %a",name,r,first)              end          elseif strict then              local top = stack[first]              local fullchain = dn.fullchain              if not fullchain or #fullchain == 0 then                  if trace_marks_get and not notrace then -                    report_marks("no full chain, trying: name=%s, first=%s, last=%s",name,first,last) +                    report_marks("warning: no full chain, trying again, name %a, first %a, last %a",name,first,last)                  end                  return resolve(name,first,last)              else                  if trace_marks_get and not notrace then -                    report_marks("found chain: %s",concat(fullchain," => ")) +                    report_marks("found chain [ % => T ]",fullchain)                  end                  local chaindata, chainlength = { }, #fullchain                  for i=1,chainlength do @@ -412,7 +412,7 @@ local function resolve(name,first,last,strict,quitonfalse,notrace)                          local value = resolve(cname,first,last,false,false,true)                          if value == "" then                              if trace_marks_get and not notrace then -                                report_marks("quit chain: name=%s, reset=%s, start=%s",name,r,first) +                                report_marks("quitting chain, name %a, reset %a, start %a",name,r,first)                              end                              return ""                          else @@ -421,28 +421,28 @@ local function resolve(name,first,last,strict,quitonfalse,notrace)                      end                  end                  if trace_marks_get and not notrace then -                    report_marks("chain list: %s",concat(chaindata," => ")) +                    report_marks("using chain  [ % => T ]",chaindata)                  end                  local value, index, found = resolve(name,first,last,false,false,true)                  if value ~= ""  then                      if trace_marks_get and not notrace then -                        report_marks("following chain: %s",concat(fullchain," => ")) +                        report_marks("following chain  [ % => T ]",chaindata)                      end                      for i=1,chainlength do                          local cname = fullchain[i]                          if data[cname].set > 0 and chaindata[i] ~= found[cname] then                              if trace_marks_get and not notrace then -                                report_marks("empty in chain: name=%s, reset=%s, index=%s",name,r,first) +                                report_marks("quiting chain, name %a, reset %a, index %a",name,r,first)                              end                              return ""                          end                      end                      if trace_marks_get and not notrace then -                        report_marks("found: name=%s, reset=%s, start=%s, index=%s, value=%s",name,r,first,index,value) +                        report_marks("found in chain, name %a, reset %a, start %a, index %a, value %a",name,r,first,index,value)                      end                      return value, index, found                  elseif trace_marks_get and not notrace then -                    report_marks("not found: name=%s, reset=%s",name,r) +                    report_marks("not found, name %a, reset %a",name,r)                  end              end          else @@ -457,18 +457,18 @@ local function resolve(name,first,last,strict,quitonfalse,notrace)                      end                  elseif value == true then                      if trace_marks_get and not notrace then -                        report_marks("quit: name=%s, reset=%s, start=%s, index=%s",name,r,first,i) +                        report_marks("quitting steps, name %a, reset %a, start %a, index %a",name,r,first,i)                      end                      return ""                  elseif value ~= "" then                      if trace_marks_get and not notrace then -                        report_marks("found: name=%s, reset=%s, start=%s, index=%s, value=%s",name,r,first,i,value) +                        report_marks("found in steps, name %a, reset %a, start %a, index %a, value %a",name,r,first,i,value)                      end                      return value, i, current                  end              end              if trace_marks_get and not notrace then -                report_marks("not found: name=%s, reset=%s",name,r) +                report_marks("not found in steps, name %a, reset %a",name,r)              end          end      end @@ -483,8 +483,8 @@ local function doresolve(name,rangename,swap,df,dl,strict)      local range = ranges[rangename] or ranges[v_page]      local first, last = range.first, range.last      if trace_marks_get then -        report_marks("resolve: name=%s, range=%s, swap=%s, first=%s, last=%s, df=%s, dl=%s, strict=%s", -            name,rangename,tostring(swap or false),first,last,df,dl,tostring(strict or false)) +        report_marks("action %a, name %a, range %a, swap %a, first %a, last %a, df %a, dl %a, strict %a", +            "resolving",name,rangename,swap or false,first,last,df,dl,strict or false)      end      if swap then          first, last = last + df, first + dl @@ -517,11 +517,11 @@ methods[v_next_nocheck]     = function(name,range) return doresolve(name,range,t  local function do_first(name,range,check)      if trace_marks_get then -        report_marks("resolve: name=%s, range=%s, resolve first",name,range) +        report_marks("action %a, name %a, range %a","resolving first",name,range)      end      local f_value, f_index, f_found = doresolve(name,range,false,0,0,check)      if trace_marks_get then -        report_marks("resolve: name=%s, range=%s, resolve last",name,range) +        report_marks("action %a, name %a, range %a","resolving last",name,range)      end      local l_value, l_index, l_found = doresolve(name,range,true ,0,0,check)      if f_found and l_found and l_index > f_index then @@ -531,25 +531,25 @@ local function do_first(name,range,check)              local sn = si[name]              if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= f_value then                  if trace_marks_get then -                    report_marks("resolve: name=%s, range=%s, index=%s, value=%s",name,range,i,sn) +                    report_marks("action %a, name %a, range %a, index %a, value %a","resolving",name,range,i,sn)                  end                  return sn, i, si              end          end      end      if trace_marks_get then -        report_marks("resolve: name=%s, range=%s, using first",name,range) +        report_marks("resolved, name %a, range %a, using first",name,range)      end      return f_value, f_index, f_found  end  local function do_last(name,range,check)      if trace_marks_get then -        report_marks("resolve: name=%s, range=%s, resolve first",name,range) +        report_marks("action %a, name %a, range %a","resolving first",name,range)      end      local f_value, f_index, f_found = doresolve(name,range,false,0,0,check)      if trace_marks_get then -        report_marks("resolve: name=%s, range=%s, resolve last",name,range) +        report_marks("action %a, name %a, range %a","resolving last",name,range)      end      local l_value, l_index, l_found = doresolve(name,range,true ,0,0,check)      if f_found and l_found and l_index > f_index then @@ -559,14 +559,14 @@ local function do_last(name,range,check)              local sn = si[name]              if sn and sn ~= false and sn ~= true and sn ~= "" and sn ~= l_value then                  if trace_marks_get then -                    report_marks("resolve: name=%s, range=%s, index=%s, value=%s",name,range,i,sn) +                    report_marks("action %a, name %a, range %a, index %a, value %a","resolving",name,range,i,sn)                  end                  return sn, i, si              end          end      end      if trace_marks_get then -        report_marks("resolve: name=%s, range=%s, using last",name,range) +        report_marks("resolved, name %a, range %a, using first",name,range)      end      return l_value, l_index, l_found  end @@ -586,9 +586,9 @@ local function fetched(name,range,method)      if not trace_marks_get then          -- no report      elseif value == "" then -        report_marks("nothing fetched: name=%s, range=%s, method=%s",name,range,method) +        report_marks("nothing fetched, name %a, range %a, method %a",name,range,method)      else -        report_marks("marking fetched: name=%s, range=%s, method=%s, value=%s",name,range,method,value) +        report_marks("marking fetched, name %a, range %a, method %a, value %a",name,range,method,value)      end      return value or ""  end @@ -640,7 +640,7 @@ end  function marks.fetch(name,range,method) -- chapter page first | chapter column:1 first      if trace_marks_get then -        report_marks("marking asked: name=%s, range=%s, method=%s",name,range,method) +        report_marks("marking requested, name %a, range %a, method %a",name,range,method)      end      if method == "" or method == v_default then          fetchonemark(name,range,v_first) diff --git a/tex/context/base/strc-not.lua b/tex/context/base/strc-not.lua index d71b371ab..b3a50c0d6 100644 --- a/tex/context/base/strc-not.lua +++ b/tex/context/base/strc-not.lua @@ -55,10 +55,10 @@ local function store(tag,n)      nd[nnd] = n      local state = notestates[tag]      if not state then -        report_notes("unknown state for %s",tag) +        report_notes("unknown state for %a",tag)      elseif state.kind ~= "insert" then          if trace_notes then -            report_notes("storing %s with state %s as %s",tag,state.kind,nnd) +            report_notes("storing %a with state %a as %a",tag,state.kind,nnd)          end          state.start = state.start or nnd      end @@ -78,7 +78,7 @@ local function get(tag,n) -- tricky ... only works when defined          nd = nd[n]          if nd then              if trace_notes then -                report_notes("getting note %s of '%s' with listindex '%s'",n,tag,nd) +                report_notes("getting note %a of %a with listindex %a",n,tag,nd)              end              -- is this right?  --             local newdata = lists.collected[nd] @@ -113,7 +113,7 @@ end  local function setstate(tag,newkind)      local state = notestates[tag]      if trace_notes then -        report_notes("setting state of '%s' from %s to %s",tag,(state and state.kind) or "unset",newkind) +        report_notes("setting state of %a from %s to %s",tag,(state and state.kind) or "unset",newkind)      end      if not state then          state = { @@ -156,7 +156,7 @@ function notes.save(tag,newkind)      local state = notestates[tag]      if state and not state.saved then          if trace_notes then -            report_notes("saving state of '%s': %s -> %s",tag,state.kind,newkind or state.kind) +            report_notes("saving state of %a, old: %a, new %a",tag,state.kind,newkind or state.kind)          end          state.saveddata = notedata[tag]          state.savedkind = state.kind @@ -170,7 +170,7 @@ function notes.restore(tag,forcedstate)      local state = notestates[tag]      if state and state.saved then          if trace_notes then -            report_notes("restoring state of '%s': %s -> %s",tag,state.kind,state.savedkind) +            report_notes("restoring state of %a, old: %a, new: %a",tag,state.kind,state.savedkind)          end          notedata[tag] = state.saveddata          state.kind = forcedstate or state.savedkind @@ -279,16 +279,16 @@ function notes.setsymbolpage(tag,n,l)      if l then          local p = texcount.realpageno          if trace_notes or trace_references then -            report_notes("note %s of '%s' with list index %s gets symbol page %s",n,tag,l,p) +            report_notes("note %a of %a with list index %a gets symbol page %a",n,tag,l,p)          end          local entry = lists.cached[l]          if entry then              entry.references.symbolpage = p          else -            report_notes("internal error: note %s of '%s' is not flushed",n,tag) +            report_notes("internal error: note %a of %a is not flushed",n,tag)          end      else -        report_notes("internal error: note %s of '%s' is not initialized",n,tag) +        report_notes("internal error: note %a of %a is not initialized",n,tag)      end  end @@ -299,7 +299,7 @@ local function getsymbolpage(tag,n)      li = li and li.references      li = li and (li.symbolpage or li.realpage) or 0      if trace_notes or trace_references then -        report_notes("page number of note symbol %s of '%s' is %s",n,tag,li) +        report_notes("page number of note symbol %a of %a is %a",n,tag,li)      end      return li  end @@ -309,7 +309,7 @@ local function getnumberpage(tag,n)      li = li and li.references      li = li and li.realpage or 0      if trace_notes or trace_references then -        report_notes("page number of note number %s of '%s' is %s",n,tag,li) +        report_notes("page number of note number %s of %a is %a",n,tag,li)      end      return li  end @@ -325,7 +325,7 @@ local function getdeltapage(tag,n)              local symbolpage = references.symbolpage or 0              local notepage   = references.realpage   or 0              if trace_references then -                report_notes("note number %s of '%s' points from page %s to page %s ",n,tag,symbolpage,notepage) +                report_notes("note number %a of %a points from page %a to page %a",n,tag,symbolpage,notepage)              end              if notepage < symbolpage then                  what = 3 -- after @@ -359,7 +359,7 @@ function commands.flushnotes(tag,whatkind,how) -- store and postpone          if kind == "postpone" then              if nd and ns then                  if trace_notes then -                    report_notes("flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) +                    report_notes("flushing state %a of %a from %a to %a",whatkind,tag,ns,#nd)                  end                  for i=ns,#nd do                      context.handlenoteinsert(tag,i) @@ -370,7 +370,7 @@ function commands.flushnotes(tag,whatkind,how) -- store and postpone          elseif kind == "store" then              if nd and ns then                  if trace_notes then -                    report_notes("flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) +                    report_notes("flushing state %a of %a from %a to %a",whatkind,tag,ns,#nd)                  end                  -- todo: as registers: start, stop, inbetween                  for i=ns,#nd do @@ -394,15 +394,15 @@ function commands.flushnotes(tag,whatkind,how) -- store and postpone          elseif kind == "reset" then              if nd and ns then                  if trace_notes then -                    report_notes("flushing state %s of %s from %s to %s",whatkind,tag,ns,#nd) +                    report_notes("flushing state %a of %a from %a to %a",whatkind,tag,ns,#nd)                  end              end              state.start = nil          elseif trace_notes then -            report_notes("not flushing state %s of %s",whatkind,tag) +            report_notes("not flushing state %a of %a",whatkind,tag)          end      elseif trace_notes then -        report_notes("not flushing state %s of %s",whatkind,tag) +        report_notes("not flushing state %a of %a",whatkind,tag)      end  end diff --git a/tex/context/base/strc-num.lua b/tex/context/base/strc-num.lua index b82132a00..b0eae6b78 100644 --- a/tex/context/base/strc-num.lua +++ b/tex/context/base/strc-num.lua @@ -148,7 +148,7 @@ end  setmetatableindex(constructor,function(t,k)      if trace_counters then -        report_counters("unknown constructor %q",tostring(k)) +        report_counters("unknown constructor %a",k)      end      return dummyconstructor  end) @@ -209,7 +209,7 @@ local function savevalue(name,i)          local cs = tobesaved[name][i]          local cc = collected[name]          if trace_counters then -            report_counters("saving, counter: %s, value: %s",name,cd.number) +            report_counters("action %a, counter %s, value %s","save",name,cd.number)          end          local cr = cd.range          local old = (cc and cc[i] and cc[i][cr]) or 0 @@ -316,14 +316,14 @@ local function synchronize(name,d)      local dc = d.counter      if dc then          if trace_counters then -            report_counters("synchronize, counter: %s, name: %s, value: %s, action: setting",dc,name,d.number) +            report_counters("action %a, name %a, counter %a, value %a","synchronize",name,dc,d.number)          end          texsetcount("global",dc,d.number)      end      local cs = counterspecials[name]      if cs then          if trace_counters then -            report_counters("synchronize, counter: %s, name: %s, action: special",dc,name) +            report_counters("action %a, name %a, counter %a","synccommand",name,dc)          end          cs(name)      end @@ -339,7 +339,7 @@ local function reset(name,n)              d.number = number              d.own = nil              if trace_counters then -                report_counters("resetting, name: %s, sub: %s, value: %s",name,i,number) +                report_counters("action %a, name %a, sub %a, value %a","reset",name,i,number)              end              synchronize(name,d)          end @@ -356,7 +356,7 @@ local function set(name,n,value)          d.number = number          d.own = nil          if trace_counters then -            report_counters("setting, name: %s, value: %s",name,number) +            report_counters("action %a, name %a, sub %a, value %a","set",name,"no",number)          end          synchronize(name,d)      end @@ -370,7 +370,7 @@ local function check(name,data,start,stop)          d.number = number          d.own = nil          if trace_counters then -            report_counters("checking, name: %s, sub: %s, value: %s",name,i,number) +            report_counters("action %a, name %a, sub %a, value %a","check",name,i,number)          end          synchronize(name,d)      end @@ -436,28 +436,28 @@ function counters.add(name,n,delta)          if not level or level == -1 then              -- -1 is signal that we reset manually              if trace_counters then -                report_counters("adding, name: %s, level: manually, action: no checking",name) +                report_counters("action %a, name %a, sub %a, how %a","add",name,"no","no checking")              end          elseif level == -2 then              -- -2 is signal that we work per text              if trace_counters then -                report_counters("adding, name: %s, level: text, action: checking",name) +                report_counters("action %a, name %a, sub %a, how %a","add",name,"text","checking")              end              check(name,data,n+1)          elseif level > 0 or level == -3 then              -- within countergroup              if trace_counters then -                report_counters("adding, name: %s, level: %s, action: checking within group",name,level) +                report_counters("action %a, name %a, sub %a, how %a","add",name,level,"checking within group")              end              check(name,data,n+1)          elseif level == 0 then              -- happens elsewhere              if trace_counters then -                report_counters("adding, name: %s, level: %s, action: no checking",name,level) +                report_counters("action %a, name %a, sub %a, how %a","add",name,level,"no checking")              end          else              if trace_counters then -                report_counters("adding, name: %s, level: unknown, action: no checking",name) +                report_counters("action %a, name %a, sub %a, how %a","add",name,"unknown","no checking")              end          end          synchronize(name,d) @@ -470,12 +470,12 @@ function counters.check(level)      for name, cd in next, counterdata do          if level > 0 and cd.level == -3 then -- could become an option              if trace_counters then -                report_counters("resetting, name: %s, level: %s (head)",name,level) +                report_counters("action %a, name %a, sub %a, detail %a","reset",name,level,"head")              end              reset(name)          elseif cd.level == level then              if trace_counters then -                report_counters("resetting, name: %s, level: %s (normal)",name,level) +                report_counters("action %a, name %a, sub %a, detail %a","reset",name,level,"normal")              end              reset(name)          end @@ -596,54 +596,54 @@ function commands.checkcountersetup(name,level,start,state)      sections.setchecker(name,level,counters.reset)  end ---~ -- move to strc-pag.lua - ---~ function counters.analyze(name,counterspecification) ---~     local cd = counterdata[name] ---~     -- safeguard ---~     if not cd then ---~         return false, false, "no counter data" ---~     end ---~     -- section data ---~     local sectiondata = sections.current() ---~     if not sectiondata then ---~         return cd, false, "not in section" ---~     end ---~     local references = sectiondata.references ---~     if not references then ---~         return cd, false, "no references" ---~     end ---~     local section = references.section ---~     if not section then ---~         return cd, false, "no section" ---~     end ---~     sectiondata = sections.collected[references.section] ---~     if not sectiondata then ---~         return cd, false, "no section data" ---~     end ---~     -- local preferences ---~     local no = v_no ---~     if counterspecification and counterspecification.prefix == no then ---~         return cd, false, "current spec blocks prefix" ---~     end ---~     -- stored preferences (not used) ---~     if cd.prefix == no then ---~         return cd, false, "entry blocks prefix" ---~     end ---~     -- sectioning ---~     -- if sectiondata.prefix == no then ---~     --     return false, false, "sectiondata blocks prefix" ---~     -- end ---~     -- final verdict ---~     return cd, sectiondata, "okay" ---~ end - ---~ function counters.prefixedconverted(name,prefixspec,numberspec) ---~     local cd, prefixdata, result = counters.analyze(name,prefixspec) ---~     if cd then ---~         if prefixdata then ---~             sections.typesetnumber(prefixdata,"prefix",prefixspec or false,cd or false) ---~         end ---~         counters.converted(name,numberspec) ---~     end ---~ end +-- -- move to strc-pag.lua +-- +-- function counters.analyze(name,counterspecification) +--     local cd = counterdata[name] +--     -- safeguard +--     if not cd then +--         return false, false, "no counter data" +--     end +--     -- section data +--     local sectiondata = sections.current() +--     if not sectiondata then +--         return cd, false, "not in section" +--     end +--     local references = sectiondata.references +--     if not references then +--         return cd, false, "no references" +--     end +--     local section = references.section +--     if not section then +--         return cd, false, "no section" +--     end +--     sectiondata = sections.collected[references.section] +--     if not sectiondata then +--         return cd, false, "no section data" +--     end +--     -- local preferences +--     local no = v_no +--     if counterspecification and counterspecification.prefix == no then +--         return cd, false, "current spec blocks prefix" +--     end +--     -- stored preferences (not used) +--     if cd.prefix == no then +--         return cd, false, "entry blocks prefix" +--     end +--     -- sectioning +--     -- if sectiondata.prefix == no then +--     --     return false, false, "sectiondata blocks prefix" +--     -- end +--     -- final verdict +--     return cd, sectiondata, "okay" +-- end +-- +-- function counters.prefixedconverted(name,prefixspec,numberspec) +--     local cd, prefixdata, result = counters.analyze(name,prefixspec) +--     if cd then +--         if prefixdata then +--             sections.typesetnumber(prefixdata,"prefix",prefixspec or false,cd or false) +--         end +--         counters.converted(name,numberspec) +--     end +-- end diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 61f9dc69e..88a1dc480 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -293,9 +293,9 @@ function references.set(kind,prefix,tag,data)          if ref ~= "" then              if check_duplicates and pd[ref] then                  if prefix and prefix ~= "" then -                    report_references("redundant reference: %q in namespace %q",ref,prefix) +                    report_references("redundant reference %a in namespace %a",ref,prefix)                  else -                    report_references("redundant reference %q",ref) +                    report_references("redundant reference %a",ref)                  end              else                  n = n + 1 @@ -396,7 +396,7 @@ local function register_from_lists(collected,derived,pages,sections)                      local t = { kind, i, entry }                      for s in gmatch(reference,"%s*([^,]+)") do                          if trace_referencing then -                            report_references("list entry %s provides %s reference '%s' on realpage %s",i,kind,s,realpage) +                            report_references("list entry %a provides %a reference %a on realpage %a",i,kind,s,realpage)                          end                          c[s] = c[s] or t -- share them                          d[s] = d[s] or t -- share them @@ -714,7 +714,7 @@ local function resolve(prefix,reference,args,set) -- we start with prefix,refere                          set.has_tex = true                      end                  else -                --  report_references("funny pattern: %s",ri or "?") +                --  report_references("funny pattern %a",ri)                  end              end          end @@ -776,7 +776,8 @@ local function loadexternalreferences(name,utilitydata)          for prefix, set in next, external do              for reference, data in next, set do                  if trace_importing then -                    report_importing("registering external reference: regular | %s | %s | %s",name,prefix,reference) +                    report_importing("registering %a reference, kind %a, name %a, prefix %a, reference %a", +                        "external","regular",name,prefix,reference)                  end                  local section  = reference.section                  local realpage = reference.realpage @@ -807,7 +808,8 @@ local function loadexternalreferences(name,utilitydata)                          end                          for s in gmatch(reference,"%s*([^,]+)") do                              if trace_importing then -                                report_importing("registering external reference: %s | %s | %s | %s",kind,name,prefix,s) +                                report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", +                                    "external",kind,name,prefix,s)                              end                              target[s] = target[s] or entry                          end @@ -866,7 +868,8 @@ local function loadproductreferences(productname,componentname,utilitydata)          for prefix, set in next, productreferences do              for reference, data in next, set do                  if trace_importing then -                    report_importing("registering product reference: regular | %s | %s | %s",productname,prefix,reference) +                    report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", +                        "product","regular",productname,prefix,reference)                  end                  local section  = reference.section                  local realpage = reference.realpage @@ -920,13 +923,15 @@ local function loadproductreferences(productname,componentname,utilitydata)                          for s in gmatch(reference,"%s*([^,]+)") do                              if ptarget then                                  if trace_importing then -                                    report_importing("registering product reference: %s | %s | %s | %s",kind,productname,prefix,s) +                                    report_importing("registering %s reference, kind %a, name %a, prefix %a, reference %a", +                                        "product",kind,productname,prefix,s)                                  end                                  ptarget[s] = ptarget[s] or entry                              end                              if ctarget then                                  if trace_importing then -                                    report_importing("registering component reference: %s | %s | %s | %s",kind,productname,prefix,s) +                                    report_importing("registering %s reference, kind %a, name %a, prefix %a, referenc %a", +                                        "component",kind,productname,prefix,s)                                  end                                  ctarget[s] = ctarget[s] or entry                              end @@ -954,7 +959,7 @@ local function loadproductvariables(product,component,utilitydata)                          local numbers = firstsection.numberdata.numbers                          if numbers then                              if trace_importing then -                                report_importing("initializing section number to %s",concat(numbers,":")) +                                report_importing("initializing section number to %:t",numbers)                              end                              productdata.firstsection = firstsection                              structures.documents.preset(numbers) @@ -965,7 +970,7 @@ local function loadproductvariables(product,component,utilitydata)                          local number = firstpage and firstpage.number                          if number then                              if trace_importing then -                                report_importing("initializing page number to %s",number) +                                report_importing("initializing page number to %a",number)                              end                              productdata.firstpage = firstpage                              counters.set("userpage",1,number) @@ -1017,7 +1022,7 @@ function structures.references.loadpresets(product,component) -- we can consider              local utilitydata = job.loadother(fullname)              if utilitydata then                  if trace_importing then -                    report_importing("loading references for component %s of product %s from %s",component,product,fullname) +                    report_importing("loading references for component %a of product %a from %a",component,product,fullname)                  end                  loadproductvariables (product,component,utilitydata)                  loadproductreferences(product,component,utilitydata) @@ -1040,7 +1045,7 @@ if useproduct then              local component = justacomponent()              if component then                  if trace_referencing or trace_importing then -                    report_references("loading presets for component '%s' of product '%s'",component,product) +                    report_references("loading presets for component %a of product %a",component,product)                  end                  structures.references.loadpresets(product,component)              end @@ -1059,9 +1064,9 @@ local function report_identify_special(set,var,i,type)      local error     = var.error      local kind      = var.kind      if error then -        report_identifying("type %s: %s, n: %s, prefix: %s, special: %s, error: %s",type,reference,i,prefix,special,error) +        report_identifying("type %a, reference %a, index %a, prefix %a, special %a, error %a",type,reference,i,prefix,special,error)      else -        report_identifying("type %s: %s, n: %s, prefix: %s, special: %s, kind: %s",type,reference,i,prefix,special,kind) +        report_identifying("type %a, reference %a, index %a, prefix %a, special %a, kind %a",type,reference,i,prefix,special,kind)      end  end @@ -1072,9 +1077,9 @@ local function report_identify_arguments(set,var,i,type)      local error     = var.error      local kind      = var.kind      if error then -        report_identifying("type %s: %s, n: %s, prefix: %s, arguments: %s, error: %s",type,reference,i,prefix,arguments,error) +        report_identifying("type %a, reference %a, index %a, prefix %a, arguments %a, error %a",type,reference,i,prefix,arguments,error)      else -        report_identifying("type %s: %s, n: %s, prefix: %s, arguments: %s, kind: %s",type,reference,i,prefix,arguments,kind) +        report_identifying("type %a, reference %a, index %a, prefix %a, arguments %a, kind %a",type,reference,i,prefix,arguments,kind)      end  end @@ -1086,15 +1091,15 @@ local function report_identify_outer(set,var,i,type)      local kind      = var.kind      if outer then          if error then -            report_identifying("type %s: %s, n: %s, prefix: %s, outer: %s, error: %s",type,reference,i,prefix,outer,error) +            report_identifying("type %a, reference %a, index %a, prefix %a, outer %a, error %a",type,reference,i,prefix,outer,error)          else -            report_identifying("type %s: %s, n: %s, prefix: %s, outer: %s, kind: %s",type,reference,i,prefix,outer,kind) +            report_identifying("type %a, reference %a, index %a, prefix %a, outer %a, kind %a",type,reference,i,prefix,outer,kind)          end      else          if error then -            report_identifying("type %s: %s, n: %s, prefix: %s, error: %s",type,reference,i,prefix,error) +            report_identifying("type %a, reference %a, index %a, prefix %a, error %a",type,reference,i,prefix,error)          else -            report_identifying("type %s: %s, n: %s, prefix: %s, kind: %s",type,reference,i,prefix,kind) +            report_identifying("type %a, reference %a, index %a, prefix %a, kind %a",type,reference,i,prefix,kind)          end      end  end @@ -1238,7 +1243,7 @@ local function identify_inner(set,var,prefix,collected,derived,tobesaved)                  ri(var)              else                  -- can't happen as we catch it with a metatable now -                report_references("unknown inner resolver for '%s'",i[1]) +                report_references("unknown inner resolver for %a",i[1])              end          else              -- no prefixes here @@ -1631,7 +1636,7 @@ function references.setinnermethod(m)          end      end      function references.setinnermethod() -        report_references("inner method is already set and frozen to '%s'",innermethod) +        report_references("inner method is already set and frozen to %a",innermethod)      end  end @@ -1741,20 +1746,20 @@ function references.filter(name,...) -- number page title ...                  filter = filter and (filter[name] or filter.unknown or filters.generic[name] or filters.generic.unknown)                  if filter then                      if trace_referencing then -                        report_references("name '%s', kind '%s', using dedicated filter",name,kind) +                        report_references("name %a, kind %a, using dedicated filter",name,kind)                      end                      filter(data,name,...)                  elseif trace_referencing then -                    report_references("name '%s', kind '%s', using generic filter",name,kind) +                    report_references("name %a, kind %a, using generic filter",name,kind)                  end              elseif trace_referencing then -                report_references("name '%s', unknown kind",name) +                report_references("name %a, unknown kind",name)              end          end      elseif name == "realpage" then          context(0)      elseif trace_referencing then -        report_references("name '%s', no reference",name) +        report_references("name %a, no reference",name)      end  end @@ -1870,7 +1875,7 @@ function filters.section.number(data,what,prefixspec)          elseif numberdata.hidenumber then              local references = data.references              if trace_empty then -                report_empty("reference %q has a hidden number",references.reference or "?") +                report_empty("reference %a has a hidden number",references.reference)                  context.emptyreference() -- maybe an option              end          else diff --git a/tex/context/base/strc-reg.lua b/tex/context/base/strc-reg.lua index 23609cfd9..40cd3455b 100644 --- a/tex/context/base/strc-reg.lua +++ b/tex/context/base/strc-reg.lua @@ -169,9 +169,9 @@ local function filtercollected(names,criterium,number,collected,prevmode)      end      if trace_registers then          if detail then -            report_registers("criterium: %s, %s, found: %s",criterium,detail,#result) +            report_registers("criterium %a, detail %a, found %a",criterium,detail,#result)          else -            report_registers("criterium: %s, found: %s",criterium,#result) +            report_registers("criterium %a, detail %a, found %a",criterium,nil,#result)          end      end      return result @@ -523,7 +523,7 @@ function registers.finalize(data,options) -- maps character to index (order)          local entry, tag = firstofsplit(v)          if tag ~= lasttag then              if trace_registers then -                report_registers("splitting at %s",tag) +                report_registers("splitting at %a",tag)              end              done, nofdone = { }, 0              nofsplit = nofsplit + 1 @@ -679,8 +679,7 @@ function registers.flush(data,options,prefixspec,pagespec)                      list[#list] = nil                  else                      -- we have an \seeindex{Foo}{Bar} without Foo being defined anywhere -                    report_registers("invalid see entry in register '%s', reference '%s'", -                        entry.metadata.name or "?",list[1][1] or "?") +                    report_registers("invalid see entry in register %a, reference %a",entry.metadata.name,list[1][1])                  end              end          end diff --git a/tex/context/base/symb-ini.lua b/tex/context/base/symb-ini.lua index 559b032e4..9b3f55d2f 100644 --- a/tex/context/base/symb-ini.lua +++ b/tex/context/base/symb-ini.lua @@ -22,13 +22,13 @@ local function action(name,foundname)      -- context.startnointerference()      context.startreadingfile()      context.input(foundname) -    status_symbols("loaded: library '%s'",name) +    status_symbols("library %a loaded",name)      context.stopreadingfile()      -- context.stopnointerference()  end  local function failure(name) -    report_symbols("unknown: library '%s'",name) +    report_symbols("library %a is unknown",name)  end  function symbols.uselibrary(name) diff --git a/tex/context/base/tabl-tbl.lua b/tex/context/base/tabl-tbl.lua index 7291facd3..19548e7b3 100644 --- a/tex/context/base/tabl-tbl.lua +++ b/tex/context/base/tabl-tbl.lua @@ -13,7 +13,6 @@ local context, commands = context, commands  local tonumber = tonumber  local gsub, rep, sub, find = string.gsub, string.rep, string.sub, string.find -  local P, C, Cc, Ct, lpegmatch = lpeg.P, lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.match  local settexcount = tex.setcount diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua index 01b7ef9eb..cf9a4a0a6 100644 --- a/tex/context/base/tabl-xtb.lua +++ b/tex/context/base/tabl-xtb.lua @@ -468,13 +468,12 @@ function xtables.reflow_width()          if not options[v_stretch] then              -- not needed              if trace_xtable then -                report_xtable("too wide but no stretch, delta: %s",points(delta)) +                report_xtable("too wide but no stretch, delta %p",delta)              end          elseif options[v_width] then              local factor = delta / width              if trace_xtable then -                report_xtable("proportional stretch, delta: %s, width: %s, factor: %s", -                    points(delta),points(width),factor) +                report_xtable("proportional stretch, delta %p, width %p, factor %a",delta,width,factor)              end              for c=1,nofcolumns do                  widths[c] = widths[c] + factor * widths[c] @@ -483,8 +482,7 @@ function xtables.reflow_width()              -- frozen -> a column with option=fixed will not stretch              local extra = delta / (nofcolumns - noffrozen)              if trace_xtable then -                report_xtable("normal stretch, delta: %s, extra: %s", -                    points(delta),points(extra)) +                report_xtable("normal stretch, delta %p, extra %p",delta,extra)              end              for c=1,nofcolumns do                  if not frozencolumns[c] then @@ -497,8 +495,7 @@ function xtables.reflow_width()              done = false              local available = (widetotal + delta) / nofwide              if trace_xtable then -                report_xtable("shrink check, total: %s, delta: %s, columns: %s, fixed: %s", -                    points(widetotal),points(delta),nofwide,points(available)) +                report_xtable("shrink check, total %p, delta %p, columns %s, fixed %p",widetotal,delta,nofwide,available)              end              for c=1,nofcolumns do                  if autowidths[c] and available >= widths[c] then @@ -517,8 +514,7 @@ function xtables.reflow_width()          if options[v_width] then -- not that much (we could have a clever vpack loop balancing .. no fun)              local factor = (widetotal + delta) / width              if trace_xtable then -                report_xtable("proportional shrink used, total: %s, delta: %s, columns: %s, factor: %s", -                    points(widetotal),points(delta),nofwide,factor) +                report_xtable("proportional shrink used, total %p, delta %p, columns %s, factor %s",widetotal,delta,nofwide,factor)              end              for c=1,nofcolumns do                  if autowidths[c] then @@ -528,8 +524,7 @@ function xtables.reflow_width()          else              local available = (widetotal + delta) / nofwide              if trace_xtable then -                report_xtable("normal shrink used, total: %s, delta: %s, columns: %s, fixed: %s", -                    points(widetotal),points(delta),nofwide,points(available)) +                report_xtable("normal shrink used, total %p, delta %p, columns %s, fixed %p",widetotal,delta,nofwide,available)              end              for c=1,nofcolumns do                  if autowidths[c] then @@ -591,7 +586,7 @@ local function showspans(data)                  line[#line+1] = "none"              end          end -        report_xtable("%3d : %s : %s",r,namedmodes[modes[r]] or "----",concat(line," ")) +        report_xtable("%3d : %s : % t",r,namedmodes[modes[r]] or "----",line)      end  end diff --git a/tex/context/base/trac-lmx.lua b/tex/context/base/trac-lmx.lua index fb3211079..b7e811860 100644 --- a/tex/context/base/trac-lmx.lua +++ b/tex/context/base/trac-lmx.lua @@ -138,7 +138,7 @@ local function loadedfile(name)      name = resolvers and resolvers.findfile and resolvers.findfile(name) or name      local data = io.loaddata(name)      if not data or data == "" then -        report_lmx("empty file: %s",name) +        report_lmx("file %a is empty",name)      end      return data  end @@ -173,14 +173,14 @@ local function do_variable(str)          -- nothing      elseif type(value) == "string" then          if #value > 80 then -            report_lmx("variable %q => %s ...",str,collapsespaces(sub(value,1,80))) +            report_lmx("variable %a is set to: %s ...",str,collapsespaces(sub(value,1,80)))          else -            report_lmx("variable %q => %s",str,collapsespaces(value)) +            report_lmx("variable %a is set to: %s",str,collapsespaces(value))          end      elseif type(value) == "nil" then -        report_lmx("variable %q => <!-- unset -->",str) +        report_lmx("variable %a is set to: %s",str,"<!-- unset -->")      else -        report_lmx("variable %q => %q",str,tostring(value)) +        report_lmx("variable %a is set to: %S",str,value)      end      if type(value) == "function" then -- obsolete ... will go away          return value(str) @@ -236,7 +236,7 @@ local function do_include(filename)      end      if not data or data == "" then          data = format("<!-- unknown lmx include file: %s -->",filename) -        report_lmx("empty include file: %s",filename) +        report_lmx("include file %a is empty",filename)      else       -- report_lmx("included file: %s",filename)          data = do_nested_include(data) @@ -271,10 +271,10 @@ function lmx.initialize(d,v)          if variables ~= d then              setmetatableindex(variables,d)              if trace_variables then -                report_lmx("variables => given defaults => lmx variables") +                report_lmx("using chain: variables => given defaults => lmx variables")              end          elseif trace_variables then -            report_lmx("variables == given defaults => lmx variables") +            report_lmx("using chain: variables == given defaults => lmx variables")          end      elseif d ~= v then          setmetatableindex(v,d) @@ -283,19 +283,19 @@ function lmx.initialize(d,v)              if variables ~= v then                  setmetatableindex(variables,v)                  if trace_variables then -                    report_lmx("variables => given variables => given defaults => lmx variables") +                    report_lmx("using chain: variables => given variables => given defaults => lmx variables")                  end              elseif trace_variables then -                report_lmx("variables == given variables => given defaults => lmx variables") +                report_lmx("using chain: variables == given variables => given defaults => lmx variables")              end          else              if variables ~= v then                  setmetatableindex(variables,v)                  if trace_variables then -                    report_lmx("variabes => given variables => given defaults") +                    report_lmx("using chain: variabes => given variables => given defaults")                  end              elseif trace_variables then -                report_lmx("variables == given variables => given defaults") +                report_lmx("using chain: variables == given variables => given defaults")              end          end      else @@ -303,10 +303,10 @@ function lmx.initialize(d,v)          if variables ~= v then              setmetatableindex(variables,v)              if trace_variables then -                report_lmx("variables => given variables => lmx variables") +                report_lmx("using chain: variables => given variables => lmx variables")              end          elseif trace_variables then -            report_lmx("variables == given variables => lmx variables") +            report_lmx("using chain: variables == given variables => lmx variables")          end      end      result = { } @@ -590,7 +590,7 @@ end  function lmx.convertfile(templatefile,variables,nocache)      if trace_variables then -- will become templates -        report_lmx("converting file: %s",templatefile) +        report_lmx("converting file %a",templatefile)      end      local converter = loadedfiles[templatefile]      if not converter then @@ -602,7 +602,7 @@ end  function lmxconvert(templatefile,resultfile,variables,nocache) -- or (templatefile,variables)      if trace_variables then -- will become templates -        report_lmx("converting file: %s",templatefile) +        report_lmx("converting file %a",templatefile)      end      if not variables and type(resultfile) == "table" then          variables = resultfile diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index 40d2860be..22d46e7bd 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -7,9 +7,7 @@ if not modules then modules = { } end modules ['trac-log'] = {  }  -- todo: less categories, more subcategories (e.g. nodes) - ---~ io.stdout:setvbuf("no") ---~ io.stderr:setvbuf("no") +-- todo: split into basics and ctx specific  local write_nl, write = texio and texio.write_nl or print, texio and texio.write or io.write  local format, gmatch, find = string.format, string.gmatch, string.find @@ -17,13 +15,14 @@ local concat, insert, remove = table.concat, table.insert, table.remove  local topattern = string.topattern  local texcount = tex and tex.count  local next, type, select = next, type, select +local utfchar = utf.char  local setmetatableindex = table.setmetatableindex  local formatters        = string.formatters  --[[ldx--  <p>This is a prelude to a more extensive logging module. We no longer -provide <l n='xml'/> based logging a sparsing is relatively easy anyway.</p> +provide <l n='xml'/> based logging as parsing is relatively easy anyway.</p>  --ldx]]--  logs       = logs or { } @@ -37,6 +36,36 @@ webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net  wiki     : http://contextgarden.net  ]] +-- -- we extend the formatters: +-- +-- function utilities.strings.unichr(s) return "U+" .. format("%05X",s) .. " (" .. utfchar(s) .. ")" end +-- function utilities.strings.chruni(s) return utfchar(s) .. " (U+" .. format("%05X",s) .. ")" end +-- +-- utilities.strings.formatters.add ( +--     string.formatters, "uni", +--     [[unichr(%s)]], +--     [[local unichr = utilities.strings.unichr]] +-- ) +-- +-- utilities.strings.formatters.add ( +--     string.formatters, "chr", +--     [[chruni(%s)]], +--     [[local chruni = utilities.strings.chruni]] +-- ) + +utilities.strings.formatters.add ( +    formatters, "unichr", +    [["U+" .. format("%%05X",%s) .. " (" .. utfchar(%s) .. ")"]] +) + +utilities.strings.formatters.add ( +    formatters, "chruni", +    [[utfchar(%s) .. " (U+" .. format("%%05X",%s) .. ")"]] +) + +-- print(formatters["Missing character %!chruni! in font."](234)) +-- print(formatters["Missing character %!unichr! in font."](234)) +  -- basic loggers  local function ignore() end @@ -49,6 +78,8 @@ local direct, subdirect, writer, pushtarget, poptarget  if tex and (tex.jobname or tex.formatname) then + -- local format = string.formatter +      local valueiskey   = { __index = function(t,k) t[k] = k return k end } -- will be helper      local target       = "term and log" @@ -69,9 +100,13 @@ if tex and (tex.jobname or tex.formatname) then      local f_one = formatters["%-15s > %s\n"]      local f_two = formatters["%-15s >\n"] +    -- we can use formatters but best check for % then because for simple messages +    -- we con't want this overhead for single messages (not that there are that +    -- many; we could have a special weak table) +      report = function(a,b,c,...)          if c then -            write_nl(target,f_one(translations[a],format(formats[b],c,...))) +            write_nl(target,f_one(translations[a],formatters[formats[b]](c,...)))          elseif b then              write_nl(target,f_one(translations[a],formats[b]))          elseif a then @@ -86,7 +121,7 @@ if tex and (tex.jobname or tex.formatname) then      direct = function(a,b,c,...)          if c then -            return f_one(translations[a],format(formats[b],c,...)) +            return f_one(translations[a],formatters[formats[b]](c,...))          elseif b then              return f_one(translations[a],formats[b])          elseif a then @@ -101,7 +136,7 @@ if tex and (tex.jobname or tex.formatname) then      subreport = function(a,s,b,c,...)          if c then -            write_nl(target,f_one(translations[a],translations[s],format(formats[b],c,...))) +            write_nl(target,f_one(translations[a],translations[s],formatters[formats[b]](c,...)))          elseif b then              write_nl(target,f_one(translations[a],translations[s],formats[b]))          elseif a then @@ -116,7 +151,7 @@ if tex and (tex.jobname or tex.formatname) then      subdirect = function(a,s,b,c,...)          if c then -            return f_one(translations[a],translations[s],format(formats[b],c,...)) +            return f_one(translations[a],translations[s],formatters[formats[b]](c,...))          elseif b then              return f_one(translations[a],translations[s],formats[b])          elseif a then @@ -131,7 +166,7 @@ if tex and (tex.jobname or tex.formatname) then      status = function(a,b,c,...)          if c then -            write_nl(target,f_one(translations[a],format(formats[b],c,...))) +            write_nl(target,f_one(translations[a],formatters[formats[b]](c,...)))          elseif b then              write_nl(target,f_one(translations[a],formats[b]))          elseif a then @@ -182,6 +217,8 @@ if tex and (tex.jobname or tex.formatname) then  else +--     local format = string.formatter +      logs.flush = ignore      writer = write_nl @@ -195,7 +232,7 @@ else      report = function(a,b,c,...)          if c then -            write_nl(f_one(a,format(b,c,...))) +            write_nl(f_one(a,formatters[b](c,...)))          elseif b then              write_nl(f_one(a,b))          elseif a then @@ -210,7 +247,7 @@ else      subreport = function(a,sub,b,c,...)          if c then -            write_nl(f_one(a,sub,format(b,c,...))) +            write_nl(f_one(a,sub,formatters[b](c,...)))          elseif b then              write_nl(f_one(a,sub,b))          elseif a then @@ -225,7 +262,7 @@ else      status = function(a,b,c,...) -- not to be used in lua anyway          if c then -            write_nl(f_one(a,format(b,c,...))) +            write_nl(f_one(a,formatters[b](c,...)))          elseif b then              write_nl(f_one(a,b)) -- b can have %'s          elseif a then @@ -407,7 +444,7 @@ function logs.show()              state = "unknown"          end          -- no new here -        report("logging","category: '%s', subcategories: '%s', state: '%s'",category,subcategories,state) +        report("logging","category %a, subcategories %a, state %a",category,subcategories,state)      end      report("logging","categories: %s, max category: %s, max subcategory: %s, max combined: %s",n,c,s,max)  end @@ -500,7 +537,7 @@ function logs.show_open(name)   --         nesting = nesting + 1   --         report_files("level %s, opening %s",nesting,name)   --     else - --         write(format("(%s",name)) -- tex adds a space + --         write(formatters["(%s"](name)) -- tex adds a space   --     end   -- end  end @@ -521,7 +558,7 @@ function logs.show_load(name)   --     if verbose then   --         report_files("level %s, loading %s",nesting+1,name)   --     else - --         write(format("(%s)",name)) + --         write(formatters["(%s)"](name))   --     end   -- end  end @@ -598,20 +635,20 @@ function logs.application(t)      return t  end --- somewhat special +-- somewhat special .. will be redone (already a better solution in place in lmx)  -- logging to a file ---~ local syslogname = "oeps.xxx" ---~ ---~ for i=1,10 do ---~     logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") ---~ end +-- local syslogname = "oeps.xxx" +-- +-- for i=1,10 do +--     logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") +-- end  function logs.system(whereto,process,jobname,category,...) -    local message = format("%s %s => %s => %s => %s\r",os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) +    local message = formatters["%s %s => %s => %s => %s\r"](os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...))      for i=1,10 do -        local f = io.open(whereto,"a") -- we can consider keepint the file open +        local f = io.open(whereto,"a") -- we can consider keeping the file open          if f then              f:write(message)              f:close() @@ -628,18 +665,18 @@ function logs.obsolete(old,new)      local o = loadstring("return " .. new)()      if type(o) == "function" then          return function(...) -            report_system("function %s is obsolete, use %s",old,new) +            report_system("function %a is obsolete, use %a",old,new)              loadstring(old .. "=" .. new  .. " return ".. old)()(...)          end      elseif type(o) == "table" then          local t, m = { }, { }          m.__index = function(t,k) -            report_system("table %s is obsolete, use %s",old,new) +            report_system("table %a is obsolete, use %a",old,new)              m.__index, m.__newindex = o, o              return o[k]          end          m.__newindex = function(t,k,v) -            report_system("table %s is obsolete, use %s",old,new) +            report_system("table %a is obsolete, use %a",old,new)              m.__index, m.__newindex = o, o              o[k] = v          end @@ -665,7 +702,8 @@ else      end  end --- do we still need io.flush then? +-- this is somewhat slower but prevents out-of-order messages when print is mixed +-- with texio.write  io.stdout:setvbuf('no')  io.stderr:setvbuf('no') diff --git a/tex/context/base/trac-pro.lua b/tex/context/base/trac-pro.lua index 43c5ef7db..d6e0d0339 100644 --- a/tex/context/base/trac-pro.lua +++ b/tex/context/base/trac-pro.lua @@ -26,17 +26,17 @@ local registered = { }  local function report_index(k,name)      if trace_namespaces then -        report_system("reference to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) +        report_system("reference to %a in protected namespace %a: %s",k,name,debug.traceback())      else -        report_system("reference to '%s' in protected namespace '%s'",k,name) +        report_system("reference to %a in protected namespace %a",k,name)      end  end  local function report_newindex(k,name)      if trace_namespaces then -        report_system("assignment to '%s' in protected namespace '%s', %s",k,name,debug.traceback()) +        report_system("assignment to %a in protected namespace %a: %s",k,name,debug.traceback())      else -        report_system("assignment to '%s' in protected namespace '%s'",k,name) +        report_system("assignment to %a in protected namespace %a",k,name)      end  end diff --git a/tex/context/base/trac-set.lua b/tex/context/base/trac-set.lua index ddbd94825..9dc5dd9da 100644 --- a/tex/context/base/trac-set.lua +++ b/tex/context/base/trac-set.lua @@ -42,12 +42,12 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti                      local oldvalue = functions.value                      if functions.frozen then                          if trace_initialize then -                            setter.report("%s: %q is frozen to %q",filename,key,tostring(oldvalue)) +                            setter.report("%s: %a is %s to %a",filename,key,"frozen",oldvalue)                          end                      elseif #functions > 0 and not oldvalue then  --                     elseif #functions > 0 and oldvalue == nil then                          if trace_initialize then -                            setter.report("%s: %q is set to %q",filename,key,tostring(newvalue)) +                            setter.report("%s: %a is %s to %a",filename,key,"set",newvalue)                          end                          for i=1,#functions do                              functions[i](newvalue) @@ -56,7 +56,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti                          functions.frozen = functions.frozen or frozen                      else                          if trace_initialize then -                            setter.report("%s: %q is kept as %q",filename,key,tostring(oldvalue)) +                            setter.report("%s: %a is %s as %a",filename,key,"kept",oldvalue)                          end                      end                  else @@ -65,7 +65,7 @@ function setters.initialize(filename,name,values) -- filename only for diagnosti                      functions = { default = newvalue, frozen = frozen }                      data[key] = functions                      if trace_initialize then -                        setter.report("%s: %q default to %q",filename,key,tostring(newvalue)) +                        setter.report("%s: %a is %s to %a",filename,key,"defaulted",newvalue)                      end                  end              end @@ -148,7 +148,7 @@ function setters.register(t,what,...)          functions = { }          data[what] = functions          if trace_initialize then -            t.report("defining %s",what) +            t.report("defining %a",what)          end      end      local default = functions.default -- can be set from cnf file @@ -157,7 +157,7 @@ function setters.register(t,what,...)          local typ = type(fnc)          if typ == "string" then              if trace_initialize then -                t.report("coupling %s to %s",what,fnc) +                t.report("coupling %a to %a",what,fnc)              end              local s = fnc -- else wrong reference              fnc = function(value) set(t,s,value) end @@ -290,28 +290,28 @@ local trace_experiments = false local trace_experiments = false  trackers.regist  function directives.enable(...)      if trace_directives then -        d_report("enabling: %s",concat({...}," ")) +        d_report("enabling: % t",{...})      end      d_enable(...)  end  function directives.disable(...)      if trace_directives then -        d_report("disabling: %s",concat({...}," ")) +        d_report("disabling: % t",{...})      end      d_disable(...)  end  function experiments.enable(...)      if trace_experiments then -        e_report("enabling: %s",concat({...}," ")) +        e_report("enabling: % t",{...})      end      e_enable(...)  end  function experiments.disable(...)      if trace_experiments then -        e_report("disabling: %s",concat({...}," ")) +        e_report("disabling: % t",{...})      end      e_disable(...)  end diff --git a/tex/context/base/trac-tim.lua b/tex/context/base/trac-tim.lua index e76882afc..25ae6b1bc 100644 --- a/tex/context/base/trac-tim.lua +++ b/tex/context/base/trac-tim.lua @@ -27,7 +27,7 @@ end  function progress.save(name)      local filename = (name or progress.defaultfilename) .. ".lut" -    report_timing("saving data in %q",filename) +    report_timing("saving data in %a",filename)      table.save(filename,nodes.snapshots.getsamples())      nodes.snapshots.resetsamples()  end diff --git a/tex/context/base/type-ini.lua b/tex/context/base/type-ini.lua index 758fb5683..03cdb0fe5 100644 --- a/tex/context/base/type-ini.lua +++ b/tex/context/base/type-ini.lua @@ -30,13 +30,13 @@ end  local name_one, name_two  local function failure_two(name) -    report_typescripts("unknown: library '%s' or '%s'",name_one,name_two) +    report_typescripts("unknown library %a or %a",name_one,name_two)  end  local function failure_one(name)      name_two = gsub(name,"%-.*$","")      if name_two == name then -        report_typescripts("unknown: library '%s'",name_one) +        report_typescripts("unknown library %a",name_one)      else          commands.uselibrary {              name     = name_two, @@ -62,7 +62,7 @@ end  local patterns = { "type-imp-%s.mkiv", "type-imp-%s.tex" }  local function failure(name) -    report_typescripts("unknown: library '%s'",name) +    report_typescripts("unknown library %a",name)  end  function commands.loadtypescriptfile(name) -- a more specific name diff --git a/tex/context/base/typo-bld.lua b/tex/context/base/typo-bld.lua index 97893ad2b..ed700add7 100644 --- a/tex/context/base/typo-bld.lua +++ b/tex/context/base/typo-bld.lua @@ -76,7 +76,7 @@ function constructors.start(name)      if mainconstructor ~= unsetvalue then          constructors.enable()      end ---     report_parbuilders("start %s",name) + -- report_parbuilders("start %a",name)  end  function constructors.stop() @@ -86,7 +86,7 @@ function constructors.stop()      if mainconstructor == unsetvalue then          constructors.disable()      end ---     report_parbuilders("stop") + -- report_parbuilders("stop")  end  -- return values: @@ -107,7 +107,7 @@ function constructors.handler(head,followed_by_display)                  if handler then                      return handler(head,followed_by_display)                  else -                    report_parbuilders("contructor method '%s' is not defined",tostring(method)) +                    report_parbuilders("contructor method %a is not defined",tostring(method))                      return true -- let tex break                  end              end diff --git a/tex/context/base/typo-cap.lua b/tex/context/base/typo-cap.lua index 0b9e52749..0285b262e 100644 --- a/tex/context/base/typo-cap.lua +++ b/tex/context/base/typo-cap.lua @@ -273,10 +273,10 @@ local function process(namespace,attribute,head) -- not real fast but also not u                      start, ok = action(start,attribute,attr)                      done = done and ok                      if trace_casing then -                        report_casing("case trigger %s, instance %s, result %s",attr%100,div(attr,100),tostring(ok)) +                        report_casing("case trigger %a, instance %a, result %a",attr%100,div(attr,100),ok)                      end                  elseif trace_casing then -                    report_casing("unknown case trigger %s",attr) +                    report_casing("unknown case trigger %a",attr)                  end              end          end diff --git a/tex/context/base/typo-dig.lua b/tex/context/base/typo-dig.lua index 30d7d96ac..e6c65399d 100644 --- a/tex/context/base/typo-dig.lua +++ b/tex/context/base/typo-dig.lua @@ -92,7 +92,7 @@ actions[1] = function(head,start,attribute,attr)          local oldwidth, newwidth = start.width, getdigitwidth(font)          if newwidth ~= oldwidth then              if trace_digits then -                report_digits("digit trigger %s, instance %s, char 0x%05X, unicode 0x%05X, delta %s", +                report_digits("digit trigger %a, instance %a, char %C, unicode %U, delta %s",                      attr%100,div(attr,100),char,what,newwidth-oldwidth)              end              head, start = nodes.aligned(head,start,start,newwidth,"middle") @@ -114,7 +114,7 @@ local function process(namespace,attribute,head)                      head, current, ok = action(head,current,attribute,attr)                      done = done and ok                  elseif trace_digits then -                    report_digits("unknown digit trigger %s",attr) +                    report_digits("unknown digit trigger %a",attr)                  end              end          end diff --git a/tex/context/base/typo-itc.lua b/tex/context/base/typo-itc.lua index 57b4e38b8..ef44a7f28 100644 --- a/tex/context/base/typo-itc.lua +++ b/tex/context/base/typo-itc.lua @@ -33,8 +33,6 @@ local unsetvalue          = attributes.unsetvalue  local new_correction_kern = nodes.pool.fontkern  local new_correction_glue = nodes.pool.glue -local points              = number.points -  local fonthashes          = fonts.hashes  local fontdata            = fonthashes.identifiers  local italicsdata         = fonthashes.italics @@ -69,7 +67,7 @@ local function setitalicinfont(font,char)                  end              end              if trace_italics then -                report_italics("setting italic correction of %s (U+%05X) of font %s to %s",utfchar(char),char,font,points(italic)) +                report_italics("setting italic correction of %C of font %a to %p",char,font,italic)              end              character.italic_correction = italic or 0          end @@ -100,18 +98,18 @@ local function process(namespace,attribute,head)                  if italic ~= 0 then                      if data then                          if trace_italics then -                            report_italics("ignoring %s between italic %s and italic %s",points(italic),utfchar(prevchar),utfchar(char)) +                            report_italics("ignoring %p between italic %C and italic %C",italic,prevchar,char)                          end                      else                          if trace_italics then -                            report_italics("inserting %s between italic %s and regular %s",points(italic),utfchar(prevchar),utfchar(char)) +                            report_italics("inserting %p between italic %C and regular %C",italic,prevchar,char)                          end                          insert_node_after(head,previous,new_correction_kern(italic))                          done = true                      end                  elseif inserted and data then                      if trace_italics then -                        report_italics("deleting last correction before %s",utfchar(char)) +                        report_italics("deleting last correction before %C",char)                      end                      delete_node(head,inserted)                  else @@ -154,7 +152,7 @@ local function process(namespace,attribute,head)          elseif id == glue_code then              if italic ~= 0 then                  if trace_italics then -                    report_italics("inserting %s between italic %s and glue",points(italic),utfchar(prevchar)) +                    report_italics("inserting %p between italic %C and glue",italic,prevchar)                  end                  inserted = new_correction_glue(italic) -- maybe just add ? else problem with penalties                  insert_node_after(head,previous,inserted) @@ -163,7 +161,7 @@ local function process(namespace,attribute,head)              end          elseif italic ~= 0 then              if trace_italics then -                report_italics("inserting %s between italic %s and whatever",points(italic),utfchar(prevchar)) +                report_italics("inserting %p between italic %C and whatever",italic,prevchar)              end              inserted = nil              insert_node_after(head,previous,new_correction_kern(italic)) @@ -174,7 +172,7 @@ local function process(namespace,attribute,head)      end      if italic ~= 0 and lastattr > 1 then -- more control is needed here          if trace_italics then -            report_italics("inserting %s between italic %s and end of list",points(italic),utfchar(prevchar)) +            report_italics("inserting %p between italic %C and end of list",italic,prevchar)          end          insert_node_after(head,previous,new_correction_kern(italic))          done = true @@ -235,7 +233,7 @@ function commands.setupitaliccorrection(option) -- no grouping !          texattribute[a_italics] = variant      end      if trace_italics then -        report_italics("force: %s, variant: %s",tostring(forcedvariant),tostring(variant ~= unsetvalue and variant)) +        report_italics("forcing %a, variant %a",forcedvariant,variant ~= unsetvalue and variant)      end  end diff --git a/tex/context/base/typo-mar.lua b/tex/context/base/typo-mar.lua index 02f425298..9f9fe9168 100644 --- a/tex/context/base/typo-mar.lua +++ b/tex/context/base/typo-mar.lua @@ -234,10 +234,10 @@ local function showstore(store,banner,location)      if next(store) then          for i, si in table.sortedpairs(store) do              local si =store[i] -            report_margindata("%s: stored in %s at %s: %s => %s",banner,location,i,validstring(si.name,"no name"),nodes.toutf(si.box.list)) +            report_margindata("%s: stored in %a at %s: %a => %s",banner,location,i,validstring(si.name,"no name"),nodes.toutf(si.box.list))          end      else -        report_margindata("%s: nothing stored in %s",banner,location) +        report_margindata("%s: nothing stored in location %a",banner,location)      end  end @@ -249,7 +249,7 @@ function margins.save(t)      local inline   = t.inline      local scope    = t.scope or v_global      if not content then -        report_margindata("ignoring empty margin data: %s",location or "unknown") +        report_margindata("ignoring empty margin data %a",location or "unknown")          return      end      local store @@ -258,13 +258,13 @@ function margins.save(t)      else          store = displaystore[category][location]          if not store then -            report_margindata("invalid location: %s",location) +            report_margindata("invalid location %a",location)              return          end          store = store[scope]      end      if not store then -        report_margindata("invalid scope: %s",scope) +        report_margindata("invalid scope %a",scope)          return      end      if enablelocal and scope == v_local then @@ -338,7 +338,7 @@ function margins.save(t)          showstore(store,"after",location)      end      if trace_margindata then -        report_margindata("saved: %s, location: %s, scope: %s, inline: %s",nofsaved,location,scope,tostring(inline)) +        report_margindata("saved %a, location %a, scope %a, inline %a",nofsaved,location,scope,inline)      end  end @@ -439,11 +439,11 @@ local function realign(current,candidate)      if move_x then          delta = delta - move_x          if trace_margindata then -            report_margindata("realigned: %s, location: %s, margin: %s, move: %s",candidate.n,location,margin,points(move_x)) +            report_margindata("realigned %a, location %a, margin %a, move %p",candidate.n,location,margin,move_x)          end      else          if trace_margindata then -            report_margindata("realigned: %s, location: %s, margin: %s",candidate.n,location,margin) +            report_margindata("realigned %a, location %a, margin %a",candidate.n,location,margin)          end      end @@ -501,8 +501,7 @@ local function getovershoot(location)          local offset = p[location] or 0          local overshoot = offset - distance          if trace_marginstack then -            report_margindata("location: %s, distance: %s, offset: %s, overshoot: %s", -                location,points(distance),points(offset),points(overshoot)) +            report_margindata("location %a, distance %p, offset %p, overshoot %p",location,distance,offset,overshoot)          end          if overshoot > 0 then              return overshoot @@ -550,7 +549,7 @@ local function inject(parent,head,candidate)      candidate.hsize = parent.width -- we can also pass textwidth      candidate.psubtype = psubtype      if trace_margindata then -        report_margindata("processing, index %s, height: %s, depth: %s, parent: %s",candidate.n,height,depth,listcodes[psubtype]) +        report_margindata("processing, index %s, height %p, depth %p, parent %s",candidate.n,height,depth,listcodes[psubtype])      end      if firstonstack then          offset = 0 @@ -576,7 +575,7 @@ local function inject(parent,head,candidate)      if method == v_top then          local delta = height - parent.height          if trace_margindata then -            report_margindata("top aligned, amount: %s",delta) +            report_margindata("top aligned by %p",delta)          end          if delta < candidate.threshold then              shift = shift + voffset + delta @@ -593,18 +592,18 @@ local function inject(parent,head,candidate)      elseif method == v_depth then          local delta = strutdepth          if trace_margindata then -            report_margindata("depth aligned, amount: %s",delta) +            report_margindata("depth aligned by %p",delta)          end          shift = shift + voffset + delta      elseif method == v_height then          local delta = - strutheight          if trace_margindata then -            report_margindata("height aligned, amount: %s",delta) +            report_margindata("height aligned by %p",delta)          end          shift = shift + voffset + delta      elseif voffset ~= 0 then          if trace_margindata then -            report_margindata("voffset applied: %s",voffset) +            report_margindata("voffset %p applied",voffset)          end          shift = shift + voffset      end @@ -612,7 +611,7 @@ local function inject(parent,head,candidate)      if line ~= 0 then          local delta = line * candidate.lineheight          if trace_margindata then -            report_margindata("line offset applied: %s (%s)",line,delta) +            report_margindata("offset %p applied to line %s",delta,line)          end          shift = shift + delta          offset = offset + delta @@ -634,7 +633,7 @@ local function inject(parent,head,candidate)      end      box[a_margindata] = nofstatus      if trace_margindata then -        report_margindata("injected, location: %s, shift: %s",location,shift) +        report_margindata("injected, location %a, shift %p",location,shift)      end      -- we need to add line etc to offset as well      offset = offset + depth @@ -648,7 +647,7 @@ local function inject(parent,head,candidate)      stacked[location] = offset -- weird, no table ?      -- todo: if no real depth then zero      if trace_margindata then -        report_margindata("status, offset: %s",offset) +        report_margindata("status, offset %s",offset)      end      return head, room, stack == v_continue  end @@ -735,7 +734,7 @@ end  local function handler(scope,head,group)     if nofstored > 0 then          if trace_margindata then -            report_margindata("flushing stage one, stored: %s, scope: %s, delayed: %s, group: %s",nofstored,scope,nofdelayed,group) +            report_margindata("flushing stage one, stored %s, scope %s, delayed %s, group %a",nofstored,scope,nofdelayed,group)          end          local current = head          local done = false @@ -769,14 +768,14 @@ function margins.localhandler(head,group) -- sometimes group is "" which is weir      local inhibit = conditionals.inhibitmargindata      if inhibit then          if trace_margingroup then -            report_margindata("ignored: 3, group: %s, stored: %s, inhibit: %s",group,nofstored,tostring(inhibit)) +            report_margindata("ignored 3, group %a, stored %s, inhibit %a",group,nofstored,inhibit)          end          return head, false      elseif nofstored > 0 then          return handler(v_local,head,group)      else          if trace_margingroup then -            report_margindata("ignored: 4, group: %s, stored: %s, inhibit: %s",group,nofstored,tostring(inhibit)) +            report_margindata("ignored 4, group %a, stored %s, inhibit %a",group,nofstored,inhibit)          end          return head, false      end @@ -786,7 +785,7 @@ function margins.globalhandler(head,group) -- check group      local inhibit = conditionals.inhibitmargindata      if inhibit or nofstored == 0 then          if trace_margingroup then -            report_margindata("ignored: 1, group: %s, stored: %s, inhibit: %s",group,nofstored,tostring(inhibit)) +            report_margindata("ignored 1, group %a, stored %s, inhibit %a",group,nofstored,inhibit)          end          return head, false      elseif group == "hmode_par" then @@ -801,7 +800,7 @@ function margins.globalhandler(head,group) -- check group          return handler("global",head,group)      else          if trace_margingroup then -            report_margindata("ignored: 2, group: %s, stored: %s, inhibit: %s",group,nofstored,tostring(inhibit)) +            report_margindata("ignored 2, group %a, stored %s, inhibit %a",group,nofstored,inhibit)          end          return head, false      end diff --git a/tex/context/base/typo-pag.lua b/tex/context/base/typo-pag.lua index 6488b7c6b..0dd75ddf9 100644 --- a/tex/context/base/typo-pag.lua +++ b/tex/context/base/typo-pag.lua @@ -19,8 +19,6 @@ local new_penalty         = nodes.pool.penalty  local unsetvalue          = attributes.unsetvalue -local points              = number.points -  local a_keeptogether      = attributes.private("keeptogether")  local trace_keeptogether  = false @@ -81,8 +79,7 @@ function builders.paragraphs.registertogether(line,specification) -- might chang              else                  noflines = math.round((height + depth - slack) / noflines)              end -            report_keeptogether("registered, index: %s, height: %s, depth: %s, slack: %s, noflines: %s", -                a,points(height),points(depth),points(slack),noflines) +            report_keeptogether("registered, index %s, height %p, depth %p, slack %p, noflines %a",a,height,depth,slack,noflines)          end      end  end @@ -97,14 +94,14 @@ local function keeptogether(start,a)              local slack = specification.slack              local threshold = specification.depth - slack              if trace_keeptogether then -                report_keeptogether("list, index: %s, total: %s, threshold: %s, slack: %s",a,points(total),points(threshold),points(slack)) +                report_keeptogether("%s, index %s, total %p, threshold %p, slack %p","list",a,total,threshold,slack)              end              while current do                  local id = current.id                  if id == vlist_code or id == hlist_code then                      total = total + current.height + current.depth                      if trace_keeptogether then -                        report_keeptogether("list, index: %s, total: %s, threshold: %s",a,points(total),points(threshold)) +                        report_keeptogether("%s, index %s, total %p, threshold %p","list",a,total,threshold)                      end                      if total <= threshold then                          if previous.id == penalty_code then @@ -119,7 +116,7 @@ local function keeptogether(start,a)                      -- hm, breakpoint, maybe turn this into kern                      total = total + current.spec.width                      if trace_keeptogether then -                        report_keeptogether("glue, index: %s, total: %s, threshold: %s",a,points(total),points(threshold)) +                        report_keeptogether("%s, index %s, total %p, threshold %p","glue",a,total,threshold)                      end                      if total <= threshold then                          if previous.id == penalty_code then @@ -133,7 +130,7 @@ local function keeptogether(start,a)                  elseif id == kern_code then                      total = total + current.kern                      if trace_keeptogether then -                        report_keeptogether("kern, index: %s, total: %s, threshold: %s",a,points(total),points(threshold)) +                        report_keeptogether("%s, index %s, total %s, threshold %s","kern",a,total,threshold)                      end                      if total <= threshold then                          if previous.id == penalty_code then diff --git a/tex/context/base/typo-prc.lua b/tex/context/base/typo-prc.lua index ae9b541bf..5b74abd0b 100644 --- a/tex/context/base/typo-prc.lua +++ b/tex/context/base/typo-prc.lua @@ -53,17 +53,17 @@ function processors.apply(p,s)      end      if p and registered[p] then          if trace_processors then -            report_processors("known: %s, argument: %s",p,s or "") +            report_processors("applying %s processor %a, argument: %s","known",p,s)          end          context.applyprocessor(p,s)      elseif s then          if trace_processors then -            report_processors("unknown: %s, argument: %s",p or "?",s) +            report_processors("applying %s processor %a, argument: %s","unknown",p,s)          end          context(s)      elseif str then          if trace_processors then -            report_processors("direct: %s",str) +            report_processors("applying %s processor, data: %s","ignored",str)          end          context(str)      end @@ -76,21 +76,21 @@ function processors.startapply(p,s)      end      if p and registered[p] then          if trace_processors then -            report_processors("start: %s",p or "?") +            report_processors("start applying %s processor %a","known",p)          end          context.applyprocessor(p)          context("{")          return s      elseif p then          if trace_processors then -            report_processors("start: %s (unknown)",p) +            report_processors("start applying %s processor %a","unknown",p)          end          context.firstofoneargument()          context("{")          return s      else          if trace_processors then -            report_processors("start: ? (unset)") +            report_processors("start applying %s processor","ignored")          end          context.firstofoneargument()          context("{") @@ -101,7 +101,7 @@ end  function processors.stopapply()      context("}")      if trace_processors then -        report_processors("stop") +        report_processors("stop applying processor")      end  end @@ -123,4 +123,3 @@ end  commands.registerstructureprocessor = processors.register  commands.resetstructureprocessor    = processors.reset - diff --git a/tex/context/base/typo-rep.lua b/tex/context/base/typo-rep.lua index 6534bf457..8451ce52b 100644 --- a/tex/context/base/typo-rep.lua +++ b/tex/context/base/typo-rep.lua @@ -54,20 +54,20 @@ end  local function process(what,head,current,char)      if what == true then          if trace_stripping then -            report_stripping("deleting 0x%05X from text",char) +            report_stripping("deleting %C from text",char)          end          head, current = delete_node(head,current)      elseif type(what) == "function" then          head, current = what(head,current)          current = current.next          if trace_stripping then -            report_stripping("processing 0x%05X in text",char) +            report_stripping("processing %C in text",char)          end      elseif what then  -- assume node          head, current = replace_node(head,current,copy_node(what))          current = current.next          if trace_stripping then -            report_stripping("replacing 0x%05X in text",char) +            report_stripping("replacing %C in text",char)          end      end      return head, current diff --git a/tex/context/base/typo-spa.lua b/tex/context/base/typo-spa.lua index 764ee0cfb..1464ea2af 100644 --- a/tex/context/base/typo-spa.lua +++ b/tex/context/base/typo-spa.lua @@ -92,13 +92,13 @@ local function process(namespace,attribute,head)                                      local somepenalty = somepenalty(prevprev,10000)                                      if somepenalty then                                          if trace_spacing then -                                            report_spacing("removing penalty and space before %s (left)", utfchar(start.char)) +                                            report_spacing("removing penalty and space before %C (left)",start.char)                                          end                                          head = remove_node(head,prev,true)                                          head = remove_node(head,prevprev,true)                                      else                                          if trace_spacing then -                                            report_spacing("removing space before %s (left)", utfchar(start.char)) +                                            report_spacing("removing space before %C (left)",start.char)                                          end                                          head = remove_node(head,prev,true)                                      end @@ -109,7 +109,7 @@ local function process(namespace,attribute,head)                              end                              if ok then                                  if trace_spacing then -                                    report_spacing("inserting penalty and space before %s (left)", utfchar(start.char)) +                                    report_spacing("inserting penalty and space before %C (left)",start.char)                                  end                                  insert_node_before(head,start,new_penalty(10000))                                  insert_node_before(head,start,new_glue(left*quad)) @@ -126,7 +126,7 @@ local function process(namespace,attribute,head)                                      local somespace = somespace(nextnext,true)                                      if somespace then                                          if trace_spacing then -                                            report_spacing("removing penalty and space after %s (right)", utfchar(start.char)) +                                            report_spacing("removing penalty and space after %C right",start.char)                                          end                                          head = remove_node(head,next,true)                                          head = remove_node(head,nextnext,true) @@ -135,7 +135,7 @@ local function process(namespace,attribute,head)                                      local somespace = somespace(next,true)                                      if somespace then                                          if trace_spacing then -                                            report_spacing("removing space after %s (right)", utfchar(start.char)) +                                            report_spacing("removing space after %C (right)", start.char)                                          end                                          head = remove_node(head,next,true)                                      end @@ -146,7 +146,7 @@ local function process(namespace,attribute,head)                              end                              if ok then                                  if trace_spacing then -                                    report_spacing("inserting penalty and space after %s (right)", utfchar(start.char)) +                                    report_spacing("inserting penalty and space after %C (right)",start.char)                                  end                                  insert_node_after(head,start,new_glue(right*quad))                                  insert_node_after(head,start,new_penalty(10000)) diff --git a/tex/context/base/util-dim.lua b/tex/context/base/util-dim.lua index 4bae2d099..47b2706b7 100644 --- a/tex/context/base/util-dim.lua +++ b/tex/context/base/util-dim.lua @@ -20,6 +20,7 @@ local P, S, R, Cc, C, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.C, lpeg.  local allocate          = utilities.storage.allocate  local setmetatableindex = table.setmetatableindex +local formatters        = string.formatters  --this might become another namespace @@ -86,6 +87,7 @@ local dimenfactors = allocate {  format (string) is implemented using this table.</p>  --ldx]]-- +  local function numbertodimen(n,unit,fmt)      if type(n) == 'string' then          return n diff --git a/tex/context/base/util-lua.lua b/tex/context/base/util-lua.lua index 96101f8ec..cabcc3c9a 100644 --- a/tex/context/base/util-lua.lua +++ b/tex/context/base/util-lua.lua @@ -16,7 +16,7 @@ utilities          = utilities or {}  utilities.lua      = utilities.lua or { }  local luautilities = utilities.lua -utilities.report   = logs and logs.reporter("system") or print -- can be overloaded later +local report_lua = logs.reporter("system","lua")  local tracestripping           = false  local forcestupidcompile       = true  -- use internal bytecode compiler @@ -39,17 +39,13 @@ luautilities.suffixes = {      tuc = "tuc",  } -local function fatalerror(name) -    utilities.report(format("fatal error in %q",name or "unknown")) -end -  -- environment.loadpreprocessedfile can be set to a preprocessor  if jit or status.luatex_version >= 74 then      local function register(name)          if tracestripping then -            utilities.report("stripped bytecode: %s",name or "unknown") +            report_lua("stripped bytecode from %a",name or "unknown")          end          strippedchunks[#strippedchunks+1] = name          luautilities.nofstrippedchunks = luautilities.nofstrippedchunks + 1 @@ -67,10 +63,10 @@ if jit or status.luatex_version >= 74 then                      return true, 0                  end              else -                fatalerror() +                report_lua("fatal error in file %a",luafile)              end          else -            fatalerror() +            report_lua("fatal error in file %a",luafile)          end          return false, 0      end @@ -106,7 +102,7 @@ if jit or status.luatex_version >= 74 then          if forcestrip and luautilities.stripcode or luautilities.alwaysstripcode then              code = load(code)              if not code then -                fatalerror(name) +                report_lua("fatal error in file %a",name)              end              register(name)              code = dump(code,true) @@ -115,13 +111,13 @@ if jit or status.luatex_version >= 74 then      end      function luautilities.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true -        utilities.report("lua: compiling %s into %s",luafile,lucfile) +        report_lua("compiling %a into %a",luafile,lucfile)          os.remove(lucfile)          local done = stupidcompile(luafile,lucfile,strip ~= false)          if done then -            utilities.report("lua: %s dumped into %s (stripped)",luafile,lucfile) +            report_lua("dumping %a into %a stripped",luafile,lucfile)              if cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then -                utilities.report("lua: removing %s",luafile) +                report_lua("removing %a",luafile)                  os.remove(luafile)              end          end @@ -151,7 +147,7 @@ else      local function register(name,before,after)          local delta = before - after          if tracestripping then -            utilities.report("stripped bytecode: %s, before %s, after %s, delta %s",name or "unknown",before,after,delta) +            report_lua("bytecodes stripped from %a, # before %s, # after %s, delta %s",name,before,after,delta)          end          strippedchunks[#strippedchunks+1] = name          luautilities.nofstrippedchunks = luautilities.nofstrippedchunks + 1 @@ -268,7 +264,7 @@ else          if (forcestrip and luautilities.stripcode) or luautilities.alwaysstripcode then              code = load(code)              if not code then -                fatalerror(name) +                report_lua("fatal error in file %a",name)              end              code, n = strip_code_pc(dump(code),name)          end @@ -281,7 +277,7 @@ else          if code and code ~= "" then              code = load(code)              if not code then -                fatalerror() +                report_lua("fatal error in file %a",luafile)              end              code = dump(code)              if strip then @@ -298,7 +294,7 @@ else      local luac_strip  = "texluac -s -o %q %q"      function luautilities.compile(luafile,lucfile,cleanup,strip,fallback) -- defaults: cleanup=false strip=true -        utilities.report("lua: compiling %s into %s",luafile,lucfile) +        report_lua("compiling %a into %a",luafile,lucfile)          os.remove(lucfile)          local done = false          if strip ~= false then @@ -314,15 +310,15 @@ else          if not done and fallback then              local n = stupidcompile(luafile,lucfile,strip)              if n > 0 then -                utilities.report("lua: %s dumped into %s (%i bytes stripped)",luafile,lucfile,n) +                report_lua("%a dumped into %a (%i bytes stripped)",luafile,lucfile,n)              else -                utilities.report("lua: %s dumped into %s (unstripped)",luafile,lucfile) +                report_lua("%a dumped into %a (unstripped)",luafile,lucfile)              end              cleanup = false -- better see how bad it is              done = true -- hm          end          if done and cleanup == true and lfs.isfile(lucfile) and lfs.isfile(luafile) then -            utilities.report("lua: removing %s",luafile) +            report_lua("removing %a",luafile)              os.remove(luafile)          end          return done diff --git a/tex/context/base/util-mrg.lua b/tex/context/base/util-mrg.lua index f8742151c..97a02e7cf 100644 --- a/tex/context/base/util-mrg.lua +++ b/tex/context/base/util-mrg.lua @@ -18,10 +18,11 @@ local lpegmatch, patterns = lpeg.match, lpeg.patterns  utilities             = utilities or { }  local merger          = utilities.merger or { }  utilities.merger      = merger -utilities.report      = logs and logs.reporter("system") or print -  merger.strip_comment  = true +local report          = logs.reporter("system","merge") +utilities.report      = report +  local m_begin_merge   = "begin library merge"  local m_end_merge     = "end library merge"  local m_begin_closure = "do -- create closure to overcome 200 locals limit" @@ -64,9 +65,9 @@ end  local function self_load(name)      local data = io.loaddata(name) or ""      if data == "" then -        utilities.report("merge: unknown file %s",name) +        report("unknown file %a",name)      else -        utilities.report("merge: inserting %s",name) +        report("inserting file %a",name)      end      return data or ""  end @@ -135,7 +136,7 @@ local function self_compact(data)       -- data = string.strip(data)          local after = #data          delta = before - after -        utilities.report("merge: %s bytes compacted to %s (%s bytes stripped)",before,after,delta) +        report("original size %s, compacted to %s, stripped %s",before,after,delta)          data = format("-- original size: %s, stripped down to: %s\n\n%s",before,after,data)      end      return lpegmatch(stripreturn,data) or data, delta @@ -144,7 +145,7 @@ end  local function self_save(name, data)      if data ~= "" then          io.savedata(name,data) -        utilities.report("merge: saving %s bytes in %s",#data,name) +        report("saving %s with size %s",name,#data)      end  end @@ -161,7 +162,7 @@ local function self_libs(libs,list)          local lib = libs[i]          for j=1,#list do              local pth = gsub(list[j],"\\","/") -- file.clean_path -            utilities.report("merge: checking library path %s",pth) +            report("checking library path %a",pth)              local name = pth .. "/" .. lib              if lfs.isfile(name) then                  foundpath = pth @@ -170,13 +171,13 @@ local function self_libs(libs,list)          if foundpath then break end      end      if foundpath then -        utilities.report("merge: using library path %s",foundpath) +        report("using library path %a",foundpath)          local right, wrong, original, stripped = { }, { }, 0, 0          for i=1,#libs do              local lib = libs[i]              local fullname = foundpath .. "/" .. lib              if lfs.isfile(fullname) then -                utilities.report("merge: using library %s",fullname) +                report("using library %a",fullname)                  local preloaded = file.nameonly(lib)                  local data = io.loaddata(fullname,true)                  original = original + #data @@ -188,19 +189,19 @@ local function self_libs(libs,list)                  result[#result+1] = m_end_closure                  stripped = stripped + delta              else -                utilities.report("merge: skipping library %s",fullname) +                report("skipping library %a",fullname)                  wrong[#wrong+1] = lib              end          end          right = #right > 0 and concat(right," ") or "-"          wrong = #wrong > 0 and concat(wrong," ") or "-" -        utilities.report("merge: used libraries: %s",right) -        utilities.report("merge: skipped libraries: %s",wrong) -        utilities.report("merge: original bytes: %s",original) -        utilities.report("merge: stripped bytes: %s",stripped) +        report("used libraries: %a",right) +        report("skipped libraries: %a",wrong) +        report("original bytes: %a",original) +        report("stripped bytes: %a",stripped)          result[#result+1] = format(m_report,right,wrong,original,stripped)      else -        utilities.report("merge: no valid library path found") +        report("no valid library path found")      end      return concat(result, "\n\n")  end diff --git a/tex/context/base/util-sql-imp-client.lua b/tex/context/base/util-sql-imp-client.lua index 8a25c405d..e09dfde94 100644 --- a/tex/context/base/util-sql-imp-client.lua +++ b/tex/context/base/util-sql-imp-client.lua @@ -87,14 +87,14 @@ local function splitdata(data) -- todo: hash on first line ... maybe move to cli          if n == 1 then              local key = keys[1]              if trace_sql then -                report_state("one field with name",key) +                report_state("one field with name %a",key)              end              p = Cg(Cc(key) * entry)          else              for i=1,n do                  local key = keys[i]                  if trace_sql then -                    report_state("field %s has name %q",i,key) +                    report_state("field %s has name %a",i,key)                  end                  local s = Cg(Cc(key) * entry)                  if p then diff --git a/tex/context/base/util-sql-imp-library.lua b/tex/context/base/util-sql-imp-library.lua index 5de3670e5..34b9b339d 100644 --- a/tex/context/base/util-sql-imp-library.lua +++ b/tex/context/base/util-sql-imp-library.lua @@ -109,11 +109,11 @@ local function fetched(specification,query,converter)          if not connection then              session = initialize()              if not session then -                return format("no session for %q",id) +                return format("no session for %a",id)              end              connection = connect(session,specification)              if not connection then -                return format("no connection for %q",id) +                return format("no connection for %a",id)              end              cache[id] = { session = session, connection = connection }          end @@ -142,7 +142,7 @@ local function fetched(specification,query,converter)          local q = query[i]          local r, m = connection:execute(q)          if m then -            report_state("error in query to host %s: %s",specification.host or "?",string.collapsespaces(q)) +            report_state("error in query to host %a: %s",specification.host,string.collapsespaces(q))              if m then                  report_state("message: %s",m)              end @@ -208,13 +208,13 @@ local function datafetched(specification,query,converter)          report_state("call error, retrying")          callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter)      elseif connectionerror then -        report_state("error: %q, retrying",connectionerror) +        report_state("error: %s, retrying",connectionerror)          callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter)      end      if not callokay then          report_state("persistent call error")      elseif connectionerror then -        report_state("persistent error: %q",connectionerror) +        report_state("persistent error: %s",connectionerror)      end      return data or { }, keys or { }  end diff --git a/tex/context/base/util-sql-loggers.lua b/tex/context/base/util-sql-loggers.lua index b2dccf4b5..7fceb8032 100644 --- a/tex/context/base/util-sql-loggers.lua +++ b/tex/context/base/util-sql-loggers.lua @@ -76,7 +76,7 @@ function loggers.createdb(presets,datatable)          },      } -    report("datatable %q created in %q",db.name,db.base) +    report("datatable %a created in %a",db.name,db.base)      return db @@ -97,7 +97,7 @@ function loggers.deletedb(presets,datatable)          },      } -    report("datatable %q removed in %q",db.name,db.base) +    report("datatable %a removed in %a",db.name,db.base)  end diff --git a/tex/context/base/util-sql-sessions.lua b/tex/context/base/util-sql-sessions.lua index 40556dd5e..76bb91962 100644 --- a/tex/context/base/util-sql-sessions.lua +++ b/tex/context/base/util-sql-sessions.lua @@ -63,7 +63,7 @@ function sessions.createdb(presets,datatable)          },      } -    report("datatable %q created in %q",db.name,db.base) +    report("datatable %a created in %a",db.name,db.base)      return db @@ -84,7 +84,7 @@ function sessions.deletedb(presets,datatable)          },      } -    report("datatable %q removed in %q",db.name,db.base) +    report("datatable %a removed in %a",db.name,db.base)  end diff --git a/tex/context/base/util-sql-tickets.lua b/tex/context/base/util-sql-tickets.lua index 41010d265..5e958299d 100644 --- a/tex/context/base/util-sql-tickets.lua +++ b/tex/context/base/util-sql-tickets.lua @@ -95,7 +95,7 @@ function tickets.createdb(presets,datatable)          },      } -    report("datatable %q created in %q",db.name,db.base) +    report("datatable %a created in %a",db.name,db.base)      return db @@ -116,7 +116,7 @@ function tickets.deletedb(presets,datatable)          },      } -    report("datatable %q removed in %q",db.name,db.base) +    report("datatable %a removed in %a",db.name,db.base)  end diff --git a/tex/context/base/util-sql-users.lua b/tex/context/base/util-sql-users.lua index 00fca942e..ea8fb4e07 100644 --- a/tex/context/base/util-sql-users.lua +++ b/tex/context/base/util-sql-users.lua @@ -145,7 +145,7 @@ function users.createdb(presets,datatable)          },      } -    report("datatable %q created in %q",db.name,db.base) +    report("datatable %a created in %a",db.name,db.base)      return db diff --git a/tex/context/base/util-sql.lua b/tex/context/base/util-sql.lua index b793a3ae3..1c1766edf 100644 --- a/tex/context/base/util-sql.lua +++ b/tex/context/base/util-sql.lua @@ -112,9 +112,9 @@ local defaults     = { __index =  }  setmetatableindex(sql.methods,function(t,k) -    report_state("start loading method %q",k) +    report_state("start loading method %a",k)      require("util-sql-imp-"..k) -    report_state("loading method %q done",k) +    report_state("loading method %a done",k)      return rawget(t,k)  end) @@ -247,9 +247,9 @@ local function validspecification(specification)      specification.queryfile  = queryfile      specification.resultfile = resultfile      if trace_sql then -        report_state("template file: %q",templatefile or "<none>") -        report_state("query file: %q",queryfile) -        report_state("result file: %q",resultfile) +        report_state("template file: %s",templatefile or "<none>") +        report_state("query file: %s",queryfile) +        report_state("result file: %s",resultfile)      end      return true  end @@ -269,9 +269,9 @@ local function preparetemplate(specification)      if templatefile then          local query = loadtemplate(templatefile,specification.variables,'sql')          if not query then -            report_state("error in template file %q",templatefile) +            report_state("error in template file %a",templatefile)          elseif trace_queries then -            report_state("query from template file %q: %s",templatefile,query) +            report_state("query from template file %a: %s",templatefile,query)          end          return query      end diff --git a/tex/context/base/util-str.lua b/tex/context/base/util-str.lua index 11ca90912..8e55629c7 100644 --- a/tex/context/base/util-str.lua +++ b/tex/context/base/util-str.lua @@ -157,17 +157,104 @@ end  -- there is an extra function call involved. In principle we end up with a  -- string concatination so one could inline such a sequence but often at the  -- cost of less readabinity. So, it's a sort of (visual) compromise. Of course --- there is the benefit of more variants. +-- there is the benefit of more variants. (Concerning the speed: a simple format +-- like %05fpt is better off with format than with a formatter, but as soon as +-- you put something in front formatters become faster. Passing the pt as extra +-- argument makes formatters behave better. Of course this is rather +-- implementation dependent.) + +-- integer          %...i   number +-- integer          %...d   number +-- unsigned         %...u   number +-- character        %...c   number +-- hexadecimal      %...x   number +-- HEXADECIMAL      %...X   number +-- octal            %...o   number +-- string           %...s   string number +-- float            %...f   number +-- exponential      %...e   number +-- exponential      %...E   number +-- autofloat        %...g   number +-- autofloat        %...G   number +-- utf character    %...c   number +-- force tostring   %...S   any +-- force tostring   %Q      any +-- force tonumber   %N      number (strip leading zeros) +-- signed number    %I      number +-- rounded number   %r      number +-- 0xhexadecimal    %...h   character number +-- 0xHEXADECIMAL    %...H   character number +-- U+hexadecimal    %...u   character number +-- U+HEXADECIMAL    %...U   character number +-- points           %p      number (scaled points) +-- basepoints       %b      number (scaled points) +-- table concat     %...t   table +-- serialize        %...T   sequenced (no nested tables) +-- boolean (logic)  %l      boolean +-- BOOLEAN          %L      boolean +-- whitespace       %...w +-- automatic        %...a   'whatever' +-- automatic        %...a   "whatever"  local n = 0  -- we are somewhat sloppy in parsing prefixes as it's not that critical --- --- this does not work out ok: --- --- function fnc(...) -- 1,2,3 ---     print(...,...,...) -- 1,1,1,2,3 --- end + +-- hard to avoid but we can collect them in a private namespace if needed + +-- inline the next two makes no sense as we only use this in logging + +local sequenced = table.sequenced + +function string.autodouble(s,sep) +    if s == nil then +        return '""' +    end +    local t = type(s) +    if t == "number" then +        return tostring(s) -- tostring not really needed +    end +    if t == "table" then +        return ('"' .. sequenced(t,sep or ",") .. '"') +    end +    return ('"' .. tostring(s) .. '"') +end + +function string.autosingle(s,sep) +    if s == nil then +        return "''" +    end +    local t = type(s) +    if t == "number" then +        return tostring(s) -- tostring not really needed +    end +    if t == "table" then +        return ("'" .. sequenced(t,sep or ",") .. "'") +    end +    return ("'" .. tostring(s) .. "'") +end + +local tracedchars  = { } +string.tracedchars = tracedchars +strings.tracers    = tracedchars + +function string.tracedchar(b) +    -- todo: table +    if type(b) == "number" then +        return tracedchars[b] or (utfchar(b) .. " (U+" .. format('%%05X',b) .. ")") +    else +        local c = utfbyte(b) +        return tracedchars[c] or (b .. " (U+" .. format('%%05X',c) .. ")") +    end +end + +function number.signed(i) +    if i > 0 then +        return "+",  i +    else +        return "-", -i +    end +end  local preamble = [[  local type = type @@ -182,7 +269,11 @@ local utfchar = utf.char  local utfbyte = utf.byte  local lpegmatch = lpeg.match  local xmlescape = lpeg.patterns.xmlescape -local spaces = string.nspaces +local nspaces = string.nspaces +local tracedchar = string.tracedchar +local autosingle = string.autosingle +local autodouble = string.autodouble +local sequenced = table.sequenced  ]]  local template = [[ @@ -191,7 +282,6 @@ local template = [[  return function(%s) return %s end  ]] -  local arguments = { "a1" } -- faster than previously used (select(n,...))  setmetatable(arguments, { __index = @@ -207,12 +297,14 @@ local prefix_tab = C((1-R("az","AZ","09","%%"))^0)  -- we've split all cases as then we can optimize them (let's omit the fuzzy u) +-- todo: replace outer formats in next by .. +  local format_s = function(f)      n = n + 1      if f and f ~= "" then          return format("format('%%%ss',a%s)",f,n) -    else -        return format("a%s",n) +    else -- best no tostring in order to stay compatible (.. does a selective tostring too) +        return format("(a%s or '')",n) -- goodie: nil check      end  end @@ -227,7 +319,7 @@ end  local format_q = function()      n = n + 1 -    return format("format('%%q',a%s)",n) -- maybe an own lpeg +    return format("(a%s and format('%%q',a%s) or '')",n,n) -- goodie: nil check (maybe separate lpeg, not faster)  end  local format_Q = function() -- can be optimized @@ -246,21 +338,9 @@ end  local format_d = format_i -function number.signed(i) -    if i > 0 then -        return "+",  i -    else -        return "-", -i -    end -end -  local format_I = function(f)      n = n + 1 -    if f and f ~= "" then -        return format("format('%%s%%%si',signed(a%s))",f,n) -    else -        return format("format('%%s%%i',signed(a%s))",n) -    end +    return format("format('%%s%%%si',signed(a%s))",f,n)  end  local format_f = function(f) @@ -308,6 +388,11 @@ local format_c = function()      return format("utfchar(a%s)",n)  end +local format_C = function() +    n = n + 1 +    return format("tracedchar(a%s)",n) +end +  local format_r = function(f)      n = n + 1      return format("format('%%%s.0f',a%s)",f,n) @@ -372,6 +457,15 @@ local format_t = function(f)      end  end +local format_T = function(f) +    n = n + 1 +    if f and f ~= "" then +        return format("sequenced(a%s,%q)",n,f) +    else +        return format("sequenced(a%s)",n) +    end +end +  local format_l = function()      n = n + 1      return format("(a%s and 'true' or 'false')",n) @@ -387,22 +481,41 @@ local format_N = function() -- strips leading zeros      return format("tostring(tonumber(a%s) or a%s)",n,n)  end -local format_a = function(s) -    return format("%q",s) +local format_a = function(f) +    n = n + 1 +    if f and f ~= "" then +        return format("autosingle(a%s,%q)",n,f) +    else +        return format("autosingle(a%s)",n) +    end +end + + +local format_A = function(f) +    n = n + 1 +    if f and f ~= "" then +        return format("autodouble(a%s,%q)",n,f) +    else +        return format("autodouble(a%s)",n) +    end  end  local format_w = function(f) -- handy when doing depth related indent      n = n + 1      f = tonumber(f) -    if f then -        return format("spaces[%s+tonumber(a%s)]",f,n) +    if f then -- not that useful +        return format("nspaces[%s+a%s]",f,n) -- no real need for tonumber      else -        return format("spaces[tonumber(a%s)]",n) +        return format("nspaces[a%s]",n) -- no real need for tonumber      end  end  local format_W = function(f) -- handy when doing depth related indent -    return format("spaces[%s]",tonumber(f) or 0) +    return format("nspaces[%s]",tonumber(f) or 0) +end + +local format_rest = function(s) +    return format("%q",s) -- catches " and \n and such  end  local format_extension = function(extensions,f,name) @@ -412,14 +525,16 @@ local format_extension = function(extensions,f,name)          return extension      elseif f == 1 then          n = n + 1 -        return format(extension,"a"..n) +        local a = "a" .. n +        return format(extension,a,a) -- maybe more times?      elseif f < 0 then -        return format(extension,"a"..n+f+1) +        local a = "a" .. (n + f + 1) +        return format(extension,a,a)      else          local t = { }          for i=1,f do              n = n + 1 -            t[#t+1] = "a"..n +            t[#t+1] = "a" .. n          end          return format(extension,unpack(t))      end @@ -437,6 +552,7 @@ local builder = Cs { "start",                + V("x") + V("X") + V("o")                --                + V("c") +              + V("C")                + V("S") -- new                + V("Q") -- new                + V("N") -- new @@ -444,18 +560,19 @@ local builder = Cs { "start",                + V("r")                + V("h") + V("H") + V("u") + V("U")                + V("p") + V("b") -              + V("t") +              + V("t") + V("T")                + V("l") + V("L")                + V("I")                + V("h") -- new                + V("w") -- new                + V("W") -- new +              + V("a") -- new +              + V("A") -- new                -- -              + V("a") -- ignores probably messed up % +              + V("*") -- ignores probably messed up %              ) -          + V("a") +          + V("*")          ) ---      * (P(-1) + Cc(".."))       * (P(-1) + Carg(1))      )^0,      -- @@ -476,6 +593,7 @@ local builder = Cs { "start",      ["Q"] = (prefix_any * P("Q")) / format_S, -- %Q => %q (tostring)      ["N"] = (prefix_any * P("N")) / format_N, -- %N => tonumber (strips leading zeros)      ["c"] = (prefix_any * P("c")) / format_c, -- %c => utf character (extension to regular) +    ["C"] = (prefix_any * P("C")) / format_C, -- %c => U+.... utf character      --      ["r"] = (prefix_any * P("r")) / format_r, -- %r => round      ["h"] = (prefix_any * P("h")) / format_h, -- %h => 0x0a1b2 (when - no 0x) was v @@ -485,16 +603,19 @@ local builder = Cs { "start",      ["p"] = (prefix_any * P("p")) / format_p, -- %p => 12.345pt / maybe: P (and more units)      ["b"] = (prefix_any * P("b")) / format_b, -- %b => 12.342bp / maybe: B (and more units)      ["t"] = (prefix_tab * P("t")) / format_t, -- %t => concat +    ["T"] = (prefix_tab * P("T")) / format_T, -- %t => sequenced      ["l"] = (prefix_tab * P("l")) / format_l, -- %l => boolean      ["L"] = (prefix_tab * P("L")) / format_L, -- %L => BOOLEAN      ["I"] = (prefix_any * P("I")) / format_I, -- %I => signed integer      --      ["w"] = (prefix_any * P("w")) / format_w, -- %w => n spaces (optional prefix is added) -    ["W"] = (prefix_any * P("W")) / format_W, -- %w => mandate prefix, no specifier +    ["W"] = (prefix_any * P("W")) / format_W, -- %W => mandate prefix, no specifier +    -- +    ["a"] = (prefix_any * P("a")) / format_a, -- %a => '...' (forces tostring) +    ["A"] = (prefix_any * P("A")) / format_A, -- %A => "..." (forces tostring)      -- -    ["a"] = Cs(((1-P("%"))^1 + P("%%")/"%%%%")^1) / format_a, -- rest (including %%) +    ["*"] = Cs(((1-P("%"))^1 + P("%%")/"%%%%")^1) / format_rest, -- rest (including %%)      -- - -- ["!"] = P("!xml!") / format_xml, -- %!xml! => hypertext escaped " < > &      ["!"] = Carg(2) * prefix_any * P("!") * C((1-P("!"))^1) * P("!") / format_extension,  } @@ -503,13 +624,15 @@ local builder = Cs { "start",  local direct = Cs (          P("%")/""        * Cc([[local format = string.format return function(str) return format("%]]) -      * C(S("+- .") + R("09"))^0 * S("sqidfgGeExXo") +      * (S("+- .") + R("09"))^0 +      * S("sqidfgGeExXo")        * Cc([[",str) end]])        * P(-1)      )  local function make(t,str)      local f +    local p      local p = lpegmatch(direct,str)      if p then          f = loadstripped(p)() @@ -518,7 +641,7 @@ local function make(t,str)          p = lpegmatch(builder,str,1,"..",t._extensions_) -- after this we know n          if n > 0 then              p = format(template,preamble,t._preamble_,arguments[n],p) -         -- print("builder>",p) +--           print("builder>",p)              f = loadstripped(p)()          else              f = function() return str end @@ -528,18 +651,66 @@ local function make(t,str)      return f  end +-- -- collect periodically +-- +-- local threshold = 1000 -- max nof cached formats +-- +-- local function make(t,str) +--     local f = rawget(t,str) +--     if f then +--         return f +--     end +--     local parent = t._t_ +--     if parent._n_ > threshold then +--         local m = { _t_ = parent } +--         getmetatable(parent).__index = m +--         setmetatable(m, { __index = make }) +--     else +--         parent._n_ = parent._n_ + 1 +--     end +--     local f +--     local p = lpegmatch(direct,str) +--     if p then +--         f = loadstripped(p)() +--     else +--         n = 0 +--         p = lpegmatch(builder,str,1,"..",parent._extensions_) -- after this we know n +--         if n > 0 then +--             p = format(template,preamble,parent._preamble_,arguments[n],p) +--          -- print("builder>",p) +--             f = loadstripped(p)() +--         else +--             f = function() return str end +--         end +--     end +--     t[str] = f +--     return f +-- end +  local function use(t,fmt,...)      return t[fmt](...)  end  strings.formatters = { } +-- we cannot make these tables weak, unless we start using an indirect +-- table (metatable) in which case we could better keep a count and +-- clear that table when a threshold is reached +  function strings.formatters.new()      local t = { _extensions_ = { }, _preamble_ = "", _type_ = "formatter" }      setmetatable(t, { __index = make, __call = use })      return t  end +-- function strings.formatters.new() +--     local t = { _extensions_ = { }, _preamble_ = "", _type_ = "formatter", _n_ = 0 } +--     local m = { _t_ = t } +--     setmetatable(t, { __index = m, __call = use }) +--     setmetatable(m, { __index = make }) +--     return t +-- end +  local formatters   = strings.formatters.new() -- the default instance  string.formatters  = formatters -- in the main string namespace diff --git a/tex/context/base/util-tpl.lua b/tex/context/base/util-tpl.lua index 304c9c739..7a6abefd6 100644 --- a/tex/context/base/util-tpl.lua +++ b/tex/context/base/util-tpl.lua @@ -28,13 +28,13 @@ local function replacekey(k,t,how,recursive)      local v = t[k]      if not v then          if trace_template then -            report_template("unknown key %q",k) +            report_template("unknown key %a",k)          end          return ""      else          v = tostring(v)          if trace_template then -            report_template("setting key %q to value %q",k,v) +            report_template("setting key %a to value %a",k,v)          end          if recursive then              return lpegmatch(replacer,v,1,t,how,recursive) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index b4cc4e1b4..4590f9513 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@  -- merged file : luatex-fonts-merged.lua  -- parent file : luatex-fonts.lua --- merge date  : 03/11/13 00:17:48 +-- merge date  : 03/13/13 00:08:37  do -- begin closure to overcome local limits and interference @@ -1477,9 +1477,18 @@ function table.reverse(t)      return t    end  end -function table.sequenced(t,sep)  -  if t then -    local s,n={},0 +function table.sequenced(t,sep,simple)  +  if not t then +    return "" +  end +  local n=#t +  local s={} +  if n>0 then +    for i=1,n do +      s[i]=tostring(t[i]) +    end +  else +    n=0      for k,v in sortedhash(t) do        if simple then          if v==true then @@ -1494,10 +1503,8 @@ function table.sequenced(t,sep)          s[n]=k.."="..tostring(v)        end      end -    return concat(s,sep or " | ") -  else -    return ""    end +  return concat(s,sep or " | ")  end  function table.print(t,...)    if type(t)~="table" then @@ -2533,11 +2540,6 @@ containers=containers or {}  local containers=containers  containers.usecache=true  local report_containers=logs.reporter("resolvers","containers") -local function report(container,tag,name) -  if trace_cache or trace_containers then -    report_containers("container: %s, tag: %s, name: %s",container.subcategory,tag,name or 'invalid') -  end -end  local allocated={}  local mt={    __index=function(t,k) @@ -2593,13 +2595,17 @@ function containers.read(container,name)    if not stored and container.enabled and caches and containers.usecache then      stored=caches.loaddata(container.readables,name)      if stored and stored.cache_version==container.version then -      report(container,"loaded",name) +      if trace_cache or trace_containers then +        report_containers("action %a, category %a, name %a","load",container.subcategory,name) +      end      else        stored=nil      end      storage[name]=stored    elseif stored then -    report(container,"reusing",name) +    if trace_cache or trace_containers then +      report_containers("action %a, category %a, name %a","reuse",container.subcategory,name) +    end    end    return stored  end @@ -2610,10 +2616,14 @@ function containers.write(container,name,data)        local unique,shared=data.unique,data.shared        data.unique,data.shared=nil,nil        caches.savedata(container.writable,name,data) -      report(container,"saved",name) +      if trace_cache or trace_containers then +        report_containers("action %a, category %a, name %a","save",container.subcategory,name) +      end        data.unique,data.shared=unique,shared      end -    report(container,"stored",name) +    if trace_cache or trace_containers then +      report_containers("action %a, category %a, name %a","store",container.subcategory,name) +    end      container.storage[name]=data    end    return data @@ -3105,44 +3115,33 @@ function constructors.scale(tfmdata,specification)    local scaledwidth=defaultwidth*hdelta    local scaledheight=defaultheight*vdelta    local scaleddepth=defaultdepth*vdelta -  if trace_defining then -    report_defining("scaling by (%s,%s): name '%s', fullname: '%s', filename: '%s'", -      hdelta,vdelta,name or "noname",fullname or "nofullname",filename or "nofilename") -  end    local hasmath=(properties.hasmath or next(mathparameters)) and true    if hasmath then -    if trace_defining then -      report_defining("math enabled for: name '%s', fullname: '%s', filename: '%s'", -        name or "noname",fullname or "nofullname",filename or "nofilename") -    end      constructors.assignmathparameters(target,tfmdata)       properties.hasmath=true      target.nomath=false      target.MathConstants=target.mathparameters    else -    if trace_defining then -      report_defining("math disabled for: name '%s', fullname: '%s', filename: '%s'", -        name or "noname",fullname or "nofullname",filename or "nofilename") -    end      properties.hasmath=false      target.nomath=true      target.mathparameters=nil     end    local italickey="italic" +  local useitalics=true    if hasmath then      autoitalicamount=false  -  else -    if properties.textitalics then -      italickey="italic_correction" -      if trace_defining then -        report_defining("text italics disabled for: name '%s', fullname: '%s', filename: '%s'", -          name or "noname",fullname or "nofullname",filename or "nofilename") -      end -      if properties.delaytextitalics then -        autoitalicamount=false -      end +  elseif properties.textitalics then +    italickey="italic_correction" +    useitalics=false +    if properties.delaytextitalics then +      autoitalicamount=false      end    end +  if trace_defining then +    report_defining("defining tfm, name %a, fullname %a, filename %a, hscale %a, vscale %a, math %a, italics %a", +      name,fullname,filename,hdelta,vdelta, +      hasmath and "enabled" or "disabled",useitalics and "enabled" or "disabled") +  end    constructors.beforecopyingcharacters(target,tfmdata)    local sharedkerns={}    for unicode,character in next,characters do @@ -3541,7 +3540,7 @@ function constructors.setname(tfmdata,specification)      if specname then        tfmdata.properties.name=specname        if trace_defining then -        report_otf("overloaded fontname: '%s'",specname) +        report_otf("overloaded fontname %a",specname)        end      end    end @@ -3554,10 +3553,10 @@ function constructors.checkedfilename(data)        askedfilename=resolvers.resolve(askedfilename)         foundfilename=resolvers.findbinfile(askedfilename,"") or ""        if foundfilename=="" then -        report_defining("source file '%s' is not found",askedfilename) +        report_defining("source file %a is not found",askedfilename)          foundfilename=resolvers.findbinfile(file.basename(askedfilename),"") or ""          if foundfilename~="" then -          report_defining("using source file '%s' (cache mismatch)",foundfilename) +          report_defining("using source file %a due to cache mismatch",foundfilename)          end        end      end @@ -3579,7 +3578,7 @@ local locations={}  local function setindeed(mode,target,group,name,action,position)    local t=target[mode]    if not t then -    report_defining("fatal error in setting feature '%s', group '%s', mode '%s'",name or "?",group or "?",mode) +    report_defining("fatal error in setting feature %a, group %a, mode %a",name,group,mode)      os.exit()    elseif position then      insert(t,position,{ name=name,action=action }) @@ -3597,12 +3596,12 @@ end  local function set(group,name,target,source)    target=target[group]    if not target then -    report_defining("fatal target error in setting feature '%s', group '%s'",name or "?",group or "?") +    report_defining("fatal target error in setting feature %a, group %a",name,group)      os.exit()    end    local source=source[group]    if not source then -    report_defining("fatal source error in setting feature '%s', group '%s'",name or "?",group or "?") +    report_defining("fatal source error in setting feature %a, group %a",name,group)      os.exit()    end    local node=source.node @@ -3727,8 +3726,8 @@ function constructors.initializefeatures(what,tfmdata,features,trace,report)            else              local action=step.action              if trace then -              report("initializing feature %s to %s for mode %s for font %s",feature, -                tostring(value),mode or 'unknown',tfmdata.properties.fullname or 'unknown') +              report("initializing feature %a to %a for mode %a for font %a",feature, +                value,mode,tfmdata.properties.fullname)              end              action(tfmdata,value,features)               if mode~=properties.mode or mode~=features.mode then @@ -3775,8 +3774,7 @@ function constructors.collectprocessors(what,tfmdata,features,trace,report)          if features[feature] then            local action=step.action            if trace then -            report("installing feature processor %s for mode %s for font %s",feature, -              mode or 'unknown',tfmdata.properties.fullname or 'unknown') +            report("installing feature processor %a for mode %a for font %a",feature,mode,tfmdata.properties.fullname)            end            if action then              nofprocesses=nofprocesses+1 @@ -3785,8 +3783,7 @@ function constructors.collectprocessors(what,tfmdata,features,trace,report)          end        end      elseif trace then -      report("no feature processors for mode %s for font %s", -        mode or 'unknown',tfmdata.properties.fullname or 'unknown') +      report("no feature processors for mode %a for font %a",mode,tfmdata.properties.fullname)      end    end    return processes @@ -3806,8 +3803,7 @@ function constructors.applymanipulators(what,tfmdata,features,trace,report)          if value then            local action=step.action            if trace then -            report("applying feature manipulator %s for mode %s for font %s",feature, -              mode or 'unknown',tfmdata.properties.fullname or 'unknown') +            report("applying feature manipulator %a for mode %a for font %a",feature,mode,tfmdata.properties.fullname)            end            if action then              action(tfmdata,feature,value) @@ -3919,14 +3915,14 @@ local function locate(registry,ordering,supplement)    local found=cidmap[hashname]    if not found then      if trace_loading then -      report_otf("checking cidmap, registry: %s, ordering: %s, supplement: %s, filename: %s",registry,ordering,supplement,filename) +      report_otf("checking cidmap, registry %a, ordering %a, supplement %a, filename %a",registry,ordering,supplement,filename)      end      local fullname=resolvers.findfile(filename,'cid') or ""      if fullname~="" then        found=loadcidfile(fullname)        if found then          if trace_loading then -          report_otf("using cidmap file %s",filename) +          report_otf("using cidmap file %a",filename)          end          cidmap[hashname]=found          found.usedname=file.basename(filename) @@ -3937,7 +3933,7 @@ local function locate(registry,ordering,supplement)  end  function cid.getmap(specification)    if not specification then -    report_otf("invalid cidinfo specification (table expected)") +    report_otf("invalid cidinfo specification, table expected")      return    end    local registry=specification.registry @@ -3949,7 +3945,7 @@ function cid.getmap(specification)      return found    end    if trace_loading then -    report_otf("needed cidmap, registry: %s, ordering: %s, supplement: %s",registry,ordering,supplement) +    report_otf("cidmap needed, registry %a, ordering %a, supplement %a",registry,ordering,supplement)    end    found=locate(registry,ordering,supplement)    if not found then @@ -4014,7 +4010,7 @@ local function loadlumtable(filename)    local lumfile=resolvers.findfile(lumname,"map") or ""    if lumfile~="" and lfs.isfile(lumfile) then      if trace_loading or trace_mapping then -      report_fonts("enhance: loading %s ",lumfile) +      report_fonts("loading map table %a",lumfile)      end      lumunic=dofile(lumfile)      return lumunic,lumfile @@ -4048,7 +4044,7 @@ local function tounicode16(unicode)    elseif unicode<0x1FFFFFFFFF then      return format("%04X%04X",floor(unicode/1024),unicode%1024+0xDC00)    else -    report_fonts("can't convert %s into tounicode",unicode) +    report_fonts("can't convert %a into tounicode",unicode)    end  end  local function tounicode16sequence(unicodes) @@ -4060,7 +4056,7 @@ local function tounicode16sequence(unicodes)      elseif unicode<0x1FFFFFFFFF then        t[l]=format("%04X%04X",floor(unicode/1024),unicode%1024+0xDC00)      else -      report_fonts ("can't convert %s into tounicode",unicode) +      report_fonts ("can't convert %a into tounicode",unicode)      end    end    return concat(t) @@ -4219,14 +4215,14 @@ function mappings.addtounicode(data,filename)        local index=glyph.index        local toun=tounicode[index]        if toun then -        report_fonts("internal: 0x%05X, name: %s, unicode: U+%05X, tounicode: %s",index,name,unic,toun) +        report_fonts("internal slot %U, name %a, unicode %U, tounicode %a",index,name,unic,toun)        else -        report_fonts("internal: 0x%05X, name: %s, unicode: U+%05X",index,name,unic) +        report_fonts("internal slot %U, name %a, unicode %U",index,name,unic)        end      end    end    if trace_loading and (ns>0 or nl>0) then -    report_fonts("enhance: %s tounicode entries added (%s ligatures)",nl+ns,ns) +    report_fonts("%s tounicode entries added, ligatures %s",nl+ns,ns)    end  end @@ -4482,7 +4478,7 @@ registerdirective("fonts.otf.loader.forcenotdef",function(v) forcenotdef=v end)  local function load_featurefile(raw,featurefile)    if featurefile and featurefile~="" then      if trace_loading then -      report_otf("featurefile: %s",featurefile) +      report_otf("using featurefile %a",featurefile)      end      fontloader.apply_featurefile(raw,featurefile)    end @@ -4491,7 +4487,7 @@ local function showfeatureorder(rawdata,filename)    local sequences=rawdata.resources.sequences    if sequences and #sequences>0 then      if trace_loading then -      report_otf("font %s has %s sequences",filename,#sequences) +      report_otf("font %a has %s sequences",filename,#sequences)        report_otf(" ")      end      for nos=1,#sequences do @@ -4501,7 +4497,7 @@ local function showfeatureorder(rawdata,filename)        local subtables=sequence.subtables or { "no-subtables" }        local features=sequence.features        if trace_loading then -        report_otf("%3i  %-15s  %-20s  [%s]",nos,name,typ,concat(subtables,",")) +        report_otf("%3i  %-15s  %-20s  [% t]",nos,name,typ,subtables)        end        if features then          for feature,scripts in next,features do @@ -4512,14 +4508,14 @@ local function showfeatureorder(rawdata,filename)                for language,_ in next,languages do                  ttt[#ttt+1]=language                end -              tt[#tt+1]=format("[%s: %s]",script,concat(ttt," ")) +              tt[#tt+1]=formatters["[%s: % t]"](script,ttt)              end              if trace_loading then -              report_otf("       %s: %s",feature,concat(tt," ")) +              report_otf("       %s: % t",feature,tt)              end            else              if trace_loading then -              report_otf("       %s: %s",feature,tostring(scripts)) +              report_otf("       %s: %S",feature,scripts)              end            end          end @@ -4529,7 +4525,7 @@ local function showfeatureorder(rawdata,filename)        report_otf("\n")      end    elseif trace_loading then -    report_otf("font %s has no sequences",filename) +    report_otf("font %a has no sequences",filename)    end  end  local valid_fields=table.tohash { @@ -4607,17 +4603,17 @@ local function enhance(name,data,filename,raw)    local enhancer=actions[name]    if enhancer then      if trace_loading then -      report_otf("enhance: %s (%s)",name,filename) +      report_otf("apply enhancement %a to file %a",name,filename)        ioflush()      end      enhancer(data,filename,raw) -  elseif trace_loading then +  else    end  end  function enhancers.apply(data,filename,raw)    local basename=file.basename(lower(filename))    if trace_loading then -    report_otf("start enhancing: %s",filename) +    report_otf("%s enhancing file %a","start",filename)    end    ioflush()     for e=1,#ordered_enhancers do @@ -4642,7 +4638,7 @@ function enhancers.apply(data,filename,raw)      ioflush()     end    if trace_loading then -    report_otf("stop enhancing") +    report_otf("%s enhancing file %a","stop",filename)    end    ioflush()   end @@ -4659,14 +4655,15 @@ function patches.register(what,where,pattern,action)  end  function patches.report(fmt,...)    if trace_loading then -    report_otf("patching: "..fmt,...) +    report_otf("patching: %s",formatters[fmt](...))    end  end  function enhancers.register(what,action)     actions[what]=action  end  function otf.load(filename,format,sub,featurefile) -  local name=file.basename(file.removesuffix(filename)) +  local base=file.basename(file.removesuffix(filename)) +  local name=file.removesuffix(base)    local attr=lfs.attributes(filename)    local size=attr and attr.size or 0    local time=attr and attr.modification or 0 @@ -4687,7 +4684,7 @@ function otf.load(filename,format,sub,featurefile)      for s in gmatch(featurefile,"[^,]+") do        local name=resolvers.findfile(file.addsuffix(s,'fea'),'fea') or ""        if name=="" then -        report_otf("loading: no featurefile '%s'",s) +        report_otf("loading error, no featurefile %a",s)        else          local attr=lfs.attributes(name)          featurefiles[#featurefiles+1]={ @@ -4704,7 +4701,7 @@ function otf.load(filename,format,sub,featurefile)    local data=containers.read(otf.cache,hash)    local reload=not data or data.size~=size or data.time~=time    if forceload then -    report_otf("loading: forced reload due to hard coded flag") +    report_otf("forced reload of %a due to hard coded flag",filename)      reload=true    end    if not reload then @@ -4725,11 +4722,11 @@ function otf.load(filename,format,sub,featurefile)        reload=true      end      if reload then -      report_otf("loading: forced reload due to changed featurefile specification: %s",featurefile or "--") +      report_otf("loading: forced reload due to changed featurefile specification %a",featurefile)      end     end     if reload then -    report_otf("loading: %s (hash: %s)",filename,hash) +    report_otf("loading %a, hash %a",filename,hash)      local fontdata,messages      if sub then        fontdata,messages=fontloader.open(filename,sub) @@ -4744,11 +4741,11 @@ function otf.load(filename,format,sub,featurefile)          report_otf("warning: %s",messages)        else          for m=1,#messages do -          report_otf("warning: %s",tostring(messages[m])) +          report_otf("warning: %S",messages[m])          end        end      else -      report_otf("font loaded okay") +      report_otf("loading done")      end      if fontdata then        if featurefiles then @@ -4800,14 +4797,14 @@ function otf.load(filename,format,sub,featurefile)          enhance("pack",data,filename,nil)          stoptiming(packtime)        end -      report_otf("saving in cache: %s",filename) +      report_otf("saving %a in cache",filename)        data=containers.write(otf.cache,hash,data)        if cleanup>1 then          collectgarbage("collect")        end        stoptiming(data)        if elapsedtime then  -        report_otf("preprocessing and caching took %s seconds (packtime: %s)", +        report_otf("preprocessing and caching time %s, packtime %s",            elapsedtime(data),packdata and elapsedtime(packtime) or 0)        end        fontloader.close(fontdata)  @@ -4820,12 +4817,12 @@ function otf.load(filename,format,sub,featurefile)        end      else        data=nil -      report_otf("loading failed (file read error)") +      report_otf("loading failed due to read error")      end    end    if data then      if trace_defining then -      report_otf("loading from cache: %s",hash) +      report_otf("loading from cache using hash %a",hash)      end      enhance("unpack",data,filename,nil,false)      enhance("add dimensions",data,filename,nil,false) @@ -4860,13 +4857,14 @@ actions["add dimensions"]=function(data,filename)      local defaultwidth=resources.defaultwidth or 0      local defaultheight=resources.defaultheight or 0      local defaultdepth=resources.defaultdepth or 0 +    local basename=trace_markwidth and file.basename(filename)      if usemetatables then        for _,d in next,descriptions do          local wd=d.width          if not wd then            d.width=defaultwidth          elseif trace_markwidth and wd~=0 and d.class=="mark" then -          report_otf("mark with width %s (%s) in %s",wd,d.name or "<noname>",file.basename(filename)) +          report_otf("mark %a with width %b found in %s",d.name or "<noname>",wd,basename)          end          setmetatable(d,mt)        end @@ -4876,7 +4874,7 @@ actions["add dimensions"]=function(data,filename)          if not wd then            d.width=defaultwidth          elseif trace_markwidth and wd~=0 and d.class=="mark" then -          report_otf("mark with width %s (%s) in %s",wd,d.name or "<noname>",file.basename(filename)) +          report_otf("mark %a with width %b found in %s",d.name or "<noname>",wd,basename)          end          if bb then            local ht,dp=bb[4],-bb[2] @@ -4964,7 +4962,7 @@ actions["prepare glyphs"]=function(data,filename,raw)                  unicode=private                  unicodes[name]=private                  if trace_private then -                  report_otf("enhance: glyph %s at index 0x%04X is moved to private unicode slot U+%05X",name,index,private) +                  report_otf("glyph %a at index %H is moved to private unicode slot %U",name,index,private)                  end                  private=private+1                  nofnames=nofnames+1 @@ -4992,10 +4990,10 @@ actions["prepare glyphs"]=function(data,filename,raw)            report_otf("cid font remapped, %s unicode points, %s symbolic names, %s glyphs",nofunicodes,nofnames,nofunicodes+nofnames)          end        elseif trace_loading then -        report_otf("unable to remap cid font, missing cid file for %s",filename) +        report_otf("unable to remap cid font, missing cid file for %a",filename)        end      elseif trace_loading then -      report_otf("font %s has no glyphs",filename) +      report_otf("font %a has no glyphs",filename)      end    else      for index=0,raw.glyphcnt-1 do  @@ -5007,7 +5005,7 @@ actions["prepare glyphs"]=function(data,filename,raw)            unicode=private            unicodes[name]=private            if trace_private then -            report_otf("enhance: glyph %s at index 0x%04X is moved to private unicode slot U+%05X",name,index,private) +            report_otf("glyph %a at index %H is moved to private unicode slot %U",name,index,private)            end            private=private+1          else @@ -5049,7 +5047,7 @@ actions["prepare glyphs"]=function(data,filename,raw)            end          end        else -        report_otf("potential problem: glyph 0x%04X is used but empty",index) +        report_otf("potential problem: glyph %U is used but empty",index)        end      end    end @@ -5067,22 +5065,22 @@ actions["check encoding"]=function(data,filename,raw)    local criterium=0xFFFF    if find(encname,"unicode") then       if trace_loading then -      report_otf("checking embedded unicode map '%s'",encname) +      report_otf("checking embedded unicode map %a",encname)      end      for unicode,index in next,unicodetoindex do         if unicode<=criterium and not descriptions[unicode] then          local parent=indices[index]           if parent then -          report_otf("weird, unicode U+%05X points to U+%05X with index 0x%04X",unicode,parent,index) +          report_otf("weird, unicode %U points to %U with index %H",unicode,parent,index)          else -          report_otf("weird, unicode U+%05X points to nowhere with index 0x%04X",unicode,index) +          report_otf("weird, unicode %U points to nowhere with index %H",unicode,index)          end        end      end    elseif properties.cidinfo then -    report_otf("warning: no unicode map, used cidmap '%s'",properties.cidinfo.usedname or "?") +    report_otf("warning: no unicode map, used cidmap %a",properties.cidinfo.usedname)    else -    report_otf("warning: non unicode map '%s', only using glyph unicode data",encname or "whatever") +    report_otf("warning: non unicode map %a, only using glyph unicode data",encname or "whatever")    end    if mapdata then      mapdata.map={}  @@ -5117,7 +5115,7 @@ actions["add duplicates"]=function(data,filename,raw)            end          end          if trace_loading then -          report_otf("duplicating U+%05X to U+%05X with index 0x%04X (%s kerns)",unicode,u,description.index,n) +          report_otf("duplicating %U to %U with index %H (%s kerns)",unicode,u,description.index,n)          end        end      end @@ -5577,7 +5575,7 @@ local function check_variants(unicode,the_variants,splitter,unicodes)      for i=1,#glyphs do        local g=glyphs[i]        if done[g] then -        report_otf("skipping cyclic reference U+%05X in math variant U+%05X",g,unicode) +        report_otf("skipping cyclic reference %U in math variant %U",g,unicode)        else          if n==0 then            n=1 @@ -5691,7 +5689,7 @@ actions["reorganize glyph kerns"]=function(data,filename,raw)                end              end            elseif trace_loading then -            report_otf("problems with unicode %s of kern %s of glyph U+%05X",name,k,unicode) +            report_otf("problems with unicode %a of kern %a of glyph %U",name,k,unicode)            end          end        end @@ -5772,7 +5770,7 @@ actions["merge kern classes"]=function(data,filename,raw)                            lookupkerns[second_unicode]=kern                          end                        elseif trace_loading then -                        report_otf("no glyph data for U+%05X",first_unicode) +                        report_otf("no glyph data for %U",first_unicode)                        end                      end                    end @@ -5830,7 +5828,7 @@ actions["reorganize glyph lookups"]=function(data,filename,raw)            if not lt then              lookuptypes[tag]=lookuptype            elseif lt~=lookuptype then -            report_otf("conflicting lookuptypes: %s => %s and %s",tag,lt,lookuptype) +            report_otf("conflicting lookuptypes, %a points to %a and %a",tag,lt,lookuptype)            end            if lookuptype=="ligature" then              lookuplist[l]={ lpegmatch(splitter,specification.components) } @@ -6256,45 +6254,65 @@ local registerotffeature=otffeatures.register  otf.defaultbasealternate="none"   local wildcard="*"  local default="dflt" +local formatters=string.formatters +local f_unicode=formatters["%U"] +local f_uniname=formatters["%U (%s)"] +local f_unilist=formatters["% t (% t)"]  local function gref(descriptions,n)    if type(n)=="number" then      local name=descriptions[n].name      if name then -      return format("U+%05X (%s)",n,name) +      return f_uniname(n,name)      else -      return format("U+%05X") +      return f_unicode(n)      end    elseif n then      local num,nam={},{} -    for i=2,#n do  +    for i=2,#n do        local ni=n[i] -      num[i-1]=format("U+%05X",ni) -      nam[i-1]=descriptions[ni].name or "?" -    end -    return format("%s (%s)",concat(num," "),concat(nam," ")) +      if tonumber(ni) then  +        local di=descriptions[ni] +        num[i]=f_unicode(ni) +        nam[i]=di and di.name or "-" +      end +    return f_unilist(num,nam)    else -    return "?" +    return "<error in base mode tracing>"    end  end  local function cref(feature,lookupname)    if lookupname then -    return format("feature %s, lookup %s",feature,lookupname) +    return format("feature %a, lookup %a",feature,lookupname)    else -    return format("feature %s",feature) +    return format("feature %a",feature)    end  end  local function report_alternate(feature,lookupname,descriptions,unicode,replacement,value,comment) -  report_prepare("%s: base alternate %s => %s (%s => %s)",cref(feature,lookupname), -    gref(descriptions,unicode),replacement and gref(descriptions,replacement) or "-", -    tostring(value),comment) +  report_prepare("%s: base alternate %s => %s (%S => %S)", +    cref(feature,lookupname), +    gref(descriptions,unicode), +    replacement and gref(descriptions,replacement), +    value, +    comment)  end  local function report_substitution(feature,lookupname,descriptions,unicode,substitution) -  report_prepare("%s: base substitution %s => %s",cref(feature,lookupname), -    gref(descriptions,unicode),gref(descriptions,substitution)) +  report_prepare("%s: base substitution %s => %S", +    cref(feature,lookupname), +    gref(descriptions,unicode), +    gref(descriptions,substitution))  end  local function report_ligature(feature,lookupname,descriptions,unicode,ligature) -  report_prepare("%s: base ligature %s => %s",cref(feature,lookupname), -    gref(descriptions,ligature),gref(descriptions,unicode)) +  report_prepare("%s: base ligature %s => %S", +    cref(feature,lookupname), +    gref(descriptions,ligature), +    gref(descriptions,unicode)) +end +local function report_kern(feature,lookupname,descriptions,unicode,otherunicode,value) +  report_prepare("%s: base kern %s + %s => %S", +    cref(feature,lookupname), +    gref(descriptions,unicode), +    gref(descriptions,otherunicode), +    value)  end  local basemethods={}  local basemethod="<unset>" @@ -6518,15 +6536,13 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist                  newkerns={ [otherunicode]=value }                  done=true                  if traceindeed then -                  report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), -                    gref(descriptions,unicode),gref(descriptions,otherunicode),value) +                  report_kern(feature,lookup,descriptions,unicode,otherunicode,value)                  end                elseif not newkerns[otherunicode] then                   newkerns[otherunicode]=value                  done=true                  if traceindeed then -                  report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), -                    gref(descriptions,unicode),gref(descriptions,otherunicode),value) +                  report_kern(feature,lookup,descriptions,unicode,otherunicode,value)                  end                end              end @@ -6572,7 +6588,7 @@ local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,don        local character=characters[preceding]        if not character then          if trace_baseinit then -          report_prepare("weird ligature in lookup %s: U+%05X (%s), preceding U+%05X (%s)",lookupname,v,utfchar(v),preceding,utfchar(preceding)) +          report_prepare("weird ligature in lookup %a, current %C, preceding %C",lookupname,v,preceding)          end          character=makefake(tfmdata,name,present)        end @@ -6688,8 +6704,7 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist          for otherunicode,kern in next,data do            if not kerns[otherunicode] and kern~=0 then              kerns[otherunicode]=kern -            report_prepare("%s: base kern %s + %s => %s",cref(feature,lookup), -              gref(descriptions,unicode),gref(descriptions,otherunicode),kern) +            report_kern(feature,lookup,descriptions,unicode,otherunicode,kern)            end          end        else @@ -6751,7 +6766,7 @@ local function featuresinitializer(tfmdata,value)        registerbasehash(tfmdata)      end      if trace_preparing then -      report_prepare("preparation time is %0.3f seconds for %s",os.clock()-t,tfmdata.properties.fullname or "?") +      report_prepare("preparation time is %0.3f seconds for %a",os.clock()-t,tfmdata.properties.fullname)      end    end  end @@ -6859,7 +6874,7 @@ index=#mb+1        start[a_markdone]=index        return dx,dy,bound      else -      report_injections("possible problem, U+%05X is base mark without data (id: %s)",base.char,bound) +      report_injections("possible problem, %U is base mark without data (id %a)",base.char,bound)      end    end    index=index or 1 @@ -6884,38 +6899,38 @@ local function trace(head)        local cb=n[a_cursbase]        local cc=n[a_curscurs]        local char=n.char -      report_injections("char U+%05X, font %s, glyph %s",char,n.font,utfchar(char)) +      report_injections("font %s, char %U, glyph %c",char,n.font,char)        if kp then          local k=kerns[kp]          if k[3] then -          report_injections("  pairkern: dir=%s, x=%s, y=%s, w=%s, h=%s",dir(k[1]),k[2] or "?",k[3] or "?",k[4] or "?",k[5] or "?") +          report_injections("  pairkern: dir %a, x %p, y %p, w %p, h %p",dir(k[1]),k[2],k[3],k[4],k[5])          else -          report_injections("  kern: dir=%s, dx=%s",dir(k[1]),k[2] or "?") +          report_injections("  kern: dir %a, dx %p",dir(k[1]),k[2])          end        end        if mb then -        report_injections("  markbase: bound=%s",mb) +        report_injections("  markbase: bound %a",mb)        end        if mm then          local m=marks[mm]          if mb then            local m=m[mb]            if m then -            report_injections("  markmark: bound=%s, index=%s, dx=%s, dy=%s",mm,md or "?",m[1] or "?",m[2] or "?") +            report_injections("  markmark: bound %a, index %a, dx %p, dy %p",mm,md,m[1],m[2])            else -            report_injections("  markmark: bound=%s, missing index",mm) +            report_injections("  markmark: bound %a, missing index",mm)            end          else            m=m[1] -          report_injections("  markmark: bound=%s, dx=%s, dy=%s",mm,m and m[1] or "?",m and m[2] or "?") +          report_injections("  markmark: bound %a, dx %p, dy %p",mm,m and m[1],m and m[2])          end        end        if cb then -        report_injections("  cursbase: bound=%s",cb) +        report_injections("  cursbase: bound %a",cb)        end        if cc then          local c=cursives[cc] -        report_injections("  curscurs: bound=%s, dir=%s, dx=%s, dy=%s",cc,dir(c[1]),c[2] or "?",c[3] or "?") +        report_injections("  curscurs: bound %a, dir %a, dx %p, dy %p",cc,dir(c[1]),c[2],c[3])        end      end    end @@ -7415,7 +7430,7 @@ local arab_warned={}  local function warning(current,what)    local char=current.char    if not arab_warned[char] then -    log.report("analyze","arab: character %s (U+%05X) has no %s class",char,char,what) +    log.report("analyze","arab: character %C has no %a class",char,what)      arab_warned[char]=true    end  end @@ -7623,41 +7638,45 @@ end  local function logwarning(...)    report_direct(...)  end -local function gref(n) +local formatters=string.formatters +local f_unicode=formatters["%U"] +local f_uniname=formatters["%U (%s)"] +local f_unilist=formatters["% t (% t)"] +local function gref(n)     if type(n)=="number" then      local description=descriptions[n]      local name=description and description.name      if name then -      return format("U+%05X (%s)",n,name) +      return f_uniname(n,name)      else -      return format("U+%05X",n) +      return f_unicode(n)      end -  elseif not n then -    return "<error in tracing>" -  else +  elseif n then      local num,nam={},{}      for i=1,#n do        local ni=n[i]        if tonumber(ni) then           local di=descriptions[ni] -        num[i]=format("U+%05X",ni) -        nam[i]=di and di.name or "?" +        num[i]=f_unicode(ni) +        nam[i]=di and di.name or "-"        end      end -    return format("%s (%s)",concat(num," "),concat(nam," ")) +    return f_unilist(num,nam) +  else +    return "<error in node mode tracing>"    end  end  local function cref(kind,chainname,chainlookupname,lookupname,index)    if index then -    return format("feature %s, chain %s, sub %s, lookup %s, index %s",kind,chainname,chainlookupname,lookupname,index) +    return formatters["feature %a, chain %a, sub %a, lookup %a, index %a"](kind,chainname,chainlookupname,lookupname,index)    elseif lookupname then -    return format("feature %s, chain %s, sub %s, lookup %s",kind,chainname or "?",chainlookupname or "?",lookupname) +    return formatters["feature %a, chain %a, sub %a, lookup %a"](kind,chainname,chainlookupname,lookupname)    elseif chainlookupname then -    return format("feature %s, chain %s, sub %s",kind,chainname or "?",chainlookupname) +    return formatters["feature %a, chain %a, sub %a"](kind,chainname,chainlookupname)    elseif chainname then -    return format("feature %s, chain %s",kind,chainname) +    return formatters["feature %a, chain %a"](kind,chainname)    else -    return format("feature %s",kind) +    return formatters["feature %a"](kind)    end  end  local function pref(kind,lookupname) @@ -9316,7 +9335,7 @@ elseif id==math_code then                        rlmode=rlparmode                      end                      if trace_directions then -                      report_process("directions after txtdir %s: txtdir=%s:%s, parmode=%s, txtmode=%s",dir,topstack,newdir or "unset",rlparmode,rlmode) +                      report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir)                      end                    elseif subtype==localpar_code then                      local dir=start.dir @@ -9329,12 +9348,12 @@ elseif id==math_code then                      end                      rlmode=rlparmode                      if trace_directions then -                      report_process("directions after pardir %s: parmode=%s, txtmode=%s",dir,rlparmode,rlmode) +                      report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode)                      end                    end                    start=start.next -elseif id==math_code then -  start=endofmath(start).next +                elseif id==math_code then +                  start=endofmath(start).next                  else                    start=start.next                  end @@ -9395,7 +9414,7 @@ elseif id==math_code then                      rlmode=rlparmode                    end                    if trace_directions then -                    report_process("directions after txtdir %s: txtdir=%s:%s, parmode=%s, txtmode=%s",dir,topstack,newdir or "unset",rlparmode,rlmode) +                    report_process("directions after txtdir %a: parmode %a, txtmode %a, # stack %a, new dir %a",dir,rlparmode,rlmode,topstack,newdir)                    end                  elseif subtype==localpar_code then                    local dir=start.dir @@ -9408,12 +9427,12 @@ elseif id==math_code then                    end                    rlmode=rlparmode                    if trace_directions then -                    report_process("directions after pardir %s: parmode=%s, txtmode=%s",dir,rlparmode,rlmode) +                    report_process("directions after pardir %a: parmode %a, txtmode %a",dir,rlparmode,rlmode)                    end                  end                  start=start.next -elseif id==math_code then -  start=endofmath(start).next +              elseif id==math_code then +                start=endofmath(start).next                else                  start=start.next                end @@ -9565,9 +9584,9 @@ local function prepare_contextchains(tfmdata)            local format=lookupdata.format            local validformat=valid[format]            if not validformat then -            report_prepare("unsupported format %s",format) +            report_prepare("unsupported format %a",format)            elseif not validformat[lookuptype] then -            report_prepare("unsupported %s %s for %s",format,lookuptype,lookupname) +            report_prepare("unsupported format %a, lookuptype %a, lookupname %a",format,lookuptype,lookupname)            else              local contexts=lookuphash[lookupname]              if not contexts then @@ -9616,7 +9635,7 @@ local function prepare_contextchains(tfmdata)          else          end        else -        report_prepare("missing lookuptype for %s",lookupname) +        report_prepare("missing lookuptype for lookupname %a",lookupname)        end      end    end @@ -9633,7 +9652,7 @@ local function featuresinitializer(tfmdata,value)        prepare_lookups(tfmdata)        properties.initialized=true        if trace_preparing then -        report_prepare("preparation time is %0.3f seconds for %s",os.clock()-starttime,tfmdata.properties.fullname or "?") +        report_prepare("preparation time is %0.3f seconds for %a",os.clock()-starttime,tfmdata.properties.fullname)        end      end    end @@ -9759,14 +9778,13 @@ function definers.registersplit(symbol,action,verbosename)  end  local function makespecification(specification,lookup,name,sub,method,detail,size)    size=size or 655360 -  if trace_defining then -    report_defining("%s -> lookup: %s, name: %s, sub: %s, method: %s, detail: %s", -      specification,lookup~="" and lookup or "[file]",name~="" and name or "-", -      sub~="" and sub or "-",method~="" and method or "-",detail~="" and detail or "-") -  end    if not lookup or lookup=="" then      lookup=definers.defaultlookup    end +  if trace_defining then +    report_defining("specification %a, lookup %a, name %a, sub %a, method %a, detail %a", +      specification,lookup,name,sub,method,detail) +  end    local t={      lookup=lookup,      specification=specification, @@ -9889,7 +9907,7 @@ function definers.loadfont(specification)        local reader=readers[lower(forced)]        tfmdata=reader and reader(specification)        if not tfmdata then -        report_defining("forced type %s of %s not found",forced,specification.name) +        report_defining("forced type %a of %a not found",forced,specification.name)        end      else        local sequence=readers.sequence  @@ -9897,7 +9915,7 @@ function definers.loadfont(specification)          local reader=sequence[s]          if readers[reader] then             if trace_defining then -            report_defining("trying (reader sequence driven) type %s for %s with file %s",reader,specification.name,specification.filename or "unknown") +            report_defining("trying (reader sequence driven) type %a for %a with file %a",reader,specification.name,specification.filename)            end            tfmdata=readers[reader](specification)            if tfmdata then @@ -9916,7 +9934,7 @@ function definers.loadfont(specification)      end    end    if not tfmdata then -    report_defining("font with asked name '%s' is not found using lookup '%s'",specification.name,specification.lookup) +    report_defining("font with asked name %a is not found using lookup %a",specification.name,specification.lookup)    end    return tfmdata  end @@ -9956,7 +9974,7 @@ function definers.register(tfmdata,id)      if not internalized[hash] then        internalized[hash]=id        if trace_defining then -        report_defining("registering font, id: %s, hash: %s",id or "?",hash or "?") +        report_defining("registering font, id %s, hash %a",id,hash)        end        fontdata[id]=tfmdata      end @@ -9996,19 +10014,13 @@ function definers.read(specification,size,id)    end    lastdefined=tfmdata or id     if not tfmdata then  -    report_defining("unknown font %s, loading aborted",specification.name) +    report_defining("unknown font %a, loading aborted",specification.name)    elseif trace_defining and type(tfmdata)=="table" then      local properties=tfmdata.properties or {}      local parameters=tfmdata.parameters or {} -    report_defining("using %s font with id %s, name:%s size:%s bytes:%s encoding:%s fullname:%s filename:%s", -            properties.format    or "unknown", -            id            or "?", -            properties.name     or "?", -            parameters.size     or "default", -            properties.encodingbytes or "?", -            properties.encodingname or "unicode", -            properties.fullname   or "?", -     file.basename(properties.filename   or "?")) +    report_defining("using %s font with id %a, name %a, size %a, bytes %a, encoding %a, fullname %a, filename %a", +      properties.format,id,properties.name,parameters.size,properties.encodingbytes, +      properties.encodingname,properties.fullname,file.basename(properties.filename))    end    statistics.stoptiming(fonts)    return tfmdata | 
