[NTG-context] update
Hans Hagen
j.hagen at xs4all.nl
Thu Jun 25 11:34:25 CEST 2020
Hi,
I uploaded a new version (both mkiv and lmtx). We removed some low level
no longer used code (older engines), normalized some in the process,
fixed a few things, etc.
=== lmtx only ===
While updating the cld manual I decided to also add an other table
mechanism (in addition to the one already reported in an earlier mail).
I have no clue how useful it is, but as usual with tex, users find ways
to (ab)use it. This one behaves a bit more like registers. A hashed one
is defined as:
\newhashedtable\somehashtable
\somehashtable{ foo = 123, bar = "foo" }
[123 = \the\somehashtable{foo}] [123 = \the\somehashtable foo ]
[foo = \the\somehashtable{bar}] [foo = \the\somehashtable bar ]
\bgroup
\somehashtable{ foo = 456, bar = "oof" }
[456 = \the\somehashtable{foo}]
[oof = \the\somehashtable{bar}]
\egroup
[123 = \the\somehashtable{foo}]
[foo = \the\somehashtable{bar}]
\bgroup
\global\somehashtable{ foo = 456 }
\somehashtable{ bar = "oof" }
[456 = \the\somehashtable{foo}]
[oof = \the\somehashtable{bar}]
\egroup
[456 = \the\somehashtable{foo}]
[foo = \the\somehashtable{bar}]
or an indexed one:
\newindexedtable\someindextable
\someindextable{ 123, "foo" }
[123 = \the\someindextable 1] [123 = \the\someindextable \numexpr 2 -
1\relax]
[foo = \the\someindextable 2] [foo = \the\someindextable \numexpr 1 +
1\relax]
\bgroup
\someindextable{ 456, "oof" }
[456 = \the\someindextable 1]
[oof = \the\someindextable 2]
\egroup
[123 = \the\someindextable 1]
[foo = \the\someindextable 2]
\bgroup
\global\someindextable{ [1] = 456 }
\someindextable{ [2] = "oof" }
[456 = \the\someindextable 1]
[oof = \the\someindextable 2]
\egroup
[456 = \the\someindextable 1]
[foo = \the\someindextable 2]
In both cases, local and global assignments are supported.
At the Lua end you can access these tables too:
context.hashedtables.somehashtable.bar
context.indexedtables.someindextable[2]
There is some overhead involved but performance and memory usage is
quiite okay.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
More information about the ntg-context
mailing list