summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-08-24 20:03:53 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-08-24 20:03:53 +0200
commit89f7bbac9616406b3990b8608c17c542f5fb476d (patch)
tree9e487938454fd224025391d975ae85dff85a10f8
parent4ba731dd6ff370a42984b4df050906fd9a884bc8 (diff)
downloadcontext-89f7bbac9616406b3990b8608c17c542f5fb476d.tar.gz
2020-08-24 19:49:00
-rw-r--r--doc/context/documents/general/manuals/luametatex.pdfbin1231680 -> 1219876 bytes
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-differences.tex33
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex145
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex18
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-languages.tex81
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-lua.tex25
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex107
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex48
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-style.tex2
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-tex.tex3
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex.tex2
-rw-r--r--doc/context/sources/general/manuals/mk/mk-memory.tex8
-rw-r--r--scripts/context/lua/mtx-context.lua16
-rw-r--r--scripts/context/lua/mtx-timing.lua218
-rw-r--r--scripts/context/lua/mtxrun.lua50
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua50
-rw-r--r--scripts/context/stubs/unix/mtxrun50
-rw-r--r--scripts/context/stubs/win64/mtxrun.lua50
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-en.mkii1
-rw-r--r--tex/context/base/mkii/mult-nl.mkii2
-rw-r--r--tex/context/base/mkiv/back-ini.lua4
-rw-r--r--tex/context/base/mkiv/back-out.lmt4
-rw-r--r--tex/context/base/mkiv/blob-ini.lmt210
-rw-r--r--tex/context/base/mkiv/blob-ini.lua12
-rw-r--r--tex/context/base/mkiv/blob-ini.mkiv11
-rw-r--r--tex/context/base/mkiv/blob-ini.mkxl56
-rw-r--r--tex/context/base/mkiv/cldf-lmt.lmt8
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/cont-run.lua40
-rw-r--r--tex/context/base/mkiv/context.mkiv6
-rw-r--r--tex/context/base/mkiv/context.mkxl6
-rw-r--r--tex/context/base/mkiv/core-uti.lua82
-rw-r--r--tex/context/base/mkiv/file-job.lua6
-rw-r--r--tex/context/base/mkiv/file-mod.lua104
-rw-r--r--tex/context/base/mkiv/font-map.lua1
-rw-r--r--tex/context/base/mkiv/l-lua.lua6
-rw-r--r--tex/context/base/mkiv/lang-rep.lua24
-rw-r--r--tex/context/base/mkiv/luat-cnf.lua94
-rw-r--r--tex/context/base/mkiv/luat-cod.lmt49
-rw-r--r--tex/context/base/mkiv/luat-cod.lua26
-rw-r--r--tex/context/base/mkiv/luat-fmt.lua4
-rw-r--r--tex/context/base/mkiv/luat-lib.mkiv2
-rw-r--r--tex/context/base/mkiv/luat-run.lua8
-rw-r--r--tex/context/base/mkiv/luat-sto.lua9
-rw-r--r--tex/context/base/mkiv/mlib-ctx.lua5
-rw-r--r--tex/context/base/mkiv/mlib-mpf.lua18
-rw-r--r--tex/context/base/mkiv/mtx-context-timing.tex23
-rw-r--r--tex/context/base/mkiv/node-gcm.lmt5
-rw-r--r--tex/context/base/mkiv/node-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/node-ltp.lua2
-rw-r--r--tex/context/base/mkiv/node-nut.lua12
-rw-r--r--tex/context/base/mkiv/node-snp.lmt61
-rw-r--r--tex/context/base/mkiv/node-tra.lua14
-rw-r--r--tex/context/base/mkiv/page-run.lua36
-rw-r--r--tex/context/base/mkiv/page-run.mkiv6
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin28129 -> 28127 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin255169 -> 255953 bytes
-rw-r--r--tex/context/base/mkiv/strc-itm.mklx2
-rw-r--r--tex/context/base/mkiv/strc-itm.mkvi2
-rw-r--r--tex/context/base/mkiv/syst-ini.mkxl18
-rw-r--r--tex/context/base/mkiv/toks-ini.lua1
-rw-r--r--tex/context/base/mkiv/toks-scn.lua3
-rw-r--r--tex/context/base/mkiv/trac-deb.lmt519
-rw-r--r--tex/context/base/mkiv/trac-deb.lua100
-rw-r--r--tex/context/base/mkiv/trac-deb.mkiv2
-rw-r--r--tex/context/base/mkiv/trac-inf.lmt353
-rw-r--r--tex/context/base/mkiv/trac-inf.lua39
-rw-r--r--tex/context/base/mkiv/trac-tim.lmt177
-rw-r--r--tex/context/interface/mkii/keys-en.xml1
-rw-r--r--tex/context/interface/mkii/keys-nl.xml2
-rw-r--r--tex/context/modules/mkiv/m-timing.mkxl114
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.mkiv10
-rw-r--r--tex/context/modules/mkiv/s-module-basic.mkiv45
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua6
76 files changed, 2268 insertions, 997 deletions
diff --git a/doc/context/documents/general/manuals/luametatex.pdf b/doc/context/documents/general/manuals/luametatex.pdf
index 072f63507..36b1c54c1 100644
--- a/doc/context/documents/general/manuals/luametatex.pdf
+++ b/doc/context/documents/general/manuals/luametatex.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-differences.tex b/doc/context/sources/general/manuals/luametatex/luametatex-differences.tex
index a4b5fe6da..482371cd9 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-differences.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-differences.tex
@@ -121,7 +121,8 @@ In the \type {node}, \type {tex} and \type {status} library we no longer have
helpers and variables that relate to the backend. The \LUAMETATEX\ engine is in
principle \DVI\ and \PDF\ unaware. There are only generic whatsit nodes that can
be used for some management related tasks. For instance you can use them to
-implement user nodes.
+implement user nodes. More extensive status information is provided in the
+overhauled status library.
The margin kern nodes are gone and we now use regular kern nodes for them. As a
consequence there are two extra subtypes indicating the injected left or right
@@ -139,11 +140,16 @@ find_write_file find_format_file open_data_file
The callbacks related to errors are changed:
\starttyping
-intercept_tex_error intercept_lua_error,
+intercept_tex_error intercept_lua_error
show_error_message show_warning_message
\stoptyping
-and a new ont \type {if_end_of_file} has been added to the repertoire.
+There is a hook that gets called when one of the fundamental memory structures
+gets reallocated.
+
+\starttyping
+trace_memory
+\stoptyping
The (job) management hooks are kept:
@@ -163,18 +169,9 @@ show_whatsit
Being the core of extensibility, the typesetting callbacks of course stayed. This
is what we ended up with:
-% \ctxlua{inspect(table.sortedkeys(callbacks.list))}
-
-\starttyping
-find_log_file, find_format_file, open_data_file, if_end_of_file, process_jobname,
-start_run, stop_run, define_font, pre_output_filter, buildpage_filter,
-hpack_filter, vpack_filter, hyphenate, ligaturing, kerning, pre_linebreak_filter,
-linebreak_filter, post_linebreak_filter, append_to_vlist_filter, mlist_to_hlist,
-pre_dump, start_file, stop_file, intercept_tex_error, intercept_lua_error,
-show_error_message, show_warning_message, hpack_quality, vpack_quality,
-insert_local_par, contribute_filter, build_page_insert, wrapup_run, new_graf,
-make_extensible, show_whatsit
-\stoptyping
+\startalign[flushleft,nothyphenated]
+\tt \cldcontext{table.concat(table.sortedkeys(callbacks.list), ", ")}
+\stopalign
As in \LUATEX\ font loading happens with the following callback. This time it
really needs to be set because there is no built|-|in font loader.
@@ -186,7 +183,7 @@ define_font
There are all kinds of subtle differences in the implementation, for instance we
no longer intercept \type {*} and \type {&} as these were already replaced long
ago in \TEX\ engines by command line options. Talking of options, only a few are
-left.
+left. All input goes via \LUA, even the console.
We took our time for reaching a stable state in \LUATEX. Among the reasons is the
fact that most was experimented with in \CONTEXT. It took many man|-|years to
@@ -237,7 +234,7 @@ if luatex and luametatex then
luatex = table.tohash(luatex)
luametatex = table.tohash(luametatex)
- context.page()
+ -- context.page()
context("The following primitives are available in \\LUATEX\\ but not in \\LUAMETATEX.")
context("Some of these are emulated in \\CONTEXT.")
@@ -252,7 +249,7 @@ if luatex and luametatex then
context.stopcolumns()
- context.page()
+ -- context.page()
context("The following primitives are available in \\LUAMETATEX\\ only.")
context("At some point in time some might be added to \\LUATEX.")
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex b/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
index 03dfc1bad..a233bf630 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-enhancements.tex
@@ -83,9 +83,9 @@ There are three primitives to test the version of \LUATEX\ (and \LUAMETATEX):
\BC explanation \NC \NR
\TB
\NC \lpr {luatexbanner} \NC \VersionHack{\luatexbanner}
- \NC the banner reported on the command line \NC \NR
+ \NC the banner reported on the console \NC \NR
\NC \lpr {luatexversion} \NC \the\luatexversion
- \NC a combination of major and minor number \NC \NR
+ \NC major and minor number combined \NC \NR
\NC \lpr {luatexrevision} \NC \the\luatexrevision
\NC the revision number \NC \NR
\LL
@@ -178,7 +178,9 @@ the time comes to print a character $c>=1{,}114{,}112$, \LUATEX\ will actually
print the single byte corresponding to $c$ minus 1{,}114{,}112.
Contrary to other \TEX\ engines, the output to the terminal is as|-|is so there
-is no escaping with \type {^^}. We operate in a \UTF\ universe.
+is no escaping with \type {^^}. We operate in a \UTF\ universe. Because we
+operate in a \CCODE\ universum, zero characters are special but because we also
+live in a \UNICODE\ galaxy that is no real problem.
\stopsubsection
@@ -400,6 +402,12 @@ mode, but in \LUAMETATEX\ there is no error message and the box the height and
depth are equally divided. Of course in text mode there is no math axis related
offset applied.
+It is possible to change or add to the attributes assigned to a box:
+
+\starttyping
+\boxattr 0 123 456
+\stoptyping
+
\stopsubsection
\stopsection
@@ -475,20 +483,22 @@ will result in
Note that the expansion of \prm {directlua} is a sequence of characters, not of
tokens, contrary to all \TEX\ commands. So formally speaking its expansion is
-null, but it places material on a pseudo-file to be immediately read by \TEX, as
-\ETEX's \prm {scantokens}. For a description of print functions look at \in
-{section} [sec:luaprint].
+null, but it collects material in a new level on the input stack to be
+immediately read by \TEX\ after the \LUA\ call as finished. It is a bit like
+\ETEX's \prm {scantokens}, which now uses the same mechanism. For a description
+of print functions look at \in {section} [sec:luaprint].
Because the \syntax {<general text>} is a chunk, the normal \LUA\ error handling
is triggered if there is a problem in the included code. The \LUA\ error messages
-should be clear enough, but the contextual information is still pretty bad.
-Often, you will only see the line number of the right brace at the end of the
-code.
+should be clear enough, but the contextual information is often suboptimal
+because it can come from deep down, and \TEX\ has no knowledge about what you do
+in \LUA. Often, you will only see the line number of the right brace at the end
+of the code.
While on the subject of errors: some of the things you can do inside \LUA\ code
can break up \LUAMETATEX\ pretty bad. If you are not careful while working with
-the node list interface, you may even end up with assertion errors from within
-the \TEX\ portion of the executable.
+the node list interface, you may even end up with errors or even crashes from
+within the \TEX\ portion of the executable.
\stopsubsection
@@ -565,53 +575,6 @@ tokens and assume that the function is available when that token expands. On the
other hand, as we have tested this functionality in relative complex situations
normal usage should not give problems.
-There are another three (still experimental) primitives that behave like \lpr
-{luafunction} but they expect the function to return an integer, dimension (also
-an integer) or a gluespec node. The return values gets injected into the input.
-
-\starttyping
-\luacountfunction 997 123
-\luadimenfunction 998 123pt
-\luaskipfunction 999 123pt plus 10pt minus 20pt
-\stoptyping
-
-Examples of function 997 in the above lines are:
-
-\starttyping
-function() return token.scan_int() end
-function() return 1234 end
-\stoptyping
-
-This itself is not spectacular so there is more. These functions can be called in
-two modes: either \TEX\ is expecting a value, or it is not and just expanding the
-call.
-
-\starttyping
-local n = 0
-function(slot,scanning)
- if scanning then
- return n
- else
- n = token.scan_int()
- end
-end
-\stoptyping
-
-So, assuming that the function is in slot 997, you can do this:
-
-\starttyping
-\luacountfunction 997 123
-\count100=\luacountfunction 997
-\stoptyping
-
-After which \type {\count 100} has the value \type {123}.
-
-% Also experimental (I need to play with this a bit more when I have time):
-%
-% The \type {token.set_lua} function already accepts some strings as optional
-% arguments (\type {protected} and \type {global}) and now also handles \type
-% {count}, \type {dimen} and \type {skip}.
-
\stopsubsection
\startsubsection[title={\lpr {luabytecode} and \lpr {luabytecodecall}}]
@@ -663,14 +626,14 @@ contents is stored and retrieved from the format file.
\startsubsection[title={\lpr {catcodetable}}]
-\startsyntax
-\catcodetable <15-bit number>
-\stopsyntax
-
The primitive \lpr {catcodetable} switches to a different catcode table. Such a
table has to be previously created using one of the two primitives below, or it
has to be zero. Table zero is initialized by \INITEX.
+\startsyntax
+\catcodetable <15-bit number>
+\stopsyntax
+
\stopsubsection
\startsubsection[title={\lpr {initcatcodetable}}]
@@ -710,11 +673,9 @@ initial values are:
\lpr {savecatcodetable} copies the current set of catcodes to a new table with
the requested number. The definitions in this new table are all treated as if
-they were made in the outermost level.
-
-The new table is allocated globally: it will not go away after the current group
-has ended. If the supplied number is the currently active table, an error is
-raised.
+they were made in the outermost level. Again, the new table is allocated globally:
+it will not go away after the current group has ended. If the supplied number is
+the currently active table, an error is raised.
\stopsubsection
@@ -722,7 +683,7 @@ raised.
\startsection[title={Tokens, commands and strings}]
-\startsubsection[title={\lpr {scantextokens}}]
+\startsubsection[title={\lpr {scantextokens} and \lpr {tokenized}}]
\topicindex {tokens+scanning}
@@ -732,8 +693,7 @@ differences are:
\startitemize
\startitem
- The last (and usually only) line does not have a \prm {endlinechar}
- appended.
+ The last (and usually only) line does not have a \prm {endlinechar} appended.
\stopitem
\startitem
\lpr {scantextokens} never raises an EOF error, and it does not execute
@@ -746,6 +706,18 @@ differences are:
\stopitem
\stopitemize
+The implementation in \LUAMETATEX\ is different in the sense that it uses the same
+methods as printing from \LUA\ to \TEX\ does. Therefore, in addition to the two
+commands we also have this expandable command:
+
+\startsyntax
+\tokenized {...}
+\tokenized catcodetable <number> {...}
+\stopsyntax
+
+The \ETEX\ command \type {\tracingscantokens} has been dropped in the process as
+that was interwoven with the old code.
+
\stopsubsection
\startsubsection[title={\lpr {toksapp}, \lpr {tokspre}, \lpr {etoksapp}, \lpr {etokspre},
@@ -805,7 +777,7 @@ that it saves a few tokens and can make code a bit more readable.
This primitive complements the \ETEX\ mark primitives and clears a mark class
completely, resetting all three connected mark texts to empty. It is an
-immediate command.
+immediate command (no synchronization node is used).
\startsyntax
\clearmarks <16-bit number>
@@ -1102,8 +1074,6 @@ valid style identifier (a primitive identifier or number). The \type
\stopsubsection
-\stopsubsection
-
\startsubsection[title={\lpr {ifempty}}]
This primitive tests for the following token (control sequence) having no
@@ -1219,7 +1189,7 @@ we use \type {\unless} to negate the result.
\stopsubsection
-\startsubsection[title={\lpr {orelse}}]
+\startsubsection[title={\lpr {orelse} and \lpr {orunless}}]
Sometimes you have successive tests that, when laid out in the source lead to
deep trees. The \type {\ifcase} test is an exception. Experiments with \type
@@ -1285,6 +1255,12 @@ Of course it is only useful at the right level, so you might end up with cases l
\fi
\stoptyping
+The \lpr {orunless} variant negates the next test, just like \prm {unless}. In
+some cases these commands look at the next token to see if it is an if|-|test so
+a following negation will not work (read: making that work would complicate the
+code and hurt efficiency too). Side note: interesting is that in \CONTEXT\ we
+hardly use this kind of negation.
+
\stopsubsection
\startsubsection[title={\lpr {ifprotected}, \lpr {frozen}, \lpr {iffrozen} and \lpr {ifusercmd}}]
@@ -1315,13 +1291,6 @@ the acceptable range is from 0 to 65535.
\stopsubsection
-\startsubsection[title={\prm {vpack}, \prm {hpack} and \prm {tpack}}]
-
-These three primitives are like \prm {vbox}, \prm {hbox} and \prm {vtop}
-but don't apply the related callbacks.
-
-\stopsubsection
-
\startsubsection[title={\prm {vsplit}}]
\topicindex {splitting}
@@ -1332,7 +1301,7 @@ a split of the given size but result has the natural dimensions then.
\stopsubsection
-\startsubsection[title={Images and reused box objects},reference=sec:imagedandforms]
+\startsubsection[title={Images and reused box objects},reference=sec:imagesandforms]
In original \TEX\ image support is dealt with via specials. It's not a native
feature of the engine. All that \TEX\ cares about is dimensions, so in practice
@@ -1409,10 +1378,12 @@ packages.
\startsubsection[title={\lpr {hpack}, \lpr {vpack} and \lpr {tpack}}]
-These three primitives are the equivalents of \type {\hbox}, \type {\vbox} and
-\type {\vtop} but they don't trigger the packaging related callbacks. Of course
+These three primitives are the equivalents of \prm {hbox}, \prm {vbox} and
+\prm {vtop} but they don't trigger the packaging related callbacks. Of course
one never know if content needs a treatment so using them should be done with
-care.
+care. Apart from accepting more keywords (and therefore options) the normal
+box behave the same as before. The \prm {vcenter} builder also works in text
+mode.
\stopsubsection
@@ -1864,6 +1835,10 @@ shows that is't okay, they will become official, so we just mention them: \type
{\boxdirection}, \type {\boxattr}, \type {\boxorientation}, \type {\boxxoffset},
\type {\boxyoffset}, \type {\boxxmove}, \type {\boxymove} and \type {\boxtotal}.
+{\em This is still somewhat experimental and will be documented in more detail
+when I've used it more in \CONTEXT\ and the specification is frozen. This might
+take some time (and user input).}
+
\stopsubsection
\stopsection
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex b/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
index 774f3d8d9..2afdf75bd 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
@@ -47,7 +47,8 @@ further) adapted. It also discusses the (main) differences. Some of the new
primitives or functions that show up in \LUAMETATEX\ might show up in \LUATEX\ at
some point, others might not, so don't take this manual as reference for \LUATEX
! For now it is an experimental engine in which we can change things at will but
-with \CONTEXT\ in tandem so that this macro package will keep working.
+with \CONTEXT\ in tandem so that this macro package will keep working. Often you
+can find examples of usage in \CONTEXT\ related documents and the source code.
For \CONTEXT\ users the \LUAMETATEX\ engine will become the default. The
\CONTEXT\ variant for this engine is tagged \LMTX. The pair can be used in
@@ -55,7 +56,7 @@ production, just as with \LUATEX\ and \MKIV. In fact, most users will probably
not really notice the difference. In some cases there will be a drop in
performance, due to more work being delegated to \LUA, but on the average
performance will be better, also due to some changes below the hood of the
-engine.
+engine. Memory consumption is also less.
As this follow up is closely related to \CONTEXT\ development, and because we
expect stock \LUATEX\ to be used outside the \CONTEXT\ proper, there will be no
@@ -100,10 +101,15 @@ Hans Hagen
\vfilll
-{\bf remark:} \LUAMETATEX\ development is mostly done by Hans Hagen and Alan
-Braslau, who love playing with the three languages involved. And as usual Mojca
-Miklavec make sure all compiles well on the buildbot infrastructure. Testing is
-done by \CONTEXT\ developers and users. Many thanks for their patience!
+{\bf remark:} \LUAMETATEX\ development is mostly done by Hans Hagen and in
+adapting the macros to the new features Wolfgang Schuster, who knows the code
+inside||out is a instrumental. In the initial phase Alan Braslau, who love
+playing with the three languages did extensive testing and compiled for several
+platforms. Later Mojca Miklavec make sure all compiles well on the buildbot
+infrastructure. After the first release more users got involved in testing. Many
+thanks for their patience! The development also triggered upgrading of the wiki
+support infrastructure where Taco Hoekwater and Paul Mazaitis have teamed up. So,
+progress all around.
{\bf remark:} When there are non|-|intrusive features that also make sense in
\LUATEX, these will be applied in the experimental branch first, so that there is
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex b/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
index 0a3ecd6bf..85701bdc3 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
@@ -192,15 +192,15 @@ The start and end of a sequence of characters is signalled by a \nod {glue}, \no
{penalty}, \nod {kern} or \nod {boundary} node. But by default also a \nod
{hlist}, \nod {vlist}, \nod {rule}, \nod {dir}, \nod {whatsit}, \nod {ins}, and
\nod {adjust} node indicate a start or end. You can omit the last set from the
-test by setting \lpr {hyphenationbounds} to a non|-|zero value:
+test by setting flags in \lpr {hyphenationmode}:
\starttabulate[|c|l|]
-\DB value \BC behaviour \NC \NR
+\DB value \BC behaviour \NC \NR
\TB
-\NC \type{0} \NC not strict \NC \NR
-\NC \type{1} \NC strict start \NC \NR
-\NC \type{2} \NC strict end \NC \NR
-\NC \type{3} \NC strict start and strict end \NC \NR
+\NC \NC not strict \NC \NR
+\NC \type{64} \NC strict start \NC \NR
+\NC \type{128} \NC strict end \NC \NR
+\NC \type{192} \NC strict start and strict end \NC \NR
\LL
\stoptabulate
@@ -210,11 +210,11 @@ The word start is determined as follows:
\DB node \BC behaviour \NC \NR
\TB
\BC boundary \NC yes when wordboundary \NC \NR
-\BC hlist \NC when hyphenationbounds 1 or 3 \NC \NR
-\BC vlist \NC when hyphenationbounds 1 or 3 \NC \NR
-\BC rule \NC when hyphenationbounds 1 or 3 \NC \NR
-\BC dir \NC when hyphenationbounds 1 or 3 \NC \NR
-\BC whatsit \NC when hyphenationbounds 1 or 3 \NC \NR
+\BC hlist \NC when the start bit is set \NC \NR
+\BC vlist \NC when the start bit is set \NC \NR
+\BC rule \NC when the start bit is set \NC \NR
+\BC dir \NC when the start bit is set \NC \NR
+\BC whatsit \NC when the start bit is set \NC \NR
\BC glue \NC yes \NC \NR
\BC math \NC skipped \NC \NR
\BC glyph \NC exhyphenchar (one only) : yes (so no -- ---) \NC \NR
@@ -232,13 +232,13 @@ The word end is determined as follows:
\BC glue \NC yes \NC \NR
\BC penalty \NC yes \NC \NR
\BC kern \NC yes when not italic (for some historic reason) \NC \NR
-\BC hlist \NC when hyphenationbounds 2 or 3 \NC \NR
-\BC vlist \NC when hyphenationbounds 2 or 3 \NC \NR
-\BC rule \NC when hyphenationbounds 2 or 3 \NC \NR
-\BC dir \NC when hyphenationbounds 2 or 3 \NC \NR
-\BC whatsit \NC when hyphenationbounds 2 or 3 \NC \NR
-\BC ins \NC when hyphenationbounds 2 or 3 \NC \NR
-\BC adjust \NC when hyphenationbounds 2 or 3 \NC \NR
+\BC hlist \NC when the end bit is set \NC \NR
+\BC vlist \NC when the end bit is set \NC \NR
+\BC rule \NC when the end bit is set \NC \NR
+\BC dir \NC when the end bit is set \NC \NR
+\BC whatsit \NC when the end bit is set \NC \NR
+\BC ins \NC when the end bit is set \NC \NR
+\BC adjust \NC when the end bit is set \NC \NR
\LL
\stoptabulate
@@ -256,52 +256,52 @@ min values to 1 and make sure that the words hyphenate at each character.
\hbox to 2cm {%
\vtop {%
\hsize 1pt
- \hyphenationbounds#1
+ \advance\hyphenationmode#1\relax
#2
\par}}}
\startplacefigure[reference=hb:1,title={\type{one}}]
\startcombination[4*1]
- {\SomeTest{0}{one}} {\type{0}}
- {\SomeTest{1}{one}} {\type{1}}
- {\SomeTest{2}{one}} {\type{2}}
- {\SomeTest{3}{one}} {\type{3}}
+ {\SomeTest {0}{one}} {\type {0}}
+ {\SomeTest {64}{one}} {\type {64}}
+ {\SomeTest{128}{one}} {\type{128}}
+ {\SomeTest{192}{one}} {\type{192}}
\stopcombination
\stopplacefigure
\startplacefigure[reference=hb:2,title={\type{one\null two}}]
\startcombination[4*1]
- {\SomeTest{0}{one\null two}} {\type{0}}
- {\SomeTest{1}{one\null two}} {\type{1}}
- {\SomeTest{2}{one\null two}} {\type{2}}
- {\SomeTest{3}{one\null two}} {\type{3}}
+ {\SomeTest {0}{one\null two}} {\type {0}}
+ {\SomeTest {64}{one\null two}} {\type {64}}
+ {\SomeTest{128}{one\null two}} {\type{128}}
+ {\SomeTest{192}{one\null two}} {\type{192}}
\stopcombination
\stopplacefigure
\startplacefigure[reference=hb:3,title={\type{\null one\null two}}]
\startcombination[4*1]
- {\SomeTest{0}{\null one\null two}} {\type{0}}
- {\SomeTest{1}{\null one\null two}} {\type{1}}
- {\SomeTest{2}{\null one\null two}} {\type{2}}
- {\SomeTest{3}{\null one\null two}} {\type{3}}
+ {\SomeTest {0}{\null one\null two}} {\type {0}}
+ {\SomeTest {64}{\null one\null two}} {\type {64}}
+ {\SomeTest{128}{\null one\null two}} {\type{128}}
+ {\SomeTest{192}{\null one\null two}} {\type{192}}
\stopcombination
\stopplacefigure
\startplacefigure[reference=hb:4,title={\type{one\null two\null}}]
\startcombination[4*1]
- {\SomeTest{0}{one\null two\null}} {\type{0}}
- {\SomeTest{1}{one\null two\null}} {\type{1}}
- {\SomeTest{2}{one\null two\null}} {\type{2}}
- {\SomeTest{3}{one\null two\null}} {\type{3}}
+ {\SomeTest {0}{one\null two\null}} {\type {0}}
+ {\SomeTest {64}{one\null two\null}} {\type {64}}
+ {\SomeTest{128}{one\null two\null}} {\type{128}}
+ {\SomeTest{192}{one\null two\null}} {\type{192}}
\stopcombination
\stopplacefigure
\startplacefigure[reference=hb:5,title={\type{\null one\null two\null}}]
\startcombination[4*1]
- {\SomeTest{0}{\null one\null two\null}} {\type{0}}
- {\SomeTest{1}{\null one\null two\null}} {\type{1}}
- {\SomeTest{2}{\null one\null two\null}} {\type{2}}
- {\SomeTest{3}{\null one\null two\null}} {\type{3}}
+ {\SomeTest {0}{\null one\null two\null}} {\type {0}}
+ {\SomeTest {64}{\null one\null two\null}} {\type {64}}
+ {\SomeTest{128}{\null one\null two\null}} {\type{128}}
+ {\SomeTest{192}{\null one\null two\null}} {\type{192}}
\stopcombination
\stopplacefigure
@@ -312,7 +312,8 @@ some control over aspects of the hyphenation and yet another one concerns
automatic hyphens (e.g.\ \type {-} characters in the input).
Hyphenation and discretionary injection is driven by a mode parameter which is
-a bitset made from the following values.
+a bitset made from the following values, some of which we saw in the previous
+examples.
\starttabulate[|||]
\NC \number \normalhyphenationmodecode \NC honour (normal) \prm{discretionary}'s \NC \NR
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-lua.tex b/doc/context/sources/general/manuals/luametatex/luametatex-lua.tex
index a126a95dc..803820de1 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-lua.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-lua.tex
@@ -31,9 +31,10 @@ In this mode, it will set \LUA's \type {arg[0]} to the found script name, pushin
preceding options in negative values and the rest of the command line in the
positive values, just like the \LUA\ interpreter does.
-\LUAMETATEX\ will exit immediately after executing the specified \LUA\ script and is,
-in effect, a somewhat bulky stand alone \LUA\ interpreter with a bunch of extra
-preloaded libraries.
+\LUAMETATEX\ will exit immediately after executing the specified \LUA\ script and
+is, in effect, a somewhat bulky stand alone \LUA\ interpreter with a bunch of
+extra preloaded libraries. But we really want to keep the binary small, if
+possible below the 3MB which is okay for a script engine.
When no argument is given, \LUAMETATEX\ will look for a \LUA\ file with the same
name as the binary and run that one when present. This makes it possible to use
@@ -105,7 +106,7 @@ values from the \type {texconfig} table at the end of script execution (see the
description of the \type {texconfig} table later on in this document for more
details on which ones exactly).
-So let's summarize this. The handling of when is called jobname is a bit complex.
+So let's summarize this. The handling of what is called jobname is a bit complex.
There can be explicit names set on the command line but when not set they can be
taken from the \type {texconfig} table.
@@ -117,7 +118,9 @@ taken from the \type {texconfig} table.
These names are initialized according to \type {--luaonly} or the first filename
seen in the list of options. Special treatment of \type {&} and \type {*} as well
-as interactive startup is gone.
+as interactive startup is gone but we still enter \TEX\ via an forced \type {\input}
+into the input buffer. \footnote {This might change at some point into an explicit
+loading triggered via \LUA.}
When we are in \TEX\ mode at some point the engine needs a filename, for instance
for opening a log file. At that moment the set jobname becomes the internal one
@@ -133,6 +136,12 @@ access etc.\ internally uses the current code page but to the user is exposed as
% engine_state .startup_jobname : handles by option parser
% environment_state.input_name : temporary interceptor
+There is an extra options \type{--permitloadlib} that needs to be given when you
+load external libraries via \LUA. Although you could manage this via \LUA\ itself
+in a startup script, the reason for having this as option is the wish for
+security (at some point that became a demand for \LUATEX), so this might give an
+extra feeling of protection.
+
\stopsubsection
\stopsection
@@ -199,8 +208,10 @@ some care you can deal with \UNICODE\ just fine.
There are some more libraries present. These are discussed on a later chapter.
For instance we embed \type {luasocket} but contrary to \LUATEX\ don't embed the
related \LUA\ code. An adapted version of \type {luafilesystem} is also included.
-There is a more extensive math library and there are libraries that deal with
-encryption and compression.
+There are more extensive math libraries and there are libraries that deal with
+encryption and compression. At some point some of these might become so called
+optional libraries (read: the handful that we provide interfaces for but that get
+loaded on demand).
\stopsection
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex b/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
index 6448f2b01..9827884ad 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
@@ -16,14 +16,15 @@
The first version of \LUATEX, made by Hartmut after we discussed the possibility
of an extension language, only had a few extra primitives and it was largely the
same as \PDFTEX. It was presented to the public in 2005. As part of the Oriental
-\TEX\ project, Taco merged substantial parts of \ALEPH\ into the code and some
-more primitives were added. Then we started more fundamental experiments. After
-many years, when the engine had become more stable, the decision was made to
-clean up the rather hybrid nature of the program. This means that some primitives
-were promoted to core primitives, often with a different name, and that others
-were removed. This also made it possible to start cleaning up the code base. In
-\in {chapter} [enhancements] we discuss some new primitives, here we will cover
-most of the adapted ones.
+\TEX\ project, Taco merged some parts of \ALEPH\ into the code and some more
+primitives were added. Then we started more fundamental experiments. After many
+years, when the engine had become more stable, the decision was made to clean up
+the rather hybrid nature of the program. This means that some primitives were
+promoted to core primitives, often with a different name, and that others were
+removed. This also made it possible to start cleaning up the code base, which
+showed decades of stepwise additions to original \TEX. In \in {chapter}
+[enhancements] we discuss some new primitives, here we will cover most of the
+adapted ones.
During more than a decade stepwise new functionality was added and after 10 years
the more of less stable version 1.0 was presented. But we continued and after
@@ -50,10 +51,10 @@ most still comes from original Knuthian \TEX. But we divert a bit.
\startitemize
\startitem
- The current code base is written in \CCODE, not \PASCAL. The original \CWEB\
+ The current code base is written in \CCODE, not \PASCAL. The original \WEB\
documentation is kept when possible and not wrapped in tagged comments. As a
consequence instead of one large file plus change files, we now have multiple
- files organized in categories like \type {tex}, \type {luaf}, \type
+ files organized in categories like \type {tex}, \type {lua}, \type
{languages}, \type {fonts}, \type {libraries}, etc. There are some artifacts
of the conversion to \CCODE, but these got (and get) removed stepwise. The
documentation, which actually comes from the mix of engines (via so called
@@ -61,8 +62,8 @@ most still comes from original Knuthian \TEX. But we divert a bit.
close as possible to the original so that the documentation of the
fundamentals behind \TEX\ by Don Knuth still applies. However, because we use
\CCODE, some documentation is a bit off. Also, most global variables are now
- collected in structures, but the original names were kept. There are lots of
- so called macros too.
+ collected in structures, but the original names and level of abstraction were
+ mostly kept. On the other hand, opening up had its impact on the code.
\stopitem
\startitem
@@ -74,14 +75,20 @@ most still comes from original Knuthian \TEX. But we divert a bit.
wherever we like. There are various options to control discretionary
injection and related penalties are now integrated in these nodes. Language
information is now bound to glyphs. The number of languages in \LUAMETATEX\
- is smaller than in \LUATEX.
+ is smaller than in \LUATEX. Control over discretionaries is more granular and
+ now managed by less variables.
\stopitem
\startitem
There is no pool file, all strings are embedded during compilation. This also
removed some memory constraints. We kept token and node memory management
because it is convenient and efficient but parts were reimplemented in order
- to remove some constraints. Token memory management is largely the same.
+ to remove some constraints. Token memory management is largely the same. All
+ the other large memory structures, like those related to nesting, the save
+ stack, input levels, the hash table and table of equivalents, etc. now all
+ start out small and are enlarged when needed, where maxima are controlled in
+ the usual way. In principle the initial memory footprint is smaller while at
+ the same time we can go real large.
\stopitem
\startitem
@@ -126,6 +133,12 @@ most still comes from original Knuthian \TEX. But we divert a bit.
\stopitem
\startitem
+ The math style related primitives can use numbers as well as symbolic names.
+ There is some more (control over) math anyway, which is a side effect of
+ supporting \OPENTYPE\ math.
+\stopitem
+
+\startitem
When detailed logging is enabled more detail is output with respect to what
nodes are involved. This is a side effect of the core nodes having more
detailed subtype information. The benefit of more detail wins from any wish
@@ -172,6 +185,20 @@ features, but with a few small adaptations.
\stopitem
\startitem
+ Because we have more nodes, conditionals, etc.\ the \ETEX\ status related
+ variables are adapted to \LUAMETATEX: we use different \quote {constants},
+ but that should be no problem because any sane macro package uses
+ abstraction.
+\stopitem
+
+\startitem
+ The \type {\scantokens} primitive is now using the same mechanism as \LUA\
+ print|-|to|-|\TEX\ uses, which simplifies the code. There is a little
+ performance hit but it will not be noticed in \CONTEXT, because we never use
+ this primitive.
+\stopitem
+
+\startitem
Because we don't use change files on top of original \TEX, the integration of
\ETEX\ functionality is bit more natural, code wise.
\stopitem
@@ -292,7 +319,8 @@ Here is a summary of inherited functionality:
\startitem
Glues {\it immediately after} direction change commands are not legal
- breakpoints. There is a bit more sanity testing for the direction state.
+ breakpoints. There is a bit more sanity testing for the direction state. This
+ can be configured.
\stopitem
\startitem
@@ -303,7 +331,7 @@ Here is a summary of inherited functionality:
\startitem
There are no direction related primitives for page and body directions. The
paragraph, text and math directions are specified using primitives that
- take a number.
+ take a number. The three letter codes are dropped.
\stopitem
\stopitemize
@@ -334,7 +362,10 @@ The single internal memory heap that traditional \TEX\ used for tokens and nodes
is split into two separate arrays. Each of these will grow dynamically when
needed. Internally a token or node is an index into these arrays. This permits
for an efficient implementation and is also responsible for the performance of
-the core. The original documentation in \TEX\ The Program mostly applies!
+the core. All other data structures are mostly the same but managed dynamically
+too. Because we operate in a 64 bit world, the parallel table of equivalents
+needed for managing levels, is gone. Anyhow, the original documentation in \TEX\
+The Program mostly applies!
\stopsubsection
@@ -352,10 +383,6 @@ assignments don't show up when using the \ETEX\ tracing routines \prm
{tracingassigns} and \prm {tracingrestores} but we don't see that as a real
limitation. It also saves a lot of clutter.
-A side|-|effect of the current implementation is that \prm {global} is now more
-expensive in terms of processing than non|-|global assignments but not many users
-will notice that.
-
The glyph ids within a font are also managed by means of a sparse array as glyph
ids can go up to index $2^{21}-1$ but these are never accessed directly so again
users will not notice this.
@@ -367,26 +394,33 @@ users will not notice this.
\topicindex {csnames}
Single|-|character commands are no longer treated specially in the internals,
-they are stored in the hash just like the multiletter csnames.
+they are stored in the hash just like the multiletter control sequences. This is
+a side effect of going \UNICODE\ and \UTF. Where using 256 slots in an array add
+no burden supporting the whole \UNICODE\ range is a waste of space. Therefore,
+also active characters are internally implemented as a special type of
+multi|-|letter control sequences that uses a prefix that is otherwise impossible
+to obtain.
The code that displays control sequences explicitly checks if the length is one
when it has to decide whether or not to add a trailing space.
-Active characters are internally implemented as a special type of multi|-|letter
-control sequences that uses a prefix that is otherwise impossible to obtain.
-
\stopsubsection
\startsubsection[title=Binary file reading]
\topicindex {files+binary}
-All of the internal code is changed in such a way that if one of the \type
-{read_xxx_file} callbacks is not set, then the file is read by a \CCODE\ function
-using basically the same convention as the callback: a single read into a buffer
-big enough to hold the entire file contents. While this uses more memory than the
-previous code (that mostly used \type {getc} calls), it can be quite a bit faster
-(depending on your \IO\ subsystem). So far we never had issues with this approach.
+All input now goes via \LUA: files loaded with \type {\input} as well as files
+that are opened with \type {\openin}. Actually the later has to be implemented
+in terms of macros and \LUA\ calls. This also means that compared to \LUATEX\
+the internal handling of input has been changed but users won't notice that.
+
+Setting a callback is expected now. Although reading input natively using \type
+{getc} calls is more efficient, we now fetch lines from \LUA, put them in a
+buffer and then pick successive bytes (keep in mind that we read \UTF) from that.
+The performance is quite ok, also because \LUA\ is fast, todays operating systems
+cache, and storage media have become very fast. Also, \TEX\ is spending more time
+messing around with what it has input than actually reading input.
\stopsubsection
@@ -419,9 +453,9 @@ more details anyway.
The information that goes into the log file can be different from \LUATEX, and
might even differ a bit more in the future. The main reason is that inside the
engine we have more granularity, which for instance means that we output subtype
-related information when nodes are printed. Of course we could have offered a
-compatibility mode but it serves no purpose. Over time there have been many
-subtle changes to control logs in the \TEX\ ecosystems so another one is
+and attribute related information when nodes are printed. Of course we could have
+offered a compatibility mode but it serves no purpose. Over time there have been
+many subtle changes to control logs in the \TEX\ ecosystems so another one is
bearable.
In a similar fashion, there is a bit different behaviour when \TEX\ expects
@@ -429,7 +463,10 @@ input, which in turn is a side effect of removing the interception of \type {*}
and \type {&} which made for cleaner code (quite a bit had accumulated as side
effect of continuous adaptations in the \TEX\ ecosystems). There was already code
that was never executed, simply as side effect of the way \LUATEX\ initializes
-itself (one needs to enable classes of primitives for instance).
+itself (one needs to enable classes of primitives for instance). Keep in mind
+that over time system dependencies have been handles with \TEX\ change files, the
+\WEBC\ infrastructure, \KPSE\ features, compilation variables and flags, etc. In
+\LUAMETATEX\ we try to minimize all that.
\stopsubsection
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex b/doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex
index 8f1400c9f..9a2fe5690 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex
@@ -47,19 +47,21 @@ If you still decide to read on, then it's good to know what nodes are, so we do
quick introduction here. If you input this text:
\starttyping
-Hi There
+Hi There ...
\stoptyping
eventually we will get a linked lists of nodes, which in \ASCII\ art looks like:
\starttyping
-H <=> i <=> [glue] <=> T <=> h <=> e <=> r <=> e
+H <=> i <=> [glue] <=> T <=> h <=> e <=> r <=> e ...
\stoptyping
-When we have a paragraph, we actually get something:
+When we have a paragraph, we actually get something like this, where a \type
+{localpar} node stores some metadata and is followed by a \type {hlist} flagged
+as indent box:
\starttyping
-[localpar] <=> H <=> i <=> [glue] <=> T <=> h <=> e <=> r <=> e <=> [glue]
+[localpar] <=> [hlist] <=> H <=> i <=> [glue] <=> T <=> h <=> e <=> r <=> e ...
\stoptyping
Each character becomes a so called glyph node, a record with properties like the
@@ -69,14 +71,14 @@ back to a previous node or next node, given that these exist. Sometimes
multiple characters are represented by one glyphs, so one can also get:
\starttyping
-[localpar] <=> H <=> i <=> [glue] <=> Th <=> e <=> r <=> e <=> [glue]
+[localpar] <=> [hlist] <=> H <=> i <=> [glue] <=> Th <=> e <=> r <=> e ...
\stoptyping
And maybe some characters get positioned relative to each other, so we might
see:
\starttyping
-[localpar] <=> H <=> [kern] <=> i <=> [glue] <=> Th <=> e <=> r <=> e <=> [glue]
+[localpar] <=> [hlist] <=> H <=> [kern] <=> i <=> [glue] <=> Th <=> e <=> r <=> e ...
\stoptyping
It's also good to know beforehand that \TEX\ is basically centered around
@@ -96,6 +98,8 @@ means these hooks. The \TEX\ engine itself is pretty well optimized but when you
kick in much \LUA\ code, you will notices that performance drops. Don't blame and
bother the authors with performance issues. In \CONTEXT\ over 50\% of the time
can be spent in \LUA, but so far we didn't get many complaints about efficiency.
+Adding more callbacks makes no sense, also because at some point the performance
+hit gets too large. There are plenty ways to achieve one goals.
Where plain \TEX\ is basically a basic framework for writing a specific style,
macro packages like \CONTEXT\ and \LATEX\ provide the user a whole lot of
@@ -108,7 +112,7 @@ mess around to much, the engine eventually might bark and quit. It can even
crash, because testing everywhere for what users can do wrong is no real option.
When you read about nodes in the following chapters it's good to keep in mind
-their commands that relate to then. Here are a few:
+what commands relate to them. Here are a few:
\starttabulate[|l|l|p|]
\DB command \BC node \BC explanation \NC \NR
@@ -137,23 +141,23 @@ all terms used in the next chapters. Don't worry, they loose their magic once yo
use \TEX\ a lot. You have access to most of the internals and when not, at least
it is possible to query some state we're in or level we're at.
-When we talk about packing it can mean two things. When \TEX\ has consumed some
-tokens that represent text the next can happen. When the text is put into a so
-called \type {\hbox} it (normally) first gets hyphenated, next ligatures are
-build, and finally kerns are added. Each of that stages can be overloaded using
-\LUA\ code. When these three stages are finished, the dimension of the content is
-calculated and the box gets its width, height and depth. What happens with the
-box depends on what macros do with it.
+When we talk about pack(ag)ing it can mean two things. When \TEX\ has consumed
+some tokens that represent text. When the text is put into a so called \type
+{\hbox} it (normally) first gets hyphenated (even in an horizontal list), next
+ligatures are build, and finally kerns are added. Each of these stages can be
+overloaded using \LUA\ code. When these three stages are finished, the dimension
+of the content is calculated and the box gets its width, height and depth. What
+happens with the box depends on what macros do with it.
The other thing that can happen is that the text starts a new paragraph. In that
-case some (directional) information is put in front, indentation is prepended and
-some skip appended at the end. Again the three stages are applied but this time,
-afterwards, the long line is broken into lines and the result is either added to
-the content of a box or to the main vertical list (the running text so to say).
-This is called par building. At some point \TEX\ decides that enough is enough
-and it will trigger the page builder. So, building is another concept we will
-encounter. Another example of a builder is the one that turns an intermediate
-math list into something typeset.
+case some information is stored in a leading \type {localpar} node. Then
+indentation is appended and the paragraph ends with some glue. Again the three
+stages are applied but this time, afterwards, the long line is broken into lines
+and the result is either added to the content of a box or to the main vertical
+list (the running text so to say). This is called par building. At some point
+\TEX\ decides that enough is enough and it will trigger the page builder. So,
+building is another concept we will encounter. Another example of a builder is
+the one that turns an intermediate math list into something typeset.
Wrapping something in a box is called packing. Adding something to a list is
described in terms of contributing. The more complicated processes are wrapped
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-style.tex b/doc/context/sources/general/manuals/luametatex/luametatex-style.tex
index a07cbe9dd..4d3ef36e3 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-style.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-style.tex
@@ -136,7 +136,7 @@
\definecolor[othercolor][r=.5,g=.5]
\writestatus{luametatex manual}{}
-\writestatus{luametatex manual}{defining lucodaot} \usebodyfont [lucidaot]
+\writestatus{luametatex manual}{defining lucidaot} \usebodyfont [lucidaot]
\writestatus{luametatex manual}{defining pagella} \usebodyfont [pagella]
\writestatus{luametatex manual}{defining cambria} \usebodyfont [cambria]
\writestatus{luametatex manual}{defining modern} \usebodyfont [modern]
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex b/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
index 648ee5eef..28cf20840 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
@@ -173,11 +173,12 @@ but you {\it can\/} use \type {pairs} on \type {info}, of course. If you do not
need the full list, you can also ask for a single item by using its name as an
index into \type {status}. The current list is:
+{\em This table is under reconstrction!}
+
\starttabulate[|l|p|]
\DB key \BC explanation \NC \NR
\TB
\NC \type{banner} \NC terminal display banner \NC \NR
-\NC \type{best_page_break} \NC the current best break (a node) \NC \NR
\NC \type{buf_size} \NC current allocated size of the line buffer \NC \NR
\NC \type{callbacks} \NC total number of executed callbacks so far \NC \NR
\NC \type{cs_count} \NC number of control sequences \NC \NR
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex.tex b/doc/context/sources/general/manuals/luametatex/luametatex.tex
index 6192c8e94..b58b108a2 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex.tex
@@ -57,7 +57,7 @@
\startdocument
[manual=LuaMeta\TeX,
- % status=experimental,
+ %status=experimental,
version=\cldcontext{status.luatex_verbose}]
\component luametatex-titlepage
diff --git a/doc/context/sources/general/manuals/mk/mk-memory.tex b/doc/context/sources/general/manuals/mk/mk-memory.tex
index 4c16e613e..f8259c7db 100644
--- a/doc/context/sources/general/manuals/mk/mk-memory.tex
+++ b/doc/context/sources/general/manuals/mk/mk-memory.tex
@@ -131,10 +131,10 @@ If you want to run such tests yourself, you need to load a module at startup:
The graphics can be generated with:
\starttyping
-\def\ShowUsage {optional filename}
-\def\ShowNamedUsage {optional filename}{red graphic}{blue graphic}
-\def\ShowMemoryUsage{optional filename}
-\def\ShowNodeUsage {optional filename}
+\ShowUsage {optional filename}
+\ShowNamedUsage {optional filename}{red graphic}{blue graphic}
+\ShowMemoryUsage{optional filename}
+\ShowNodeUsage {optional filename}
\stoptyping
(This interface may change.)
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 223da8193..6a8ea4dd0 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -628,7 +628,7 @@ function scripts.context.run(ctxdata,filename)
-- files = { }
elseif #files > 0 then
-- the list of given files is processed using the stub file
- mainfile = usedfiles.yes
+ mainfile = usedfiles.yes -- this can become "" for luametatex/lmtx
filelist = files
files = { }
else
@@ -821,20 +821,12 @@ function scripts.context.run(ctxdata,filename)
-- ["safer"] = a_safer, -- better use --sandbox
-- ["no-mktex"] = true,
-- ["file-line-error-style"] = true,
--- ["fmt"] = formatfile,
--- ["lua"] = scriptfile,
+-- ["fmt"] = formatfile,
+-- ["lua"] = scriptfile,
["jobname"] = jobname,
["jithash"] = a_jithash,
}
--
- if not a_timing then
- -- okay
- elseif c_flags.usemodule then
- c_flags.usemodule = format("timing,%s",c_flags.usemodule)
- else
- c_flags.usemodule = "timing"
- end
- --
local directives = { }
--
if a_nodates then
@@ -1012,7 +1004,7 @@ function scripts.context.run(ctxdata,filename)
report("you can process (timing) statistics with:",jobname)
report()
report("context --extra=timing '%s'",jobname)
- report("mtxrun --script timing --xhtml [--launch --remove] '%s'",jobname)
+ -- report("mtxrun --script timing --xhtml [--launch --remove] '%s'",jobname)
report()
end
else
diff --git a/scripts/context/lua/mtx-timing.lua b/scripts/context/lua/mtx-timing.lua
deleted file mode 100644
index 5ba361e5f..000000000
--- a/scripts/context/lua/mtx-timing.lua
+++ /dev/null
@@ -1,218 +0,0 @@
-if not modules then modules = { } end modules ['mtx-timing'] = {
- version = 1.002,
- comment = "companion to mtxrun.lua",
- author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
- copyright = "PRAGMA ADE / ConTeXt Development Team",
- license = "see context related readme files"
-}
-
-local format, gsub, concat = string.format, string.gsub, table.concat
-
-local helpinfo = [[
-<?xml version="1.0"?>
-<application>
- <metadata>
- <entry name="name">mtx-timing</entry>
- <entry name="detail">ConTeXt Timing Tools</entry>
- <entry name="version">0.10</entry>
- </metadata>
- <flags>
- <category name="basic">
- <subcategory>
- <flag name="xhtml"><short>make xhtml file</short></flag>
- <flag name="launch"><short>launch after conversion</short></flag>
- <flag name="remove"><short>remove after launching</short></flag>
- </subcategory>
- </category>
- </flags>
-</application>
-]]
-
-local application = logs.application {
- name = "mtx-timing",
- banner = "ConTeXt Timing Tools 0.10",
- helpinfo = helpinfo,
-}
-
-local report = application.report
-
-dofile(resolvers.findfile("node-snp.lua","tex"))
-dofile(resolvers.findfile("trac-tim.lua","tex"))
-dofile(resolvers.findfile("trac-lmx.lua","tex"))
-
-local meta = [[
- beginfig(%s) ;
- begingroup ;
- save p, q, b, h, w ;
- path p, q, b ; numeric h, w ;
- linecap := butt ;
- h := 100 ;
- w := 800pt ;
- p := %s ;
- q := %s ;
- p := p shifted -llcorner p ;
- q := q shifted -llcorner q ;
- q := q xstretched w ;
- p := p xstretched w ;
- b := boundingbox (llcorner p -- llcorner p shifted (w,h)) ;
- draw b withcolor white withpen pencircle scaled 4pt ;
- draw p withcolor red withpen pencircle scaled 4pt ;
- draw q withcolor blue withpen pencircle scaled 2pt ;
- endgroup ;
- endfig ;
-]]
-
-local html_graphic = [[
- <h1><a name='graphic-%s'>%s (red) %s (blue)</a></h1>
- <table>
- <tr>
- <td>%s</td>
- <td valign='top'>
- &nbsp;&nbsp;min: %s<br/>
- &nbsp;&nbsp;max: %s<br/>
- &nbsp;&nbsp;pages: %s<br/>
- &nbsp;&nbsp;average: %s<br/>
- </td>
- </tr>
- </table>
- <br/>
-]]
-
-local html_menu = [[
- <a href='#graphic-%s'>%s</a>
-]]
-
-local directrun = true
-
-local what = { "parameters", "nodes" }
-
-plugins = plugins or { progress = { } } -- brrr, will become moduledata as well
-
-function plugins.progress.make_svg(filename,other)
- local metadata, menudata, c = { }, { }, 0
- metadata[#metadata+1] = 'outputformat := "svg" ;'
- for i=1,#what do
- local kind, mdk = what[i], { }
- menudata[kind] = mdk
- for n, name in next, plugins.progress[kind](filename) do
- local first = plugins.progress.path(filename,name)
- local second = plugins.progress.path(filename,other)
- c = c + 1
- metadata[#metadata+1] = format(meta,c,first,second)
- mdk[#mdk+1] = { name, c }
- end
- end
- metadata[#metadata+1] = "end ."
- metadata = concat(metadata,"\n\n")
- if directrun then
- dofile(resolvers.findfile("mlib-run.lua","tex"))
- commands = commands or { }
- commands.writestatus = report
- local result = metapost.directrun("metafun","timing data","svg",true,metadata)
- return menudata, result
- else
- local mpname = file.replacesuffix(filename,"mp")
- io.savedata(mpname,metadata)
- os.execute(format("mpost --progname=context --mem=metafun.mem %s",mpname))
- os.remove(mpname)
- os.remove(file.removesuffix(filename).."-mpgraph.mpo") -- brr
- os.remove(file.removesuffix(filename)..".log") -- brr
- return menudata
- end
-end
-
-function plugins.progress.makehtml(filename,other,menudata,metadata)
- local graphics = { }
- local result = { graphics = graphics }
- for i=1,#what do
- local kind, menu = what[i], { }
- local md = menudata[kind]
- result[kind] = menu
- for k=1,#md do
- local v = md[k]
- local name, number = v[1], v[2]
- local min = plugins.progress.bot(filename,name)
- local max = plugins.progress.top(filename,name)
- local pages = plugins.progress.pages(filename)
- local average = math.round(max/pages)
- if directrun then
- local data = metadata[number]
- menu[#menu+1] = format(html_menu,name,name)
- graphics[#graphics+1] = format(html_graphic,name,name,other,data,min,max,pages,average)
- else
- local mpname = file.replacesuffix(filename,number)
- local data = io.loaddata(mpname) or ""
- -- data = gsub(data,"<!%-%-(.-)%-%->[\n\r]*","")
- data = gsub(data,"<%?xml.->","")
- menu[#menu+1] = format(html_menu,name,name)
- graphics[#graphics+1] = format(html_graphic,name,name,other,data,min,max,pages,average)
- os.remove(mpname)
- end
- end
- end
- return result
-end
-
-function plugins.progress.valid_file(name)
- return name and name ~= "" and lfs.isfile(name .. "-luatex-progress.lut")
-end
-
-function plugins.progress.make_lmx_page(name,launch,remove)
-
- local filename = name .. "-luatex-progress"
- local other = "elapsed_time"
- local template = 'context-timing.lmx'
-
- plugins.progress.convert(filename)
-
- local menudata, metadata = plugins.progress.make_svg(filename,other)
- local htmldata = plugins.progress.makehtml(filename,other,menudata,metadata)
-
- lmx.htmfile = function(name) return name .. "-timing.xhtml" end
- lmx.lmxfile = function(name) return resolvers.findfile(name,'tex') end
-
- local variables = {
- ['title-default'] = 'ConTeXt Timing Information',
- ['title'] = format('ConTeXt Timing Information: %s',file.basename(name)),
- ['parametersmenu'] = concat(htmldata.parameters, "&nbsp;&nbsp;"),
- ['nodesmenu'] = concat(htmldata.nodes, "&nbsp;&nbsp;"),
- ['graphics'] = concat(htmldata.graphics, "\n\n"),
- ['color-background-one'] = lmx.get('color-background-green'),
- ['color-background-two'] = lmx.get('color-background-blue'),
- }
-
- if launch then
- local htmfile = lmx.show(template,variables)
- if remove then
- os.sleep(1) -- give time to launch
- os.remove(htmfile)
- end
- else
- lmx.make(template,variables)
- end
-
-end
-
-scripts = scripts or { }
-scripts.timings = scripts.timings or { }
-
-function scripts.timings.xhtml(filename)
- if filename == "" then
- report("provide filename")
- elseif not plugins.progress.valid_file(filename) then
- report("first run context again with the --timing option")
- else
- local basename = file.removesuffix(filename)
- local launch = environment.argument("launch")
- local remove = environment.argument("remove")
- plugins.progress.make_lmx_page(basename,launch,remove)
- end
-end
-
-if environment.argument("xhtml") then
- scripts.timings.xhtml(environment.files[1] or "")
-elseif environment.argument("exporthelp") then
- application.export(environment.argument("exporthelp"),environment.files[1])
-else
- application.help()
-end
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 81d3c1824..26910b46e 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6529, stripped down to: 2933
+-- original size: 6405, stripped down to: 2865
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -291,9 +291,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -13984,7 +13981,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 10182, stripped down to: 7498
+-- original size: 9781, stripped down to: 7325
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -14158,17 +14155,10 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- if LUATEXENGINE=="luametatex" then
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,LUATEXFORMATID,status.used_compiler)
- end)
- else
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- end
+ register("used engine",function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
+ end)
register("used hash slots",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
end)
@@ -14183,15 +14173,10 @@ function statistics.show()
end
end
register("lua properties",function()
- local hashchar=tonumber(status.luatex_hashchars)
- local mask=lua.mask or "ascii"
+ local hash=2^status.luatex_hashchars
+ local mask=load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask=="utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline()
@@ -14247,6 +14232,13 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+function status.getreadstate()
+ return {
+ filename=status.filename or "?",
+ linenumber=status.linenumber or 0,
+ iocode=status.inputid or 0,
+ }
+end
end -- of closure
@@ -25899,7 +25891,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 11725, stripped down to: 8417
+-- original size: 11612, stripped down to: 8339
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25950,14 +25942,13 @@ local function secondaryflags(arguments)
end
return concat(flags," ")
end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers={
primaryflags="verbose",
secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
- dump="string",
binarypath="string",
}
local runners={
@@ -26058,7 +26049,6 @@ function environment.make_format(formatname)
secondaryflags=secondaryflags,
luafile=quoted(fullluasourcename),
texfile=quoted(fulltexsourcename),
- dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect="> temp.log"
@@ -26189,8 +26179,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.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-sha.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 util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.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 util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1040387
--- stripped bytes : 410960
+-- original bytes : 1039749
+-- stripped bytes : 410641
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 81d3c1824..26910b46e 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6529, stripped down to: 2933
+-- original size: 6405, stripped down to: 2865
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -291,9 +291,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -13984,7 +13981,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 10182, stripped down to: 7498
+-- original size: 9781, stripped down to: 7325
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -14158,17 +14155,10 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- if LUATEXENGINE=="luametatex" then
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,LUATEXFORMATID,status.used_compiler)
- end)
- else
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- end
+ register("used engine",function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
+ end)
register("used hash slots",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
end)
@@ -14183,15 +14173,10 @@ function statistics.show()
end
end
register("lua properties",function()
- local hashchar=tonumber(status.luatex_hashchars)
- local mask=lua.mask or "ascii"
+ local hash=2^status.luatex_hashchars
+ local mask=load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask=="utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline()
@@ -14247,6 +14232,13 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+function status.getreadstate()
+ return {
+ filename=status.filename or "?",
+ linenumber=status.linenumber or 0,
+ iocode=status.inputid or 0,
+ }
+end
end -- of closure
@@ -25899,7 +25891,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 11725, stripped down to: 8417
+-- original size: 11612, stripped down to: 8339
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25950,14 +25942,13 @@ local function secondaryflags(arguments)
end
return concat(flags," ")
end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers={
primaryflags="verbose",
secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
- dump="string",
binarypath="string",
}
local runners={
@@ -26058,7 +26049,6 @@ function environment.make_format(formatname)
secondaryflags=secondaryflags,
luafile=quoted(fullluasourcename),
texfile=quoted(fulltexsourcename),
- dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect="> temp.log"
@@ -26189,8 +26179,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.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-sha.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 util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.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 util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1040387
--- stripped bytes : 410960
+-- original bytes : 1039749
+-- stripped bytes : 410641
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 81d3c1824..26910b46e 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6529, stripped down to: 2933
+-- original size: 6405, stripped down to: 2865
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -291,9 +291,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -13984,7 +13981,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 10182, stripped down to: 7498
+-- original size: 9781, stripped down to: 7325
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -14158,17 +14155,10 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- if LUATEXENGINE=="luametatex" then
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,LUATEXFORMATID,status.used_compiler)
- end)
- else
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- end
+ register("used engine",function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
+ end)
register("used hash slots",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
end)
@@ -14183,15 +14173,10 @@ function statistics.show()
end
end
register("lua properties",function()
- local hashchar=tonumber(status.luatex_hashchars)
- local mask=lua.mask or "ascii"
+ local hash=2^status.luatex_hashchars
+ local mask=load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask=="utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline()
@@ -14247,6 +14232,13 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+function status.getreadstate()
+ return {
+ filename=status.filename or "?",
+ linenumber=status.linenumber or 0,
+ iocode=status.inputid or 0,
+ }
+end
end -- of closure
@@ -25899,7 +25891,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 11725, stripped down to: 8417
+-- original size: 11612, stripped down to: 8339
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25950,14 +25942,13 @@ local function secondaryflags(arguments)
end
return concat(flags," ")
end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers={
primaryflags="verbose",
secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
- dump="string",
binarypath="string",
}
local runners={
@@ -26058,7 +26049,6 @@ function environment.make_format(formatname)
secondaryflags=secondaryflags,
luafile=quoted(fullluasourcename),
texfile=quoted(fulltexsourcename),
- dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect="> temp.log"
@@ -26189,8 +26179,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.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-sha.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 util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.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 util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1040387
--- stripped bytes : 410960
+-- original bytes : 1039749
+-- stripped bytes : 410641
-- end library merge
diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua
index 81d3c1824..26910b46e 100644
--- a/scripts/context/stubs/win64/mtxrun.lua
+++ b/scripts/context/stubs/win64/mtxrun.lua
@@ -194,7 +194,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lua"] = package.loaded["l-lua"] or true
--- original size: 6529, stripped down to: 2933
+-- original size: 6405, stripped down to: 2865
if not modules then modules={} end modules ['l-lua']={
version=1.001,
@@ -291,9 +291,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -13984,7 +13981,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["trac-inf"] = package.loaded["trac-inf"] or true
--- original size: 10182, stripped down to: 7498
+-- original size: 9781, stripped down to: 7325
if not modules then modules={} end modules ['trac-inf']={
version=1.001,
@@ -14158,17 +14155,10 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown",environment.texos or "unknown")
end)
- if LUATEXENGINE=="luametatex" then
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,LUATEXFORMATID,status.used_compiler)
- end)
- else
- register("used engine",function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
- end)
- end
+ register("used engine",function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE,LUATEXVERSION,LUATEXFUNCTIONALITY,lower(status.banner))
+ end)
register("used hash slots",function()
return format("%s of %s + %s",status.cs_count,status.hash_size,status.hash_extra)
end)
@@ -14183,15 +14173,10 @@ function statistics.show()
end
end
register("lua properties",function()
- local hashchar=tonumber(status.luatex_hashchars)
- local mask=lua.mask or "ascii"
+ local hash=2^status.luatex_hashchars
+ local mask=load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask=="utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua",LUAVERSION,statistics.memused(),hash,mask,mask=="utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline()
@@ -14247,6 +14232,13 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+function status.getreadstate()
+ return {
+ filename=status.filename or "?",
+ linenumber=status.linenumber or 0,
+ iocode=status.inputid or 0,
+ }
+end
end -- of closure
@@ -25899,7 +25891,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["luat-fmt"] = package.loaded["luat-fmt"] or true
--- original size: 11725, stripped down to: 8417
+-- original size: 11612, stripped down to: 8339
if not modules then modules={} end modules ['luat-fmt']={
version=1.001,
@@ -25950,14 +25942,13 @@ local function secondaryflags(arguments)
end
return concat(flags," ")
end
-local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template=[[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers={
primaryflags="verbose",
secondaryflags="verbose",
luafile="readable",
texfile="readable",
redirect="string",
- dump="string",
binarypath="string",
}
local runners={
@@ -26058,7 +26049,6 @@ function environment.make_format(formatname)
secondaryflags=secondaryflags,
luafile=quoted(fullluasourcename),
texfile=quoted(fulltexsourcename),
- dump=os.platform=="unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect="> temp.log"
@@ -26189,8 +26179,8 @@ end -- of closure
-- used libraries : l-bit32.lua l-lua.lua l-macro.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-sha.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 util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.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 util-zip.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 libs-ini.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 1040387
--- stripped bytes : 410960
+-- original bytes : 1039749
+-- stripped bytes : 410641
-- end library merge
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 42229a6b2..71cceb7db 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{2020.08.14 18:54}
+\newcontextversion{2020.08.24 19:46}
%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 24ad82756..b38af7afc 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{2020.08.14 18:54}
+\edef\contextversion{2020.08.24 19:46}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii
index 14d7555b2..20021c4ea 100644
--- a/tex/context/base/mkii/mult-en.mkii
+++ b/tex/context/base/mkii/mult-en.mkii
@@ -954,6 +954,7 @@
\setinterfaceconstant{limittext}{limittext}
\setinterfaceconstant{line}{line}
\setinterfaceconstant{linecorrection}{linecorrection}
+\setinterfaceconstant{linedirection}{linedirection}
\setinterfaceconstant{lines}{lines}
\setinterfaceconstant{list}{list}
\setinterfaceconstant{listtext}{listtext}
diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii
index 0868762e9..287f47814 100644
--- a/tex/context/base/mkii/mult-nl.mkii
+++ b/tex/context/base/mkii/mult-nl.mkii
@@ -634,6 +634,7 @@
\setinterfaceconstant{afterkey}{natoets}
\setinterfaceconstant{aftersection}{nasectie}
\setinterfaceconstant{align}{uitlijnen}
+\setinterfaceconstant{alignbottom}{alignbottom}
\setinterfaceconstant{aligncharacter}{karakteruitlijnen}
\setinterfaceconstant{alignmentcharacter}{uitlijnkarakter}
\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
@@ -953,6 +954,7 @@
\setinterfaceconstant{limittext}{limiettekst}
\setinterfaceconstant{line}{regel}
\setinterfaceconstant{linecorrection}{regelcorrectie}
+\setinterfaceconstant{linedirection}{regelrichting}
\setinterfaceconstant{lines}{regels}
\setinterfaceconstant{list}{lijst}
\setinterfaceconstant{listtext}{lijsttekst}
diff --git a/tex/context/base/mkiv/back-ini.lua b/tex/context/base/mkiv/back-ini.lua
index b0af61edc..ca6f6c1e5 100644
--- a/tex/context/base/mkiv/back-ini.lua
+++ b/tex/context/base/mkiv/back-ini.lua
@@ -207,6 +207,6 @@ implement {
-- could also be codeinjections
-function backends.noflatelua()
- return status.late_callbacks or 0
+function backends.getcallbackstate()
+ return { count = status.late_callbacks or 0 }
end
diff --git a/tex/context/base/mkiv/back-out.lmt b/tex/context/base/mkiv/back-out.lmt
index 832e93a14..968617ecc 100644
--- a/tex/context/base/mkiv/back-out.lmt
+++ b/tex/context/base/mkiv/back-out.lmt
@@ -204,8 +204,8 @@ function backends.latelua(current,pos_h,pos_v) -- todo: pass pos_h and pos_v (mo
end
end
-function backends.noflatelua()
- return noflatelua
+function backends.getcallbackstate()
+ return { count = noflatelua }
end
function nodepool.originliteral(str) local t = copynode(literalnode) nodeproperties[t] = { data = str, mode = originliteral_code } return t end
diff --git a/tex/context/base/mkiv/blob-ini.lmt b/tex/context/base/mkiv/blob-ini.lmt
new file mode 100644
index 000000000..42a18fddd
--- /dev/null
+++ b/tex/context/base/mkiv/blob-ini.lmt
@@ -0,0 +1,210 @@
+if not modules then modules = { } end modules ['blob-ini'] = {
+ version = 1.001,
+ comment = "companion to blob-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This module is just a playground. Occasionally we need to typeset at the lua and and
+-- this is one method. In principle we can construct pages this way too which sometimes
+-- makes sense in dumb cases. Actually, if one only needs this, one does not really need
+-- tex, okay maybe the parbuilder but that one can be simplified as well then.
+
+-- set fonts, attributes
+-- rest already done in packers etc
+-- add local par whatsit (or wait till cleaned up)
+-- collapse or new pars
+-- interline spacing etc
+
+-- blob.char
+-- blob.line
+-- blob.paragraph
+-- blob.page
+
+local type, tostring = type, tostring
+local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
+
+local report_blobs = logs.reporter("blobs")
+
+local flush_node_list = node.flush_list
+local hpack_node_list = node.hpack
+----- vpack_node_list = node.vpack
+local write_node = node.write
+
+local typesetters = nodes.typesetters
+local tonodes = typesetters.tonodes
+local tohpack = typesetters.tohpack
+local tovpack = typesetters.tovpack
+
+local implement = interfaces.implement
+
+-- provide copies here (nicer for manuals)
+
+blobs = blobs or { }
+local blobs = blobs
+
+blobs.tonodes = tonodes
+blobs.tohpack = tohpack
+blobs.tovpack = tovpack
+
+-- end of helpers
+
+local newline = lpeg.patterns.newline
+local space = lpeg.patterns.spacer
+local newpar = (space^0*newline*space^0)^2
+
+local ctxtextcapture = lpeg.Ct ( ( space^0 * ( newpar + lpeg.Cs(((space^1/" " + 1)-newpar)^1) ) )^0)
+
+function blobs.new()
+ return {
+ list = { },
+ }
+end
+
+function blobs.dispose(t)
+ local list = t.list
+ for i=1,#list do
+ local li = list[i]
+ local pack = li.pack
+ if pack then
+ flush_node_list(pack)
+ li.pack = nil
+ end
+ end
+end
+
+function blobs.append(t,str) -- compare concat and link
+ local typ = type(str)
+ local dummy = nil
+ if typ == "number" then
+ str = tostring(str)
+ typ = "string"
+ end
+ if typ == "string" then
+ local pars = lpegmatch(ctxtextcapture,str)
+ local list = t.list
+ for p=1,#pars do
+ local head, tail = tonodes(pars[p],nil,nil)
+ list[#list+1] = { head = head, tail = tail }
+ end
+ end
+end
+
+function blobs.pack(t,how)
+ local list = t.list
+ for i=1,#list do
+ local pack = list[i].pack
+ if pack then
+ flush_node_list(node.pack)
+ end
+ if how == "vertical" then
+ -- we need to prepend a local par node
+ -- list[i].pack = vpack_node_list(list[i].head,"exactly")
+ report_blobs("vpack not yet supported")
+ else
+ list[i].pack = hpack_node_list(list[i].head,"exactly")
+ end
+ end
+end
+
+function blobs.write(t)
+ local list = t.list
+ for i=1,#list do
+ local li = list[i]
+ local pack = li.pack
+ if pack then
+ write_node(pack)
+ flush_node_list(pack)
+ li.pack = nil
+ end
+ end
+end
+
+function blobs.dimensions(t)
+ local list = t.list
+ local first = list and list[1]
+ if first then
+ local pack = first.pack
+ return pack.width, pack.height, pack.depth
+ else
+ return 0, 0, 0
+ end
+end
+
+-- blob.char
+-- blob.line: head, tail
+-- blob.paragraph
+-- blob.page
+
+-- local lineblob = {
+-- type = "line",
+-- head = false,
+-- tail = false,
+-- pack = false,
+-- properties = { },
+-- end
+
+-- local parblob = {
+-- type = "line",
+-- head = false,
+-- tail = false,
+-- pack = false,
+-- properties = { },
+-- end
+
+-- for the moment here:
+
+local function strwd(str)
+ local l = tohpack(str)
+ local w = l.width
+ flush_node_list(l)
+ return w
+end
+
+local function strht(str)
+ local l = tohpack(str)
+ local h = l.height
+ flush_node_list(l)
+ return h
+end
+
+local function strdp(str)
+ local l = tohpack(str)
+ local d = l.depth
+ flush_node_list(l)
+ return d
+end
+
+local function strhd(str)
+ local l = tohpack(str)
+ local s = l.height + l.depth
+ flush_node_list(l)
+ return s
+end
+
+blobs.strwd = strwd
+blobs.strht = strht
+blobs.strdp = strdp
+blobs.strhd = strhd
+
+-- upgraded
+
+local dimension_code = tokens.values.dimension
+local scan_hbox = tokens.scanners.hbox
+
+local function action(field,what)
+ local l = scan_hbox()
+ local d = l[field]
+ flush_node_list(l)
+ if what == "value" then
+ return dimension_code, d
+ else
+ context("%p",d)
+ end
+end
+
+implement { name = "widthofstring", public = true, usage = "value", actions = function(w) return action("width", w) end }
+implement { name = "heightofstring", public = true, usage = "value", actions = function(w) return action("height",w) end }
+implement { name = "depthofstring", public = true, usage = "value", actions = function(w) return action("depth", w) end }
+implement { name = "totalofstring", public = true, usage = "value", actions = function(w) return action("total", w) end }
diff --git a/tex/context/base/mkiv/blob-ini.lua b/tex/context/base/mkiv/blob-ini.lua
index f825b7aa3..0b35c3b65 100644
--- a/tex/context/base/mkiv/blob-ini.lua
+++ b/tex/context/base/mkiv/blob-ini.lua
@@ -188,7 +188,11 @@ blobs.strht = strht
blobs.strdp = strdp
blobs.strhd = strhd
-implement { name = "strwd", arguments = "string", actions = { strwd, context } }
-implement { name = "strht", arguments = "string", actions = { strht, context } }
-implement { name = "strdp", arguments = "string", actions = { strdp, context } }
-implement { name = "strhd", arguments = "string", actions = { strhd, context } }
+-- upgraded
+
+local scan_hbox = tokens.scanners.hbox
+
+implement { name = "strwd", actions = function() local l = scan_hbox() context(l.width) flush_node_list(l) end }
+implement { name = "strht", actions = function() local l = scan_hbox() context(l.height) flush_node_list(l) end }
+implement { name = "strdp", actions = function() local l = scan_hbox() context(l.depth) flush_node_list(l) end }
+implement { name = "strhd", actions = function() local l = scan_hbox() context(l.height + l.depth) flush_node_list(l) end }
diff --git a/tex/context/base/mkiv/blob-ini.mkiv b/tex/context/base/mkiv/blob-ini.mkiv
index 3cee3ff2f..dd33087f2 100644
--- a/tex/context/base/mkiv/blob-ini.mkiv
+++ b/tex/context/base/mkiv/blob-ini.mkiv
@@ -32,12 +32,13 @@
\def\dpofstring#1{\dimexpr\clf_strdp{#1}\scaledpoint\relax}
\def\hdofstring#1{\dimexpr\clf_strhd{#1}\scaledpoint\relax}
-\def\widthofstring {\the\wdofstring}
-\def\heightofstring {\the\htofstring}
-\def\depthofstring {\the\dpofstring}
-\def\heightanddepthofstring{\the\hdofstring}
+\def\widthofstring {\the\wdofstring}
+\def\heightofstring {\the\htofstring}
+\def\depthofstring {\the\dpofstring}
+\def\totalofstring {\the\hdofstring}
-\let\htdpofstring \hdofstring
+\let\heightanddepthofstring\totalofstring
+\let\htdpofstring \hdofstring
\let\hd\htdp % if yes then move this
diff --git a/tex/context/base/mkiv/blob-ini.mkxl b/tex/context/base/mkiv/blob-ini.mkxl
new file mode 100644
index 000000000..126319b12
--- /dev/null
+++ b/tex/context/base/mkiv/blob-ini.mkxl
@@ -0,0 +1,56 @@
+%D \module
+%D [ file=blob-ini,
+%D version=2010.04.06,
+%D title=\CONTEXT\ \LUA\ Typesetting,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Lua Typesetting / Initialization}
+
+%D This is a prelude to typesetting at the \LUA\ end. The code
+%D is already quite old but will only get nice when we are further
+%D down the road (close to version 1.00 of \LUATEX). Typesetting in
+%D pure \LUA\ sometimes makes sense.
+
+\registerctxluafile{node-typ}{} % experimental
+\registerctxluafile{blob-ini}{autosuffix}
+
+\unprotect
+
+% \widthofstring % defined in lua
+% \heightofstring % defined in lua
+% \depthofstring % defined in lua
+% \heightanddepthofstring % defined in lua
+
+\def\wdofstring#1{\dimexpr\widthofstring {#1}\relax} % assured an dimen
+\def\htofstring#1{\dimexpr\heightofstring{#1}\relax} % assured an dimen
+\def\dpofstring#1{\dimexpr\depthofstring {#1}\relax} % assured an dimen
+\def\hdofstring#1{\dimexpr\totalofstring {#1}\relax} % assured an dimen
+
+\let\heightanddepthofstring\totalofstring
+\let\htdpofstring \hdofstring
+
+\let\hd\htdp % if yes then move this
+
+% This one takes anything that can be typeset
+
+\unexpanded\def\setwidthof#1\to#2{\edef#2{\widthofstring{#1}}}
+
+\protect \endinput
+
+% \starttext
+%
+% \startluacode
+% local b = blobs.new()
+% blobs.append(b,"Hello world.\n Here we are.\n\n And Again!")
+% blobs.pack(b)
+% blobs.write(b)
+% \stopluacode
+%
+% \stoptext
diff --git a/tex/context/base/mkiv/cldf-lmt.lmt b/tex/context/base/mkiv/cldf-lmt.lmt
index 6a9353d2e..c60c75deb 100644
--- a/tex/context/base/mkiv/cldf-lmt.lmt
+++ b/tex/context/base/mkiv/cldf-lmt.lmt
@@ -934,10 +934,10 @@ interfaces.implement {
local escape = function(s) return "\\" .. byte(s) end
interfaces.implement {
- name = "ctxluamatch",
- public = true,
- value = true,
- actions = function()
+ name = "ctxluamatch",
+ public = true,
+ usage = "value",
+ actions = function()
local command = context[scancsname()]
local pattern = gsub(scanstring(),"\\.",escape)
local input = gsub(scanstring(),"\\.",escape)
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 07f25fd35..2354e1a71 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2020.08.14 18:54}
+\newcontextversion{2020.08.24 19:46}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/cont-run.lua b/tex/context/base/mkiv/cont-run.lua
index c5f9014ff..3fef61672 100644
--- a/tex/context/base/mkiv/cont-run.lua
+++ b/tex/context/base/mkiv/cont-run.lua
@@ -207,37 +207,6 @@ local preparejob preparejob = function() -- tricky: we need a hook for this
}
end
- -- -- todo: move from mtx-context to here:
- --
- -- local timing = arguments.timing
- -- if type(timing) == "string" then
- -- context.usemodule { timing }
- -- end
- -- local nodates = arguments.nodates
- -- if nodates then
- -- context.enabledirectives { "backend.date=" .. (type(nodates) == "string" and nodates or "no") }
- -- end
- -- local trailerid = arguments.trailerid
- -- if type(trailerid) == "string" then
- -- context.enabledirectives { "backend.trailerid=" .. trailerid }
- -- end
- -- local profile = arguments.profile
- -- if profile then
- -- context.enabledirectives { "system.profile=" .. tonumber(profile) or 0 }
- -- 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
-
preparejob = function() end
job.prepare = preparejob
@@ -248,6 +217,8 @@ job.prepare = preparejob
local function processjob()
+ tokens.setters.macro("processjob","") -- make a
+
environment.initializefilenames() -- todo: check if we really need to pre-prep the filename
local arguments = environment.arguments
@@ -331,6 +302,13 @@ end
implement {
name = "processjob",
+ public = true,
onlyonce = true,
actions = processjob,
}
+
+if CONTEXTLMTXMODE then
+
+ texconfig.firstline = "\\processjob " -- experiment, yet undocumented
+
+end
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 6dd323348..79b0987ed 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.08.14 18:54}
+\edef\contextversion{2020.08.24 19:46}
%D Kind of special:
@@ -194,8 +194,6 @@
\loadmarkfile{trac-tex}
\loadmarkfile{trac-deb} % will move up
-%loadmarkfile{blob-ini} % not to be used, we only use a helper
-
\loadmarkfile{supp-box}
\loadmarkfile{supp-ran}
@@ -428,7 +426,7 @@
\loadmarkfile{spac-chr} % depends on fonts
-\loadmarkfile{blob-ini} % not to be used, we only use a helper
+\loadmarkfile{blob-ini}
\loadmarkfile{trac-vis}
\loadmarkfile{trac-jus}
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index 6b02b49c2..4a733dcdb 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.08.14 18:54}
+\edef\contextversion{2020.08.24 19:46}
%D Kind of special:
@@ -177,8 +177,6 @@
\loadmarkfile{trac-tex}
\loadmarkfile{trac-deb} % will move up
-%loadmarkfile{blob-ini} % not to be used, we only use a helper
-
\loadmkxlfile{supp-box} % LMTX
\loadmarkfile{supp-ran}
@@ -413,7 +411,7 @@
\loadmarkfile{spac-chr} % depends on fonts
-\loadmarkfile{blob-ini} % not to be used, we only use a helper
+\loadmkxlfile{blob-ini}
\loadmarkfile{trac-vis}
\loadmarkfile{trac-jus}
diff --git a/tex/context/base/mkiv/core-uti.lua b/tex/context/base/mkiv/core-uti.lua
index 50c7bc9dc..1debf347b 100644
--- a/tex/context/base/mkiv/core-uti.lua
+++ b/tex/context/base/mkiv/core-uti.lua
@@ -73,10 +73,9 @@ local enabled = true
local initialized = false
directives.register("job.save",function(v) enabled = v end)
-----------.register("job.keep",function(v) kept = v end)
-function job.disablesave() -- can be command
- enabled = false
+function job.disablesave()
+ enabled = false -- for instance called when an error
end
function job.initialize(loadname,savename)
@@ -89,10 +88,7 @@ function job.initialize(loadname,savename)
end
job.load(loadname) -- has to come after structure is defined !
luatex.registerstopactions(function()
- if enabled and not status.lasterrorstring or status.lasterrorstring == "" then
- -- if kept then
- -- job.keep(loadname) -- could move to mtx-context instead
- -- end
+ if enabled then
job.save(savename)
end
end)
@@ -396,37 +392,53 @@ statistics.register("jobdata time",function()
end
end)
--- statistics.register("callbacks", function()
--- local total, indirect = status.callbacks or 0, status.indirect_callbacks or 0
--- local pages = texgetcount('realpageno') - 1
--- if pages > 1 then
--- return format("direct: %s, indirect: %s, total: %s (%i per page)", total-indirect, indirect, total, total/pages)
--- else
--- return format("direct: %s, indirect: %s, total: %s", total-indirect, indirect, total)
--- end
--- end)
-
-function statistics.callbacks()
- local c_internal = status.callbacks or 0
- local c_file = status.indirect_callbacks or 0
- local c_direct = status.direct_callbacks or 0
- local c_late = backends.noflatelua() or 0
- local c_function = status.function_callbacks or 0
- local c_total = c_internal + c_file + c_direct + c_late + c_function
- local n_pages = texgetcount('realpageno') - 1
- local c_average = n_pages > 0 and math.round(c_total/n_pages) or 0
- local s_result = format (
- c_average > 0 and "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s (%s per page)"
- or "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s",
- c_internal, c_file, c_direct, c_late, c_function, c_total, c_average
- )
- statistics.callbacks = function()
- return s_result
+if CONTEXTLMTXMODE > 0 then
+
+ function statistics.callbacks()
+ local backend = backends.getcallbackstate()
+ local frontend = status.getcallbackstate()
+ local pages = structures.pages.nofpages or 0
+ local total = frontend.count + backend.count
+ local average = pages > 0 and math.round(total/pages) or 0
+ local result = format (
+ "file: %s, saved: %s, direct: %s, function: %s, value: %s, message: %s, bytecode: %s, late %s, total: %s (%s per page)",
+ frontend.file, frontend.saved, frontend.direct, frontend["function"],
+ frontend.value, frontend.message, frontend.bytecode, backend.count,
+ total, average
+ )
+ statistics.callbacks = function()
+ return result
+ end
+ return result
+ end
+
+ statistics.register("callbacks", statistics.callbacks)
+
+else
+
+ function statistics.callbacks()
+ local c_internal = status.callbacks or 0
+ local c_file = status.indirect_callbacks or 0
+ local c_direct = status.direct_callbacks or 0
+ local c_late = backends.getcallbackstate().count
+ local c_function = status.function_callbacks or 0
+ local c_total = c_internal + c_file + c_direct + c_late + c_function
+ local n_pages = structures.pages.nofpages or 0
+ local c_average = n_pages > 0 and math.round(c_total/n_pages) or 0
+ local result = format (
+ "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s (%s per page)",
+ c_internal, c_file, c_direct, c_late, c_function, c_total, c_average
+ )
+ statistics.callbacks = function()
+ return result
+ end
+ return result
end
- return s_result
+
+ statistics.register("callbacks", statistics.callbacks)
+
end
-statistics.register("callbacks", statistics.callbacks)
statistics.register("randomizer", function()
if rmethod and rvalue then
diff --git a/tex/context/base/mkiv/file-job.lua b/tex/context/base/mkiv/file-job.lua
index 5641d3e15..1197bb1ac 100644
--- a/tex/context/base/mkiv/file-job.lua
+++ b/tex/context/base/mkiv/file-job.lua
@@ -968,7 +968,11 @@ function document.setcommandline() -- has to happen at the tex end in order to e
-- to trick the files table which actually only has one entry in a tex job
if arguments.timing then
- context.usemodule("timing")
+ context.usemodule { "timing" }
+ end
+
+ if arguments.usage then
+ directives.enable("system.usage")
end
if arguments.batchmode then
diff --git a/tex/context/base/mkiv/file-mod.lua b/tex/context/base/mkiv/file-mod.lua
index c10e557c7..d392887ec 100644
--- a/tex/context/base/mkiv/file-mod.lua
+++ b/tex/context/base/mkiv/file-mod.lua
@@ -111,64 +111,66 @@ local function usemodule(name,hasscheme)
end
function environment.usemodules(prefix,askedname,truename)
- local truename = truename or environment.truefilename(askedname)
- local hasprefix = prefix and prefix ~= ""
- local hashname = ((hasprefix and prefix) or "*") .. "-" .. truename
- local status = modstatus[hashname] or false -- yet unset
- if status == 0 then
- -- not found
- elseif status == 1 then
- status = status + 1
- else
- if trace_modules then
- report("locating, prefix %a, askedname %a, truename %a",prefix,askedname,truename)
- end
- local hasscheme = url.hasscheme(truename)
- if hasscheme then
- -- no prefix and suffix done
- if usemodule(truename,true) then
- status = 1
- else
- status = 0
- end
- elseif hasprefix then
- if usemodule(prefix .. "-" .. truename) then
- status = 1
- else
- status = 0
- end
+ local truename = truename or environment.truefilename(askedname) or askedname
+ if truename and truename ~= "" then
+ local hasprefix = prefix and prefix ~= ""
+ local hashname = ((hasprefix and prefix) or "*") .. "-" .. truename
+ local status = modstatus[hashname] or false -- yet unset
+ if status == 0 then
+ -- not found
+ elseif status == 1 then
+ status = status + 1
else
- for i=1,#prefixes do
- -- todo: reconstruct name i.e. basename
- local thename = prefixes[i] .. "-" .. truename
- if usemodule(thename) then
+ if trace_modules then
+ report("locating, prefix %a, askedname %a, truename %a",prefix,askedname,truename)
+ end
+ local hasscheme = url.hasscheme(truename)
+ if hasscheme then
+ -- no prefix and suffix done
+ if usemodule(truename,true) then
status = 1
- break
+ else
+ status = 0
+ end
+ elseif hasprefix then
+ if usemodule(prefix .. "-" .. truename) then
+ status = 1
+ else
+ status = 0
end
- end
- if status then
- -- ok, don't change
- elseif find(truename,"-",1,true) and usemodule(truename) then
- -- assume a user namespace
- report("using user prefixed file %a",truename)
- status = 1
- elseif permit_unprefixed and usemodule(truename) then
- report("using unprefixed file %a",truename)
- status = 1
else
- status = 0
+ for i=1,#prefixes do
+ -- todo: reconstruct name i.e. basename
+ local thename = prefixes[i] .. "-" .. truename
+ if usemodule(thename) then
+ status = 1
+ break
+ end
+ end
+ if status then
+ -- ok, don't change
+ elseif find(truename,"-",1,true) and usemodule(truename) then
+ -- assume a user namespace
+ report("using user prefixed file %a",truename)
+ status = 1
+ elseif permit_unprefixed and usemodule(truename) then
+ report("using unprefixed file %a",truename)
+ status = 1
+ else
+ status = 0
+ end
end
end
+ if status == 0 then
+ missing = true
+ report("%a is not found",askedname)
+ elseif status == 1 then
+ report("%a is loaded",trace_modules and truename or askedname)
+ else
+ report("%a is already loaded",trace_modules and truename or askedname)
+ end
+ modstatus[hashname] = status
end
- if status == 0 then
- missing = true
- report("%a is not found",askedname)
- elseif status == 1 then
- report("%a is loaded",trace_modules and truename or askedname)
- else
- report("%a is already loaded",trace_modules and truename or askedname)
- end
- modstatus[hashname] = status
end
statistics.register("loaded tex modules", function()
diff --git a/tex/context/base/mkiv/font-map.lua b/tex/context/base/mkiv/font-map.lua
index 990a561f9..c983ea963 100644
--- a/tex/context/base/mkiv/font-map.lua
+++ b/tex/context/base/mkiv/font-map.lua
@@ -104,6 +104,7 @@ local hash = { }
local conc = { }
table.setmetatableindex(hash,function(t,k)
+ local v
if k < 0xD7FF or (k > 0xDFFF and k <= 0xFFFF) then
v = f_single(k)
else
diff --git a/tex/context/base/mkiv/l-lua.lua b/tex/context/base/mkiv/l-lua.lua
index f411230d4..00989c5ce 100644
--- a/tex/context/base/mkiv/l-lua.lua
+++ b/tex/context/base/mkiv/l-lua.lua
@@ -195,12 +195,6 @@ function optionalrequire(...)
end
end
--- nice for non ascii scripts (this might move):
-
-if lua then
- lua.mask = load([[τεχ = 1]]) and "utf" or "ascii"
-end
-
local flush = io.flush
if flush then
diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua
index d0f6f6d5f..a48215781 100644
--- a/tex/context/base/mkiv/lang-rep.lua
+++ b/tex/context/base/mkiv/lang-rep.lua
@@ -40,6 +40,10 @@ local trace_details = false trackers.register("languages.replacements.deta
local report_replacement = logs.reporter("languages","replacements")
local glyph_code = nodes.nodecodes.glyph
+local glue_code = nodes.nodecodes.glue
+
+local spaceskip_code = nodes.gluecodes.spaceskip
+local xspaceskip_code = nodes.gluecodes.xspaceskip
local nuts = nodes.nuts
@@ -47,6 +51,7 @@ local getnext = nuts.getnext
local getprev = nuts.getprev
local getattr = nuts.getattr
local getid = nuts.getid
+local getsubtype = nuts.getsubtype
local getchar = nuts.getchar
local isglyph = nuts.isglyph
@@ -105,7 +110,7 @@ lists[v_reset].attribute = unsetvalue -- so we discard 0
local function add(root,word,replacement)
local processor, replacement = splitprocessor(replacement,true) -- no check
replacement = lpegmatch(stripper,replacement) or replacement
- local list = utfsplit(word,true)
+ local list = utfsplit(word) -- ,true)
local size = #list
for i=1,size do
local l = utfbyte(list[i])
@@ -169,9 +174,12 @@ local function hit(a,head)
local lastfinal = false
while current do
local char, id = isglyph(current)
- -- if not char and id == glue_code then
- -- char = " " -- if needed we can also deal with spaces and special nbsp and such
- -- end
+ if not char and id == glue_code then
+ local s = getsubtype(current)
+ if s == spaceskip_code or s == xspaceskip_code then
+ char = 32 -- if needed we can also deal with spaces and special nbsp and such
+ end
+ end
if char then
local newroot = root[char]
if not newroot then
@@ -288,9 +296,9 @@ function replacements.handler(head)
i = i + 1
end
flush_list(list)
- elseif newlength == 0 then
- -- nothing gets replaced
- current = getnext(last)
+ -- elseif newlength == 0 then
+ -- -- nothing gets replaced
+ -- current = getnext(last)
elseif oldlength == newlength then -- #old == #new
if final.word == final.replacement then
-- nothing to do but skip
@@ -311,7 +319,7 @@ function replacements.handler(head)
setchar(current,newcodes[i])
current = getnext(current)
end
- else -- #old > #new
+ else -- #old > #new or #new == 0
for i=1,oldlength-newlength do
head, current = remove_node(head,current,true)
end
diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua
index c9ccc1b90..910ee5989 100644
--- a/tex/context/base/mkiv/luat-cnf.lua
+++ b/tex/context/base/mkiv/luat-cnf.lua
@@ -19,20 +19,70 @@ texconfig.shell_escape = 't'
luatex = luatex or { }
local luatex = luatex
-texconfig.error_line = 250 -- 79 -- frozen / large values can crash
-texconfig.expand_depth = 10000
-texconfig.half_error_line = 125 -- 50 -- frozen
-texconfig.hash_extra = 100000
-texconfig.max_in_open = 1000 -- frozen
-texconfig.max_print_line = 100000 -- frozen
-texconfig.max_strings = 500000
-texconfig.nest_size = 1000
-texconfig.param_size = 25000
-texconfig.save_size = 100000
-texconfig.stack_size = 10000
-texconfig.function_size = 32768
-texconfig.properties_size = 10000
-texconfig.fix_mem_init = 750000
+texconfig.error_line = 250
+texconfig.expand_depth = 10000
+texconfig.half_error_line = 125
+texconfig.max_print_line = 100000
+texconfig.max_strings = 500000
+texconfig.hash_extra = 200000
+texconfig.function_size = 32768
+texconfig.properties_size = 10000
+
+if CONTEXTLMTXMODE > 0 then
+
+texconfig.max_in_open = 2000
+texconfig.nest_size = 10000
+texconfig.param_size = 100000
+texconfig.save_size = 500000
+texconfig.stack_size = 100000
+texconfig.buffer_size = 10000000
+texconfig.token_size = 10000000
+texconfig.node_size = 20000000
+
+else
+
+texconfig.max_in_open = 1000
+texconfig.nest_size = 1000
+texconfig.param_size = 25000
+texconfig.save_size = 100000
+texconfig.stack_size = 10000
+texconfig.buf_size = 10000000
+texconfig.fix_mem_init = 1000000
+
+end
+
+local variablenames = CONTEXTLMTXMODE > 0 and {
+ error_line = false,
+ half_error_line = false,
+ max_print_line = false,
+ max_in_open = false,
+ expand_depth = true,
+ hash_extra = true,
+ nest_size = true,
+ max_strings = true,
+ param_size = true,
+ save_size = true,
+ stack_size = true,
+ function_size = true,
+ properties_size = true,
+ token_size = true,
+ node_size = true,
+} or {
+ error_line = false,
+ half_error_line = false,
+ max_print_line = false,
+ max_in_open = false,
+ expand_depth = true,
+ hash_extra = true,
+ nest_size = true,
+ max_strings = true,
+ param_size = true,
+ save_size = true,
+ stack_size = true,
+ function_size = true,
+ properties_size = true,
+ fix_mem_init = true,
+}
local stub = [[
@@ -201,22 +251,6 @@ end)
-- done, from now on input and callbacks are internal
]]
-local variablenames = {
- error_line = false,
- half_error_line = false,
- max_print_line = false,
- max_in_open = false,
- expand_depth = true,
- hash_extra = true,
- nest_size = true,
- max_strings = true,
- param_size = true,
- save_size = true,
- stack_size = true,
- function_size = true,
- properties_size = true,
-}
-
local function makestub()
name = name or (environment.jobname .. ".lui")
report("creating stub file %a using directives:",name)
diff --git a/tex/context/base/mkiv/luat-cod.lmt b/tex/context/base/mkiv/luat-cod.lmt
index c7c868f42..802a89fc1 100644
--- a/tex/context/base/mkiv/luat-cod.lmt
+++ b/tex/context/base/mkiv/luat-cod.lmt
@@ -17,22 +17,27 @@ local texconfig, lua = texconfig, lua
-- some basic housekeeping
-texconfig.kpse_init = false
-texconfig.shell_escape = 't'
-
-texconfig.error_line = 250 -- 79 -- frozen / large values can crash
-texconfig.expand_depth = 10000
-texconfig.half_error_line = 125 -- 50 -- frozen
-texconfig.max_in_open = 1000
-texconfig.max_print_line = 100000
-texconfig.max_strings = 500000
-texconfig.nest_size = 1000
-texconfig.param_size = 25000
-texconfig.save_size = 100000
-texconfig.stack_size = 10000
-texconfig.function_size = 32768
-texconfig.properties_size = 10000
-texconfig.fix_mem_init = 750000
+texconfig.kpse_init = false -- not needed in lmtx
+texconfig.shell_escape = 't' -- not needed in lmtx
+
+texconfig.max_in_open = 2000
+texconfig.nest_size = 10000
+texconfig.param_size = 100000
+texconfig.save_size = 500000
+texconfig.stack_size = 100000
+texconfig.buffer_size = 10000000
+texconfig.token_size = 10000000
+texconfig.node_size = 20000000
+
+texconfig.max_print_line = 100000
+texconfig.max_strings = 500000
+texconfig.hash_extra = 200000
+
+texconfig.expand_depth = 10000
+texconfig.function_size = 32768
+texconfig.properties_size = 10000
+texconfig.error_line = 250
+texconfig.half_error_line = 125
-- registering bytecode chunks
@@ -276,3 +281,15 @@ end
callback.register('find_log_file', find_log_file)
callback.register('find_data_file' , find_data_file )
callback.register('open_data_file' , open_data_file )
+
+callback.register("trace_memory", function(what,success)
+ success = success and "succeeded" or "failed"
+ if logs then
+ logs.report("tex memory","bumping category %a %s, details: %s",
+ what,success,table.sequenced(status["get"..what.."state"]()))
+ elseif texio then
+ texio.write_nl(format("bumping tex %a memory %s",
+ what,success))
+ end
+ -- os.exit()
+end)
diff --git a/tex/context/base/mkiv/luat-cod.lua b/tex/context/base/mkiv/luat-cod.lua
index a2a261866..0b7521180 100644
--- a/tex/context/base/mkiv/luat-cod.lua
+++ b/tex/context/base/mkiv/luat-cod.lua
@@ -20,19 +20,19 @@ local texconfig, lua = texconfig, lua
texconfig.kpse_init = false
texconfig.shell_escape = 't'
-texconfig.error_line = 250 -- 79 -- frozen / large values can crash
-texconfig.expand_depth = 10000
-texconfig.half_error_line = 125 -- 50 -- frozen
-texconfig.max_in_open = 1000
-texconfig.max_print_line = 100000
-texconfig.max_strings = 500000
-texconfig.nest_size = 1000
-texconfig.param_size = 25000
-texconfig.save_size = 100000
-texconfig.stack_size = 10000
-texconfig.function_size = 32768
-texconfig.properties_size = 10000
-texconfig.fix_mem_init = 750000
+texconfig.error_line = 250
+texconfig.expand_depth = 10000
+texconfig.half_error_line = 125
+texconfig.max_in_open = 1000
+texconfig.max_print_line = 100000
+texconfig.max_strings = 500000
+texconfig.nest_size = 1000
+texconfig.param_size = 25000
+texconfig.save_size = 100000
+texconfig.stack_size = 10000
+texconfig.function_size = 32768
+texconfig.properties_size = 10000
+texconfig.fix_mem_init = 1000000
-- registering bytecode chunks
diff --git a/tex/context/base/mkiv/luat-fmt.lua b/tex/context/base/mkiv/luat-fmt.lua
index ab831fafc..815ff10db 100644
--- a/tex/context/base/mkiv/luat-fmt.lua
+++ b/tex/context/base/mkiv/luat-fmt.lua
@@ -64,7 +64,7 @@ end
-- The silent option is for Taco. It's a bit of a hack because we cannot yet mess
-- with directives. In fact, I could probably clean up the maker a bit by now.
-local template = [[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %dump% %redirect%]]
+local template = [[--ini %primaryflags% --lua=%luafile% %texfile% %secondaryflags% %redirect%]]
local checkers = {
primaryflags = "verbose", -- "flags"
@@ -72,7 +72,6 @@ local checkers = {
luafile = "readable", -- "cache"
texfile = "readable", -- "cache"
redirect = "string",
- dump = "string",
binarypath = "string",
}
@@ -193,7 +192,6 @@ function environment.make_format(formatname)
secondaryflags = secondaryflags,
luafile = quoted(fullluasourcename),
texfile = quoted(fulltexsourcename),
- dump = os.platform == "unix" and "\\\\dump" or "\\dump",
}
if silent then
specification.redirect = "> temp.log"
diff --git a/tex/context/base/mkiv/luat-lib.mkiv b/tex/context/base/mkiv/luat-lib.mkiv
index 4d3fd1823..ac60374d0 100644
--- a/tex/context/base/mkiv/luat-lib.mkiv
+++ b/tex/context/base/mkiv/luat-lib.mkiv
@@ -25,7 +25,7 @@
\registerctxluafile{trac-set}{}
\registerctxluafile{trac-log}{}
-\registerctxluafile{trac-inf}{}
+\registerctxluafile{trac-inf}{autosuffix}
\registerctxluafile{util-lua}{}
\registerctxluafile{util-deb}{} % could also be done in trac-deb.mkiv
diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua
index 305948edb..beec93088 100644
--- a/tex/context/base/mkiv/luat-run.lua
+++ b/tex/context/base/mkiv/luat-run.lua
@@ -62,7 +62,9 @@ local function stop_run()
if trace_tex_status then
logs.newline()
for k, v in table.sortedhash(status.list()) do
- report_tex("%S=%S",k,v)
+ if type(v) ~= "table" then
+ report_tex("%S=%S",k,v)
+ end
end
end
if quit then
@@ -125,10 +127,10 @@ appendgroup(wrapupactions,"user")
appendgroup(cleanupactions,"system")
appendgroup(cleanupactions,"user")
-local function wrapup_run()
+local function wrapup_run(someerror)
local runner = wrapupactions.runner
if runner then
- runner()
+ runner(someerror) -- we could use the error flag in lmtx
end
end
diff --git a/tex/context/base/mkiv/luat-sto.lua b/tex/context/base/mkiv/luat-sto.lua
index 620de9a15..17290848b 100644
--- a/tex/context/base/mkiv/luat-sto.lua
+++ b/tex/context/base/mkiv/luat-sto.lua
@@ -111,10 +111,11 @@ function lua.collectgarbage(threshold)
end
statistics.register("stored bytecode data", function()
- local nofmodules = (storage.nofmodules > 0 and storage.nofmodules) or (status.luabytecodes - lua.firstbytecode - 1)
- local nofdumps = (storage.noftables > 0 and storage.noftables ) or storage.max-storage.min + 1
- local tofmodules = storage.tofmodules or 0
- local tofdumps = storage.toftables or 0
+ local nofbytecodes = CONTEXTLMTXMODE > 0 and status.luastate.bytecodes or status.lua_bytecodes
+ local nofmodules = (storage.nofmodules > 0 and storage.nofmodules) or (nofbytecodes - lua.firstbytecode - 1)
+ local nofdumps = (storage.noftables > 0 and storage.noftables ) or storage.max-storage.min + 1
+ local tofmodules = storage.tofmodules or 0
+ local tofdumps = storage.toftables or 0
if environment.initex then
local luautilities = utilities.lua
return format("%s modules, %s tables, %s chunks, %s chunks stripped (%s bytes)",
diff --git a/tex/context/base/mkiv/mlib-ctx.lua b/tex/context/base/mkiv/mlib-ctx.lua
index 0240c6a80..4e3d05654 100644
--- a/tex/context/base/mkiv/mlib-ctx.lua
+++ b/tex/context/base/mkiv/mlib-ctx.lua
@@ -335,12 +335,13 @@ statistics.register("metapost", function()
if n and n > 0 then
local elapsedtime = statistics.elapsedtime
local elapsed = statistics.elapsed
+ local runs, stats = metapost.nofscriptruns()
local instances,
memory = metapost.getstatistics(true)
- return format("%s seconds, loading: %s, execution: %s, n: %s, average: %s, instances: %i, luacalls: %i, memory: %0.3f M",
+ return format("%s seconds, loading: %s, execution: %s, n: %s, average: %s, instances: %i, luacalls: %s, memory: %0.3f M",
elapsedtime(metapost), elapsedtime(mplib), elapsedtime(metapost.exectime), n,
elapsedtime((elapsed(metapost) + elapsed(mplib) + elapsed(metapost.exectime)) / n),
- instances, metapost.nofscriptruns(),memory/(1024*1024))
+ instances, stats and stats or runs, memory/(1024*1024))
else
return nil
end
diff --git a/tex/context/base/mkiv/mlib-mpf.lua b/tex/context/base/mkiv/mlib-mpf.lua
index 83a585850..1e381b7c8 100644
--- a/tex/context/base/mkiv/mlib-mpf.lua
+++ b/tex/context/base/mkiv/mlib-mpf.lua
@@ -256,8 +256,22 @@ do
return result
end
- function metapost.nofscriptruns()
- return runs
+ if CONTEXTLMTXMODE > 0 then
+
+ function metapost.nofscriptruns()
+ local c = mplib.getcallbackstate()
+ return c.count, string.format(
+ "%s (file: %s, text: %s, script: %s, log: %s)",
+ c.count, c.file, c.text, c.script, c.log
+ )
+ end
+
+ else
+
+ function metapost.nofscriptruns()
+ return runs
+ end
+
end
-- writers
diff --git a/tex/context/base/mkiv/mtx-context-timing.tex b/tex/context/base/mkiv/mtx-context-timing.tex
index c545c768f..db0d4c283 100644
--- a/tex/context/base/mkiv/mtx-context-timing.tex
+++ b/tex/context/base/mkiv/mtx-context-timing.tex
@@ -19,14 +19,27 @@
\enablemode[no-timing] \usemodule[timing]
+\usemodule[article-basic]
+
\setuplayout
- [topspace=1cm,
- bottomspace=.5cm,
- header=0pt,
- width=middle,
- height=middle,
+ [tight]
+ [footer=15pt,
style=\tt]
+\setuplayout
+ [tight]
+
+\setupbodyfont
+ [10pt]
+
+% \setuplayout
+% [topspace=1cm,
+% bottomspace=.5cm,
+% header=0pt,
+% width=middle,
+% height=middle,
+% style=\tt]
+
\setupfootertexts
[\getdocumentfilename{1}-luatex-progress.lut \emdash\ \pagenumber]
diff --git a/tex/context/base/mkiv/node-gcm.lmt b/tex/context/base/mkiv/node-gcm.lmt
index 2b5b24369..8b09fb82b 100644
--- a/tex/context/base/mkiv/node-gcm.lmt
+++ b/tex/context/base/mkiv/node-gcm.lmt
@@ -15,6 +15,7 @@ local nuts = nodes.nuts
local getnext = nuts.getnext
local getsubtype = nuts.getsubtype
local copy_node = nuts.copy
+local flush_list = nuts.flush_list
local count = nuts.count
local isglyph = nuts.isglyph
local getprop = nuts.getprop
@@ -27,6 +28,7 @@ local report_error = logs.reporter("node-aux:error")
local function set_components(base,list)
local t = { }
local n = 0
+ local l = list
while list do
local char = isglyph(list)
if char then
@@ -35,6 +37,9 @@ local function set_components(base,list)
end
list = getnext(list)
end
+ -- was forgotten:
+ flush_list(l)
+ --
setprop(base,"components",n > 0 and t or false)
end
diff --git a/tex/context/base/mkiv/node-ini.mkiv b/tex/context/base/mkiv/node-ini.mkiv
index 231a8524e..2ecef4a54 100644
--- a/tex/context/base/mkiv/node-ini.mkiv
+++ b/tex/context/base/mkiv/node-ini.mkiv
@@ -30,7 +30,7 @@
\registerctxluafile{node-gcm}{autosuffix}
\registerctxluafile{node-tst}{}
\registerctxluafile{node-tra}{} % we might split it off (module)
-\registerctxluafile{node-snp}{}
+\registerctxluafile{node-snp}{autosuffix}
\registerctxluafile{node-tsk}{}
\registerctxluafile{node-tex}{}
\registerctxluafile{node-dir}{} % experimental, not yet (and maybe never) used
diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua
index 709ef2b95..87a19de34 100644
--- a/tex/context/base/mkiv/node-ltp.lua
+++ b/tex/context/base/mkiv/node-ltp.lua
@@ -2878,7 +2878,7 @@ do
local function common_message(hlist,line,str)
write_nl("")
- if status.output_active then -- unset
+ if CONTEXTLMTXMODE > 0 and tex.getoutputactive() or status.output_active then
write(str," has occurred while \\output is active")
else
write(str)
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index 5eed1b2b1..80335e933 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -296,6 +296,7 @@ nuts.getdepth = direct.getdepth
nuts.setdepth = direct.setdepth
nuts.getshift = direct.getshift
nuts.setshift = direct.setshift
+nuts.gettotal = direct.gettotal
-- lmtx compatibility
@@ -468,6 +469,17 @@ if not nuts.getpre then
end
+if not nuts.gettotal then
+
+ local d_getheight = direct.getheight
+ local d_getdepth = direct.getdepth
+
+ function nuts.gettotal(n)
+ return (d_getheight(n) or 0) + (d_getdepth(n) or 0)
+ end
+
+end
+
-- alias
nuts.getsurround = nuts.getkern
diff --git a/tex/context/base/mkiv/node-snp.lmt b/tex/context/base/mkiv/node-snp.lmt
new file mode 100644
index 000000000..a8d467956
--- /dev/null
+++ b/tex/context/base/mkiv/node-snp.lmt
@@ -0,0 +1,61 @@
+if not modules then modules = { } end modules ['node-snp'] = {
+ version = 1.001,
+ comment = "companion to node-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+if not nodes then
+ nodes = { } -- also loaded in mtx-timing
+end
+
+local snapshots = { }
+nodes.snapshots = snapshots
+
+local status = status
+
+local nodeusage = nodes.pool and nodes.pool.usage
+local clock = os.gettimeofday or os.clock -- should go in environment
+local lasttime = clock()
+local samples = { }
+
+function snapshots.takesample(comment)
+ if nodeusage then
+ local c = clock()
+ samples[#samples+1] = {
+ nodes = nodeusage(),
+ texcallbacks = status.getcallbackstate(),
+ mpcallbacks = mplib.getcallbackstate(),
+ backendcallbacks = backends.getcallbackstate(),
+ luavariables = status.getluastate(),
+ texvariables = status.gettexstate(),
+ comment = comment,
+ variables = {
+ lasttime = c,
+ elapsed = c - lasttime,
+ },
+ memories = {
+ pool = status.getpoolstate(),
+ hash = status.gethashstate(),
+ node = status.getnodestate(),
+ token = status.gettokenstate(),
+ buffer = status.getbufferstate(),
+ input = status.getinputstate(),
+ file = status.getfilestate(),
+ nest = status.getneststate(),
+ parameter = status.getparameterstate(),
+ save = status.getsavestate(),
+ expand = status.getexpandstate(),
+ },
+ }
+ end
+end
+
+function snapshots.getsamples()
+ return samples -- one return value !
+end
+
+function snapshots.resetsamples()
+ samples = { }
+end
diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua
index c7556aba6..d56e2adef 100644
--- a/tex/context/base/mkiv/node-tra.lua
+++ b/tex/context/base/mkiv/node-tra.lua
@@ -193,8 +193,18 @@ end
nodes.tosequence = tosequence
nuts .tosequence = tosequence
-function nodes.report(t)
- report_nodes("output %a, %s nodes",status.output_active,count_nodes(t))
+if CONTEXTLMTXMODE > 0 then
+
+ function nodes.report(t)
+ report_nodes("output %a, %s nodes",tex.getoutputactive(),count_nodes(t))
+ end
+
+else
+
+ function nodes.report(t)
+ report_nodes("output %a, %s nodes",status.output_active,count_nodes(t))
+ end
+
end
function nodes.packlist(head)
diff --git a/tex/context/base/mkiv/page-run.lua b/tex/context/base/mkiv/page-run.lua
index cb8cf0311..7ad9c8d9f 100644
--- a/tex/context/base/mkiv/page-run.lua
+++ b/tex/context/base/mkiv/page-run.lua
@@ -186,38 +186,4 @@ function commands.showlayout(options)
end
-local report = logs.reporter("usage")
-
-function commands.showusage()
- report("")
- report("status after shipping out page %s",tex.getcount("realpageno"))
- report("")
- report(" filename : %s", status.filename)
- report(" inputid : %s", status.inputid)
- report(" linenumber : %s", status.linenumber)
- report(" input pointer : %s", status.input_ptr)
- report("")
- report(" string pointer : %s of %s", status.str_ptr, status.max_strings + status.init_str_ptr)
- report(" pool size : %s", status.pool_size)
- report("")
- report(" node memory usage : %s of %s", status.var_used, status.var_mem_max)
- report(" token memory usage : %s of %s", status.dyn_used, status.fix_mem_max)
- report("")
- report(" cs count : %s of %s", status.cs_count, status.hash_size + status.hash_extra)
- report("")
- report(" stack size : %s of %s", status.max_in_stack, status.stack_size)
- report(" nest size : %s of %s", status.max_nest_stack, status.nest_size)
- report(" parameter size : %s of %s", status.max_param_stack, status.param_size)
- report(" buffer size : %s of %s", status.max_buf_stack, status.buf_size)
- report(" save size : %s of %s", status.max_save_stack, status.save_size)
- report("")
- report(" luabytecode bytes : %s in %s registers", status.luabytecode_bytes, status.luabytecodes)
- report(" luastate bytes : %s of %s", status.luastate_bytes, status.luastate_bytes_max or "unknown")
- report("")
- report(" callbacks : %s", status.callbacks)
- report(" indirect callbacks : %s", status.indirect_callbacks)
- report(" saved callbacks : %s", status.saved_callbacks)
- report(" direct callbacks : %s", status.direct_callbacks)
- report(" function callbacks : %s", status.function_callbacks)
- report("")
-end
+commands.showusage = statistics.showusage
diff --git a/tex/context/base/mkiv/page-run.mkiv b/tex/context/base/mkiv/page-run.mkiv
index d3efe1698..fc46d8236 100644
--- a/tex/context/base/mkiv/page-run.mkiv
+++ b/tex/context/base/mkiv/page-run.mkiv
@@ -215,10 +215,4 @@
\global\setbox#1\vpack{\noindent\backgroundline[layout:mix]{\box#1}}%
\endgroup}
-%D The next command shows some statistics (we might add more in due time):
-
-\unexpanded\gdef\showusage
- {\gtoksapp\everyaftershipout{\ctxcommand{showusage()}}%
- \glet\showusage\relax}
-
\protect \endinput
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 66d6cd7cf..415ffb8fe 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 6001d8d6a..250ff88ff 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-itm.mklx b/tex/context/base/mkiv/strc-itm.mklx
index 8ce31c1a8..609bfac29 100644
--- a/tex/context/base/mkiv/strc-itm.mklx
+++ b/tex/context/base/mkiv/strc-itm.mklx
@@ -1561,7 +1561,7 @@
\m_strc_itemgroups_text_distance
{.5\interwordspace\s!plus.5\emwidth}%
{\interwordspace \s!plus \emwidth}%
- {\emwidth \s!plus \interwordstretch\!!minus\interwordshrink}}
+ {\emwidth \s!plus \interwordstretch\s!minus\interwordshrink}}
% \unexpanded\def\strc_itemgroups_default_command
% {\EveryPar{\ignorespaces}% needed ?
diff --git a/tex/context/base/mkiv/strc-itm.mkvi b/tex/context/base/mkiv/strc-itm.mkvi
index ca47b73f7..ce1bcc6f5 100644
--- a/tex/context/base/mkiv/strc-itm.mkvi
+++ b/tex/context/base/mkiv/strc-itm.mkvi
@@ -1560,7 +1560,7 @@
\m_strc_itemgroups_text_distance
{.5\interwordspace\s!plus.5\emwidth}%
{\interwordspace \s!plus \emwidth}%
- {\emwidth \s!plus \interwordstretch\!!minus\interwordshrink}}
+ {\emwidth \s!plus \interwordstretch\s!minus\interwordshrink}}
% \unexpanded\def\strc_itemgroups_default_command
% {\EveryPar{\ignorespaces}% needed ?
diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl
index c8c16b773..9b516f3c5 100644
--- a/tex/context/base/mkiv/syst-ini.mkxl
+++ b/tex/context/base/mkiv/syst-ini.mkxl
@@ -203,19 +203,23 @@
% 255 : page
% 256 - : user
+% use \chardef instead for min and max
+%
+% will be blocked: \newfamily \newlanguage
+
\countdef \c_syst_min_allocated_register = 52 \c_syst_min_allocated_register = 256 % can change
-\countdef \c_syst_max_allocated_register = 53 \c_syst_max_allocated_register = 32767
-\countdef \c_syst_min_allocated_read = 54 \c_syst_min_allocated_read = -1
-\countdef \c_syst_max_allocated_read = 55 \c_syst_max_allocated_read = 16
+\countdef \c_syst_max_allocated_register = 53 \c_syst_max_allocated_register = 65535
+\countdef \c_syst_min_allocated_read = 54 \c_syst_min_allocated_read = 0
+\countdef \c_syst_max_allocated_read = 55 \c_syst_max_allocated_read = 1023
\countdef \c_syst_min_allocated_language = 56 \c_syst_min_allocated_language = 0
-\countdef \c_syst_max_allocated_language = 57 \c_syst_max_allocated_language = 255
+\countdef \c_syst_max_allocated_language = 57 \c_syst_max_allocated_language = 8191
\countdef \c_syst_min_allocated_insert = 58 \c_syst_min_allocated_insert = 128
\countdef \c_syst_max_allocated_insert = 59 \c_syst_max_allocated_insert = 254
\countdef \c_syst_min_allocated_family = 60 \c_syst_min_allocated_family = 128
\countdef \c_syst_max_allocated_family = 61 \c_syst_max_allocated_family = 255
\countdef \c_syst_min_allocated_attribute = 62 \c_syst_min_allocated_attribute = 1024 % 0-1023 : private
\countdef \c_syst_min_allocated_write = 63 \c_syst_min_allocated_write = 0
-\countdef \c_syst_max_allocated_write = 64 \c_syst_max_allocated_write = 127
+\countdef \c_syst_max_allocated_write = 64 \c_syst_max_allocated_write = 1023
\countdef \c_syst_last_allocated_count = 32 \c_syst_last_allocated_count = \c_syst_min_allocated_register
\countdef \c_syst_last_allocated_dimen = 33 \c_syst_last_allocated_dimen = \c_syst_min_allocated_register
@@ -1049,8 +1053,8 @@
%D For a while we will keep these useless numbers as for instance tikz checks for them:
-\chardef\eTeXversion 2
-\def \eTeXrevision {2}
+\frozen\chardef\eTeXversion 2
+\frozen\def \eTeXrevision {2}
%D Experiment:
diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua
index 834bc773d..3696364b9 100644
--- a/tex/context/base/mkiv/toks-ini.lua
+++ b/tex/context/base/mkiv/toks-ini.lua
@@ -158,6 +158,7 @@ if not scan_box then
if s == "hbox" or s == "vbox" or s == "vtop" then
put_next(create_token(s))
end
+ return scan_list()
end
token.scan_box = scan_box
diff --git a/tex/context/base/mkiv/toks-scn.lua b/tex/context/base/mkiv/toks-scn.lua
index abf39a319..ec5681cd7 100644
--- a/tex/context/base/mkiv/toks-scn.lua
+++ b/tex/context/base/mkiv/toks-scn.lua
@@ -184,7 +184,8 @@ local function scanbracketed()
if s then
return s
else
- report_scan("missing argument in line %i of %a", status.linenumber, status.filename)
+ local readstate = status.getreadstate()
+ report_scan("missing argument in line %i of %a", readstate.linenumber, readstate.filename)
return ""
end
end
diff --git a/tex/context/base/mkiv/trac-deb.lmt b/tex/context/base/mkiv/trac-deb.lmt
new file mode 100644
index 000000000..42f6d183c
--- /dev/null
+++ b/tex/context/base/mkiv/trac-deb.lmt
@@ -0,0 +1,519 @@
+if not modules then modules = { } end modules ['trac-deb'] = {
+ version = 1.001,
+ comment = "companion to trac-deb.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This is an old mechanism, a result of some experiments in the early days of
+-- luatex and mkiv, but still nice anyway. I will clean it up in lmtx.
+
+local status = status
+
+local tonumber, tostring, type = tonumber, tostring, type
+local format, concat, match, find, gsub = string.format, table.concat, string.match, string.find, string.gsub
+local lpegmatch = lpeg.match
+
+-- maybe tracers -> tracers.tex (and tracers.lua for current debugger)
+
+----- report_tex = logs.reporter("tex error")
+----- report_lua = logs.reporter("lua error")
+local report_nl = logs.newline
+local report_str = logs.writer
+
+tracers = tracers or { }
+local tracers = tracers
+
+-- this is old tracing stuff ... will go to its own module
+
+tracers.lists = { }
+local lists = tracers.lists
+
+tracers.strings = { }
+local strings = tracers.strings
+
+local texgetdimen = tex.getdimen
+local texgettoks = tex.gettoks
+local texgetcount = tex.getcount
+local texgethelp = tex.gethelptext or function() end
+local fatalerror = tex.fatalerror
+
+local implement = interfaces.implement
+
+-- this is used in lmx files but needs to be redone
+
+strings.undefined = "undefined"
+
+function tracers.dimen(name)
+ local d = texgetdimen(name)
+ return d and number.topoints(d) or strings.undefined
+end
+
+function tracers.count(name)
+ return texgetcount(name) or strings.undefined
+end
+
+function tracers.toks(name,limit)
+ local t = texgettoks(name)
+ return t and string.limit(t,tonumber(limit) or 40) or strings.undefined
+end
+
+function tracers.primitive(name)
+ return tex[name] or strings.undefined
+end
+
+lists.scratch = {
+ 0, 2, 4, 6, 8
+}
+
+lists.internals = {
+ 'p:hsize', 'p:parindent', 'p:leftskip','p:rightskip',
+ 'p:vsize', 'p:parskip', 'p:baselineskip', 'p:lineskip', 'p:topskip'
+}
+
+lists.context = {
+ 'd:lineheight',
+ 'c:realpageno', 'c:userpageno', 'c:pageno', 'c:subpageno'
+}
+
+local types = {
+ ['d'] = tracers.dimen,
+ ['c'] = tracers.count,
+ ['t'] = tracers.toks,
+ ['p'] = tracers.primitive
+}
+
+local splitboth = lpeg.splitat(":")
+
+function tracers.type(csname)
+ local tag, name = lpegmatch(splitboth,csname)
+ return tag or ""
+end
+
+function tracers.name(csname)
+ local tag, name = lpegmatch(splitboth,csname)
+ return name or csname
+end
+
+function tracers.cs(csname)
+ local tag, name = lpegmatch(splitboth,csname)
+ if name and types[tag] then
+ return types[tag](name)
+ else
+ return tracers.primitive(csname)
+ end
+end
+
+function tracers.knownlist(name)
+ local l = lists[name]
+ return l and #l > 0
+end
+
+-- till here
+
+do
+
+ local ioflush = io.flush
+ local ioread = io.read
+ local writenl = texio.write_nl
+ local write = texio.write
+
+ local runtoks = tex.runtoks
+ local terminaldata = false
+ local context = context
+
+ interfaces.implement {
+ name = "fetchterminaldata",
+ actions = function()
+ context(terminaldata)
+ end,
+ }
+
+ function texio.terminal()
+ writenl("\n" .. "entering interactive mode, use \\quit to abort reading" .."\n\n")
+ while true do
+ write(">")
+ ioflush()
+ terminaldata = ioread()
+ if terminaldata == "\\quit" then
+ terminaldata = false
+ break
+ else
+ runtoks("t_syst_terminal_data",nil,nil,true) -- obeymode
+ end
+ end
+ end
+
+ interfaces.implement {
+ name = "readfromterminal",
+ public = true,
+ protected = true,
+ actions = texio.terminal,
+ }
+
+end
+
+local savedluaerror = nil
+local usescitelexer = nil
+local quitonerror = true
+
+local function errorreporter(luaerror)
+ local category = luaerror and "lua error" or "tex error"
+ local report = logs.reporter(category)
+ logs.enable(category)
+ return report
+end
+
+function tracers.showlines(filename,linenumber,offset,luaerrorline)
+ local data = io.loaddata(filename)
+ if not data or data == "" then
+ local hash = url.hashed(filename)
+ if not hash.noscheme then
+ local ok, d, n = resolvers.loaders.byscheme(hash.scheme,filename)
+ if ok and n > 0 then
+ data = d
+ end
+ end
+ end
+ local scite = usescitelexer and require("util-sci")
+ if scite then
+ return utilities.scite.tohtml(data,"tex",linenumber or true,false)
+ else
+ local lines = data and string.splitlines(data)
+ if lines and #lines > 0 then
+ if luaerrorline and luaerrorline > 0 then
+ -- lua error: linenumber points to last line
+ local start = "\\startluacode"
+ local stop = "\\stopluacode"
+ local n = linenumber
+ for i=n,1,-1 do
+ local line = lines[i]
+ if not line then
+ break
+ elseif find(line,start) then
+ n = i + luaerrorline - 1
+ if n <= linenumber then
+ linenumber = n
+ end
+ break
+ end
+ end
+ end
+ offset = tonumber(offset) or 10
+ linenumber = tonumber(linenumber) or 10
+ local start = math.max(linenumber - offset,1)
+ local stop = math.min(linenumber + offset,#lines)
+ if stop > #lines then
+ return "<linenumber past end of file>"
+ else
+ local result, fmt = { }, "%" .. #tostring(stop) .. "d %s %s"
+ for n=start,stop do
+ result[#result+1] = format(fmt,n,n == linenumber and ">>" or " ",lines[n])
+ end
+ return concat(result,"\n")
+ end
+ else
+ return "<empty file>"
+ end
+ end
+end
+
+-- todo: last tex error has ! prepended
+-- todo: some nested errors have two line numbers
+-- todo: collect errorcontext in string (after code cleanup)
+-- todo: have a separate status.lualinenumber
+-- todo: \starttext bla \blank[foo] bla \stoptext
+
+local nop = function() end
+local resetmessages = status.resetmessages or nop
+
+local function processerror(offset,errortype)
+ local readstate = status.readstate
+ local filename = readstate.filename
+ local linenumber = readstate.linenumber
+ local skiplinenumber = readstate.skiplinenumber
+ local errorstate = status.errorstate
+ local lastcontext = errorstate.errorcontext
+ local lasttexerror = errorstate.error or "?"
+ local lastluaerror = errorstate.luaerror or "?" -- lasttexerror
+ local luaerrorline = match(lastluaerror,[[lua%]?:.-(%d+)]]) or (lastluaerror and find(lastluaerror,"?:0:",1,true) and 0)
+ local lastmpserror = match(lasttexerror,[[^.-mp%serror:%s*(.*)$]])
+ resetmessages()
+ lastluaerror = gsub(lastluaerror,"%[\\directlua%]","[ctxlua]")
+ tracers.printerror {
+ filename = filename,
+ linenumber = linenumber,
+ skiplinenumber = skiplinenumber,
+ offset = tonumber(offset) or 10,
+ lasttexerror = lasttexerror,
+ lastmpserror = lastmpserror,
+ lastluaerror = lastluaerror, -- can be the same as lasttexerror
+ luaerrorline = luaerrorline,
+ lastcontext = lastcontext,
+ lasttexhelp = tex.gethelptext and tex.gethelptext() or nil,
+ errortype = errortype,
+ }
+ if job and type(job.disablesave) == "function" then
+ job.disablesave()
+ end
+end
+
+directives.register("system.quitonerror",function(v)
+ quitonerror = toboolean(v)
+end)
+
+directives.register("system.usescitelexer",function(v)
+ usescitelexer = toboolean(v)
+end)
+
+local busy = false
+
+function tracers.printerror(specification)
+ if not busy then
+ busy = true
+ local errorvalues = table.swapped(tex.geterrorvalues())
+ local filename = specification.filename
+ local linenumber = specification.linenumber
+ local lasttexerror = specification.lasttexerror
+ local lastmpserror = specification.lastmpserror
+ local lastluaerror = specification.lastluaerror
+ local lastcontext = specification.lastcontext
+ local luaerrorline = specification.luaerrorline
+ local errortype = specification.errortype
+ local offset = specification.offset
+ local endoffile = specification.endoffile
+ local report = errorreporter(luaerrorline)
+ if errortype == errorvalues.eof then
+ report("runaway error: %s",lasttexerror or "-")
+ if not quitonerror and texio.terminal then
+ texio.terminal() -- not well tested
+ end
+ elseif errortype == errorvalues.condition then
+ linenumber = specification.skiplinenumber
+ if linenumber > 0 then
+ report("condition error on line %s in file %s: %s",linenumber,filename,lasttexerror)
+ report_nl()
+ report_str(tracers.showlines(filename,linenumber,offset,tonumber(luaerrorline)))
+ report_nl()
+ else
+ report("runaway condition error: %s",lasttexerror or "-")
+ end
+ quitonerror = true
+ elseif not filename then
+ report("fuzzy error:")
+ report(" tex: %s",lasttexerror or "-")
+ report(" lua: %s",lastluaerror or "-")
+ report(" mps: %s",lastmpserror or "-")
+ elseif type(filename) == "number" then
+ report("error on line %s of filehandle %s: %s ...",linenumber,lasttexerror)
+ else
+ report_nl()
+ if luaerrorline then
+ if linenumber == 0 or not filename or filename == "" then
+ print("\nfatal lua error:\n\n",lastluaerror,"\n")
+ luatex.abort()
+ return
+ else
+ report("lua error on line %s in file %s:\n\n%s",linenumber,filename,lastluaerror)
+ end
+ elseif lastmpserror then
+ report("mp error on line %s in file %s:\n\n%s",linenumber,filename,lastmpserror)
+ else
+ report("tex error on line %s in file %s: %s",linenumber,filename,lasttexerror)
+ if lastcontext then
+ report_nl()
+ report_str(lastcontext)
+ report_nl()
+ else
+ report_nl()
+ -- tex.show_context()
+ end
+ if lastluaerror and not match(lastluaerror,"^%s*[%?]*%s*$") then
+ print("\nlua error:\n\n",lastluaerror,"\n")
+ quitonerror = true
+ end
+ end
+ report_nl()
+ report_str(tracers.showlines(filename,linenumber,offset,tonumber(luaerrorline)))
+ report_nl()
+ end
+ local errname = file.addsuffix(tex.jobname .. "-error","log")
+ if quitonerror then
+ table.save(errname,specification)
+ local help = specification.lasttexhelp
+ if help and #help > 0 then
+ report_nl()
+ report_str(help)
+ report_nl()
+ report_nl()
+ end
+ luatex.abort()
+ end
+ busy = false
+ end
+end
+
+luatex.wrapup(function() os.remove(file.addsuffix(tex.jobname .. "-error","log")) end)
+
+local function processwarning(offset)
+ local warningstate = status.warningstate
+ local lastwarning = warningstate.warning or "?"
+ local lastlocation = warningstate.warningtag or "?"
+ resetmessages()
+ tracers.printwarning {
+ lastwarning = lastwarning,
+ lastlocation = lastlocation,
+ }
+end
+
+function tracers.printwarning(specification)
+ logs.report("luatex warning","%s: %s",specification.lastlocation,specification.lastwarning)
+end
+
+directives.register("system.errorcontext", function(v)
+ local register = callback.register
+ if v then
+ register('show_error_message', nop)
+ register('show_warning_message', function() processwarning(v) end)
+ register('intercept_lua_error', function() processerror(v) end)
+ register('intercept_tex_error', function(mode,eof) processerror(v,eof) end)
+ else
+ register('show_error_message', nil)
+ register('show_warning_message', nil)
+ register('intercept_lua_error', nil)
+ register('intercept_tex_error', nil)
+ end
+end)
+
+-- this might move
+
+lmx = lmx or { }
+
+lmx.htmfile = function(name) return environment.jobname .. "-status.html" end
+lmx.lmxfile = function(name) return resolvers.findfile(name,'tex') end
+
+local function reportback(lmxname,default,variables)
+ if lmxname == false then
+ return variables
+ else
+ local name = lmx.show(type(lmxname) == "string" and lmxname or default,variables)
+ if name then
+ logs.report("context report","file: %s",name)
+ end
+ end
+end
+
+function lmx.showdebuginfo(lmxname)
+ local variables = {
+ ['title'] = 'ConTeXt Debug Information',
+ ['color-background-one'] = lmx.get('color-background-green'),
+ ['color-background-two'] = lmx.get('color-background-blue'),
+ }
+ reportback(lmxname,"context-debug.lmx",variables)
+end
+
+local function showerror(lmxname)
+ local readstate = status.readstate()
+ local filename = readstate.filename
+ local linenumber = tonumber(readstate.linenumber) or 0
+ local errorcontext = ""
+ if not filename then
+ filename = status.iocodes and status.iocodes[readstate.iocode] or 'unknown'
+ errorcontext = 'error in filename'
+ else
+ errorcontext = tracers.showlines(filename,linenumber,offset)
+ end
+ local variables = {
+ ['title'] = 'ConTeXt Error Information',
+ ['errormessage'] = status.errorstatus.error or "?",
+ ['linenumber'] = linenumber,
+ ['color-background-one'] = lmx.get('color-background-yellow'),
+ ['color-background-two'] = lmx.get('color-background-purple'),
+ ['filename'] = filename,
+ ['errorcontext'] = errorcontext,
+ }
+ reportback(lmxname,"context-error.lmx",variables)
+ luatex.abort()
+end
+
+lmx.showerror = showerror
+
+function lmx.overloaderror(v)
+ if v == "scite" then
+ usescitelexer = true
+ end
+ callback.register('show_error_message', function() showerror() end)
+ callback.register('intercept_lua_error', function() showerror() end)
+ callback.register('intercept_tex_error', function() showerror() end)
+end
+
+directives.register("system.showerror", lmx.overloaderror)
+
+-- local debugger = utilities.debugger
+--
+-- local function trace_calls(n)
+-- debugger.enable()
+-- luatex.registerstopactions(function()
+-- debugger.disable()
+-- debugger.savestats(tex.jobname .. "-luacalls.log",tonumber(n))
+-- end)
+-- trace_calls = function() end
+-- end
+--
+-- directives.register("system.tracecalls", function(n)
+-- trace_calls(n)
+-- end) -- indirect is needed for nilling
+
+-- Obsolete ... not that usefull as normally one runs from an editor and
+-- when run unattended it makes no sense either.
+
+-- local editor = [[scite "-open:%filename%" -goto:%linenumber%]]
+--
+-- directives.register("system.editor",function(v)
+-- editor = v
+-- end)
+--
+-- callback.register("call_edit",function(filename,linenumber)
+-- if editor then
+-- editor = gsub(editor,"%%s",filename)
+-- editor = gsub(editor,"%%d",linenumber)
+-- editor = gsub(editor,"%%filename%%",filename)
+-- editor = gsub(editor,"%%linenumber%%",linenumber)
+-- logs.report("system","starting editor: %s",editor)
+-- os.execute(editor)
+-- end
+-- end)
+
+local implement = interfaces.implement
+
+implement { name = "showtrackers", actions = trackers.show }
+implement { name = "enabletrackers", actions = trackers.enable, arguments = "string" }
+implement { name = "disabletrackers", actions = trackers.disable, arguments = "string" }
+implement { name = "resettrackers", actions = trackers.reset }
+
+implement { name = "showdirectives", actions = directives.show }
+implement { name = "enabledirectives", actions = directives.enable, arguments = "string" }
+implement { name = "disabledirectives", actions = directives.disable, arguments = "string" }
+
+implement { name = "showexperiments", actions = experiments.show }
+implement { name = "enableexperiments", actions = experiments.enable, arguments = "string" }
+implement { name = "disableexperiments", actions = experiments.disable, arguments = "string" }
+
+implement { name = "showdebuginfo", actions = lmx.showdebuginfo }
+implement { name = "overloaderror", actions = lmx.overloaderror }
+implement { name = "showlogcategories", actions = logs.show }
+
+local debugger = utilities.debugger
+
+directives.register("system.profile",function(n)
+ luatex.registerstopactions(function()
+ debugger.disable()
+ debugger.savestats("luatex-profile.log",tonumber(n) or 0)
+ report_nl()
+ logs.report("system","profiler stopped, log saved in %a","luatex-profile.log")
+ report_nl()
+ end)
+ logs.report("system","profiler started")
+ debugger.enable()
+end)
diff --git a/tex/context/base/mkiv/trac-deb.lua b/tex/context/base/mkiv/trac-deb.lua
index cdf40fd59..4667b66ee 100644
--- a/tex/context/base/mkiv/trac-deb.lua
+++ b/tex/context/base/mkiv/trac-deb.lua
@@ -114,48 +114,6 @@ end
-- for now here
-if CONTEXTLMTXMODE > 0 then
-
- local ioflush = io.flush
- local ioread = io.read
- local writenl = texio.write_nl
- local write = texio.write
-
- local runtoks = tex.runtoks
- local terminaldata = false
- local context = context
-
- interfaces.implement {
- name = "fetchterminaldata",
- actions = function()
- context(terminaldata)
- end,
- }
-
- function texio.terminal()
- writenl("\n" .. "entering interactive mode, use \\quit to abort reading" .."\n\n")
- while true do
- write(">")
- ioflush()
- terminaldata = ioread()
- if terminaldata == "\\quit" then
- terminaldata = false
- break
- else
- runtoks("t_syst_terminal_data",nil,nil,true) -- obeymode
- end
- end
- end
-
- interfaces.implement {
- name = "readfromterminal",
- public = true,
- protected = true,
- actions = texio.terminal,
- }
-
-end
-
local savedluaerror = nil
local usescitelexer = nil
local quitonerror = true
@@ -227,18 +185,12 @@ end
-- todo: some nested errors have two line numbers
-- todo: collect errorcontext in string (after code cleanup)
-- todo: have a separate status.lualinenumber
-
-- todo: \starttext bla \blank[foo] bla \stoptext
local nop = function() end
local resetmessages = status.resetmessages or nop
local function processerror(offset,eof)
- -- print("[[ last tex error: " .. tostring(status.lasterrorstring or "<unset>") .. " ]]")
- -- print("[[ last lua error: " .. tostring(status.lastluaerrorstring or "<unset>") .. " ]]")
- -- print("[[ last warning : " .. tostring(status.lastwarningstring or "<unset>") .. " ]]")
- -- print("[[ last location : " .. tostring(status.lastwarninglocation or "<unset>") .. " ]]")
- -- print("[[ last context : " .. tostring(status.lasterrorcontext or "<unset>") .. " ]]")
local filename = status.filename
local linenumber = tonumber(status.linenumber) or 0
local lastcontext = status.lasterrorcontext
@@ -260,6 +212,9 @@ local function processerror(offset,eof)
lasttexhelp = tex.gethelptext and tex.gethelptext() or nil,
endoffile = eof,
}
+ if job and type(job.disablesave) == "function" then
+ job.disablesave()
+ end
end
directives.register("system.quitonerror",function(v)
@@ -361,41 +316,20 @@ function tracers.printwarning(specification)
logs.report("luatex warning","%s: %s",specification.lastlocation,specification.lastwarning)
end
-if CONTEXTLMTXMODE > 0 then
-
- directives.register("system.errorcontext", function(v)
- local register = callback.register
- if v then
- register('show_error_message', nop)
- register('show_warning_message', function() processwarning(v) end)
- register('intercept_lua_error', function() processerror(v) end)
- register('intercept_tex_error', function(mode,eof) processerror(v,eof) end)
- else
- register('show_error_message', nil)
- register('show_warning_message', nil)
- register('intercept_lua_error', nil)
- register('intercept_tex_error', nil)
- end
- end)
-
-else
-
- directives.register("system.errorcontext", function(v)
- local register = callback.register
- if v then
- register('show_error_message', nop)
- register('show_warning_message',function() processwarning(v) end)
- register('show_error_hook', function(eof) processerror(v,eof) end)
- register('show_lua_error_hook', function() processerror(v) end)
- else
- register('show_error_message', nil)
- register('show_error_hook', nil)
- register('show_warning_message',nil)
- register('show_lua_error_hook', nil)
- end
- end)
-
-end
+directives.register("system.errorcontext", function(v)
+ local register = callback.register
+ if v then
+ register('show_error_message', nop)
+ register('show_warning_message',function() processwarning(v) end)
+ register('show_error_hook', function(eof) processerror(v,eof) end)
+ register('show_lua_error_hook', function() processerror(v) end)
+ else
+ register('show_error_message', nil)
+ register('show_error_hook', nil)
+ register('show_warning_message',nil)
+ register('show_lua_error_hook', nil)
+ end
+end)
-- this might move
diff --git a/tex/context/base/mkiv/trac-deb.mkiv b/tex/context/base/mkiv/trac-deb.mkiv
index fcf58f37f..994c357d0 100644
--- a/tex/context/base/mkiv/trac-deb.mkiv
+++ b/tex/context/base/mkiv/trac-deb.mkiv
@@ -16,7 +16,7 @@
\unprotect
%registerctxluafile{trac-lmx}{}
-\registerctxluafile{trac-deb}{}
+\registerctxluafile{trac-deb}{autosuffix}
\unexpanded\def\breakpoint {\showdebuginfo\wait}
diff --git a/tex/context/base/mkiv/trac-inf.lmt b/tex/context/base/mkiv/trac-inf.lmt
new file mode 100644
index 000000000..c7a4c3c34
--- /dev/null
+++ b/tex/context/base/mkiv/trac-inf.lmt
@@ -0,0 +1,353 @@
+if not modules then modules = { } end modules ['trac-inf'] = {
+ version = 1.001,
+ comment = "companion to trac-inf.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- As we want to protect the global tables, we no longer store the timing
+-- in the tables themselves but in a hidden timers table so that we don't
+-- get warnings about assignments. This is more efficient than using rawset
+-- and rawget.
+
+local type, tonumber, select = type, tonumber, select
+local format, lower, find = string.format, string.lower, string.find
+local concat = table.concat
+local clock = os.gettimeofday or os.clock -- should go in environment
+
+local setmetatableindex = table.setmetatableindex
+local serialize = table.serialize
+local formatters = string.formatters
+
+statistics = statistics or { }
+local statistics = statistics
+
+statistics.enable = true
+statistics.threshold = 0.01
+
+local statusinfo, n, registered, timers = { }, 0, { }, { }
+
+setmetatableindex(timers,function(t,k)
+ local v = { timing = 0, loadtime = 0, offset = 0 }
+ t[k] = v
+ return v
+end)
+
+local function hastiming(instance)
+ return instance and timers[instance]
+end
+
+local function resettiming(instance)
+ timers[instance or "notimer"] = { timing = 0, loadtime = 0, offset = 0 }
+end
+
+local ticks = clock
+local seconds = function(n) return n or 0 end
+
+ticks = lua.getpreciseticks
+seconds = lua.getpreciseseconds
+
+local function starttiming(instance,reset)
+ local timer = timers[instance or "notimer"]
+ local it = timer.timing
+ if reset then
+ it = 0
+ timer.loadtime = 0
+ end
+ if it == 0 then
+ timer.starttime = ticks()
+ if not timer.loadtime then
+ timer.loadtime = 0
+ end
+ end
+ timer.timing = it + 1
+end
+
+local function stoptiming(instance)
+ local timer = timers[instance or "notimer"]
+ local it = timer.timing
+ if it > 1 then
+ timer.timing = it - 1
+ else
+ local starttime = timer.starttime
+ if starttime and starttime > 0 then
+ local stoptime = ticks()
+ local loadtime = stoptime - starttime
+ timer.stoptime = stoptime
+ timer.loadtime = timer.loadtime + loadtime
+ timer.timing = 0
+ timer.starttime = 0
+ return loadtime
+ end
+ end
+ return 0
+end
+
+local function benchmarktimer(instance)
+ local timer = timers[instance or "notimer"]
+ local it = timer.timing
+ if it > 1 then
+ timer.timing = it - 1
+ else
+ local starttime = timer.starttime
+ if starttime and starttime > 0 then
+ timer.offset = ticks() - starttime
+ else
+ timer.offset = 0
+ end
+ end
+end
+
+local function elapsed(instance)
+ if type(instance) == "number" then
+ return instance
+ else
+ local timer = timers[instance or "notimer"]
+ return timer and seconds(timer.loadtime - 2*(timer.offset or 0)) or 0
+ end
+end
+
+local function currenttime(instance)
+ if type(instance) == "number" then
+ return instance
+ else
+ local timer = timers[instance or "notimer"]
+ local it = timer.timing
+ if it > 1 then
+ -- whatever
+ else
+ local starttime = timer.starttime
+ if starttime and starttime > 0 then
+ return seconds(timer.loadtime + ticks() - starttime - 2*(timer.offset or 0))
+ end
+ end
+ return 0
+ end
+end
+
+local function elapsedtime(instance)
+ return format("%0.3f",elapsed(instance))
+end
+
+local function elapsedindeed(instance)
+ return elapsed(instance) > statistics.threshold
+end
+
+local function elapsedseconds(instance,rest) -- returns nil if 0 seconds
+ if elapsedindeed(instance) then
+ return format("%0.3f seconds %s", elapsed(instance),rest or "")
+ end
+end
+
+statistics.hastiming = hastiming
+statistics.resettiming = resettiming
+statistics.starttiming = starttiming
+statistics.stoptiming = stoptiming
+statistics.currenttime = currenttime
+statistics.elapsed = elapsed
+statistics.elapsedtime = elapsedtime
+statistics.elapsedindeed = elapsedindeed
+statistics.elapsedseconds = elapsedseconds
+statistics.benchmarktimer = benchmarktimer
+
+-- general function .. we might split this module
+
+function statistics.register(tag,fnc)
+ if statistics.enable and type(fnc) == "function" then
+ -- second load can overload:
+ local rt = registered[tag] or (#statusinfo + 1)
+ statusinfo[rt] = { tag, fnc }
+ registered[tag] = rt
+ if #tag > n then n = #tag end
+ end
+end
+
+local report = logs.reporter("mkiv lua stats")
+
+function statistics.show()
+ if statistics.enable then
+ -- this code will move
+ local register = statistics.register
+ register("used platform", function()
+ return format("%s, type: %s, binary subtree: %s",
+ os.platform or "unknown",os.type or "unknown", environment.texos or "unknown")
+ end)
+ register("used engine", function()
+ return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
+ LUATEXENGINE, LUATEXVERSION, LUATEXFUNCTIONALITY, LUATEXFORMATID, status.used_compiler)
+ end)
+ register("used hash slots", function()
+ local t = status.gethashstate()
+ local m = status.gettexstate()
+ return format("%s of %s with base %s, approximate memory usage: %i MB",
+ t.cnt, t.max, status.tex_hash_size, m.approximate // (1024 * 1024))
+ end)
+ register("callbacks", statistics.callbacks)
+ -- so far
+ register("lua properties",function()
+ local hash = lua.gethashchars()
+ local mask = load([[τεχ = 1]]) and "utf" or "ascii"
+ return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
+ "lua", LUAVERSION, statistics.memused(), hash, mask, mask == "utf" and "τεχ" or "tex")
+ end)
+ register("runtime",statistics.runtime)
+ logs.newline() -- initial newline
+ for i=1,#statusinfo do
+ local s = statusinfo[i]
+ local r = s[2]()
+ if r then
+ report("%s: %s",s[1],r)
+ end
+ end
+ -- logs.newline() -- final newline
+ statistics.enable = false
+ end
+end
+
+function statistics.memused() -- no math.round yet -)
+ local round = math.round or math.floor
+ local luastate = status.getluastate()
+ return format("%s MB, ctx: %s MB, max: %s MB",
+ round(collectgarbage("count")/1000),
+ round(luastate.state_bytes/1000000),
+ luastate.state_bytes_max and round(luastate.state_bytes_max/1000000) or "unknown"
+ )
+end
+
+starttiming(statistics)
+
+function statistics.formatruntime(runtime) -- indirect so it can be overloaded and
+ return format("%s seconds", runtime) -- indeed that happens in cure-uti.lua
+end
+
+function statistics.runtime()
+ stoptiming(statistics)
+ -- stoptiming(statistics) -- somehow we can start the timer twice, but where
+ local runtime = lua.getruntime and lua.getruntime() or elapsedtime(statistics)
+ return statistics.formatruntime(runtime)
+end
+
+local report = logs.reporter("system")
+
+function statistics.timed(action,all)
+ starttiming("run")
+ action()
+ stoptiming("run")
+ local runtime = tonumber(elapsedtime("run"))
+ if all then
+ local alltime = tonumber(lua.getruntime and lua.getruntime() or elapsedtime(statistics))
+ if alltime and alltime > 0 then
+ report("total runtime: %0.3f seconds of %0.3f seconds",runtime,alltime)
+ return
+ end
+ end
+ report("total runtime: %0.3f seconds",runtime)
+end
+
+-- goodie
+
+function statistics.tracefunction(base,tag,...)
+ for i=1,select("#",...) do
+ local name = select(i,...)
+ local stat = { }
+ local func = base[name]
+ setmetatableindex(stat,function(t,k) t[k] = 0 return 0 end)
+ base[name] = function(n,k,v) stat[k] = stat[k] + 1 return func(n,k,v) end
+ statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
+ end
+end
+
+-- now here
+
+status.iocodes = status.iocodes or { [0] =
+ "terminal input",
+ "lua input",
+ "scan token input",
+ "scan token eof input",
+ "tex macro",
+ "file input",
+}
+
+local report = logs.reporter("usage")
+
+function statistics.showusage(when)
+ local s = status.list()
+ local c = status.getcallbackstate() -- status.callbacks
+ local m = mplib.getcallbackstate()
+ local b = backends.getcallbackstate()
+ --
+ local pool = s.poolstate
+ local hash = s.hashstate
+ local node = s.nodestate
+ local token = s.tokenstate
+ local buffer = s.bufferstate
+ local input = s.inputstate
+ local file = s.filestate
+ local nest = s.neststate
+ local parameter = s.parameterstate
+ local save = s.savestate
+ local expand = s.expandstate
+ local tstatus = s.texstate
+ local lstatus = s.luastate
+ --
+ report("")
+ if when == "finish" then
+ report("status after finishing run")
+ else
+ report("status after shipping out page %s",tex.getcount("realpageno"))
+ end
+ report("")
+ report(" current file name : %s", s.filename or "")
+ report(" current input type : %s", status.iocodes[s.iocode] or 'unknown')
+ report(" current line number : %s", s.linenumber)
+ report("")
+ report(" string memory : min: %s, max: %s, set: %s, mem: %s, top: %s, use: %s, cnt: %s", pool .min, pool .max, pool .set, pool .mem, pool .top, pool .use, pool.cnt)
+ report(" hash memory : min: %s, max: %s, set: %s, mem: %s, top: %s, use: %s, cnt: %s", hash .min, hash .max, hash .set, hash .mem, hash .top, hash .use, hash.cnt)
+ report(" node memory : min: %s, max: %s, set: %s, mem: %s, top: %s, use: %s, cnt: %s", node .min, node .max, node .set, node .mem, node .top, node .use, node.cnt)
+ report(" token memory : min: %s, max: %s, set: %s, mem: %s, top: %s, use: %s", token .min, token .max, token .set, token .mem, token .top, token.use)
+ report(" buffer size : min: %s, max: %s, set: %s, mem: %s, top: %s", buffer .min, buffer .max, buffer .set, buffer .mem, buffer .top)
+ report(" input stack : min: %s, max: %s, set: %s, mem: %s, top: %s", input .min, input .max, input .set, input .mem, input .top)
+ report(" input files : min: %s, max: %s, set: %s, mem: %s, top: %s", file .min, file .max, file .set, file .mem, file .top)
+ report(" nest stack : min: %s, max: %s, set: %s, mem: %s, top: %s", nest .min, nest .max, nest .set, nest .mem, nest .top)
+ report(" parameter stack : min: %s, max: %s, set: %s, mem: %s, top: %s", parameter.min, parameter.max, parameter.set, parameter.mem, parameter.top)
+ report(" save stack : min: %s, max: %s, set: %s, mem: %s, top: %s", save .min, save .max, save .set, save .mem, save .top)
+ report("")
+ report(" approximate memory : %s", tstatus.approximate)
+ report("")
+ report(" expansion depth : min: %s, max: %s, set: %s, top: %s", expand.min, expand.max, expand.set, expand.top)
+ report("")
+ report(" luabytecode bytes : %s in %s registers", lstatus.bytecode_bytes, lstatus.bytecodes)
+ report(" luastate bytes : %s of %s", lstatus.state_bytes, lstatus.state_bytes_max or "unknown")
+ report("")
+ report(" file callbacks : %s", c.file)
+ report(" saved callbacks : %s", c.saved)
+ report(" direct callbacks : %s", c.direct)
+ report(" function callbacks : %s", c["function"])
+ report(" value callbacks : %s", c.value)
+ report(" message callbacks : %s", c.message)
+ report(" bytecode callbacks : %s", c.bytecode)
+ report("")
+ report(" total callbacks : %s", c.count)
+ report(" backend callbacks : %s", b.count)
+ report("")
+ report(" mp file callbacks : %s", m.file)
+ report(" mp text callbacks : %s", m.text)
+ report(" mp script callbacks : %s", m.script)
+ report(" mp log callbacks : %s", m.log)
+ report("")
+ report(" mp total callbacks : %s", m.count)
+ report("")
+end
+
+local registered = false
+local enabled = false
+
+directives.register("system.usage", function(v)
+ if v and not registered then
+ luatex.registerpageactions(function() if enabled then statistics.showusage("page") end end)
+ luatex.registerstopactions(function() if enabled then statistics.showusage("finish") end end)
+ registered = true
+ end
+ enabled = v
+end)
diff --git a/tex/context/base/mkiv/trac-inf.lua b/tex/context/base/mkiv/trac-inf.lua
index daf478199..3db912be1 100644
--- a/tex/context/base/mkiv/trac-inf.lua
+++ b/tex/context/base/mkiv/trac-inf.lua
@@ -223,20 +223,10 @@ function statistics.show()
return format("%s, type: %s, binary subtree: %s",
os.platform or "unknown",os.type or "unknown", environment.texos or "unknown")
end)
- -- register("luatex banner", function()
- -- return lower(status.banner)
- -- end)
- if LUATEXENGINE == "luametatex" then
- register("used engine", function()
- return format("%s version: %s, functionality level: %s, format id: %s, compiler: %s",
- LUATEXENGINE, LUATEXVERSION, LUATEXFUNCTIONALITY, LUATEXFORMATID, status.used_compiler)
- end)
- else
- register("used engine", function()
- return format("%s version: %s, functionality level: %s, banner: %s",
- LUATEXENGINE, LUATEXVERSION, LUATEXFUNCTIONALITY, lower(status.banner))
- end)
- end
+ register("used engine", function()
+ return format("%s version: %s, functionality level: %s, banner: %s",
+ LUATEXENGINE, LUATEXVERSION, LUATEXFUNCTIONALITY, lower(status.banner))
+ end)
register("used hash slots", function()
return format("%s of %s + %s", status.cs_count, status.hash_size,status.hash_extra)
end)
@@ -251,17 +241,11 @@ function statistics.show()
end
end
-- so far
- -- collectgarbage("collect")
register("lua properties",function()
- local hashchar = tonumber(status.luatex_hashchars)
- local mask = lua.mask or "ascii"
+ local hash = 2^status.luatex_hashchars
+ local mask = load([[τεχ = 1]]) and "utf" or "ascii"
return format("engine: %s %s, used memory: %s, hash chars: min(%i,40), symbol mask: %s (%s)",
- jit and "luajit" or "lua",
- LUAVERSION,
- statistics.memused(),
- hashchar and 2^hashchar or "unknown",
- mask,
- mask == "utf" and "τεχ" or "tex")
+ jit and "luajit" or "lua", LUAVERSION, statistics.memused(), hash, mask, mask == "utf" and "τεχ" or "tex")
end)
register("runtime",statistics.runtime)
logs.newline() -- initial newline
@@ -328,3 +312,12 @@ function statistics.tracefunction(base,tag,...)
statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end)
end
end
+
+function status.getreadstate()
+ return {
+ filename = status.filename or "?",
+ linenumber = status.linenumber or 0,
+ iocode = status.inputid or 0,
+ }
+end
+
diff --git a/tex/context/base/mkiv/trac-tim.lmt b/tex/context/base/mkiv/trac-tim.lmt
new file mode 100644
index 000000000..ce61c7440
--- /dev/null
+++ b/tex/context/base/mkiv/trac-tim.lmt
@@ -0,0 +1,177 @@
+if not modules then modules = { } end modules ['trac-tim'] = {
+ version = 1.001,
+ comment = "companion to m-timing.tex",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local format, gsub = string.format, string.gsub
+local concat, sort = table.concat, table.sort
+local next, tonumber = next, tonumber
+
+moduledata = moduledata or { }
+local progress = moduledata.progress or { }
+moduledata.progress = progress
+
+local report_timing = logs.reporter("timing")
+
+if not nodes then nodes = { } end -- when loaded in mtxrun
+
+progress.defaultfilename = ((tex and tex.jobname) or "whatever") .. "-luatex-progress"
+
+-- storage
+
+function progress.store()
+ nodes.snapshots.takesample()
+end
+
+function progress.save(name)
+ local filename = (name or progress.defaultfilename) .. ".lut"
+ report_timing("saving data in %a",filename)
+ table.save(filename,nodes.snapshots.getsamples())
+ nodes.snapshots.resetsamples()
+end
+
+-- conversion
+
+local processed = { }
+
+local function convert(name)
+ name = name ~= "" and name or progress.defaultfilename
+ if not processed[name] then
+ local pages = 0
+ local names = { }
+ local top = { }
+ local bot = { }
+ local siz = { }
+ local paths = { }
+ local data = table.load(name .. ".lut")
+ if data then
+ pages = #data
+ if pages > 1 then
+
+ local factor = 100
+
+ local function path(tag,subtag,tagname)
+ local tagname = tag .. ": " .. subtag
+ local b, t, s = nil, nil, { }
+ for k=1,#data do
+ local v = data[k][tag]
+ v = v and v[subtag]
+ if v then
+ if type(v) == "table" then
+ set[tagname] = tonumber(v.set)
+ v = tonumber(v.top)
+ else
+ v = tonumber(v)
+ end
+ if v then
+ if b then
+ if v > t then t = v end
+ if v < b then b = v end
+ else
+ t = v
+ b = v
+ end
+ else
+ v = 0
+ end
+ else
+ v = 0
+ end
+ s[k] = v
+ end
+ if not b then
+ -- safeguard against updates
+ b = 0
+ t = 0
+ end
+ top[tagname] = gsub(format("%.3f",t),"%.000$","")
+ bot[tagname] = gsub(format("%.3f",b),"%.000$","")
+ local delta = t - b
+ if delta == 0 then
+ delta = 1
+ else
+ delta = factor/delta
+ end
+ for k=1,#s do
+ s[k] = format("(%.3f,%.3f)",k,(s[k]-b)*delta)
+ end
+ paths[tagname] = concat(s,"--")
+ return tagname
+ end
+
+ local function collect(category)
+ if data[1][category] then
+ local keys = { }
+ for k=1,#data do
+ for k, v in next, data[k][category] do
+ keys[k] = true
+ end
+ end
+ for k=1,#data do
+ local m = data[k][category]
+ for k, v in next, keys do
+ if not m[k] then m[k] = 0 end
+ end
+ end
+ for k in next, keys do
+ names[#names+1] = path(category,k)
+ end
+ end
+ end
+
+ collect("nodes")
+ collect("memories")
+ collect("variables")
+ collect("texvariables")
+ collect("luavariables")
+ collect("texcallbacks")
+ collect("mpcallbacks")
+ collect("backendcallbacks")
+
+ pages = pages - 1 -- hm
+ end
+ end
+
+ sort(names)
+
+ processed[name] = {
+ names = names,
+ top = top,
+ bot = bot,
+ set = set,
+ pages = pages,
+ paths = paths,
+ }
+ end
+ return processed[name]
+end
+
+progress.convert = convert
+
+function progress.set(name,tag)
+ return convert(name).set[tag] or 0
+end
+
+function progress.bot(name,tag)
+ return convert(name).bot[tag] or 0
+end
+
+function progress.top(name,tag)
+ return convert(name).top[tag] or 0
+end
+
+function progress.pages(name,tag)
+ return convert(name).pages or 0
+end
+
+function progress.path(name,tag)
+ return convert(name).paths[tag] or "origin"
+end
+
+function progress.names(name)
+ return convert(name).names or { }
+end
+
diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml
index f04b8848f..e39ab834f 100644
--- a/tex/context/interface/mkii/keys-en.xml
+++ b/tex/context/interface/mkii/keys-en.xml
@@ -960,6 +960,7 @@
<cd:constant name='limittext' value='limittext'/>
<cd:constant name='line' value='line'/>
<cd:constant name='linecorrection' value='linecorrection'/>
+ <cd:constant name='linedirection' value='linedirection'/>
<cd:constant name='lines' value='lines'/>
<cd:constant name='list' value='list'/>
<cd:constant name='listtext' value='listtext'/>
diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml
index ccec1c829..1590d4c6d 100644
--- a/tex/context/interface/mkii/keys-nl.xml
+++ b/tex/context/interface/mkii/keys-nl.xml
@@ -640,6 +640,7 @@
<cd:constant name='afterkey' value='natoets'/>
<cd:constant name='aftersection' value='nasectie'/>
<cd:constant name='align' value='uitlijnen'/>
+ <cd:constant name='alignbottom' value='alignbottom'/>
<cd:constant name='aligncharacter' value='karakteruitlijnen'/>
<cd:constant name='alignmentcharacter' value='uitlijnkarakter'/>
<cd:constant name='alignmentleftsample' value='alignmentleftsample'/>
@@ -959,6 +960,7 @@
<cd:constant name='limittext' value='limiettekst'/>
<cd:constant name='line' value='regel'/>
<cd:constant name='linecorrection' value='regelcorrectie'/>
+ <cd:constant name='linedirection' value='regelrichting'/>
<cd:constant name='lines' value='regels'/>
<cd:constant name='list' value='lijst'/>
<cd:constant name='listtext' value='lijsttekst'/>
diff --git a/tex/context/modules/mkiv/m-timing.mkxl b/tex/context/modules/mkiv/m-timing.mkxl
new file mode 100644
index 000000000..3c7667ff6
--- /dev/null
+++ b/tex/context/modules/mkiv/m-timing.mkxl
@@ -0,0 +1,114 @@
+%D \module
+%D [ file=m-timing,
+%D version=2007.12.23,
+%D title=\CONTEXT\ Modules,
+%D subtitle=Timing,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Todo: adapt to latest metafun magic.
+
+\ifdefined\ShowNamedUsage \endinput \fi
+
+%D Written at the end of 2007, this module is dedicated to Taco. Reaching this
+%D point in \LUATEX\ was a non trivial effort. By visualizing a bit what happens
+%D when pages come out of \LUATEX, you may get an idea what is involved. It took
+%D much time an dedication to reach this point in the development. Add to that
+%D those daily Skype intense discussion, testing and debugging moments. Time flies
+%D but progress is impressive. The motto of this module could be: what you see
+%D is what you get. An there is much more to come \unknown.
+
+% \usemodule[timing]
+% \setupcolors[state=start]
+% \starttext
+% \dorecurse{200}{\input tufte \par} \ShowUsage{}
+% \stoptext
+
+\definecolor[usage:line] [darkred]
+\definecolor[usage:time] [darkblue]
+\definecolor[usage:frame][darkgray]
+
+\ctxloadluafile{trac-tim.lmt}
+
+\startluacode
+local progress = moduledata.progress
+
+function progress.show(filename,names,other)
+ if not filename or filename == "" then
+ filename = progress.defaultfilename or ""
+ end
+ for n, name in pairs(progress.names(filename)) do
+ if string.find(name,names) and name ~= other and name ~= "variables: lasttime" then
+ context.ShowNamedUsage(filename,name or "",other or "")
+ end
+ end
+end
+\stopluacode
+
+\startnotmode[no-timing]
+ \appendtoks\ctxlua{moduledata.progress.store()}\to\everystarttext
+ \appendtoks\ctxlua{moduledata.progress.store()}\to\everyshipout
+ \ctxlua{luatex.registerstopactions(function() moduledata.progress.save() end)}
+\stopnotmode
+
+\unexpanded\def\ShowNamedUsage#1#2#3%
+ {\setbox\scratchbox\vbox\bgroup
+ \startMPcode{doublefun}
+ begingroup ; save p, q, b, h, w ;
+ path p, q, b ; numeric h, w ;
+ p := \cldcontext{moduledata.progress.path("#1","#2")} ;
+ % p := p shifted -llcorner p ;
+ if bbwidth(p) > 0 :
+ h := 100 ; w := 2 * h ;
+ w := \the\textwidth-3pt ; % correct for pen
+ p := p xstretched w ;
+ b := boundingbox (llcorner p -- llcorner p shifted (w,h)) ;
+ pickup pencircle scaled 3pt ; linecap := butt ;
+ draw b withcolor \MPcolor{usage:frame} ;
+ draw p withcolor \MPcolor{usage:line} ;
+ if ("#3" <> "") and ("#3" <> "#2") :
+ q := \cldcontext{moduledata.progress.path("#1","#3")} ;
+ % q := q shifted -llcorner q ;
+ if bbwidth(q) > 1 :
+ q := q xstretched w ;
+ pickup pencircle scaled 1.5pt ; linecap := butt ;
+ draw q withcolor \MPcolor{usage:time} ;
+ fi ;
+ fi ;
+ fi ;
+ endgroup ;
+ \stopMPcode
+ \egroup
+ \scratchdimen\wd\scratchbox
+ \ifdim\scratchdimen>\zeropoint
+ \startlinecorrection[blank]
+ \box\scratchbox \endgraf
+ \hbox to \scratchdimen\bgroup
+ \tttf\strut\detokenize{#2}\hss
+ \scratchcounter=\cldcontext{moduledata.progress.set("#1","\detokenize{#2}")}\relax
+ \ifcase\scratchcounter\else
+ set:\the\scratchcounter, %
+ \fi
+ \scratchcounterone=\cldcontext{moduledata.progress.bot("#1","\detokenize{#2}")}\relax
+ \scratchcountertwo=\cldcontext{moduledata.progress.top("#1","\detokenize{#2}")}\relax
+ min:\the\scratchcounterone, %
+ max:\the\scratchcountertwo, %
+ inc:\the\numexpr\scratchcountertwo-\scratchcounterone\relax, %
+ pages:\cldcontext{moduledata.progress.pages("#1")}%
+ \egroup
+ \stoplinecorrection
+ \fi}
+
+\unexpanded\def\LoadUsage #1{\ctxlua{moduledata.progress.convert("#1")}}
+\unexpanded\def\ShowUsage #1{\ctxlua{moduledata.progress.show("#1",".*", "variables: elapsed")}}
+\unexpanded\def\ShowMemoryUsage #1{\ctxlua{moduledata.progress.show("#1","memory:.*","variables: elapsed")}}
+\unexpanded\def\ShowNodeUsage #1{\ctxlua{moduledata.progress.show("#1","nodes:.*", "variables: elapsed")}}
+\unexpanded\def\ShowFilteredUsage#1#2{\ctxlua{moduledata.progress.show("#1","#2", "variables: elapsed")}}
+\unexpanded\def\ShowSimpleUsage #1#2{\ctxlua{moduledata.progress.show("#1","#2")}}
+
+\endinput
diff --git a/tex/context/modules/mkiv/s-fonts-variable.mkiv b/tex/context/modules/mkiv/s-fonts-variable.mkiv
index 5336f6024..7a9d82c5a 100644
--- a/tex/context/modules/mkiv/s-fonts-variable.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-variable.mkiv
@@ -112,4 +112,14 @@
% \showfontvariations
% [font=file:sitka.ttc]
+% For Alan:
+
+% \usemodule[article-basic]
+% \usemodule[fonts-variable]
+% \starttext
+% \showfontvariations[font=file:goldmansansitvf_wght.ttf]
+% \showfontvariations[font=file:goldmansansvf_wght.ttf]
+% \showfontvariations[font=file:goldmansanscdvf_wght.ttf]
+% \stoptext
+
\stoptext
diff --git a/tex/context/modules/mkiv/s-module-basic.mkiv b/tex/context/modules/mkiv/s-module-basic.mkiv
index 74621b2a3..7024cd91a 100644
--- a/tex/context/modules/mkiv/s-module-basic.mkiv
+++ b/tex/context/modules/mkiv/s-module-basic.mkiv
@@ -25,8 +25,6 @@
%D him when you run into problems. Bugs in this style can be sent to
%D Hans.
-\showframe
-
\usemodule[abbreviations-words]
\startmodule[modules-basics]
@@ -45,20 +43,24 @@
\let\module\setupdocument
-\definepalet [module:unknown] [localone=black,localtwo=white]
+\definepalet [module:unknown] [locallocalone=darkyellow,localtwo=darkred,localthree=white,localfour=darkgray]
-\definepalet [module:tex] [localone=blue,localtwo=green]
-\definepalet [module:mkii] [localone=blue,localtwo=green]
-\definepalet [module:mkiv] [localone=blue,localtwo=green]
-\definepalet [module:mkvi] [localone=blue,localtwo=green]
+\definepalet [module:tex] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
+\definepalet [module:mkii] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
+\definepalet [module:mkiv] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
+\definepalet [module:mkvi] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
+\definepalet [module:mkxl] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
+\definepalet [module:mklx] [localone=darkblue,localtwo=darkgreen,localthree=white,localfour=darkgray]
-\definepalet [module:lua] [localone=red,localtwo=green]
-\definepalet [module:cld] [localone=red,localtwo=green]
+\definepalet [module:lua] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray]
+\definepalet [module:lmt] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray]
+\definepalet [module:cld] [localone=darkred,localtwo=darkgreen,localthree=white,localfour=darkgray]
-\definepalet [module:mp] [localone=red,localtwo=blue]
-\definepalet [module:mpii] [localone=red,localtwo=blue]
-\definepalet [module:mpiv] [localone=red,localtwo=blue]
-\definepalet [module:metapost][localone=red,localtwo=blue]
+\definepalet [module:mp] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
+\definepalet [module:mpii] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
+\definepalet [module:mpiv] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
+\definepalet [module:mpxl] [localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
+\definepalet [module:metapost][localone=darkred,localtwo=darkblue,localthree=white,localfour=darkgray]
\setuppalet
[module:unknown]
@@ -67,12 +69,10 @@
StartPage ;
- color local_white ; local_white := .8white ;
- color local_one ; local_one := \MPcolor{localone} randomized (.6,.8) ;
- color local_two ; local_two := \MPcolor{localtwo} randomized (.3,.4) ;
-
- color local_one ; local_one := .75[\MPcolor{localone},white] ;
- color local_two ; local_two := .75[\MPcolor{localtwo},white] ;
+ color local_one ; local_one := .6 * \MPcolor{localone} ;
+ color local_two ; local_two := .6 * \MPcolor{localtwo} ;
+ color local_three ; local_three := \MPcolor{localthree} ;
+ color local_four ; local_four := \MPcolor{localfour} ;
numeric width ; width := bbwidth Page ;
numeric height ; height := bbheight Page ;
@@ -84,12 +84,13 @@
ddy := 0 ; sx := 60u ;
for i=1 upto (4 randomized 2) :
sy := 7u randomized 3u ;
- fill unitsquare xyscaled(sx,sy) shifted (0,ddy) withcolor local_two ;
+ fill unitsquare xyscaled(sx,sy) shifted (0,ddy)
+ withcolor local_two ;
ddy := ddy + sy + 4u ;
endfor ;
) ;
p := p shifted (dx,dy) shifted - center p ;
- fill boundingbox p enlarged 8u withcolor local_white ;
+ fill boundingbox p enlarged 8u withcolor local_four ;
fill boundingbox p enlarged 4u withcolor local_one ;
draw p ;
enddef ;
@@ -111,7 +112,7 @@
draw anchored.urt(textext("\bf\strut\documentvariable{subtitle}") ysized 1.5cm,urcorner Page shifted (-1cm,-10cm)) ;
draw anchored.urt(textext("\bf\strut\documentvariable{author}") ysized 1.5cm,lrcorner Page shifted (-1cm, 5cm)) ;
draw anchored.urt(textext("\bf\strut\currentdate") ysized 1.5cm,lrcorner Page shifted (-1cm, 3cm)) ;
- ) withcolor .25white ;
+ ) withcolor local_three ;
StopPage ;
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index f4b6fbb85..e33b426dc 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 : 2020-08-14 18:54
+-- merge date : 2020-08-24 19:46
do -- begin closure to overcome local limits and interference
@@ -99,9 +99,6 @@ function optionalrequire(...)
return result
end
end
-if lua then
- lua.mask=load([[τεχ = 1]]) and "utf" or "ascii"
-end
local flush=io.flush
if flush then
local execute=os.execute if execute then function os.execute(...) flush() return execute(...) end end
@@ -10483,6 +10480,7 @@ end
local hash={}
local conc={}
table.setmetatableindex(hash,function(t,k)
+ local v
if k<0xD7FF or (k>0xDFFF and k<=0xFFFF) then
v=f_single(k)
else