diff options
56 files changed, 1546 insertions, 836 deletions
diff --git a/doc/context/documents/general/manuals/workflows-mkiv.pdf b/doc/context/documents/general/manuals/workflows-mkiv.pdf Binary files differindex b0af6d56e..f70f110d0 100644 --- a/doc/context/documents/general/manuals/workflows-mkiv.pdf +++ b/doc/context/documents/general/manuals/workflows-mkiv.pdf diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex e993f1544..053b9d939 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex eea03e492..f305372dc 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex 5c441b1f7..7e1e6dd8d 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex 32b81870e..dc07b31c4 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 1ef4327d8..21d857fd0 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex e574aa5dd..707bd8ba8 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex 465711bd9..3331fe43a 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/doc/context/scripts/mkii/texmfstart.man b/doc/context/scripts/mkii/texmfstart.man index 5ddb5f6b2..b79d1603f 100644 --- a/doc/context/scripts/mkii/texmfstart.man +++ b/doc/context/scripts/mkii/texmfstart.man @@ -1,4 +1,4 @@ -.TH "mtxrun" "1" "01-01-2017" "version 1.32" "ConTeXt TDS Runner Tool" +.TH "mtxrun" "1" "01-01-2017" "version 1.33" "ConTeXt TDS Runner Tool" .SH NAME .B mtxrun .SH SYNOPSIS diff --git a/doc/context/scripts/mkii/texmfstart.xml b/doc/context/scripts/mkii/texmfstart.xml index a10fef328..0fc6505f4 100644 --- a/doc/context/scripts/mkii/texmfstart.xml +++ b/doc/context/scripts/mkii/texmfstart.xml @@ -2,7 +2,7 @@ <metadata> <entry name="name">mtxrun</entry> <entry name="detail">ConTeXt TDS Runner Tool</entry> - <entry name="version">1.32</entry> + <entry name="version">1.33</entry> </metadata> <flags> <category name="basic"> diff --git a/doc/context/scripts/mkiv/context.html b/doc/context/scripts/mkiv/context.html index 199277b4e..0eb5f7e72 100644 --- a/doc/context/scripts/mkiv/context.html +++ b/doc/context/scripts/mkiv/context.html @@ -14,7 +14,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> - <title>ConTeXt Process Management 1.01</title> + <title>ConTeXt Process Management 1.02</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type="text/css"> body { color: #FFFFFF; background-color: #808080; font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans; font-size: 12px; line-height: 18px; } a:link, a:active, a:visited { color: #FFFFFF; } a.dir-view:link, a.dir-view:active, a.dir-view:visited { color: #FFFFFF; text-decoration: underline; } .valid { color: #00FF00; } .invalid { color: #FF0000; } .invisible { visibility: hidden; } button, .commonlink, .smallbutton { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; border-color: #7F7F7F; border-style: solid; border-width: .125ex; background-color: #FFFFFF; padding: .5ex; } .smallbutton { width: 1em; } a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; } h1, .title { font-style: normal; font-weight: normal; font-size: 18px; line-height: 18px; margin-bottom: 20px; } h2, .subtitle { font-style: normal; font-weight: normal; font-size: 12px; margin-top: 18px; margin-bottom: 18px; } table { line-height: 18px; font-size: 12px; margin: 0; } th { font-weight: bold; text-align: left; padding-bottom: 6px; } .tc { font-weight: bold; text-align: left; } p, li { max-width: 60em; } .empty-line { margin-top: 4px; } .more-room { margin-right: 1.5em; } .much-more-room { margin-right: 3em; } #main { position: absolute; left: 10%; top: 10%; right: 10%; bottom: 10%; z-index: 2; width: 80%; height: 80%; padding: 0%; margin: 0%; overflow: auto; border-style: none; border-width: 0; background-color: #3F3F3F; } #main-settings { margin: 12px; x_max-width: 60em; line-height: 18px; font-size: 12px; } #left { position: absolute; top : 10%; left: 0%; bottom: 0%; right: 90%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; } #right { position: absolute; top : 0%; left: 90%; bottom: 10%; right: 0%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; _margin-left: -15px; } #bottom { position: absolute; left: 10%; right: 0%; top: 90%; bottom: 0%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top { position: absolute; left: 0%; right: 10%; top: 0%; bottom: 90%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #top-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: right; vertical-align: middle; } #bottom-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #bottom-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: left; vertical-align: middle; } #left-one { position: absolute; width: 100%; buggedheight: 100%; } #left-two { position: relative; margin-top: 12px; line-height: 18px; text-align: center; vertical-align: top; } #right-one { display: table; height: 100%; width: 100%; } #right-two { display: table-row; height: 100%; width: 100%; } #right-three { display: table-cell; width: 100%; vertical-align: bottom; _position: absolute; _top: 100%; } #right-four { text-align: center; margin-bottom: 2ex; _position: relative; _top: -100%; } #more-top { position: absolute; top: 0%; left: 90%; bottom: 90%; right: 0%; z-index: 3; width: 10%; height: 10%; padding: 0%; margin: 0%; border-style: none; border-width: 0; } #more-top-settings { text-align: center; } #more-right-settings { margin-right: 12px; margin-left: 12px; line-height: 18px; font-size: 10px; text-align: center; } #right-safari { _display: table; width: 100%; height: 100%; } @@ -24,7 +24,7 @@ </head> <body> <div id="top"> <div id="top-one"> - <div id="top-two">ConTeXt Process Management 1.01 </div> + <div id="top-two">ConTeXt Process Management 1.02 </div> </div> </div> <div id="bottom"> <div id="bottom-one"> @@ -61,6 +61,7 @@ <tr><th>--trackers</th><td>list</td><td>set tracker variables (show list with --showtrackers)</td></tr> <tr><th>--directives</th><td>list</td><td>set directive variables (show list with --showdirectives)</td></tr> <tr><th>--silent</th><td>list</td><td>disable logcatgories (show list with --showlogcategories)</td></tr> + <tr><th>--errors</th><td>list</td><td>show errors at the end of a run, quit when in list (also when ----silent)</td></tr> <tr><th>--noconsole</th><td></td><td>disable logging to the console (logfile only)</td></tr> <tr><th>--purgeresult</th><td></td><td>purge result file before run</td></tr> <tr><th/><td/><td/></tr> diff --git a/doc/context/scripts/mkiv/context.man b/doc/context/scripts/mkiv/context.man index 88f970e7b..630fe6bec 100644 --- a/doc/context/scripts/mkiv/context.man +++ b/doc/context/scripts/mkiv/context.man @@ -65,6 +65,9 @@ set directive variables (show list with --showdirectives) .B --silent=list disable logcatgories (show list with --showlogcategories) .TP +.B --errors=list +show errors at the end of a run, quit when in list (also when ----silent) +.TP .B --noconsole disable logging to the console (logfile only) .TP diff --git a/doc/context/scripts/mkiv/context.xml b/doc/context/scripts/mkiv/context.xml index 25e92d7a6..e58d71f5f 100644 --- a/doc/context/scripts/mkiv/context.xml +++ b/doc/context/scripts/mkiv/context.xml @@ -70,6 +70,9 @@ <flag name="silent" value="list"> <short>disable logcatgories (show list with <ref name="showlogcategories"/>)</short> </flag> + <flag name="errors" value="list"> + <short>show errors at the end of a run, quit when in list (also when <ref name="--silent"/>)</short> + </flag> <flag name="noconsole"> <short>disable logging to the console (logfile only)</short> </flag> diff --git a/doc/context/scripts/mkiv/mtx-context.html b/doc/context/scripts/mkiv/mtx-context.html index 199277b4e..0eb5f7e72 100644 --- a/doc/context/scripts/mkiv/mtx-context.html +++ b/doc/context/scripts/mkiv/mtx-context.html @@ -14,7 +14,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> - <title>ConTeXt Process Management 1.01</title> + <title>ConTeXt Process Management 1.02</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type="text/css"> body { color: #FFFFFF; background-color: #808080; font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans; font-size: 12px; line-height: 18px; } a:link, a:active, a:visited { color: #FFFFFF; } a.dir-view:link, a.dir-view:active, a.dir-view:visited { color: #FFFFFF; text-decoration: underline; } .valid { color: #00FF00; } .invalid { color: #FF0000; } .invisible { visibility: hidden; } button, .commonlink, .smallbutton { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; border-color: #7F7F7F; border-style: solid; border-width: .125ex; background-color: #FFFFFF; padding: .5ex; } .smallbutton { width: 1em; } a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; } h1, .title { font-style: normal; font-weight: normal; font-size: 18px; line-height: 18px; margin-bottom: 20px; } h2, .subtitle { font-style: normal; font-weight: normal; font-size: 12px; margin-top: 18px; margin-bottom: 18px; } table { line-height: 18px; font-size: 12px; margin: 0; } th { font-weight: bold; text-align: left; padding-bottom: 6px; } .tc { font-weight: bold; text-align: left; } p, li { max-width: 60em; } .empty-line { margin-top: 4px; } .more-room { margin-right: 1.5em; } .much-more-room { margin-right: 3em; } #main { position: absolute; left: 10%; top: 10%; right: 10%; bottom: 10%; z-index: 2; width: 80%; height: 80%; padding: 0%; margin: 0%; overflow: auto; border-style: none; border-width: 0; background-color: #3F3F3F; } #main-settings { margin: 12px; x_max-width: 60em; line-height: 18px; font-size: 12px; } #left { position: absolute; top : 10%; left: 0%; bottom: 0%; right: 90%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; } #right { position: absolute; top : 0%; left: 90%; bottom: 10%; right: 0%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; _margin-left: -15px; } #bottom { position: absolute; left: 10%; right: 0%; top: 90%; bottom: 0%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top { position: absolute; left: 0%; right: 10%; top: 0%; bottom: 90%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #top-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: right; vertical-align: middle; } #bottom-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #bottom-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: left; vertical-align: middle; } #left-one { position: absolute; width: 100%; buggedheight: 100%; } #left-two { position: relative; margin-top: 12px; line-height: 18px; text-align: center; vertical-align: top; } #right-one { display: table; height: 100%; width: 100%; } #right-two { display: table-row; height: 100%; width: 100%; } #right-three { display: table-cell; width: 100%; vertical-align: bottom; _position: absolute; _top: 100%; } #right-four { text-align: center; margin-bottom: 2ex; _position: relative; _top: -100%; } #more-top { position: absolute; top: 0%; left: 90%; bottom: 90%; right: 0%; z-index: 3; width: 10%; height: 10%; padding: 0%; margin: 0%; border-style: none; border-width: 0; } #more-top-settings { text-align: center; } #more-right-settings { margin-right: 12px; margin-left: 12px; line-height: 18px; font-size: 10px; text-align: center; } #right-safari { _display: table; width: 100%; height: 100%; } @@ -24,7 +24,7 @@ </head> <body> <div id="top"> <div id="top-one"> - <div id="top-two">ConTeXt Process Management 1.01 </div> + <div id="top-two">ConTeXt Process Management 1.02 </div> </div> </div> <div id="bottom"> <div id="bottom-one"> @@ -61,6 +61,7 @@ <tr><th>--trackers</th><td>list</td><td>set tracker variables (show list with --showtrackers)</td></tr> <tr><th>--directives</th><td>list</td><td>set directive variables (show list with --showdirectives)</td></tr> <tr><th>--silent</th><td>list</td><td>disable logcatgories (show list with --showlogcategories)</td></tr> + <tr><th>--errors</th><td>list</td><td>show errors at the end of a run, quit when in list (also when ----silent)</td></tr> <tr><th>--noconsole</th><td></td><td>disable logging to the console (logfile only)</td></tr> <tr><th>--purgeresult</th><td></td><td>purge result file before run</td></tr> <tr><th/><td/><td/></tr> diff --git a/doc/context/scripts/mkiv/mtx-context.man b/doc/context/scripts/mkiv/mtx-context.man index 88f970e7b..630fe6bec 100644 --- a/doc/context/scripts/mkiv/mtx-context.man +++ b/doc/context/scripts/mkiv/mtx-context.man @@ -65,6 +65,9 @@ set directive variables (show list with --showdirectives) .B --silent=list disable logcatgories (show list with --showlogcategories) .TP +.B --errors=list +show errors at the end of a run, quit when in list (also when ----silent) +.TP .B --noconsole disable logging to the console (logfile only) .TP diff --git a/doc/context/scripts/mkiv/mtx-context.xml b/doc/context/scripts/mkiv/mtx-context.xml index 25e92d7a6..e58d71f5f 100644 --- a/doc/context/scripts/mkiv/mtx-context.xml +++ b/doc/context/scripts/mkiv/mtx-context.xml @@ -70,6 +70,9 @@ <flag name="silent" value="list"> <short>disable logcatgories (show list with <ref name="showlogcategories"/>)</short> </flag> + <flag name="errors" value="list"> + <short>show errors at the end of a run, quit when in list (also when <ref name="--silent"/>)</short> + </flag> <flag name="noconsole"> <short>disable logging to the console (logfile only)</short> </flag> diff --git a/doc/context/scripts/mkiv/mtxrun.man b/doc/context/scripts/mkiv/mtxrun.man index 5ddb5f6b2..b79d1603f 100644 --- a/doc/context/scripts/mkiv/mtxrun.man +++ b/doc/context/scripts/mkiv/mtxrun.man @@ -1,4 +1,4 @@ -.TH "mtxrun" "1" "01-01-2017" "version 1.32" "ConTeXt TDS Runner Tool" +.TH "mtxrun" "1" "01-01-2017" "version 1.33" "ConTeXt TDS Runner Tool" .SH NAME .B mtxrun .SH SYNOPSIS diff --git a/doc/context/scripts/mkiv/mtxrun.xml b/doc/context/scripts/mkiv/mtxrun.xml index 25f58545f..d307239c3 100644 --- a/doc/context/scripts/mkiv/mtxrun.xml +++ b/doc/context/scripts/mkiv/mtxrun.xml @@ -3,7 +3,7 @@ <metadata> <entry name="name">mtxrun</entry> <entry name="detail">ConTeXt TDS Runner Tool</entry> - <entry name="version">1.32</entry> + <entry name="version">1.33</entry> </metadata> <flags> <category name="basic"> diff --git a/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex b/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex index 0014991f2..52070c49e 100644 --- a/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex +++ b/doc/context/sources/general/manuals/workflows/workflows-mkiv.tex @@ -38,6 +38,7 @@ \stopfrontmatter \startbodymatter + \component workflows-running \component workflows-resources \component workflows-graphics \component workflows-suspects diff --git a/doc/context/sources/general/manuals/workflows/workflows-running.tex b/doc/context/sources/general/manuals/workflows/workflows-running.tex new file mode 100644 index 000000000..119633096 --- /dev/null +++ b/doc/context/sources/general/manuals/workflows/workflows-running.tex @@ -0,0 +1,53 @@ +% language=uk + +\environment workflows-style + +\startcomponent workflows-running + +\startchapter[title={Running}] + +\startsection[title={Errors}] + +A \CONTEXT\ runs normally spits out quite some information to the console. In +fact, even more information can go to the log file. It makes sense to have a look +at the end of the log file occasionally because there you can find information +about the (file) structure loaded, modules, issues with references and|/|or +fonts, etc. + +One problem with the terminal is that you can miss an issue easily, but there is +a way out of this: + +\starttyping +\enabledirectives[logs.errors] +\stoptyping + +The command line argument \type {--errors} has the same consequence. If you want +to quit in an error, you can say for instance: + +\starttyping +\enabledirectives[logs.errors=missing characters] +\stoptyping + +If you run \CONTEXT\ with \type {--trackers} or \type {--directives} you get some +information about the possible extra tracing. It might be illustrative to run a +file with: + +\starttyping +\enabletrackers[*] +\stoptyping + +\stopsection + +\startsection[title={Silent}] + +The \type {--silent} options blocks most message. You can also pass a list (or +pattern) of categories to silence. The \type {--noconsole} option only disables +logging to the console. The error reporting mentioned in the previous section +will never be silenced. + +\stopsection + +\stopchapter + +\stopcomponent + diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index c02b1a012..574f616e2 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -34,7 +34,7 @@ local formatters = string.formatters local application = logs.application { name = "mtx-context", - banner = "ConTeXt Process Management 1.01", + banner = "ConTeXt Process Management 1.02", -- helpinfo = helpinfo, -- table with { category_a = text_1, category_b = text_2 } or helpstring or xml_blob helpinfo = "mtx-context.xml", } @@ -1780,6 +1780,13 @@ do directives.enable("logs.blocked") end + local errors = getargument("errors") + if type(errors) == "errors" then + directives.enable(format("logs.errors={%s}",silent)) + elseif errors then + directives.enable("logs.errors") + end + end if getargument("once") then diff --git a/scripts/context/lua/mtx-context.xml b/scripts/context/lua/mtx-context.xml index 25e92d7a6..e58d71f5f 100644 --- a/scripts/context/lua/mtx-context.xml +++ b/scripts/context/lua/mtx-context.xml @@ -70,6 +70,9 @@ <flag name="silent" value="list"> <short>disable logcatgories (show list with <ref name="showlogcategories"/>)</short> </flag> + <flag name="errors" value="list"> + <short>show errors at the end of a run, quit when in list (also when <ref name="--silent"/>)</short> + </flag> <flag name="noconsole"> <short>disable logging to the console (logfile only)</short> </flag> diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 77b6d12f5..98f605624 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -8804,7 +8804,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 30007, stripped down to: 20818 +-- original size: 32304, stripped down to: 22602 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8823,7 +8823,8 @@ local datetime=os.date local openfile=io.open local setmetatableindex=table.setmetatableindex local formatters=string.formatters -local texgetcount=tex and tex.getcount +local settings_to_hash=utilities.parsers.settings_to_hash +local sortedkeys=table.sortedkeys local variant="default" logs=logs or {} local logs=logs @@ -9250,14 +9251,14 @@ logs.direct=direct logs.subdirect=subdirect logs.writer=writer logs.newline=newline -local data,states={},nil +local data={} +local states=nil +local force=false function logs.reporter(category,subcategory) local logger=data[category] if not logger then - local state=false - if states==true then - state=true - elseif type(states)=="table" then + local state=states==true + if not state and type(states)=="table" then for c,_ in next,states do if find(category,c) then state=true @@ -9275,7 +9276,7 @@ function logs.reporter(category,subcategory) if not reporter then if subcategory then reporter=function(...) - if not logger.state then + if force or not logger.state then subreport(category,subcategory,...) end end @@ -9283,7 +9284,7 @@ function logs.reporter(category,subcategory) else local tag=category reporter=function(...) - if not logger.state then + if force or not logger.state then report(category,...) end end @@ -9309,7 +9310,7 @@ function logs.messenger(category,subcategory) end end local function setblocked(category,value) - if category==true then + if category==true or category=="all" then category,value="*",true elseif category==false then category,value="*",false @@ -9322,7 +9323,8 @@ local function setblocked(category,value) v.state=value end else - states=utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) + alllocked=false + states=settings_to_hash(category,type(states)=="table" and states or nil) for c in next,states do local v=data[c] if v then @@ -9345,7 +9347,7 @@ function logs.enable(category) setblocked(category,false) end function logs.categories() - return table.sortedkeys(data) + return sortedkeys(data) end function logs.show() local n,c,s,max=0,0,0,0 @@ -9367,7 +9369,7 @@ function logs.show() max=m end end - local subcategories=concat(table.sortedkeys(reporters),", ") + local subcategories=concat(sortedkeys(reporters),", ") if state==true then state="disabled" elseif state==false then @@ -9394,54 +9396,57 @@ end) directives.register("logs.target",function(v) settarget(v) end) -local report_pages=logs.reporter("pages") -local real,user,sub -function logs.start_page_number() - real=texgetcount("realpageno") - user=texgetcount("userpageno") - sub=texgetcount("subpageno") -end -local timing=false -local starttime=nil -local lasttime=nil -trackers.register("pages.timing",function(v) - starttime=os.clock() - timing=true -end) -function logs.stop_page_number() - if timing then - local elapsed,average - local stoptime=os.clock() - if not lasttime or real<2 then - elapsed=stoptime - average=stoptime - starttime=stoptime - else - elapsed=stoptime-lasttime - average=(stoptime-starttime)/(real-1) - end - lasttime=stoptime - if real<=0 then - report_pages("flushing page, time %0.04f / %0.04f",elapsed,average) - elseif user<=0 then - report_pages("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) - elseif sub<=0 then - report_pages("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) - else - report_pages("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) - end - else - if real<=0 then - report_pages("flushing page") - elseif user<=0 then - report_pages("flushing realpage %s",real) - elseif sub<=0 then - report_pages("flushing realpage %s, userpage %s",real,user) +if tex then + local report=logs.reporter("pages") + local texgetcount=tex and tex.getcount + local real,user,sub + function logs.start_page_number() + real=texgetcount("realpageno") + user=texgetcount("userpageno") + sub=texgetcount("subpageno") + end + local timing=false + local starttime=nil + local lasttime=nil + trackers.register("pages.timing",function(v) + starttime=os.clock() + timing=true + end) + function logs.stop_page_number() + if timing then + local elapsed,average + local stoptime=os.clock() + if not lasttime or real<2 then + elapsed=stoptime + average=stoptime + starttime=stoptime + else + elapsed=stoptime-lasttime + average=(stoptime-starttime)/(real-1) + end + lasttime=stoptime + if real<=0 then + report("flushing page, time %0.04f / %0.04f",elapsed,average) + elseif user<=0 then + report("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) + elseif sub<=0 then + report("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) + else + report("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) + end else - report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + if real<=0 then + report("flushing page") + elseif user<=0 then + report("flushing realpage %s",real) + elseif sub<=0 then + report("flushing realpage %s, userpage %s",real,user) + else + report("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + end end + logs.flush() end - logs.flush() end local nesting=0 local verbose=false @@ -9596,6 +9601,78 @@ io.stderr:setvbuf('no') if package.helpers.report then package.helpers.report=logs.reporter("package loader") end +if tex then + local finalactions={} + local fatalerrors={} + local possiblefatal={} + local loggingerrors=false + function logs.loggingerrors() + return loggingerrors + end + directives.register("logs.errors",function(v) + loggingerrors=v + if type(v)=="string" then + fatalerrors=settings_to_hash(v) + else + fatalerrors={} + end + end) + function logs.registerfinalactions(...) + insert(finalactions,...) + end + function logs.finalactions() + if #finalactions>0 then + for i=1,#finalactions do + finalactions[i]() + end + return next(possiblefatal) and sortedkeys(possiblefatal) or false + end + end + local what=nil + local report=nil + local state=nil + local target=nil + local function startlogging(t,r,w,s) + target=t + state=force + force=true + report=type(r)=="function" and r or logs.reporter(r) + what=w + pushtarget(target) + newline() + if s then + report("start %s: %s",what,s) + else + report("start %s",what) + end + if target=="logfile" then + newline() + end + return report + end + local function stoplogging() + if target=="logfile" then + newline() + end + report("stop %s",what) + if target=="logfile" then + newline() + end + poptarget() + state=oldstate + end + function logs.startfilelogging(...) + return startlogging("logfile",...) + end + function logs.starterrorlogging(r,w,...) + if fatalerrors[w] then + possiblefatal[w]=true + end + return startlogging("terminal",r,w,...) + end + logs.stopfilelogging=stoplogging + logs.stoperrorlogging=stoplogging +end end -- of closure @@ -11545,7 +11622,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 59348, stripped down to: 37757 +-- original size: 59364, stripped down to: 37773 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -12457,7 +12534,7 @@ local function _xmlconvert_(data,settings) if errorhandler then local currentresource=settings.currentresource if currentresource and currentresource~="" then - xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr),currentresource) else xml.errorhandler(formatters["load error: %s"](errorstr)) end @@ -20425,7 +20502,7 @@ do -- create closure to overcome 200 locals limit package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true --- original size: 9144, stripped down to: 7291 +-- original size: 9268, stripped down to: 7401 if not modules then modules={} end modules ['luat-fmt']={ version=1.001, @@ -20464,6 +20541,9 @@ local function secondaryflags() if arguments.silent then flags[#flags+1]="--c:silent" end + if arguments.errors then + flags[#flags+1]="--c:errors" + end if arguments.jit then flags[#flags+1]="--c:jiton" end @@ -20500,6 +20580,7 @@ local runners={ function environment.make_format(name,arguments) local engine=environment.ownmain or "luatex" local silent=environment.arguments.silent + local errors=environment.arguments.errors local olddir=dir.current() local path=caches.getwritablepath("formats",engine) or "" if path~="" then @@ -20657,8 +20738,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 849658 --- stripped bytes : 307056 +-- original bytes : 852095 +-- stripped bytes : 307583 -- end library merge @@ -20846,30 +20927,37 @@ local e_verbose = false -- some common flags (also passed through environment) local e_silent = environment.argument("silent") +local e_errors = environment.argument("errors") local e_noconsole = environment.argument("noconsole") local e_trackers = environment.argument("trackers") local e_directives = environment.argument("directives") local e_experiments = environment.argument("experiments") -if e_silent == true then - e_silent = "*" +local t = { } + +if type(e_directives) == "string" then + t[#t+1] = e_directives end if type(e_silent) == "string" then - if type(e_directives) == "string" then - e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) - else - e_directives = format("logs.blocked={%s}",e_silent) - end + t[#t+1] = format("logs.blocked={%s}",e_silent) +elseif e_silent == true then + t[#t+1] = "logs.blocked" +end + +if type(e_errors) == "string" then + t[#t+1] = format("logs.errors={%s}",e_errors) +elseif e_errors == true then + t[#t+1] = "logs.errors" end if e_noconsole then - if type(e_directives) == "string" then - e_directives = format("%s,logs.target=file",e_directives) - else - e_directives = format("logs.target=file") - end + t[#t+1] = format("logs.target=file") +end + +if #t > 0 then + e_directives = concat(t,",") end if e_trackers then trackers .enable(e_trackers) end @@ -20890,7 +20978,7 @@ local helpinfo = [[ <metadata> <entry name="name">mtxrun</entry> <entry name="detail">ConTeXt TDS Runner Tool</entry> - <entry name="version">1.32</entry> + <entry name="version">1.33</entry> </metadata> <flags> <category name="basic"> diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 77b6d12f5..98f605624 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -8804,7 +8804,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 30007, stripped down to: 20818 +-- original size: 32304, stripped down to: 22602 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8823,7 +8823,8 @@ local datetime=os.date local openfile=io.open local setmetatableindex=table.setmetatableindex local formatters=string.formatters -local texgetcount=tex and tex.getcount +local settings_to_hash=utilities.parsers.settings_to_hash +local sortedkeys=table.sortedkeys local variant="default" logs=logs or {} local logs=logs @@ -9250,14 +9251,14 @@ logs.direct=direct logs.subdirect=subdirect logs.writer=writer logs.newline=newline -local data,states={},nil +local data={} +local states=nil +local force=false function logs.reporter(category,subcategory) local logger=data[category] if not logger then - local state=false - if states==true then - state=true - elseif type(states)=="table" then + local state=states==true + if not state and type(states)=="table" then for c,_ in next,states do if find(category,c) then state=true @@ -9275,7 +9276,7 @@ function logs.reporter(category,subcategory) if not reporter then if subcategory then reporter=function(...) - if not logger.state then + if force or not logger.state then subreport(category,subcategory,...) end end @@ -9283,7 +9284,7 @@ function logs.reporter(category,subcategory) else local tag=category reporter=function(...) - if not logger.state then + if force or not logger.state then report(category,...) end end @@ -9309,7 +9310,7 @@ function logs.messenger(category,subcategory) end end local function setblocked(category,value) - if category==true then + if category==true or category=="all" then category,value="*",true elseif category==false then category,value="*",false @@ -9322,7 +9323,8 @@ local function setblocked(category,value) v.state=value end else - states=utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) + alllocked=false + states=settings_to_hash(category,type(states)=="table" and states or nil) for c in next,states do local v=data[c] if v then @@ -9345,7 +9347,7 @@ function logs.enable(category) setblocked(category,false) end function logs.categories() - return table.sortedkeys(data) + return sortedkeys(data) end function logs.show() local n,c,s,max=0,0,0,0 @@ -9367,7 +9369,7 @@ function logs.show() max=m end end - local subcategories=concat(table.sortedkeys(reporters),", ") + local subcategories=concat(sortedkeys(reporters),", ") if state==true then state="disabled" elseif state==false then @@ -9394,54 +9396,57 @@ end) directives.register("logs.target",function(v) settarget(v) end) -local report_pages=logs.reporter("pages") -local real,user,sub -function logs.start_page_number() - real=texgetcount("realpageno") - user=texgetcount("userpageno") - sub=texgetcount("subpageno") -end -local timing=false -local starttime=nil -local lasttime=nil -trackers.register("pages.timing",function(v) - starttime=os.clock() - timing=true -end) -function logs.stop_page_number() - if timing then - local elapsed,average - local stoptime=os.clock() - if not lasttime or real<2 then - elapsed=stoptime - average=stoptime - starttime=stoptime - else - elapsed=stoptime-lasttime - average=(stoptime-starttime)/(real-1) - end - lasttime=stoptime - if real<=0 then - report_pages("flushing page, time %0.04f / %0.04f",elapsed,average) - elseif user<=0 then - report_pages("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) - elseif sub<=0 then - report_pages("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) - else - report_pages("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) - end - else - if real<=0 then - report_pages("flushing page") - elseif user<=0 then - report_pages("flushing realpage %s",real) - elseif sub<=0 then - report_pages("flushing realpage %s, userpage %s",real,user) +if tex then + local report=logs.reporter("pages") + local texgetcount=tex and tex.getcount + local real,user,sub + function logs.start_page_number() + real=texgetcount("realpageno") + user=texgetcount("userpageno") + sub=texgetcount("subpageno") + end + local timing=false + local starttime=nil + local lasttime=nil + trackers.register("pages.timing",function(v) + starttime=os.clock() + timing=true + end) + function logs.stop_page_number() + if timing then + local elapsed,average + local stoptime=os.clock() + if not lasttime or real<2 then + elapsed=stoptime + average=stoptime + starttime=stoptime + else + elapsed=stoptime-lasttime + average=(stoptime-starttime)/(real-1) + end + lasttime=stoptime + if real<=0 then + report("flushing page, time %0.04f / %0.04f",elapsed,average) + elseif user<=0 then + report("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) + elseif sub<=0 then + report("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) + else + report("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) + end else - report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + if real<=0 then + report("flushing page") + elseif user<=0 then + report("flushing realpage %s",real) + elseif sub<=0 then + report("flushing realpage %s, userpage %s",real,user) + else + report("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + end end + logs.flush() end - logs.flush() end local nesting=0 local verbose=false @@ -9596,6 +9601,78 @@ io.stderr:setvbuf('no') if package.helpers.report then package.helpers.report=logs.reporter("package loader") end +if tex then + local finalactions={} + local fatalerrors={} + local possiblefatal={} + local loggingerrors=false + function logs.loggingerrors() + return loggingerrors + end + directives.register("logs.errors",function(v) + loggingerrors=v + if type(v)=="string" then + fatalerrors=settings_to_hash(v) + else + fatalerrors={} + end + end) + function logs.registerfinalactions(...) + insert(finalactions,...) + end + function logs.finalactions() + if #finalactions>0 then + for i=1,#finalactions do + finalactions[i]() + end + return next(possiblefatal) and sortedkeys(possiblefatal) or false + end + end + local what=nil + local report=nil + local state=nil + local target=nil + local function startlogging(t,r,w,s) + target=t + state=force + force=true + report=type(r)=="function" and r or logs.reporter(r) + what=w + pushtarget(target) + newline() + if s then + report("start %s: %s",what,s) + else + report("start %s",what) + end + if target=="logfile" then + newline() + end + return report + end + local function stoplogging() + if target=="logfile" then + newline() + end + report("stop %s",what) + if target=="logfile" then + newline() + end + poptarget() + state=oldstate + end + function logs.startfilelogging(...) + return startlogging("logfile",...) + end + function logs.starterrorlogging(r,w,...) + if fatalerrors[w] then + possiblefatal[w]=true + end + return startlogging("terminal",r,w,...) + end + logs.stopfilelogging=stoplogging + logs.stoperrorlogging=stoplogging +end end -- of closure @@ -11545,7 +11622,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 59348, stripped down to: 37757 +-- original size: 59364, stripped down to: 37773 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -12457,7 +12534,7 @@ local function _xmlconvert_(data,settings) if errorhandler then local currentresource=settings.currentresource if currentresource and currentresource~="" then - xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr),currentresource) else xml.errorhandler(formatters["load error: %s"](errorstr)) end @@ -20425,7 +20502,7 @@ do -- create closure to overcome 200 locals limit package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true --- original size: 9144, stripped down to: 7291 +-- original size: 9268, stripped down to: 7401 if not modules then modules={} end modules ['luat-fmt']={ version=1.001, @@ -20464,6 +20541,9 @@ local function secondaryflags() if arguments.silent then flags[#flags+1]="--c:silent" end + if arguments.errors then + flags[#flags+1]="--c:errors" + end if arguments.jit then flags[#flags+1]="--c:jiton" end @@ -20500,6 +20580,7 @@ local runners={ function environment.make_format(name,arguments) local engine=environment.ownmain or "luatex" local silent=environment.arguments.silent + local errors=environment.arguments.errors local olddir=dir.current() local path=caches.getwritablepath("formats",engine) or "" if path~="" then @@ -20657,8 +20738,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 849658 --- stripped bytes : 307056 +-- original bytes : 852095 +-- stripped bytes : 307583 -- end library merge @@ -20846,30 +20927,37 @@ local e_verbose = false -- some common flags (also passed through environment) local e_silent = environment.argument("silent") +local e_errors = environment.argument("errors") local e_noconsole = environment.argument("noconsole") local e_trackers = environment.argument("trackers") local e_directives = environment.argument("directives") local e_experiments = environment.argument("experiments") -if e_silent == true then - e_silent = "*" +local t = { } + +if type(e_directives) == "string" then + t[#t+1] = e_directives end if type(e_silent) == "string" then - if type(e_directives) == "string" then - e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) - else - e_directives = format("logs.blocked={%s}",e_silent) - end + t[#t+1] = format("logs.blocked={%s}",e_silent) +elseif e_silent == true then + t[#t+1] = "logs.blocked" +end + +if type(e_errors) == "string" then + t[#t+1] = format("logs.errors={%s}",e_errors) +elseif e_errors == true then + t[#t+1] = "logs.errors" end if e_noconsole then - if type(e_directives) == "string" then - e_directives = format("%s,logs.target=file",e_directives) - else - e_directives = format("logs.target=file") - end + t[#t+1] = format("logs.target=file") +end + +if #t > 0 then + e_directives = concat(t,",") end if e_trackers then trackers .enable(e_trackers) end @@ -20890,7 +20978,7 @@ local helpinfo = [[ <metadata> <entry name="name">mtxrun</entry> <entry name="detail">ConTeXt TDS Runner Tool</entry> - <entry name="version">1.32</entry> + <entry name="version">1.33</entry> </metadata> <flags> <category name="basic"> diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 77b6d12f5..98f605624 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -8804,7 +8804,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 30007, stripped down to: 20818 +-- original size: 32304, stripped down to: 22602 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8823,7 +8823,8 @@ local datetime=os.date local openfile=io.open local setmetatableindex=table.setmetatableindex local formatters=string.formatters -local texgetcount=tex and tex.getcount +local settings_to_hash=utilities.parsers.settings_to_hash +local sortedkeys=table.sortedkeys local variant="default" logs=logs or {} local logs=logs @@ -9250,14 +9251,14 @@ logs.direct=direct logs.subdirect=subdirect logs.writer=writer logs.newline=newline -local data,states={},nil +local data={} +local states=nil +local force=false function logs.reporter(category,subcategory) local logger=data[category] if not logger then - local state=false - if states==true then - state=true - elseif type(states)=="table" then + local state=states==true + if not state and type(states)=="table" then for c,_ in next,states do if find(category,c) then state=true @@ -9275,7 +9276,7 @@ function logs.reporter(category,subcategory) if not reporter then if subcategory then reporter=function(...) - if not logger.state then + if force or not logger.state then subreport(category,subcategory,...) end end @@ -9283,7 +9284,7 @@ function logs.reporter(category,subcategory) else local tag=category reporter=function(...) - if not logger.state then + if force or not logger.state then report(category,...) end end @@ -9309,7 +9310,7 @@ function logs.messenger(category,subcategory) end end local function setblocked(category,value) - if category==true then + if category==true or category=="all" then category,value="*",true elseif category==false then category,value="*",false @@ -9322,7 +9323,8 @@ local function setblocked(category,value) v.state=value end else - states=utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) + alllocked=false + states=settings_to_hash(category,type(states)=="table" and states or nil) for c in next,states do local v=data[c] if v then @@ -9345,7 +9347,7 @@ function logs.enable(category) setblocked(category,false) end function logs.categories() - return table.sortedkeys(data) + return sortedkeys(data) end function logs.show() local n,c,s,max=0,0,0,0 @@ -9367,7 +9369,7 @@ function logs.show() max=m end end - local subcategories=concat(table.sortedkeys(reporters),", ") + local subcategories=concat(sortedkeys(reporters),", ") if state==true then state="disabled" elseif state==false then @@ -9394,54 +9396,57 @@ end) directives.register("logs.target",function(v) settarget(v) end) -local report_pages=logs.reporter("pages") -local real,user,sub -function logs.start_page_number() - real=texgetcount("realpageno") - user=texgetcount("userpageno") - sub=texgetcount("subpageno") -end -local timing=false -local starttime=nil -local lasttime=nil -trackers.register("pages.timing",function(v) - starttime=os.clock() - timing=true -end) -function logs.stop_page_number() - if timing then - local elapsed,average - local stoptime=os.clock() - if not lasttime or real<2 then - elapsed=stoptime - average=stoptime - starttime=stoptime - else - elapsed=stoptime-lasttime - average=(stoptime-starttime)/(real-1) - end - lasttime=stoptime - if real<=0 then - report_pages("flushing page, time %0.04f / %0.04f",elapsed,average) - elseif user<=0 then - report_pages("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) - elseif sub<=0 then - report_pages("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) - else - report_pages("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) - end - else - if real<=0 then - report_pages("flushing page") - elseif user<=0 then - report_pages("flushing realpage %s",real) - elseif sub<=0 then - report_pages("flushing realpage %s, userpage %s",real,user) +if tex then + local report=logs.reporter("pages") + local texgetcount=tex and tex.getcount + local real,user,sub + function logs.start_page_number() + real=texgetcount("realpageno") + user=texgetcount("userpageno") + sub=texgetcount("subpageno") + end + local timing=false + local starttime=nil + local lasttime=nil + trackers.register("pages.timing",function(v) + starttime=os.clock() + timing=true + end) + function logs.stop_page_number() + if timing then + local elapsed,average + local stoptime=os.clock() + if not lasttime or real<2 then + elapsed=stoptime + average=stoptime + starttime=stoptime + else + elapsed=stoptime-lasttime + average=(stoptime-starttime)/(real-1) + end + lasttime=stoptime + if real<=0 then + report("flushing page, time %0.04f / %0.04f",elapsed,average) + elseif user<=0 then + report("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) + elseif sub<=0 then + report("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) + else + report("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) + end else - report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + if real<=0 then + report("flushing page") + elseif user<=0 then + report("flushing realpage %s",real) + elseif sub<=0 then + report("flushing realpage %s, userpage %s",real,user) + else + report("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + end end + logs.flush() end - logs.flush() end local nesting=0 local verbose=false @@ -9596,6 +9601,78 @@ io.stderr:setvbuf('no') if package.helpers.report then package.helpers.report=logs.reporter("package loader") end +if tex then + local finalactions={} + local fatalerrors={} + local possiblefatal={} + local loggingerrors=false + function logs.loggingerrors() + return loggingerrors + end + directives.register("logs.errors",function(v) + loggingerrors=v + if type(v)=="string" then + fatalerrors=settings_to_hash(v) + else + fatalerrors={} + end + end) + function logs.registerfinalactions(...) + insert(finalactions,...) + end + function logs.finalactions() + if #finalactions>0 then + for i=1,#finalactions do + finalactions[i]() + end + return next(possiblefatal) and sortedkeys(possiblefatal) or false + end + end + local what=nil + local report=nil + local state=nil + local target=nil + local function startlogging(t,r,w,s) + target=t + state=force + force=true + report=type(r)=="function" and r or logs.reporter(r) + what=w + pushtarget(target) + newline() + if s then + report("start %s: %s",what,s) + else + report("start %s",what) + end + if target=="logfile" then + newline() + end + return report + end + local function stoplogging() + if target=="logfile" then + newline() + end + report("stop %s",what) + if target=="logfile" then + newline() + end + poptarget() + state=oldstate + end + function logs.startfilelogging(...) + return startlogging("logfile",...) + end + function logs.starterrorlogging(r,w,...) + if fatalerrors[w] then + possiblefatal[w]=true + end + return startlogging("terminal",r,w,...) + end + logs.stopfilelogging=stoplogging + logs.stoperrorlogging=stoplogging +end end -- of closure @@ -11545,7 +11622,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 59348, stripped down to: 37757 +-- original size: 59364, stripped down to: 37773 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -12457,7 +12534,7 @@ local function _xmlconvert_(data,settings) if errorhandler then local currentresource=settings.currentresource if currentresource and currentresource~="" then - xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr),currentresource) else xml.errorhandler(formatters["load error: %s"](errorstr)) end @@ -20425,7 +20502,7 @@ do -- create closure to overcome 200 locals limit package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true --- original size: 9144, stripped down to: 7291 +-- original size: 9268, stripped down to: 7401 if not modules then modules={} end modules ['luat-fmt']={ version=1.001, @@ -20464,6 +20541,9 @@ local function secondaryflags() if arguments.silent then flags[#flags+1]="--c:silent" end + if arguments.errors then + flags[#flags+1]="--c:errors" + end if arguments.jit then flags[#flags+1]="--c:jiton" end @@ -20500,6 +20580,7 @@ local runners={ function environment.make_format(name,arguments) local engine=environment.ownmain or "luatex" local silent=environment.arguments.silent + local errors=environment.arguments.errors local olddir=dir.current() local path=caches.getwritablepath("formats",engine) or "" if path~="" then @@ -20657,8 +20738,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 849658 --- stripped bytes : 307056 +-- original bytes : 852095 +-- stripped bytes : 307583 -- end library merge @@ -20846,30 +20927,37 @@ local e_verbose = false -- some common flags (also passed through environment) local e_silent = environment.argument("silent") +local e_errors = environment.argument("errors") local e_noconsole = environment.argument("noconsole") local e_trackers = environment.argument("trackers") local e_directives = environment.argument("directives") local e_experiments = environment.argument("experiments") -if e_silent == true then - e_silent = "*" +local t = { } + +if type(e_directives) == "string" then + t[#t+1] = e_directives end if type(e_silent) == "string" then - if type(e_directives) == "string" then - e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) - else - e_directives = format("logs.blocked={%s}",e_silent) - end + t[#t+1] = format("logs.blocked={%s}",e_silent) +elseif e_silent == true then + t[#t+1] = "logs.blocked" +end + +if type(e_errors) == "string" then + t[#t+1] = format("logs.errors={%s}",e_errors) +elseif e_errors == true then + t[#t+1] = "logs.errors" end if e_noconsole then - if type(e_directives) == "string" then - e_directives = format("%s,logs.target=file",e_directives) - else - e_directives = format("logs.target=file") - end + t[#t+1] = format("logs.target=file") +end + +if #t > 0 then + e_directives = concat(t,",") end if e_trackers then trackers .enable(e_trackers) end @@ -20890,7 +20978,7 @@ local helpinfo = [[ <metadata> <entry name="name">mtxrun</entry> <entry name="detail">ConTeXt TDS Runner Tool</entry> - <entry name="version">1.32</entry> + <entry name="version">1.33</entry> </metadata> <flags> <category name="basic"> diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 77b6d12f5..98f605624 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -8804,7 +8804,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 30007, stripped down to: 20818 +-- original size: 32304, stripped down to: 22602 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -8823,7 +8823,8 @@ local datetime=os.date local openfile=io.open local setmetatableindex=table.setmetatableindex local formatters=string.formatters -local texgetcount=tex and tex.getcount +local settings_to_hash=utilities.parsers.settings_to_hash +local sortedkeys=table.sortedkeys local variant="default" logs=logs or {} local logs=logs @@ -9250,14 +9251,14 @@ logs.direct=direct logs.subdirect=subdirect logs.writer=writer logs.newline=newline -local data,states={},nil +local data={} +local states=nil +local force=false function logs.reporter(category,subcategory) local logger=data[category] if not logger then - local state=false - if states==true then - state=true - elseif type(states)=="table" then + local state=states==true + if not state and type(states)=="table" then for c,_ in next,states do if find(category,c) then state=true @@ -9275,7 +9276,7 @@ function logs.reporter(category,subcategory) if not reporter then if subcategory then reporter=function(...) - if not logger.state then + if force or not logger.state then subreport(category,subcategory,...) end end @@ -9283,7 +9284,7 @@ function logs.reporter(category,subcategory) else local tag=category reporter=function(...) - if not logger.state then + if force or not logger.state then report(category,...) end end @@ -9309,7 +9310,7 @@ function logs.messenger(category,subcategory) end end local function setblocked(category,value) - if category==true then + if category==true or category=="all" then category,value="*",true elseif category==false then category,value="*",false @@ -9322,7 +9323,8 @@ local function setblocked(category,value) v.state=value end else - states=utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) + alllocked=false + states=settings_to_hash(category,type(states)=="table" and states or nil) for c in next,states do local v=data[c] if v then @@ -9345,7 +9347,7 @@ function logs.enable(category) setblocked(category,false) end function logs.categories() - return table.sortedkeys(data) + return sortedkeys(data) end function logs.show() local n,c,s,max=0,0,0,0 @@ -9367,7 +9369,7 @@ function logs.show() max=m end end - local subcategories=concat(table.sortedkeys(reporters),", ") + local subcategories=concat(sortedkeys(reporters),", ") if state==true then state="disabled" elseif state==false then @@ -9394,54 +9396,57 @@ end) directives.register("logs.target",function(v) settarget(v) end) -local report_pages=logs.reporter("pages") -local real,user,sub -function logs.start_page_number() - real=texgetcount("realpageno") - user=texgetcount("userpageno") - sub=texgetcount("subpageno") -end -local timing=false -local starttime=nil -local lasttime=nil -trackers.register("pages.timing",function(v) - starttime=os.clock() - timing=true -end) -function logs.stop_page_number() - if timing then - local elapsed,average - local stoptime=os.clock() - if not lasttime or real<2 then - elapsed=stoptime - average=stoptime - starttime=stoptime - else - elapsed=stoptime-lasttime - average=(stoptime-starttime)/(real-1) - end - lasttime=stoptime - if real<=0 then - report_pages("flushing page, time %0.04f / %0.04f",elapsed,average) - elseif user<=0 then - report_pages("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) - elseif sub<=0 then - report_pages("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) - else - report_pages("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) - end - else - if real<=0 then - report_pages("flushing page") - elseif user<=0 then - report_pages("flushing realpage %s",real) - elseif sub<=0 then - report_pages("flushing realpage %s, userpage %s",real,user) +if tex then + local report=logs.reporter("pages") + local texgetcount=tex and tex.getcount + local real,user,sub + function logs.start_page_number() + real=texgetcount("realpageno") + user=texgetcount("userpageno") + sub=texgetcount("subpageno") + end + local timing=false + local starttime=nil + local lasttime=nil + trackers.register("pages.timing",function(v) + starttime=os.clock() + timing=true + end) + function logs.stop_page_number() + if timing then + local elapsed,average + local stoptime=os.clock() + if not lasttime or real<2 then + elapsed=stoptime + average=stoptime + starttime=stoptime + else + elapsed=stoptime-lasttime + average=(stoptime-starttime)/(real-1) + end + lasttime=stoptime + if real<=0 then + report("flushing page, time %0.04f / %0.04f",elapsed,average) + elseif user<=0 then + report("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) + elseif sub<=0 then + report("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) + else + report("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) + end else - report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + if real<=0 then + report("flushing page") + elseif user<=0 then + report("flushing realpage %s",real) + elseif sub<=0 then + report("flushing realpage %s, userpage %s",real,user) + else + report("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + end end + logs.flush() end - logs.flush() end local nesting=0 local verbose=false @@ -9596,6 +9601,78 @@ io.stderr:setvbuf('no') if package.helpers.report then package.helpers.report=logs.reporter("package loader") end +if tex then + local finalactions={} + local fatalerrors={} + local possiblefatal={} + local loggingerrors=false + function logs.loggingerrors() + return loggingerrors + end + directives.register("logs.errors",function(v) + loggingerrors=v + if type(v)=="string" then + fatalerrors=settings_to_hash(v) + else + fatalerrors={} + end + end) + function logs.registerfinalactions(...) + insert(finalactions,...) + end + function logs.finalactions() + if #finalactions>0 then + for i=1,#finalactions do + finalactions[i]() + end + return next(possiblefatal) and sortedkeys(possiblefatal) or false + end + end + local what=nil + local report=nil + local state=nil + local target=nil + local function startlogging(t,r,w,s) + target=t + state=force + force=true + report=type(r)=="function" and r or logs.reporter(r) + what=w + pushtarget(target) + newline() + if s then + report("start %s: %s",what,s) + else + report("start %s",what) + end + if target=="logfile" then + newline() + end + return report + end + local function stoplogging() + if target=="logfile" then + newline() + end + report("stop %s",what) + if target=="logfile" then + newline() + end + poptarget() + state=oldstate + end + function logs.startfilelogging(...) + return startlogging("logfile",...) + end + function logs.starterrorlogging(r,w,...) + if fatalerrors[w] then + possiblefatal[w]=true + end + return startlogging("terminal",r,w,...) + end + logs.stopfilelogging=stoplogging + logs.stoperrorlogging=stoplogging +end end -- of closure @@ -11545,7 +11622,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 59348, stripped down to: 37757 +-- original size: 59364, stripped down to: 37773 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -12457,7 +12534,7 @@ local function _xmlconvert_(data,settings) if errorhandler then local currentresource=settings.currentresource if currentresource and currentresource~="" then - xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr),currentresource) else xml.errorhandler(formatters["load error: %s"](errorstr)) end @@ -20425,7 +20502,7 @@ do -- create closure to overcome 200 locals limit package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true --- original size: 9144, stripped down to: 7291 +-- original size: 9268, stripped down to: 7401 if not modules then modules={} end modules ['luat-fmt']={ version=1.001, @@ -20464,6 +20541,9 @@ local function secondaryflags() if arguments.silent then flags[#flags+1]="--c:silent" end + if arguments.errors then + flags[#flags+1]="--c:errors" + end if arguments.jit then flags[#flags+1]="--c:jiton" end @@ -20500,6 +20580,7 @@ local runners={ function environment.make_format(name,arguments) local engine=environment.ownmain or "luatex" local silent=environment.arguments.silent + local errors=environment.arguments.errors local olddir=dir.current() local path=caches.getwritablepath("formats",engine) or "" if path~="" then @@ -20657,8 +20738,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 849658 --- stripped bytes : 307056 +-- original bytes : 852095 +-- stripped bytes : 307583 -- end library merge @@ -20846,30 +20927,37 @@ local e_verbose = false -- some common flags (also passed through environment) local e_silent = environment.argument("silent") +local e_errors = environment.argument("errors") local e_noconsole = environment.argument("noconsole") local e_trackers = environment.argument("trackers") local e_directives = environment.argument("directives") local e_experiments = environment.argument("experiments") -if e_silent == true then - e_silent = "*" +local t = { } + +if type(e_directives) == "string" then + t[#t+1] = e_directives end if type(e_silent) == "string" then - if type(e_directives) == "string" then - e_directives = format("%s,logs.blocked={%s}",e_directives,e_silent) - else - e_directives = format("logs.blocked={%s}",e_silent) - end + t[#t+1] = format("logs.blocked={%s}",e_silent) +elseif e_silent == true then + t[#t+1] = "logs.blocked" +end + +if type(e_errors) == "string" then + t[#t+1] = format("logs.errors={%s}",e_errors) +elseif e_errors == true then + t[#t+1] = "logs.errors" end if e_noconsole then - if type(e_directives) == "string" then - e_directives = format("%s,logs.target=file",e_directives) - else - e_directives = format("logs.target=file") - end + t[#t+1] = format("logs.target=file") +end + +if #t > 0 then + e_directives = concat(t,",") end if e_trackers then trackers .enable(e_trackers) end @@ -20890,7 +20978,7 @@ local helpinfo = [[ <metadata> <entry name="name">mtxrun</entry> <entry name="detail">ConTeXt TDS Runner Tool</entry> - <entry name="version">1.32</entry> + <entry name="version">1.33</entry> </metadata> <flags> <category name="basic"> diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 27f417f29..b3055e1ae 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.09.21 21:05} +\newcontextversion{2017.09.25 19:19} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 66e27204f..9ae5d53b6 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.09.21 21:05} +\edef\contextversion{2017.09.25 19:19} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index 8e5add4dc..ddd7db44c 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{direction}{richting} \setinterfaceconstant{directory}{directory} \setinterfaceconstant{display}{scherm} +\setinterfaceconstant{displaythreshold}{displaythreshold} \setinterfaceconstant{distance}{afstand} \setinterfaceconstant{domain}{domain} \setinterfaceconstant{dot}{punt} @@ -862,6 +863,7 @@ \setinterfaceconstant{index}{index} \setinterfaceconstant{indicator}{aanduiding} \setinterfaceconstant{initialsep}{initialsep} +\setinterfaceconstant{inlinethreshold}{inlinethreshold} \setinterfaceconstant{inner}{binnen} \setinterfaceconstant{innermargin}{binnenmarge} \setinterfaceconstant{inputfile}{inputfile} diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index 46a715d2e..ecd45751a 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{direction}{جهت} \setinterfaceconstant{directory}{پوشه} \setinterfaceconstant{display}{نمایش} +\setinterfaceconstant{displaythreshold}{displaythreshold} \setinterfaceconstant{distance}{فاصله} \setinterfaceconstant{domain}{domain} \setinterfaceconstant{dot}{نقطه} @@ -862,6 +863,7 @@ \setinterfaceconstant{index}{index} \setinterfaceconstant{indicator}{اندیکاتور} \setinterfaceconstant{initialsep}{initialsep} +\setinterfaceconstant{inlinethreshold}{inlinethreshold} \setinterfaceconstant{inner}{داخلی} \setinterfaceconstant{innermargin}{حاشیهداخلی} \setinterfaceconstant{inputfile}{پروندهورودی} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 249a503d7..493147baa 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.09.21 21:05} +\newcontextversion{2017.09.25 19:19} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/cont-run.lua b/tex/context/base/mkiv/cont-run.lua index f18d06d66..6c2880438 100644 --- a/tex/context/base/mkiv/cont-run.lua +++ b/tex/context/base/mkiv/cont-run.lua @@ -187,6 +187,18 @@ local function processjob() } end + -- -- already done in mtxrun / mtx-context, has to happen very early + -- + -- if arguments.silent then + -- directives.enable("logs.blocked",arguments.silent) + -- end + -- + -- -- already done in mtxrun / mtx-context, can as well happen here + -- + -- if arguments.errors then + -- directives.enable("logs.errors",arguments.errors) + -- end + if not filename or filename == "" then -- skip elseif suffix == "xml" or arguments.forcexml then diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 50aa3a843..6707a66bf 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.09.21 21:05} +\edef\contextversion{2017.09.25 19:19} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/file-job.lua b/tex/context/base/mkiv/file-job.lua index 2612821be..61f467a22 100644 --- a/tex/context/base/mkiv/file-job.lua +++ b/tex/context/base/mkiv/file-job.lua @@ -9,11 +9,12 @@ if not modules then modules = { } end modules ['file-job'] = { -- in retrospect dealing it's not that bad to deal with the nesting -- and push/poppign at the tex end -local rawget, tostring, tonumber = rawget, tostring, tonumber +local next, rawget, tostring, tonumber = next, rawget, tostring, tonumber local gsub, match, find = string.gsub, string.match, string.find local insert, remove, concat = table.insert, table.remove, table.concat local validstring, formatters = string.valid, string.formatters local sortedhash = table.sortedhash +local setmetatableindex, setmetatablenewindex = table.setmetatableindex, table.setmetatablenewindex local commands = commands local resolvers = resolvers @@ -25,6 +26,7 @@ local implement = interfaces.implement local trace_jobfiles = false trackers.register("system.jobfiles", function(v) trace_jobfiles = v end) +local report = logs.reporter("system") local report_jobfiles = logs.reporter("system","jobfiles") local report_functions = logs.reporter("system","functions") @@ -32,9 +34,6 @@ local texsetcount = tex.setcount local elements = interfaces.elements local constants = interfaces.constants local variables = interfaces.variables -local logsnewline = logs.newline -local logspushtarget = logs.pushtarget -local logspoptarget = logs.poptarget local settings_to_array = utilities.parsers.settings_to_array local allocate = utilities.storage.allocate @@ -171,8 +170,6 @@ implement { end } -local report_system = logs.reporter("system") - -- moved from tex to lua: local texpatterns = { "%s.mkvi", "%s.mkiv", "%s.tex" } @@ -224,7 +221,7 @@ implement { local function startprocessing(name,notext) if not notext then - -- report_system("begin file %a at line %a",name,status.linenumber or 0) + -- report("begin file %a at line %a",name,status.linenumber or 0) context.dostarttextfile(name) end end @@ -232,7 +229,7 @@ end local function stopprocessing(notext) if not notext then context.dostoptextfile() - -- report_system("end file %a at line %a",name,status.linenumber or 0) + -- report("end file %a at line %a",name,status.linenumber or 0) end end @@ -240,12 +237,28 @@ end local typestack = { } local currenttype = v_text +local nofmissing = 0 +local missing = { + tex = setmetatableindex("number"), + lua = setmetatableindex("number"), + cld = setmetatableindex("number"), + xml = setmetatableindex("number"), +} --- +local function reportfailure(kind,name) + nofmissing = nofmissing + 1 + missing[kind][name] = true + report_jobfiles("unknown %s file %a",kind,name) +end -local action = function(name,foundname) input(foundname) end -local failure = function(name,foundname) report_jobfiles("unknown %s file %a","tex",name) end +-- +local function action(name,foundname) + input(foundname) +end +local function failure(name,foundname) + reportfailure("tex",name) +end local function usetexfile(name,onlyonce,notext) startprocessing(name,notext) uselibrary { @@ -258,9 +271,12 @@ local function usetexfile(name,onlyonce,notext) stopprocessing(notext) end -local action = function(name,foundname) dofile(foundname) end -local failure = function(name,foundname) report_jobfiles("unknown %s file %a","lua",name) end - +local function action(name,foundname) + dofile(foundname) +end +local function failure(name,foundname) + reportfailure("lua",name) +end local function useluafile(name,onlyonce,notext) uselibrary { name = name, @@ -271,9 +287,12 @@ local function useluafile(name,onlyonce,notext) } end -local action = function(name,foundname) dofile(foundname) end -local failure = function(name,foundname) report_jobfiles("unknown %s file %a","cld",name) end - +local function action(name,foundname) + dofile(foundname) +end +local function failure(name,foundname) + reportfailure("cld",name) +end local function usecldfile(name,onlyonce,notext) startprocessing(name,notext) uselibrary { @@ -286,9 +305,12 @@ local function usecldfile(name,onlyonce,notext) stopprocessing(notext) end -local action = function(name,foundname) context.xmlprocess(foundname,"main","") end -local failure = function(name,foundname) report_jobfiles("unknown %s file %a","xml",name) end - +local function action(name,foundname) + context.xmlprocess(foundname,"main","") +end +local function failure(name,foundname) + reportfailure("xml",name) +end local function usexmlfile(name,onlyonce,notext) startprocessing(name,notext) uselibrary { @@ -353,7 +375,7 @@ local textlevel = 0 -- inaccessible for user, we need to define counter textleve local function dummyfunction() end local function startstoperror() - report_system("invalid \\%s%s ... \\%s%s structure",elements.start,v_text,elements.stop,v_text) + report("invalid \\%s%s ... \\%s%s structure",elements.start,v_text,elements.stop,v_text) startstoperror = dummyfunction end @@ -399,9 +421,9 @@ implement { arguments = "string", actions = function(reason) if reason then - report_system("forcing quit: %s",reason) + report("forcing quit: %s",reason) else - report_system("forcing quit") + report("forcing quit") end context.batchmode() while textlevel >= 0 do @@ -413,7 +435,7 @@ implement { implement { name = "forceendjob", actions = function() - report_system([[don't use \end to finish a document]]) + report([[don't use \end to finish a document]]) context.stoptext() end } @@ -422,7 +444,7 @@ implement { name = "autostarttext", actions = function() if textlevel == 0 then - report_system([[auto \starttext ... \stoptext]]) + report([[auto \starttext ... \stoptext]]) end context.starttext() end @@ -472,9 +494,6 @@ local stacks = { -- -local report_structures = logs.reporter("system","structure") -local report_structure = logs.reporter("used structure") - local function pushtree(what,name) local t = { } top[#top+1] = { type = what, name = name, branches = t } @@ -487,29 +506,38 @@ local function poptree() -- inspect(top) end -local function log_tree(top,depth) - report_structure("%s%s: %s",depth,top.type,top.name) - local branches = top.branches - if #branches > 0 then - depth = depth .. " " - for i=1,#branches do - log_tree(branches[i],depth) +do + + local function log_tree(report,top,depth) + report("%s%s: %s",depth,top.type,top.name) + local branches = top.branches + if #branches > 0 then + depth = depth .. " " + for i=1,#branches do + log_tree(report,branches[i],depth) + end end end -end -luatex.registerstopactions(function() - logspushtarget("logfile") - logsnewline() - report_structures("start used structure") - logsnewline() - root.name = environment.jobname - log_tree(root,"") - logsnewline() - report_structures("stop used structure") - logsnewline() - logspoptarget() -end) + logs.registerfinalactions(function() + root.name = environment.jobname + -- + logs.startfilelogging(report,"used files") + log_tree(report,root,"") + logs.stopfilelogging() + -- + if nofmissing > 0 and logs.loggingerrors() then + logs.starterrorlogging(report,"missing files") + for kind, list in sortedhash(missing) do + for name in sortedhash(list) do + report("%w%s %s",6,kind,name) + end + end + logs.stoperrorlogging() + end + end) + +end local jobstructure = job.structure or { } job.structure = jobstructure @@ -1095,113 +1123,76 @@ implement { name = "setdocumentmodules", actions = document.setmodules, implement { name = "setdocumentenvironments", actions = document.setenvironments, onlyonce = true } implement { name = "setdocumentfilenames", actions = document.setfilenames, onlyonce = true } -local report_files = logs.reporter("system","files") -local report_options = logs.reporter("system","options") -local report_file = logs.reporter("used file") -local report_option = logs.reporter("used option") - -luatex.registerstopactions(function() - local foundintrees = resolvers.foundintrees() - if #foundintrees > 0 then - logspushtarget("logfile") - logsnewline() - report_files("start used files") - logsnewline() - for i=1,#foundintrees do - report_file("%4i: % T",i,foundintrees[i]) +do + + logs.registerfinalactions(function() + local foundintrees = resolvers.foundintrees() + if #foundintrees > 0 then + logs.startfilelogging(report,"used files") + for i=1,#foundintrees do + report("%4i: % T",i,foundintrees[i]) + end + logs.stopfilelogging() end - logsnewline() - report_files("stop used files") - logsnewline() - logspoptarget() - end -end) + end) -luatex.registerstopactions(function() - local files = document.files -- or environment.files - local arguments = document.arguments -- or environment.arguments - -- - logspushtarget("logfile") - logsnewline() - report_options("start commandline options") - logsnewline() - if arguments and next(arguments) then - for argument, value in sortedhash(arguments) do - report_option("%s=%A",argument,value) + logs.registerfinalactions(function() + local files = document.files -- or environment.files + local arguments = document.arguments -- or environment.arguments + -- + logs.startfilelogging(report,"commandline options") + if arguments and next(arguments) then + for argument, value in sortedhash(arguments) do + report("%s=%A",argument,value) + end + else + report("no arguments") end - else - report_file("no arguments") - end - logsnewline() - report_options("stop commandline options") - logsnewline() - report_options("start commandline files") - logsnewline() - if files and #files > 0 then - for i=1,#files do - report_file("% 4i: %s",i,files[i]) + logs.stopfilelogging() + -- + logs.startfilelogging(report,"commandline files") + if files and #files > 0 then + for i=1,#files do + report("% 4i: %s",i,files[i]) + end + else + report("no files") end - else - report_file("no files") - end - logsnewline() - report_options("stop commandline files") - logsnewline() - logspoptarget() -end) + logs.stopfilelogging() + end) + +end if environment.initex then - local report_storage = logs.reporter("system","storage") - local report_table = logs.reporter("stored table") - local report_module = logs.reporter("stored module") - local report_attribute = logs.reporter("stored attribute") - local report_catcodetable = logs.reporter("stored catcodetable") - local report_corenamespace = logs.reporter("stored corenamespace") - - luatex.registerstopactions(function() - logspushtarget("logfile") - logsnewline() - report_storage("start stored tables") - logsnewline() + logs.registerfinalactions(function() + local startfilelogging = logs.startfilelogging + local stopfilelogging = logs.stopfilelogging + startfilelogging(report,"stored tables") for k,v in sortedhash(storage.data) do - report_table("%03i %s",k,v[1]) + report("%03i %s",k,v[1]) end - logsnewline() - report_storage("stop stored tables") - logsnewline() - report_storage("start stored modules") - logsnewline() + stopfilelogging() + startfilelogging(report,"stored modules") for k,v in sortedhash(lua.bytedata) do - report_module("%03i %s %s",k,v[2],v[1]) + report("%03i %s %s",k,v[2],v[1]) end - logsnewline() - report_storage("stop stored modules") - logsnewline() - report_storage("start stored attributes") - logsnewline() + stopfilelogging() + startfilelogging(report,"stored attributes") for k,v in sortedhash(attributes.names) do - report_attribute("%03i %s",k,v) + report("%03i %s",k,v) end - logsnewline() - report_storage("stop stored attributes") - logsnewline() - report_storage("start stored catcodetables") - logsnewline() + stopfilelogging() + startfilelogging(report,"stored catcodetables") for k,v in sortedhash(catcodes.names) do - report_catcodetable("%03i % t",k,v) + report("%03i % t",k,v) end - logsnewline() - report_storage("stop stored catcodetables") - logsnewline() - report_storage("start stored corenamespaces") + stopfilelogging() + startfilelogging(report,"stored corenamespaces") for k,v in sortedhash(interfaces.corenamespaces) do - report_corenamespace("%03i %s",k,v) + report("%03i %s",k,v) end - logsnewline() - report_storage("stop stored corenamespaces") - logsnewline() - logspoptarget() + stopfilelogging() end) end @@ -1218,7 +1209,7 @@ implement { continue = inpnamefull == basename(inpfilefull) end if continue then - report_system("continuing input file %a",inpname) + report("continuing input file %a",inpname) end ctx_doifelse(continue) end diff --git a/tex/context/base/mkiv/file-mod.lua b/tex/context/base/mkiv/file-mod.lua index 7f3763c5d..3bbc28727 100644 --- a/tex/context/base/mkiv/file-mod.lua +++ b/tex/context/base/mkiv/file-mod.lua @@ -19,11 +19,13 @@ at the <l n='tex'/> side.</p> --ldx]]-- local format, find, concat, tonumber = string.format, string.find, table.concat, tonumber +local sortedhash = table.sortedhash +local basename = file.basename local trace_modules = false trackers .register("modules.loading", function(v) trace_modules = v end) local permit_unprefixed = false directives.register("modules.permitunprefixed", function(v) permit_unprefixed = v end) -local report_modules = logs.reporter("resolvers","modules") +local report = logs.reporter("modules") local commands = commands local context = context @@ -54,6 +56,7 @@ local suffixes = { } local modstatus = { } +local missing = false local function usemodule(name,hasscheme) local foundname @@ -62,19 +65,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 %a",fullname) + report("checking url %a",fullname) end foundname = resolvers.findtexfile(fullname) or "" elseif file.suffix(name) ~= "" then if trace_modules then - report_modules("checking file %a",name) + report("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 %a",fullname) + report("checking file %a",fullname) end foundname = findbyscheme("any",fullname) or "" if foundname ~= "" then @@ -84,7 +87,7 @@ local function usemodule(name,hasscheme) end if foundname ~= "" then if trace_modules then - report_modules("loading file %a",foundname) + report("loading file %a",foundname) end context.startreadingfile() resolvers.jobs.usefile(foundname,true) -- once, notext @@ -107,7 +110,7 @@ function environment.usemodules(prefix,askedname,truename) status = status + 1 else if trace_modules then - report_modules("locating, prefix %a, askedname %a, truename %a",prefix,askedname,truename) + report("locating, prefix %a, askedname %a, truename %a",prefix,askedname,truename) end local hasscheme = url.hasscheme(truename) if hasscheme then @@ -136,10 +139,10 @@ function environment.usemodules(prefix,askedname,truename) -- ok, don't change elseif find(truename,"%-") and usemodule(truename) then -- assume a user namespace - report_modules("using user prefixed file %a",truename) + report("using user prefixed file %a",truename) status = 1 elseif permit_unprefixed and usemodule(truename) then - report_modules("using unprefixed file %a",truename) + report("using unprefixed file %a",truename) status = 1 else status = 0 @@ -147,11 +150,12 @@ function environment.usemodules(prefix,askedname,truename) end end if status == 0 then - report_modules("%a is not found",askedname) + missing = true + report("%a is not found",askedname) elseif status == 1 then - report_modules("%a is loaded",trace_modules and truename or askedname) + report("%a is loaded",trace_modules and truename or askedname) else - report_modules("%a is already loaded",trace_modules and truename or askedname) + report("%a is already loaded",trace_modules and truename or askedname) end modstatus[hashname] = status end @@ -159,14 +163,14 @@ end statistics.register("loaded tex modules", function() if next(modstatus) then local t, f, nt, nf = { }, { }, 0, 0 - for k, v in table.sortedhash(modstatus) do - k = file.basename(k) + for k, v in sortedhash(modstatus) do + local b = basename(k) if v == 0 then nf = nf + 1 - f[nf] = k + f[nf] = b else nt = nt + 1 - t[nt] = k + t[nt] = b end end if nf == 0 then @@ -181,6 +185,23 @@ statistics.register("loaded tex modules", function() end end) +logs.registerfinalactions(function() + logs.startfilelogging(report,"used modules") + for k, v in sortedhash(modstatus) do + report(v == 0 and "missing: %s" or "loaded : %s",basename(k)) + end + logs.stopfilelogging() + if missing and logs.loggingerrors() then + logs.starterrorlogging(report,"missing modules") + for k, v in sortedhash(modstatus) do + if v == 0 then + report("%w%s",6,basename(k)) + end + end + logs.stoperrorlogging() + end +end) + -- moved from syst-lua.lua: local lpegmatch = lpeg.match diff --git a/tex/context/base/mkiv/font-chk.lua b/tex/context/base/mkiv/font-chk.lua index bb3f3bbd3..d9bb497ad 100644 --- a/tex/context/base/mkiv/font-chk.lua +++ b/tex/context/base/mkiv/font-chk.lua @@ -16,8 +16,11 @@ local context = context local formatters = string.formatters local bpfactor = number.dimenfactors.bp local fastcopy = table.fastcopy +local sortedkeys = table.sortedkeys +local sortedhash = table.sortedhash -local report_fonts = logs.reporter("fonts","checking") -- replace +local report = logs.reporter("fonts") +local report_checking = logs.reporter("fonts","checking") local allocate = utilities.storage.allocate @@ -30,6 +33,8 @@ local fonthashes = fonts.hashes local fontdata = fonthashes.identifiers local fontcharacters = fonthashes.characters +local currentfont = font.current + local helpers = fonts.helpers local addprivate = helpers.addprivate @@ -78,8 +83,8 @@ local action = false -- to tfmdata.properties ? local function onetimemessage(font,char,message) -- char == false returns table - local tfmdata = fontdata[font] - local shared = tfmdata.shared + local tfmdata = fontdata[font] + local shared = tfmdata.shared local messages = shared.messages if not messages then messages = { } @@ -91,10 +96,14 @@ local function onetimemessage(font,char,message) -- char == false returns table messages[message] = category end if char == false then - return table.sortedkeys(category) - elseif not category[char] then - report_fonts("char %C in font %a with id %a: %s",char,tfmdata.properties.fullname,font,message) - category[char] = true + return sortedkeys(category), category + end + local cc = category[char] + if not cc then + report_checking("char %C in font %a with id %a: %s",char,tfmdata.properties.fullname,font,message) + category[char] = 1 + else + category[char] = cc + 1 end end @@ -240,18 +249,19 @@ fonts.loggers.add_placeholders = function(id) addmissingsymbols(fontdata[ fonts.loggers.category_to_placeholder = mapping function commands.getplaceholderchar(name) - local id = font.current() + local id = currentfont() addmissingsymbols(fontdata[id]) context(getprivatenode(fontdata[id],name)) end -- todo in luatex: option to add characters (just slots, no kerns etc) +-- we can do that now so ... local function placeholder(font,char) local tfmdata = fontdata[font] local category = chardata[char].category local fakechar = mapping[category] - local slot = getprivateslot(font,fakechar) + local slot = getprivateslot(font,fakechar) if not slot then addmissingsymbols(tfmdata) slot = getprivateslot(font,fakechar) @@ -269,9 +279,9 @@ function checkers.missing(head) local char = getchar(n) if font ~= lastfont then characters = fontcharacters[font] - lastfont = font + lastfont = font end - if not characters[char] and is_character[chardata[char].category] then + if font > 0 and not characters[char] and is_character[chardata[char].category] then if action == "remove" then onetimemessage(font,char,"missing (will be deleted)") elseif action == "replace" then @@ -319,9 +329,9 @@ local relevant = { local function getmissing(id) if id then - local list = getmissing(font.current()) + local list = getmissing(currentfont()) if list then - local _, list = next(getmissing(font.current())) + local _, list = next(getmissing(currentfont())) return list else return { } @@ -329,73 +339,91 @@ local function getmissing(id) else local t = { } for id, d in next, fontdata do - local shared = d.shared + local shared = d.shared local messages = shared.messages if messages then - local tf = t[d.properties.filename] or { } + local filename = d.properties.filename + local tf = t[filename] or { } for i=1,#relevant do local tm = messages[relevant[i]] if tm then - tf = table.merged(tf,tm) + for k, v in next, tm do + tf[k] = (tf[k] or 0) + v + end end end if next(tf) then - t[d.properties.filename] = tf + t[filename] = tf end end end + local l = { } for k, v in next, t do - t[k] = table.sortedkeys(v) + l[k] = sortedkeys(v) end - return t + return l, t end end checkers.getmissing = getmissing -local tracked = false -trackers.register("fonts.missing", function(v) - if v then - enableaction("processors","fonts.checkers.missing") - tracked = true - else - disableaction("processors","fonts.checkers.missing") - end - if v == "replace" then - otffeatures.defaults.missing = true - end - action = v -end) - -local report_characters = logs.reporter("fonts","characters") -local report_character = logs.reporter("missing") - -local logsnewline = logs.newline -local logspushtarget = logs.pushtarget -local logspoptarget = logs.poptarget - -luatex.registerstopactions(function() - if tracked then - local collected = checkers.getmissing() - if next(collected) then - logspushtarget("logfile") - for filename, list in table.sortedhash(collected) do - logsnewline() - report_characters("start missing characters: %s",filename) - logsnewline() - for i=1,#list do - local u = list[i] - report_character("%U %c %s",u,u,chardata[u].description) - end - logsnewline() - report_characters("stop missing characters") - logsnewline() +do + + local reported = true + local tracked = false + + callback.register("glyph_not_found",function(font,char) + if font > 0 then + if char > 0 then + onetimemessage(font,char,"missing") + else + -- we have a special case end - logspoptarget() + elseif not reported then + report("nullfont is used, maybe no bodyfont is defined") + reported = true end - end -end) + end) + + trackers.register("fonts.missing", function(v) + if v then + enableaction("processors","fonts.checkers.missing") + tracked = true + else + disableaction("processors","fonts.checkers.missing") + end + if v == "replace" then + otffeatures.defaults.missing = true + end + action = v + end) + + logs.registerfinalactions(function() +-- if tracked then + local collected, details = getmissing() + if next(collected) then + for filename, list in sortedhash(details) do + logs.startfilelogging(report,"missing characters",filename) + for u, v in sortedhash(list) do + report("%4i %U %c %s",v,u,u,chardata[u].description) + end + logs.stopfilelogging() + end + if logs.loggingerrors() then + for filename, list in sortedhash(details) do + logs.starterrorlogging(report,"missing characters",filename) + for u, v in sortedhash(list) do + report("%4i %U %c %s",v,u,u,chardata[u].description) + end + logs.stoperrorlogging() + end + end + end +-- end + end) + +end -- for the moment here @@ -460,7 +488,3 @@ local dummies_specification = { registerotffeature(dummies_specification) registerafmfeature(dummies_specification) - --- callback.register("char_exists",function(f,c) -- to slow anyway as called often so we should flag in tfmdata --- return true --- end) diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index 8e57e568b..89466eca8 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -37,12 +37,12 @@ local trace_mapfiles = false trackers.register("fonts.mapfiles", functio local trace_automode = false trackers.register("fonts.automode", function(v) trace_automode = v end) local trace_merge = false trackers.register("fonts.merge", function(v) trace_merge = v end) +local report = logs.reporter("fonts") local report_features = logs.reporter("fonts","features") local report_cummulative = logs.reporter("fonts","cummulative") local report_defining = logs.reporter("fonts","defining") local report_status = logs.reporter("fonts","status") local report_mapfiles = logs.reporter("fonts","mapfiles") -local report_newline = logs.newline local setmetatableindex = table.setmetatableindex @@ -2127,18 +2127,16 @@ function loggers.reportdefinedfonts() } end formatcolumns(t," ") - logs.pushtarget("logfile") - report_newline() - report_status("defined fonts:") - report_newline() + -- + logs.startfilelogging(report,"defined fonts") for k=1,tn do - report_status(t[k]) + report(t[k]) end - logs.poptarget() + logs.stopfilelogging() end end -luatex.registerstopactions(loggers.reportdefinedfonts) +logs.registerfinalactions(loggers.reportdefinedfonts) function loggers.reportusedfeatures() -- numbers, setups, merged @@ -2153,18 +2151,15 @@ function loggers.reportusedfeatures() setup.number = n -- restore it (normally not needed as we're done anyway) end formatcolumns(t," ") - logs.pushtarget("logfile") - report_newline() - report_status("defined featuresets:") - report_newline() + logs.startfilelogging(report,"defined featuresets") for k=1,n do - report_status(t[k]) + report(t[k]) end - logs.poptarget() + logs.stopfilelogging() end end -luatex.registerstopactions(loggers.reportusedfeatures) +logs.registerfinalactions(loggers.reportusedfeatures) -- maybe move this to font-log.lua: diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 8d6aa5a0b..e08994373 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -44,6 +44,7 @@ local tonumber, tostring = tonumber, tostring local format, lower, find, match, gsub = string.format, string.lower, string.find, string.match, string.gsub local longtostring = string.longtostring local contains = table.contains +local sortedhash = table.sortedhash local concat, insert, remove = table.concat, table.insert, table.remove local todimen = string.todimen local collapsepath = file.collapsepath @@ -90,10 +91,8 @@ local trace_usage = false trackers.register ("graphics.usage", func local extra_check = false directives.register("graphics.extracheck", function(v) extra_check = v end) local auto_transform = true directives.register("graphics.autotransform", function(v) auto_transform = v end) +local report = logs.reporter("graphics") local report_inclusion = logs.reporter("graphics","inclusion") -local report_figures = logs.reporter("system","graphics") -local report_figure = logs.reporter("used graphic") -local report_newline = logs.newline local f_hash_part = formatters["%s->%s->%s->%s"] local f_hash_full = formatters["%s->%s->%s->%s->%s->%s->%s->%s"] @@ -208,6 +207,7 @@ figures.defaultwidth = 0 figures.defaultheight = 0 figures.defaultdepth = 0 figures.nofprocessed = 0 +figures.nofmissing = 0 figures.preferquality = true -- quality over location local figures_loaded = allocate() figures.loaded = figures_loaded @@ -302,31 +302,38 @@ function figures.badname(name) end end -luatex.registerstopactions(function() +logs.registerfinalactions(function() + local done = false if trace_usage and figures.nofprocessed > 0 then - logs.pushtarget("logfile") - report_newline() - report_figures("start names") - for _, data in table.sortedhash(figures_found) do - report_newline() - report_figure("asked : %s",data.askedname) + logs.startfilelogging(report,"names") + for _, data in sortedhash(figures_found) do + if done then + report() + else + done = true + end + report("asked : %s",data.askedname) if data.found then - report_figure("format : %s",data.format) - report_figure("found : %s",data.foundname) - report_figure("used : %s",data.fullname) + report("format : %s",data.format) + report("found : %s",data.foundname) + report("used : %s",data.fullname) if data.badname then - report_figure("comment : %s","bad name") + report("comment : %s","bad name") elseif data.comment then - report_figure("comment : %s",data.comment) + report("comment : %s",data.comment) end else - report_figure("comment : %s","not found") + report("comment : %s","not found") end end - report_newline() - report_figures("stop names") - report_newline() - logs.poptarget() + logs.stopfilelogging() + end + if figures.nofmissing > 0 and logs.loggingerrors() then + logs.starterrorlogging(report,"missing figures") + for _, data in sortedhash(figures_found) do + report("%w%s",6,data.askedname) + end + logs.stoperrorlogging() end end) @@ -841,6 +848,9 @@ local function register(askedname,specification) specification.arguments or "" ) figures_found[askedhash] = specification + if not specification.found then + figures.nofmissing = figures.nofmissing + 1 + end return specification end @@ -1184,7 +1194,7 @@ statistics.register("used graphics",function() local filename = file.nameonly(environment.jobname) .. "-figures-usage.lua" if next(figures_found) then local found = { } - for _, data in table.sortedhash(figures_found) do + for _, data in sortedhash(figures_found) do found[#found+1] = data for k, v in next, data do if v == false or v == "" then diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua index e89bda12b..ba8610933 100644 --- a/tex/context/base/mkiv/lpdf-ano.lua +++ b/tex/context/base/mkiv/lpdf-ano.lua @@ -28,9 +28,9 @@ local trace_bookmarks = false trackers.register("references.bookmarks", local log_destinations = false directives.register("destinations.log", function(v) log_destinations = v end) local untex_urls = true directives.register("references.untexurls", function(v) untex_urls = v end) -local report_reference = logs.reporter("backend","references") -local report_destination = logs.reporter("backend","destinations") -local report_bookmark = logs.reporter("backend","bookmarks") +local report_references = logs.reporter("backend","references") +local report_destinations = logs.reporter("backend","destinations") +local report_bookmarks = logs.reporter("backend","bookmarks") local variables = interfaces.variables local v_auto = variables.auto @@ -160,7 +160,7 @@ local pagedestinations = setmetatableindex(function(t,k) end local v = rawget(t,k) if v then - -- report_reference("page number expected, got %s: %a",type(k),k) + -- report_references("page number expected, got %s: %a",type(k),k) return v end local v = k > 0 and pdfarray { @@ -197,7 +197,7 @@ local destinations = { } -- to be used soon local function pdfregisterdestination(name,reference) local d = destinations[name] if d then - report_destination("ignoring duplicate destination %a with reference %a",name,reference) + report_destinations("ignoring duplicate destination %a with reference %a",name,reference) else destinations[name] = reference end @@ -207,25 +207,16 @@ lpdf.registerdestination = pdfregisterdestination local maxslice = 32 -- could be made configureable ... 64 is also ok -luatex.registerstopactions(function() +logs.registerfinalactions(function() if log_destinations and next(destinations) then - local logsnewline = logs.newline - local log_destinations = logs.reporter("system","references") - local log_destination = logs.reporter("destination") - logs.pushtarget("logfile") - logsnewline() - log_destinations("start used destinations") - logsnewline() + local report = logs.startfilelogging("references","used destinations") local n = 0 for destination, pagenumber in table.sortedhash(destinations) do - log_destination("% 4i : %-5s : %s",pagenumber,usedviews[destination] or defaultview,destination) + report("% 4i : %-5s : %s",pagenumber,usedviews[destination] or defaultview,destination) n = n + 1 end - logsnewline() - log_destinations("stop used destinations") - logsnewline() - logs.poptarget() - report_destination("%s destinations saved in log file",n) + logs.stopfilelogging() + report_destinations("%s destinations saved in log file",n) end end) @@ -433,7 +424,7 @@ function nodeinjections.destination(width,height,depth,names,view) -- todo check if begin end node / was comment view = view and mapping[view] or defaultview if trace_destinations then - report_destination("width %p, height %p, depth %p, names %|t, view %a",width,height,depth,names,view) + report_destinations("width %p, height %p, depth %p, names %|t, view %a",width,height,depth,names,view) end local method = references.innermethod local noview = view == defaultview @@ -674,7 +665,7 @@ end -- local function reference(width,height,depth,prerolled) -- keep this one -- if prerolled then -- if trace_references then --- report_reference("width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled) +-- report_references("width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled) -- end -- return pdfannotation_node(width,height,depth,prerolled) -- end @@ -728,7 +719,7 @@ end function nodeinjections.reference(width,height,depth,prerolled) if prerolled then if trace_references then - report_reference("link: width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled) + report_references("link: width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled) end return new_latelua(function() finishreference(width,height,depth,prerolled) end) end @@ -737,7 +728,7 @@ end function nodeinjections.annotation(width,height,depth,prerolled,r) if prerolled then if trace_references then - report_reference("special: width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled) + report_references("special: width %p, height %p, depth %p, prerolled %a",width,height,depth,prerolled) end return new_latelua(function() finishannotation(width,height,depth,prerolled,r or false) end) end @@ -822,7 +813,7 @@ runners["inner"] = function(var,actions) end runners["inner with arguments"] = function(var,actions) - report_reference("todo: inner with arguments") + report_references("todo: inner with arguments") return false end @@ -845,7 +836,7 @@ runners["special outer with operation"] = function(var,actions) end runners["special outer"] = function(var,actions) - report_reference("todo: special outer") + report_references("todo: special outer") return false end @@ -855,22 +846,22 @@ runners["special"] = function(var,actions) end runners["outer with inner with arguments"] = function(var,actions) - report_reference("todo: outer with inner with arguments") + report_references("todo: outer with inner with arguments") return false end runners["outer with special and operation and arguments"] = function(var,actions) - report_reference("todo: outer with special and operation and arguments") + report_references("todo: outer with special and operation and arguments") return false end runners["outer with special"] = function(var,actions) - report_reference("todo: outer with special") + report_references("todo: outer with special") return false end runners["outer with special and operation"] = function(var,actions) - report_reference("todo: outer with special and operation") + report_references("todo: outer with special and operation") return false end @@ -882,7 +873,7 @@ function specials.internal(var,actions) -- better resolve in strc-ref local v = i and references.internals[i] if not v then -- error - report_reference("no internal reference %a",i or "<unset>") + report_references("no internal reference %a",i or "<unset>") else flaginternals[i] = true return pdflinkinternal(i,v.references.realpage) @@ -1182,17 +1173,17 @@ local function build(levels,start,parent,method,nested) if entry then pdfflushobject(child,entry) else - report_bookmark("error 1") + report_bookmarks("error 1") end return i, n, first, last else - report_bookmark("confusing level change at level %a around %a",level,title) + report_bookmarks("confusing level change at level %a around %a",level,title) startlevel = level end end if level == startlevel then if trace_bookmarks then - report_bookmark("%3i %w%s %s",realpage,(level-1)*2,(opened and "+") or "-",title) + report_bookmarks("%3i %w%s %s",realpage,(level-1)*2,(opened and "+") or "-",title) end local prev = child child = pdfreserveobject() @@ -1231,7 +1222,7 @@ local function build(levels,start,parent,method,nested) entry.Last = pdfreference(l) end else - report_bookmark("error 2") + report_bookmarks("error 2") end else -- missing intermediate level but ok @@ -1244,7 +1235,7 @@ local function build(levels,start,parent,method,nested) end pdfflushobject(child,entry) else - report_bookmark("error 3") + report_bookmarks("error 3") end return i, n, first, last end diff --git a/tex/context/base/mkiv/lpdf-epd.lua b/tex/context/base/mkiv/lpdf-epd.lua index 06afaa087..59a1aa364 100644 --- a/tex/context/base/mkiv/lpdf-epd.lua +++ b/tex/context/base/mkiv/lpdf-epd.lua @@ -37,67 +37,119 @@ local lower, match, char, byte, find = string.lower, string.match, string.char, local abs = math.abs local concat = table.concat local toutf, toeight, utfchar = string.toutf, utf.toeight, utf.char +local setmetatableindex = table.setmetatableindex local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local P, C, S, R, Ct, Cc, V, Carg, Cs, Cf, Cg = lpeg.P, lpeg.C, lpeg.S, lpeg.R, lpeg.Ct, lpeg.Cc, lpeg.V, lpeg.Carg, lpeg.Cs, lpeg.Cf, lpeg.Cg -local epdf = epdf - lpdf = lpdf or { } -local lpdf = lpdf -local lpdf_epdf = { } -lpdf.epdf = lpdf_epdf +local epdf = epdf + lpdf = lpdf or { } +local lpdf = lpdf +local lpdf_epdf = { } +lpdf.epdf = lpdf_epdf + +-- local getDict, getArray, getReal, getNum, getString, getBool, getName, getRef, getRefNum +-- local getType, getTypeName +-- local dictGetLength, dictGetVal, dictGetValNF, dictGetKey +-- local arrayGetLength, arrayGetNF, arrayGet +-- local streamReset, streamGetDict, streamGetChar +-- +-- do +-- local object = epdf.Object() +-- -- +-- getDict = object.getDict +-- getArray = object.getArray +-- getReal = object.getReal +-- getNum = object.getNum +-- getString = object.getString +-- getBool = object.getBool +-- getName = object.getName +-- getRef = object.getRef +-- getRefNum = object.getRefNum +-- -- +-- getType = object.getType +-- getTypeName = object.getTypeName +-- -- +-- streamReset = object.streamReset +-- streamGetDict = object.streamGetDict +-- streamGetChar = object.streamGetChar +-- -- +-- end +-- +-- local function initialize_methods(xref) +-- local dictionary = epdf.Dict(xref) +-- local array = epdf.Array(xref) +-- -- +-- dictGetLength = dictionary.getLength +-- dictGetVal = dictionary.getVal +-- dictGetValNF = dictionary.getValNF +-- dictGetKey = dictionary.getKey +-- -- +-- arrayGetLength = array.getLength +-- arrayGetNF = array.getNF +-- arrayGet = array.get +-- -- +-- initialize_methods = function() +-- -- already done +-- end +-- end -local pdf_open = epdf.open +-- We use as little as possible and also not an object interface. After all, we +-- don't know how the library (and its api) evolves so we better can be prepared +-- for wrappers. -local report_epdf = logs.reporter("epdf") +local registry = debug.getregistry() -local getDict, getArray, getReal, getNum, getString, getBool, getName, getRef, getRefNum -local getType, getTypeName -local dictGetLength, dictGetVal, dictGetValNF, dictGetKey -local arrayGetLength, arrayGetNF, arrayGet -local streamReset, streamGetDict, streamGetChar +local object = registry["epdf.Object"] -- or epdf.Object() +local dictionary = registry["epdf.Dict"] -- or epdf.Dict(xref) (possible when document open) +local array = registry["epdf.Array"] -- or epdf.Array(xref) (possible when document open) +local xref = registry["epdf.XRef"] +local catalog = registry["epdf.Catalog"] +local pdfdoc = registry["epdf.PDFDoc"] --- getCatalog getNumPages getPageRef fetch getXRef getDocInfo +local openPDF = epdf.open -do - local object = epdf.Object() - -- - getDict = object.getDict - getArray = object.getArray - getReal = object.getReal - getNum = object.getNum - getString = object.getString - getBool = object.getBool - getName = object.getName - getRef = object.getRef - getRefNum = object.getRefNum - -- - getType = object.getType - getTypeName = object.getTypeName - -- - streamReset = object.streamReset - streamGetDict = object.streamGetDict - streamGetChar = object.streamGetChar - -- -end +local getDict = object.getDict +local getArray = object.getArray +local getReal = object.getReal +local getNum = object.getNum +local getString = object.getString +local getBool = object.getBool +local getName = object.getName +local getRef = object.getRef +local getRefNum = object.getRefNum -local function initialize_methods(xref) - local dictionary = epdf.Dict(xref) - local array = epdf.Array(xref) - -- - dictGetLength = dictionary.getLength - dictGetVal = dictionary.getVal - dictGetValNF = dictionary.getValNF - dictGetKey = dictionary.getKey - -- - arrayGetLength = array.getLength - arrayGetNF = array.getNF - arrayGet = array.get - -- - initialize_methods = function() - -- already done - end -end +local getType = object.getType +local getTypeName = object.getTypeName + +local streamReset = object.streamReset +local streamGetDict = object.streamGetDict +local streamGetChar = object.streamGetChar + +local dictGetLength = dictionary.getLength +local dictGetVal = dictionary.getVal +local dictGetValNF = dictionary.getValNF +local dictGetKey = dictionary.getKey + +local arrayGetLength = array.getLength +local arrayGetNF = array.getNF +local arrayGet = array.get + +-- these are kind of weird as they can't be accessed by (root) object + +local getNumPages = catalog.getNumPages +local getPageRef = catalog.getPageRef + +local getXRef = pdfdoc.getXRef +local getRawCatalog = pdfdoc.getCatalog + +local fetch = xref.fetch +local getCatalog = xref.getCatalog +local getDocInfo = xref.getDocInfo + +-- we're done with library shortcuts + +local report_epdf = logs.reporter("epdf") local typenames = { [0] = "boolean", @@ -273,7 +325,10 @@ local function some_array(a,document) setmetatable(t, { __index = function(t,k) return prepare(document,a,t,n,k) - end + end, + __len = function(t) + return n + end, } ) return t end @@ -287,7 +342,10 @@ local function get_array(object,document) setmetatable(t, { __index = function(t,k) return prepare(document,a,t,n,k) - end + end, + __len = function(t) + return n + end, } ) return t end @@ -371,7 +429,7 @@ local function invalidaccess(k,document) end end -checked_access = table.setmetatableindex(function(t,k) +checked_access = setmetatableindex(function(t,k) return function(v,document) invalidaccess(k,document) end @@ -470,20 +528,25 @@ local function getstructure(document) return document.Catalog.StructTreeRoot end +-- This is the only messy helper. We can't access the root as any object (it seems) +-- so we need a few low level acessors. It's anyway sort of simple enough to deal +-- with but it won't win a beauty contest. + local function getpages(document,Catalog) - local __data__ = document.__data__ - local __xrefs__ = document.__xrefs__ - local __cache__ = document.__cache__ - local __xref__ = document.__xref__ + local __data__ = document.__data__ + local __xrefs__ = document.__xrefs__ + local __cache__ = document.__cache__ + local __xref__ = document.__xref__ -- - local catalog = __data__:getCatalog() - local pages = { } - local nofpages = catalog:getNumPages() - local metatable = { __index = Catalog.Pages } + local rawcatalog = getRawCatalog(__data__) + local nofpages = getNumPages(rawcatalog) + -- + local pages = { } + local metatable = { __index = Catalog.Pages } -- somewhat empty -- for pagenumber=1,nofpages do - local pagereference = catalog:getPageRef(pagenumber).num - local pageobject = __xref__:fetch(pagereference,0) + local pagereference = getPageRef(rawcatalog,pagenumber).num + local pageobject = fetch(__xref__,pagereference,0) local pagedata = get_dictionary(pageobject,document,pagereference,metatable) if pagedata then -- rawset(pagedata,"number",pagenumber) @@ -498,61 +561,53 @@ local function getpages(document,Catalog) -- pages.n = nofpages -- + document.pages = pages return pages end --- loader - -local function delayed(document,tag,f) - local t = { } - setmetatable(t, { __index = function(t,k) - local result = f() - if result then - document[tag] = result - return result[k] - end - end } ) - return t +local function resolve(document,k) + local entry = nil + local Catalog = document.Catalog + local Names = Catalog.Names + if k == "pages" then + entry = getpages(document,Catalog) + elseif k == "destinations" then + entry = getnames(document,Names and Names.Dests) + elseif k == "javascripts" then + entry = getnames(document,Names and Names.JS) + elseif k == "widgets" then + entry = getnames(document,Names and Names.AcroForm) + elseif k == "embeddedfiles" then + entry = getnames(document,Names and Names.EmbeddedFiles) + elseif k == "layers" then + entry = getlayers(document) + elseif k == "structure" then + entry = getstructure(document) + end + document[k] = entry + return entry end --- local catobj = data:getXRef():fetch(data:getXRef():getRootNum(),data:getXRef():getRootGen()) --- print(catobj:getDict(),data:getXRef():getCatalog():getDict()) - local loaded = { } function lpdf_epdf.load(filename) local document = loaded[filename] if not document then statistics.starttiming(lpdf_epdf) - local __data__ = pdf_open(filename) -- maybe resolvers.find_file + local __data__ = openPDF(filename) -- maybe resolvers.find_file if __data__ then - local __xref__ = __data__:getXRef() + local __xref__ = getXRef(__data__) document = { filename = filename, __cache__ = { }, __xrefs__ = { }, __fonts__ = { }, __data__ = __data__, - __xref__ = __xref__, + __xref__ = __xref__ } - -- - initialize_methods(__xref__) - -- - local Catalog = some_dictionary(__xref__:getCatalog():getDict(),document) - local Info = some_dictionary(__xref__:getDocInfo():getDict(),document) --- local Catalog = some_dictionary(getDict(__xref__:getCatalog()),document) --- local Info = some_dictionary(getDict(__xref__:getDocInfo()),document) - -- - document.Catalog = Catalog - document.Info = Info - -- a few handy helper tables - document.pages = delayed(document,"pages", function() return getpages(document,Catalog) end) - document.destinations = delayed(document,"destinations", function() return getnames(document,Catalog.Names and Catalog.Names.Dests) end) - document.javascripts = delayed(document,"javascripts", function() return getnames(document,Catalog.Names and Catalog.Names.JS) end) - document.widgets = delayed(document,"widgets", function() return getnames(document,Catalog.Names and Catalog.Names.AcroForm) end) - document.embeddedfiles = delayed(document,"embeddedfiles",function() return getnames(document,Catalog.Names and Catalog.Names.EmbeddedFiles) end) - document.layers = delayed(document,"layers", function() return getlayers(document) end) - document.structure = delayed(document,"structure", function() return getstructure(document) end) + document.Catalog = some_dictionary(getDict(getCatalog(__xref__)),document) + document.Info = some_dictionary(getDict(getDocInfo(__xref__)),document) + setmetatableindex(document,resolve) else document = false end @@ -667,7 +722,7 @@ local function analyzefonts(document,resources) -- unfinished fonts[id] = { tounicode = type(tounicode) == "table" and tounicode or { } } - table.setmetatableindex(fonts[id],"self") + setmetatableindex(fonts[id],"self") end end end diff --git a/tex/context/base/mkiv/luat-fmt.lua b/tex/context/base/mkiv/luat-fmt.lua index f61c659fa..30c55eecc 100644 --- a/tex/context/base/mkiv/luat-fmt.lua +++ b/tex/context/base/mkiv/luat-fmt.lua @@ -39,6 +39,9 @@ local function secondaryflags() if arguments.silent then flags[#flags+1] = "--c:silent" end + if arguments.errors then + flags[#flags+1] = "--c:errors" + end if arguments.jit then flags[#flags+1] = "--c:jiton" end @@ -82,6 +85,7 @@ local runners = { function environment.make_format(name,arguments) local engine = environment.ownmain or "luatex" local silent = environment.arguments.silent + local errors = environment.arguments.errors -- change to format path (early as we need expanded paths) local olddir = dir.current() local path = caches.getwritablepath("formats",engine) or "" -- maybe platform diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua index 14927dbbc..2e226dd18 100644 --- a/tex/context/base/mkiv/luat-run.lua +++ b/tex/context/base/mkiv/luat-run.lua @@ -52,14 +52,26 @@ local function stop_run() for i=1,#stopactions do stopactions[i]() end + local quit = logs.finalactions() if trace_job_status then statistics.show() end if trace_tex_status then + logs.newline() for k, v in table.sortedhash(status.list()) do report_tex("%S=%S",k,v) end end + if quit then + if status.setexitcode then + status.setexitcode(1) + if type(quit) == "table" then + logs.newline() + report_tex("quitting due to: %, t",quit) + logs.newline() + end + end + end if logs.stop_run then logs.stop_run() end diff --git a/tex/context/base/mkiv/lxml-tab.lua b/tex/context/base/mkiv/lxml-tab.lua index a4234ca6e..cc6ba289a 100644 --- a/tex/context/base/mkiv/lxml-tab.lua +++ b/tex/context/base/mkiv/lxml-tab.lua @@ -1190,7 +1190,7 @@ local function _xmlconvert_(data,settings) if errorhandler then local currentresource = settings.currentresource if currentresource and currentresource ~= "" then - xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr),currentresource) else xml.errorhandler(formatters["load error: %s"](errorstr)) end diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua index b7c76c193..2fd26c3b2 100644 --- a/tex/context/base/mkiv/lxml-tex.lua +++ b/tex/context/base/mkiv/lxml-tex.lua @@ -201,8 +201,8 @@ end -- tex interface -lxml.loaded = lxml.loaded or { } -local loaded = lxml.loaded +local loaded = lxml.loaded or { } +lxml.loaded = loaded -- print(contextdirective("context-mathml-directive function reduction yes ")) -- print(contextdirective("context-mathml-directive function ")) @@ -322,6 +322,40 @@ end -- storage +do + + local noferrors = 0 + local errors = setmetatableindex("number") + local errorhandler = xml.errorhandler + + function xml.errorhandler(message,filename) + if filename and filename ~= "" then + noferrors = noferrors + 1 + errors[filename] = errors[filename] + 1 + end + errorhandler(filename) + end + + logs.registerfinalactions(function() + if noferrors > 0 then + local report = logs.startfilelogging("lxml","problematic xml files") + for k, v in table.sortedhash(errors) do + report("%4i %s",v,k) + end + logs.stopfilelogging() + -- + if logs.loggingerrors() then + logs.starterrorlogging(report,"problematic xml files") + for k, v in table.sortedhash(errors) do + report("%4i %s",v,k) + end + logs.stoperrorlogging() + end + end + end) + +end + function lxml.store(id,root,filename) loaded[id] = root xmlsetproperty(root,"name",id) @@ -557,8 +591,8 @@ function lxml.load(id,filename,compress) noffiles, nofconverted = noffiles + 1, nofconverted + 1 starttiming(xml) local ok, data = resolvers.loadbinfile(filename) --- local xmltable = lxmlconvert(id,(ok and data) or "",compress,formatters["id: %s, file: %s"](id,filename)) -local xmltable = lxmlconvert(id,(ok and data) or "",compress,filename) + -- local xmltable = lxmlconvert(id,(ok and data) or "",compress,formatters["id: %s, file: %s"](id,filename)) + local xmltable = lxmlconvert(id,(ok and data) or "",compress,filename) stoptiming(xml) lxml.store(id,xmltable,filename) return xmltable, filename @@ -600,19 +634,18 @@ function lxml.include(id,pattern,attribute,options) filename = resolveprefix(filename) or filename end -- some protection - if options.rootpath then - if dirname(filename) == "" and root.filename then - local dn = dirname(root.filename) - if dn ~= "" then - filename = joinfile(dn,filename) - end + if options.rootpath and dirname(filename) == "" and root.filename then + local dn = dirname(root.filename) + if dn ~= "" then + filename = joinfile(dn,filename) end end if trace_loading then report_lxml("including file %a",filename) end noffiles, nofconverted = noffiles + 1, nofconverted + 1 - return resolvers.loadtexfile(filename) or "", + return + resolvers.loadtexfile(filename) or "", resolvers.findtexfile(filename) or "" else return "" diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua index 3c0b1678c..e623a8d61 100644 --- a/tex/context/base/mkiv/publ-ini.lua +++ b/tex/context/base/mkiv/publ-ini.lua @@ -79,10 +79,6 @@ local v_dataset = variables.dataset local conditionals = tex.conditionals -local logsnewline = logs.newline -local logspushtarget = logs.pushtarget -local logspoptarget = logs.poptarget - local isdefined = tex.isdefined ----- basicsorter = sorters.basicsorter -- (a,b) @@ -224,15 +220,13 @@ statistics.register("publications load time", function() end end) -luatex.registerstopactions(function() - local done = false +logs.registerfinalactions(function() + local done = false + local unknown = false for name, dataset in sortedhash(datasets) do for command, n in sortedhash(dataset.commands) do if not done then - logspushtarget("logfile") - logsnewline() - report("start used btx commands") - logsnewline() + logs.startfilelogging(report,"used btx commands") done = true end if isdefined[command] then @@ -241,14 +235,23 @@ luatex.registerstopactions(function() report("%-20s %-20s % 5i %s",name,command,n,"KNOWN") else report("%-20s %-20s % 5i %s",name,command,n,"unknown") + unknown = true end end end if done then - logsnewline() - report("stop used btx commands") - logsnewline() - logspoptarget() + logs.stopfilelogging() + end + if unknown and logs.loggingerrors() then + logs.starterrorlogging(report,"unknown btx commands") + for name, dataset in sortedhash(datasets) do + for command, n in sortedhash(dataset.commands) do + if not isdefined[command] and not isdefined[upper(command)] then + report("%-20s %-20s % 5i %s",name,command,n,"unknown") + end + end + end + logs.stoperrorlogging() end end) diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 962f63e0a..80163a4be 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex fa7946a53..0a429d4d3 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua index 41ebf353e..6b2d3f240 100644 --- a/tex/context/base/mkiv/strc-ref.lua +++ b/tex/context/base/mkiv/strc-ref.lua @@ -37,10 +37,10 @@ local check_duplicates = true directives.register("structures.referencing.checkduplicates", function(v) check_duplicates = v end) local report_references = logs.reporter("references") -local report_unknown = logs.reporter("references","unknown") local report_identifying = logs.reporter("references","identifying") local report_importing = logs.reporter("references","importing") local report_empty = logs.reporter("references","empty") +local report = report_references local variables = interfaces.variables local v_page = variables.page @@ -59,10 +59,6 @@ local texconditionals = tex.conditionals local productcomponent = resolvers.jobs.productcomponent local justacomponent = resolvers.jobs.justacomponent -local logsnewline = logs.newline -local logspushtarget = logs.pushtarget -local logspoptarget = logs.poptarget - ----- settings_to_array = utilities.parsers.settings_to_array local settings_to_table = utilities.parsers.settings_to_array_obey_fences local process_settings = utilities.parsers.process_stripped_settings @@ -1871,26 +1867,26 @@ implement { } } -function references.reportproblems() -- might become local +logs.registerfinalactions(function() if nofunknowns > 0 then statistics.register("cross referencing", function() return format("%s identified, %s unknown",nofidentified,nofunknowns) end) - logspushtarget("logfile") - logsnewline() - report_references("start problematic references") - logsnewline() - for k, v in table.sortedpairs(unknowns) do - report_unknown("%4i: %s",v,k) + local sortedhash = table.sortedhash + logs.startfilelogging(report,"missing references") + for k, v in table.sortedhash(unknowns) do + report("%4i %s",v,k) + end + logs.stopfilelogging() + if logs.loggingerrors() then + logs.starterrorlogging(report,"missing references") + for k, v in table.sortedhash(unknowns) do + report("%4i %s",v,k) + end + logs.stoperrorlogging() end - logsnewline() - report_references("stop problematic references") - logsnewline() - logspoptarget() end -end - -luatex.registerstopactions(references.reportproblems) +end) -- The auto method will try to avoid named internals in a clever way which -- can make files smaller without sacrificing external references. Some of diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv index 006edd9a1..401e82fec 100644 --- a/tex/context/base/mkiv/tabl-tbl.mkiv +++ b/tex/context/base/mkiv/tabl-tbl.mkiv @@ -1833,6 +1833,37 @@ \unexpanded\def\tabl_tabulate_CM_first{\global\c_tabl_tabulate_localcolorspan\plustwo \tabl_tabulate_set_color_column\zerocount} \unexpanded\def\tabl_tabulate_CR_first{\global\c_tabl_tabulate_localcolorspan\plusthree\tabl_tabulate_set_color_column\zerocount} +%D Sort of special: +%D +%D \startbuffer +%D \startitemize[n] +%D \starttabulate[|||||] +%D \NC p \NC \itemtag \NC q \NC r \NC \NR +%D \NC p \NC \itemtag \NC q \NC r \NC \NR +%D \NC p \NC \itemtag \NC q \NC r \NC \NR +%D \NC p \NC \itemtag \NC q \NC r \NC \NR +%D \stoptabulate +%D \stopitemize +%D +%D \startitemize[n] +%D \starttabulate[|||||] +%D \NI b \NC c \NC d \NC \NR +%D \NC a \NI c \NC d \NC \NR +%D \NC a \NC b \NI d \NC \NR +%D \NC a \NC b \NC c \NI \NR +%D \stoptabulate +%D \stopitemize +%D \stopbuffer +%D +%D \typebuffer \getbuffer + +\let\NI\relax + +\unexpanded\def\tabl_tabulate_NI_first{\doifelsefastoptionalcheck\tabl_tbl_NI_yes\tabl_tbl_NI_nop} + +\def\tabl_tbl_NI_yes[#1]{\NC \itemtag[#1]\NC} +\def\tabl_tbl_NI_nop {\NC \itemtag \NC} + %D The following shortcut is handy for tables where one needs bold headers: %unexpanded\def\tabl_tabulate_BC_first{\NC\let\fontstyle\globalfontstyle\bf} @@ -1843,36 +1874,37 @@ \bf} \appendtoks - \let\VL\tabl_tabulate_VL_first - \let\NC\tabl_tabulate_NC_first - \let\BC\tabl_tabulate_BC_first - \let\RC\tabl_tabulate_RC_first - \let\HC\tabl_tabulate_HC_first - \let\EQ\tabl_tabulate_EQ_first - \let\RQ\tabl_tabulate_RQ_first - \let\HQ\tabl_tabulate_HQ_first - \let\NG\tabl_tabulate_NG_first - \let\NN\tabl_tabulate_NN_first - \let\ND\tabl_tabulate_ND_first - \let\NR\tabl_tabulate_NR_first - \let\NB\tabl_tabulate_NB_first - \let\CC\tabl_tabulate_CC_first - \let\CL\tabl_tabulate_CL_first - \let\CM\tabl_tabulate_CM_first - \let\CR\tabl_tabulate_CR_first + \let\VL\tabl_tabulate_VL_first + \let\NC\tabl_tabulate_NC_first + \let\BC\tabl_tabulate_BC_first + \let\RC\tabl_tabulate_RC_first + \let\HC\tabl_tabulate_HC_first + \let\EQ\tabl_tabulate_EQ_first + \let\RQ\tabl_tabulate_RQ_first + \let\HQ\tabl_tabulate_HQ_first + \let\NG\tabl_tabulate_NG_first + \let\NN\tabl_tabulate_NN_first + \let\ND\tabl_tabulate_ND_first + \let\NR\tabl_tabulate_NR_first + \let\NB\tabl_tabulate_NB_first + \let\CC\tabl_tabulate_CC_first + \let\CL\tabl_tabulate_CL_first + \let\CM\tabl_tabulate_CM_first + \let\CR\tabl_tabulate_CR_first + \let\NI\tabl_tabulate_NI_first \to \t_tabl_tabulate_initializers_first \appendtoks - \let\NR\tabl_tabulate_NR_second - \let\NB\tabl_tabulate_NB_second + \let\NR\tabl_tabulate_NR_second + \let\NB\tabl_tabulate_NB_second \to \t_tabl_tabulate_initializers_second \appendtoks - \let\SR\NR - \let\FR\NR - \let\MR\NR - \let\LR\NR - \let\AR\NR + \let\SR\NR + \let\FR\NR + \let\MR\NR + \let\LR\NR + \let\AR\NR \to \t_tabl_tabulate_initializers_first \unexpanded\def\tabl_tabulate_NR_common#1#2% diff --git a/tex/context/base/mkiv/trac-log.lua b/tex/context/base/mkiv/trac-log.lua index b6bb123cf..25f30f25a 100644 --- a/tex/context/base/mkiv/trac-log.lua +++ b/tex/context/base/mkiv/trac-log.lua @@ -20,8 +20,8 @@ local openfile = io.open local setmetatableindex = table.setmetatableindex local formatters = string.formatters - -local texgetcount = tex and tex.getcount +local settings_to_hash = utilities.parsers.settings_to_hash +local sortedkeys = table.sortedkeys -- variant is set now @@ -575,15 +575,15 @@ logs.newline = newline -- todo: renew (un) locks when a new one is added and wildcard -local data, states = { }, nil +local data = { } +local states = nil +local force = false function logs.reporter(category,subcategory) local logger = data[category] if not logger then - local state = false - if states == true then - state = true - elseif type(states) == "table" then + local state = states == true + if not state and type(states) == "table" then for c, _ in next, states do if find(category,c) then state = true @@ -593,7 +593,7 @@ function logs.reporter(category,subcategory) end logger = { reporters = { }, - state = state, + state = state, } data[category] = logger end @@ -601,7 +601,7 @@ function logs.reporter(category,subcategory) if not reporter then if subcategory then reporter = function(...) - if not logger.state then + if force or not logger.state then subreport(category,subcategory,...) end end @@ -609,7 +609,7 @@ function logs.reporter(category,subcategory) else local tag = category reporter = function(...) - if not logger.state then + if force or not logger.state then report(category,...) end end @@ -645,7 +645,7 @@ end -- so far local function setblocked(category,value) -- v.state == value == true : disable - if category == true then + if category == true or category == "all" then -- lock all category, value = "*", true elseif category == false then @@ -661,7 +661,8 @@ local function setblocked(category,value) -- v.state == value == true : disable v.state = value end else - states = utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) + alllocked = false + states = settings_to_hash(category,type(states)=="table" and states or nil) for c in next, states do local v = data[c] if v then @@ -687,7 +688,7 @@ function logs.enable(category) end function logs.categories() - return table.sortedkeys(data) + return sortedkeys(data) end function logs.show() @@ -710,7 +711,7 @@ function logs.show() max = m end end - local subcategories = concat(table.sortedkeys(reporters),", ") + local subcategories = concat(sortedkeys(reporters),", ") if state == true then state = "disabled" elseif state == false then @@ -746,59 +747,64 @@ end) -- tex specific loggers (might move elsewhere) -local report_pages = logs.reporter("pages") -- not needed but saves checking when we grep for it - -local real, user, sub +if tex then -function logs.start_page_number() - real = texgetcount("realpageno") - user = texgetcount("userpageno") - sub = texgetcount("subpageno") -end + local report = logs.reporter("pages") -- not needed but saves checking when we grep for it + local texgetcount = tex and tex.getcount -local timing = false -local starttime = nil -local lasttime = nil + local real, user, sub -trackers.register("pages.timing", function(v) -- only for myself (diagnostics) - starttime = os.clock() - timing = true -end) + function logs.start_page_number() + real = texgetcount("realpageno") + user = texgetcount("userpageno") + sub = texgetcount("subpageno") + end -function logs.stop_page_number() -- the first page can includes the initialization so we omit this in average - if timing then - local elapsed, average - local stoptime = os.clock() - if not lasttime or real < 2 then - elapsed = stoptime - average = stoptime - starttime = stoptime - else - elapsed = stoptime - lasttime - average = (stoptime - starttime) / (real - 1) - end - lasttime = stoptime - if real <= 0 then - report_pages("flushing page, time %0.04f / %0.04f",elapsed,average) - elseif user <= 0 then - report_pages("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) - elseif sub <= 0 then - report_pages("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) - else - report_pages("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) - end - else - if real <= 0 then - report_pages("flushing page") - elseif user <= 0 then - report_pages("flushing realpage %s",real) - elseif sub <= 0 then - report_pages("flushing realpage %s, userpage %s",real,user) + local timing = false + local starttime = nil + local lasttime = nil + + trackers.register("pages.timing", function(v) -- only for myself (diagnostics) + starttime = os.clock() -- todo: use other timer + timing = true + end) + + function logs.stop_page_number() -- the first page can includes the initialization so we omit this in average + if timing then + local elapsed, average + local stoptime = os.clock() + if not lasttime or real < 2 then + elapsed = stoptime + average = stoptime + starttime = stoptime + else + elapsed = stoptime - lasttime + average = (stoptime - starttime) / (real - 1) + end + lasttime = stoptime + if real <= 0 then + report("flushing page, time %0.04f / %0.04f",elapsed,average) + elseif user <= 0 then + report("flushing realpage %s, time %0.04f / %0.04f",real,elapsed,average) + elseif sub <= 0 then + report("flushing realpage %s, userpage %s, time %0.04f / %0.04f",real,user,elapsed,average) + else + report("flushing realpage %s, userpage %s, subpage %s, time %0.04f / %0.04f",real,user,sub,elapsed,average) + end else - report_pages("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + if real <= 0 then + report("flushing page") + elseif user <= 0 then + report("flushing realpage %s",real) + elseif sub <= 0 then + report("flushing realpage %s, userpage %s",real,user) + else + report("flushing realpage %s, userpage %s, subpage %s",real,user,sub) + end end + logs.flush() end - logs.flush() + end -- we don't have show_open and show_close callbacks yet @@ -1039,3 +1045,88 @@ io.stderr:setvbuf('no') if package.helpers.report then package.helpers.report = logs.reporter("package loader") -- when used outside mtxrun end + +if tex then + + local finalactions = { } + local fatalerrors = { } + local possiblefatal = { } + local loggingerrors = false + + function logs.loggingerrors() + return loggingerrors + end + + directives.register("logs.errors",function(v) + loggingerrors = v + if type(v) == "string" then + fatalerrors = settings_to_hash(v) + else + fatalerrors = { } + end + end) + + function logs.registerfinalactions(...) + insert(finalactions,...) -- so we can force an order if needed + end + + function logs.finalactions() + if #finalactions > 0 then + for i=1,#finalactions do + finalactions[i]() + end + return next(possiblefatal) and sortedkeys(possiblefatal) or false + end + end + + local what = nil + local report = nil + local state = nil + local target = nil + + local function startlogging(t,r,w,s) + target = t + state = force + force = true + report = type(r) == "function" and r or logs.reporter(r) + what = w + pushtarget(target) + newline() + if s then + report("start %s: %s",what,s) + else + report("start %s",what) + end + if target == "logfile" then + newline() + end + return report + end + + local function stoplogging() + if target == "logfile" then + newline() + end + report("stop %s",what) + if target == "logfile" then + newline() + end + poptarget() + state = oldstate + end + + function logs.startfilelogging(...) + return startlogging("logfile", ...) + end + + function logs.starterrorlogging(r,w,...) + if fatalerrors[w] then + possiblefatal[w] = true + end + return startlogging("terminal",r,w,...) + end + + logs.stopfilelogging = stoplogging + logs.stoperrorlogging = stoplogging + +end diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index e99911bde..22b32e372 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -759,6 +759,7 @@ <cd:constant name='direction' value='richting'/> <cd:constant name='directory' value='directory'/> <cd:constant name='display' value='scherm'/> + <cd:constant name='displaythreshold' value='displaythreshold'/> <cd:constant name='distance' value='afstand'/> <cd:constant name='domain' value='domain'/> <cd:constant name='dot' value='punt'/> @@ -868,6 +869,7 @@ <cd:constant name='index' value='index'/> <cd:constant name='indicator' value='aanduiding'/> <cd:constant name='initialsep' value='initialsep'/> + <cd:constant name='inlinethreshold' value='inlinethreshold'/> <cd:constant name='inner' value='binnen'/> <cd:constant name='innermargin' value='binnenmarge'/> <cd:constant name='inputfile' value='inputfile'/> diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index 4033b45f8..1856519ab 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -759,6 +759,7 @@ <cd:constant name='direction' value='جهت'/> <cd:constant name='directory' value='پوشه'/> <cd:constant name='display' value='نمایش'/> + <cd:constant name='displaythreshold' value='displaythreshold'/> <cd:constant name='distance' value='فاصله'/> <cd:constant name='domain' value='domain'/> <cd:constant name='dot' value='نقطه'/> @@ -868,6 +869,7 @@ <cd:constant name='index' value='index'/> <cd:constant name='indicator' value='اندیکاتور'/> <cd:constant name='initialsep' value='initialsep'/> + <cd:constant name='inlinethreshold' value='inlinethreshold'/> <cd:constant name='inner' value='داخلی'/> <cd:constant name='innermargin' value='حاشیهداخلی'/> <cd:constant name='inputfile' value='پروندهورودی'/> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 5c441b1f7..7e1e6dd8d 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex cbdfae1db..607388fa5 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/interface/mkiv/i-tabulation.xml b/tex/context/interface/mkiv/i-tabulation.xml index a8c318150..8a8eb8741 100644 --- a/tex/context/interface/mkiv/i-tabulation.xml +++ b/tex/context/interface/mkiv/i-tabulation.xml @@ -204,6 +204,8 @@ <cd:command name="NC" scope="tabulate" file="tabl-tbl.mkiv"/> + <cd:command name="NI" scope="tabulate" file="tabl-tbl.mkiv"/> + <cd:command name="RC" scope="tabulate" file="tabl-tbl.mkiv"/> <cd:command name="HC" scope="tabulate" file="tabl-tbl.mkiv"/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 7952d17f5..a6397043b 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 09/21/17 21:05:06 +-- merge date : 09/25/17 19:19:22 do -- begin closure to overcome local limits and interference |