From 330909ad62342ff873dc758b909968c66d0252a4 Mon Sep 17 00:00:00 2001
From: Hans Hagen
Date: Sun, 16 May 2021 11:46:45 +0200
Subject: 2021-05-15 22:44:00
---
.../general/manuals/lowlevel-paragraphs.pdf | Bin 208745 -> 266886 bytes
.../documents/general/manuals/luametatex.pdf | Bin 1212387 -> 1212208 bytes
.../manuals/lowlevel/lowlevel-paragraphs.tex | 77 ++
.../manuals/luametatex/luametatex-differences.tex | 104 +-
.../manuals/luametatex/luametatex-internals.tex | 244 +++++
.../manuals/luametatex/luametatex-introduction.tex | 75 +-
.../manuals/luametatex/luametatex-languages.tex | 12 +-
.../manuals/luametatex/luametatex-metapost.tex | 59 +-
.../manuals/luametatex/luametatex-nodes.tex | 284 +++---
.../manuals/luametatex/luametatex-preamble.tex | 189 ----
.../general/manuals/luametatex/luametatex-tex.tex | 287 +++---
.../general/manuals/luametatex/luametatex.tex | 2 +-
scripts/context/lua/mtx-context.lua | 2 +-
scripts/context/lua/mtx-fonts.lua | 2 +-
tex/context/base/mkii/cont-new.mkii | 2 +-
tex/context/base/mkii/context.mkii | 2 +-
tex/context/base/mkii/mult-fr.mkii | 2 +
tex/context/base/mkiv/anch-pgr.lua | 24 +-
tex/context/base/mkiv/attr-ini.lua | 4 +-
tex/context/base/mkiv/attr-ini.mkiv | 16 -
tex/context/base/mkiv/back-exp.lua | 4 +-
tex/context/base/mkiv/blob-ini.lua | 56 +-
tex/context/base/mkiv/cldf-ini.lua | 13 +-
tex/context/base/mkiv/cont-new.mkiv | 2 +-
tex/context/base/mkiv/context.mkiv | 2 +-
tex/context/base/mkiv/font-cff.lua | 43 +-
tex/context/base/mkiv/font-chk.lua | 6 +-
tex/context/base/mkiv/font-col.lua | 1 -
tex/context/base/mkiv/font-lib.mkvi | 4 +-
tex/context/base/mkiv/font-mis.lua | 2 +-
tex/context/base/mkiv/font-mps.lua | 6 +-
tex/context/base/mkiv/font-nod.lua | 20 +-
tex/context/base/mkiv/font-ocl.lua | 24 +-
tex/context/base/mkiv/font-ocm.lua | 78 +-
tex/context/base/mkiv/font-osd.lua | 28 +-
tex/context/base/mkiv/font-ota.lua | 10 +-
tex/context/base/mkiv/font-otj.lua | 80 +-
tex/context/base/mkiv/font-otl.lua | 2 +-
tex/context/base/mkiv/font-otr.lua | 4 +-
tex/context/base/mkiv/font-ots.lua | 97 +-
tex/context/base/mkiv/font-phb.lua | 2 +-
tex/context/base/mkiv/font-sol.lua | 38 +-
tex/context/base/mkiv/font-txt.lua | 30 +-
tex/context/base/mkiv/good-mth.lua | 6 +-
tex/context/base/mkiv/grph-inc.lua | 5 +-
tex/context/base/mkiv/lang-dis.lua | 13 +-
tex/context/base/mkiv/lang-exp.lua | 6 +-
tex/context/base/mkiv/lang-hyp.lua | 30 +-
tex/context/base/mkiv/lang-ini.lua | 17 +-
tex/context/base/mkiv/lang-rep.lua | 20 +-
tex/context/base/mkiv/lang-tra.lua | 4 +-
tex/context/base/mkiv/lpdf-fld.lua | 2 +-
tex/context/base/mkiv/lpdf-mov.lua | 5 +-
tex/context/base/mkiv/lpdf-wid.lua | 13 +-
tex/context/base/mkiv/math-dir.lua | 8 +-
tex/context/base/mkiv/math-noa.lua | 28 +-
tex/context/base/mkiv/math-tag.lua | 4 +-
tex/context/base/mkiv/meta-blb.lua | 6 +-
tex/context/base/mkiv/meta-imp-txt.mkiv | 2 +-
tex/context/base/mkiv/mlib-pdf.lua | 5 +-
tex/context/base/mkiv/mlib-pps.lua | 8 +-
tex/context/base/mkiv/mult-fmt.lua | 10 +-
tex/context/base/mkiv/node-acc.lua | 10 +-
tex/context/base/mkiv/node-aux.lua | 90 +-
tex/context/base/mkiv/node-bck.lua | 4 +-
tex/context/base/mkiv/node-bwc.lua | 92 ++
tex/context/base/mkiv/node-fin.lua | 164 +--
tex/context/base/mkiv/node-fnt.lua | 16 +-
tex/context/base/mkiv/node-gcm.lua | 66 +-
tex/context/base/mkiv/node-ini.mkiv | 1 +
tex/context/base/mkiv/node-ltp.lua | 76 +-
tex/context/base/mkiv/node-met.lua | 202 ++--
tex/context/base/mkiv/node-mig.lua | 2 -
tex/context/base/mkiv/node-nut.lua | 275 ++---
tex/context/base/mkiv/node-ppt.lua | 2 +-
tex/context/base/mkiv/node-pro.lua | 8 +-
tex/context/base/mkiv/node-ref.lua | 9 +-
tex/context/base/mkiv/node-res.lua | 36 +-
tex/context/base/mkiv/node-rul.lua | 44 +-
tex/context/base/mkiv/node-scn.lua | 2 -
tex/context/base/mkiv/node-ser.lua | 7 +-
tex/context/base/mkiv/node-shp.lua | 2 +-
tex/context/base/mkiv/node-syn.lua | 28 +-
tex/context/base/mkiv/node-tra.lua | 6 +-
tex/context/base/mkiv/node-typ.lua | 15 +-
tex/context/base/mkiv/pack-rul.lua | 6 +-
tex/context/base/mkiv/page-cst.lua | 5 +-
tex/context/base/mkiv/page-ini.lua | 171 +++-
tex/context/base/mkiv/page-ini.mkiv | 26 +-
tex/context/base/mkiv/page-mix.lua | 4 +-
tex/context/base/mkiv/page-mix.mkiv | 4 -
tex/context/base/mkiv/page-str.lua | 8 +-
tex/context/base/mkiv/scrn-hlp.lua | 4 +-
tex/context/base/mkiv/scrp-cjk.lua | 212 ++--
tex/context/base/mkiv/scrp-ini.lua | 112 +--
tex/context/base/mkiv/spac-ali.lua | 2 +-
tex/context/base/mkiv/spac-chr.lua | 26 +-
tex/context/base/mkiv/spac-ver.lua | 59 +-
tex/context/base/mkiv/status-files.pdf | Bin 23954 -> 23942 bytes
tex/context/base/mkiv/status-lua.pdf | Bin 225900 -> 228905 bytes
tex/context/base/mkiv/supp-box.lua | 72 +-
tex/context/base/mkiv/syst-lua.lua | 47 +-
tex/context/base/mkiv/tabl-xtb.lua | 20 +-
tex/context/base/mkiv/task-ini.lua | 2 +-
tex/context/base/mkiv/toks-ini.lua | 225 ++---
tex/context/base/mkiv/trac-jus.lua | 4 +-
tex/context/base/mkiv/trac-vis.lua | 66 +-
tex/context/base/mkiv/typo-bld.lua | 6 +-
tex/context/base/mkiv/typo-brk.lua | 32 +-
tex/context/base/mkiv/typo-cap.lua | 18 +-
tex/context/base/mkiv/typo-chr.lua | 10 +-
tex/context/base/mkiv/typo-dha.lua | 35 +-
tex/context/base/mkiv/typo-dig.lua | 13 +-
tex/context/base/mkiv/typo-drp.lua | 11 +-
tex/context/base/mkiv/typo-dua.lua | 19 +-
tex/context/base/mkiv/typo-dub.lua | 19 +-
tex/context/base/mkiv/typo-duc.lua | 19 +-
tex/context/base/mkiv/typo-fkr.lua | 6 +-
tex/context/base/mkiv/typo-fln.lua | 30 +-
tex/context/base/mkiv/typo-itc.lua | 34 +-
tex/context/base/mkiv/typo-krn.lua | 25 +-
tex/context/base/mkiv/typo-lin.lua | 30 +-
tex/context/base/mkiv/typo-mar.lua | 18 +-
tex/context/base/mkiv/typo-pag.lua | 8 +-
tex/context/base/mkiv/typo-pnc.lua | 4 +-
tex/context/base/mkiv/typo-rep.lua | 1 +
tex/context/base/mkiv/typo-rub.lua | 3 +-
tex/context/base/mkiv/typo-spa.lua | 16 +-
tex/context/base/mkiv/typo-sus.lua | 20 +-
tex/context/base/mkiv/typo-tal.lua | 22 +-
tex/context/base/mkiv/typo-wrp.lua | 2 +
tex/context/base/mkiv/typo-wrp.mkiv | 2 +-
tex/context/base/mkxl/anch-bck.mklx | 3 -
tex/context/base/mkxl/anch-pgr.lmt | 33 +-
tex/context/base/mkxl/back-exp.lmt | 4 +-
tex/context/base/mkxl/blob-ini.lmt | 50 +-
tex/context/base/mkxl/buff-ini.lmt | 6 +-
tex/context/base/mkxl/cldf-lmt.lmt | 6 +-
tex/context/base/mkxl/cont-new.mkxl | 2 +-
tex/context/base/mkxl/context.mkxl | 2 +-
tex/context/base/mkxl/core-env.lmt | 2 +-
tex/context/base/mkxl/driv-shp.lmt | 40 +-
tex/context/base/mkxl/font-chk.lmt | 8 +-
tex/context/base/mkxl/font-col.lmt | 1 -
tex/context/base/mkxl/font-ota.lmt | 16 +-
tex/context/base/mkxl/font-otj.lmt | 108 +-
tex/context/base/mkxl/font-ots.lmt | 161 ++-
tex/context/base/mkxl/font-phb.lmt | 2 +-
tex/context/base/mkxl/font-txt.lmt | 30 +-
tex/context/base/mkxl/good-mth.lmt | 6 +-
tex/context/base/mkxl/grph-inc.lmt | 5 +-
tex/context/base/mkxl/lang-dis.lmt | 11 +-
tex/context/base/mkxl/lang-hyp.lmt | 30 +-
tex/context/base/mkxl/lang-ini.lmt | 14 +-
tex/context/base/mkxl/lpdf-emb.lmt | 6 +-
tex/context/base/mkxl/lpdf-fld.lmt | 2 +-
tex/context/base/mkxl/lpdf-img.lmt | 113 ++-
tex/context/base/mkxl/lpdf-lmt.lmt | 17 +-
tex/context/base/mkxl/lpdf-mov.lmt | 5 +-
tex/context/base/mkxl/lpdf-wid.lmt | 14 +-
tex/context/base/mkxl/luat-cod.lmt | 4 +-
tex/context/base/mkxl/luat-fio.lmt | 2 +-
tex/context/base/mkxl/luat-log.lmt | 69 +-
tex/context/base/mkxl/math-ini.mkxl | 6 -
tex/context/base/mkxl/math-noa.lmt | 26 +-
tex/context/base/mkxl/math-tag.lmt | 4 +-
tex/context/base/mkxl/mlib-lua.lmt | 136 +--
tex/context/base/mkxl/mlib-pdf.lmt | 9 +-
tex/context/base/mkxl/mlib-pps.lmt | 12 +-
tex/context/base/mkxl/mlib-scn.lmt | 13 +-
tex/context/base/mkxl/node-acc.lmt | 1 -
tex/context/base/mkxl/node-aux.lmt | 47 +-
tex/context/base/mkxl/node-bck.lmt | 4 +-
tex/context/base/mkxl/node-bwc.lmt | 168 ++++
tex/context/base/mkxl/node-cmp.lmt | 134 +--
tex/context/base/mkxl/node-dir.lmt | 8 +-
tex/context/base/mkxl/node-ext.lmt | 3 +-
tex/context/base/mkxl/node-fin.lmt | 220 ++--
tex/context/base/mkxl/node-fnt.lmt | 14 +-
tex/context/base/mkxl/node-gcm.lmt | 40 +-
tex/context/base/mkxl/node-ini.mkxl | 1 +
tex/context/base/mkxl/node-met.lmt | 96 +-
tex/context/base/mkxl/node-mig.lmt | 2 -
tex/context/base/mkxl/node-nut.lmt | 201 ++--
tex/context/base/mkxl/node-pro.lmt | 7 +-
tex/context/base/mkxl/node-ref.lmt | 9 +-
tex/context/base/mkxl/node-res.lmt | 20 +-
tex/context/base/mkxl/node-rul.lmt | 36 +-
tex/context/base/mkxl/node-scn.lmt | 2 -
tex/context/base/mkxl/node-ser.lmt | 10 +-
tex/context/base/mkxl/node-shp.lmt | 2 +-
tex/context/base/mkxl/node-syn.lmt | 16 +-
tex/context/base/mkxl/node-tra.lmt | 5 +-
tex/context/base/mkxl/pack-rul.lmt | 6 +-
tex/context/base/mkxl/page-ini.lmt | 356 +++++++
tex/context/base/mkxl/page-ini.mkxl | 19 +-
tex/context/base/mkxl/page-mix.mkxl | 4 -
tex/context/base/mkxl/page-one.mkxl | 107 +-
tex/context/base/mkxl/page-smp.mkxl | 1 +
tex/context/base/mkxl/page-txt.mklx | 5 -
tex/context/base/mkxl/scrp-ini.lmt | 1051 ++++++++++++++++++++
tex/context/base/mkxl/scrp-ini.mkxl | 2 +-
tex/context/base/mkxl/spac-ali.lmt | 2 +-
tex/context/base/mkxl/spac-chr.lmt | 28 +-
tex/context/base/mkxl/spac-ver.lmt | 61 +-
tex/context/base/mkxl/supp-box.lmt | 56 +-
tex/context/base/mkxl/syst-lua.lmt | 19 +-
tex/context/base/mkxl/syst-mac.lmt | 34 +-
tex/context/base/mkxl/task-ini.lmt | 2 +-
tex/context/base/mkxl/toks-aux.lmt | 14 +-
tex/context/base/mkxl/toks-ini.lmt | 421 ++++----
tex/context/base/mkxl/trac-deb.lmt | 2 +-
tex/context/base/mkxl/trac-vis.lmt | 66 +-
tex/context/base/mkxl/typo-bld.lmt | 6 +-
tex/context/base/mkxl/typo-brk.lmt | 40 +-
tex/context/base/mkxl/typo-cap.lmt | 16 +-
tex/context/base/mkxl/typo-chr.lmt | 10 +-
tex/context/base/mkxl/typo-dig.lmt | 21 +-
tex/context/base/mkxl/typo-drp.lmt | 11 +-
tex/context/base/mkxl/typo-duc.lmt | 19 +-
tex/context/base/mkxl/typo-fln.lmt | 30 +-
tex/context/base/mkxl/typo-hid.lmt | 2 +-
tex/context/base/mkxl/typo-itc.lmt | 34 +-
tex/context/base/mkxl/typo-krn.lmt | 31 +-
tex/context/base/mkxl/typo-lin.lmt | 24 +-
tex/context/base/mkxl/typo-mar.lmt | 18 +-
tex/context/base/mkxl/typo-pag.lmt | 8 +-
tex/context/base/mkxl/typo-rub.lmt | 1 -
tex/context/base/mkxl/typo-shp.lmt | 4 +-
tex/context/base/mkxl/typo-shp.mkxl | 114 ++-
tex/context/base/mkxl/typo-spa.lmt | 24 +-
tex/context/base/mkxl/typo-sus.lmt | 20 +-
tex/context/base/mkxl/typo-tal.lmt | 22 +-
tex/context/base/mkxl/typo-wrp.mkxl | 2 +-
tex/context/interface/mkii/keys-fr.xml | 2 +
tex/context/modules/common/s-obsolete-tokens.mkiv | 22 +-
tex/context/modules/mkiv/m-catchword.mkiv | 6 +-
tex/context/modules/mkiv/m-escrito.mkiv | 2 +-
tex/context/modules/mkiv/m-system-readers.mkxl | 4 +-
tex/context/modules/mkiv/s-fonts-emoji.mkiv | 5 +-
tex/context/modules/mkiv/s-fonts-kerns.mkiv | 27 +-
.../modules/mkiv/s-languages-hyphenation.lua | 72 +-
tex/context/modules/mkiv/s-present-weird.mkiv | 8 +-
tex/context/modules/mkiv/s-present-wobbling.mkiv | 4 +-
tex/context/modules/mkiv/s-system-macros.mkxl | 4 +-
tex/generic/context/luatex/luatex-basics-nod.lua | 221 ++--
tex/generic/context/luatex/luatex-fonts-gbn.lua | 44 +-
tex/generic/context/luatex/luatex-fonts-merged.lua | 355 ++++---
248 files changed, 6209 insertions(+), 4070 deletions(-)
create mode 100644 doc/context/sources/general/manuals/luametatex/luametatex-internals.tex
delete mode 100644 doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex
create mode 100644 tex/context/base/mkiv/node-bwc.lua
create mode 100644 tex/context/base/mkxl/node-bwc.lmt
create mode 100644 tex/context/base/mkxl/page-ini.lmt
create mode 100644 tex/context/base/mkxl/scrp-ini.lmt
diff --git a/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf b/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf
index bde7fda14..ab46092b2 100644
Binary files a/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf and b/doc/context/documents/general/manuals/lowlevel-paragraphs.pdf differ
diff --git a/doc/context/documents/general/manuals/luametatex.pdf b/doc/context/documents/general/manuals/luametatex.pdf
index 66c65f995..98b6466b8 100644
Binary files a/doc/context/documents/general/manuals/luametatex.pdf and b/doc/context/documents/general/manuals/luametatex.pdf differ
diff --git a/doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex b/doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex
index 3098333f0..a15ddb622 100644
--- a/doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex
+++ b/doc/context/sources/general/manuals/lowlevel/lowlevel-paragraphs.tex
@@ -907,6 +907,69 @@ keyword in the next code. The result is shown in \in {figure} [fig:shape:skips].
\stopcombination
\stopplacefigure
+The shape mechanism has a few more tricks but these are really meant for usage
+in specific situations, where one knows what one deals with. The following
+examples are visualized in \in {figure} [fig:flow].
+
+\startbuffer[jano]
+\useMPlibrary[dum]
+\usemodule[article-basics]
+
+\startbuffer
+ \externalfigure[dummy][width=6cm]
+\stopbuffer
+
+\startshapedparagraph[text=\getbuffer]
+ \dorecurse{3}{\samplefile{ward}\par}
+\stopshapedparagraph
+
+\page
+
+\startshapedparagraph[text=\getbuffer,distance=1em]
+ \dorecurse{3}{\samplefile{ward}\par}
+\stopshapedparagraph
+
+\page
+
+\startshapedparagraph[text=\getbuffer,distance=1em,
+ hoffset=-2em]
+ \dorecurse{3}{\samplefile{ward}\par}
+\stopshapedparagraph
+
+\page
+
+\startshapedparagraph[text=\getbuffer,distance=1em,
+ voffset=-2ex,hoffset=-2em]
+ \dorecurse{3}{\samplefile{ward}\par}
+\stopshapedparagraph
+
+\page
+
+\startshapedparagraph[text=\getbuffer,distance=1em,
+ voffset=-2ex,hoffset=-2em,lines=1]
+ \dorecurse{3}{\samplefile{ward}\par}
+\stopshapedparagraph
+
+\page
+
+\startshapedparagraph[width=4cm,lines=4]
+ \dorecurse{3}{\samplefile{ward}\par}
+\stopshapedparagraph
+\stopbuffer
+
+\typebuffer[jano]
+
+\startplacefigure[title={Flow around something},reference=fig:flow]
+ \startcombination[nx=3,ny=2]
+ {\typesetbuffer[jano][page=1,frame=on,width=\measure{combination}]}{}
+ {\typesetbuffer[jano][page=2,frame=on,width=\measure{combination}]}{}
+ {\typesetbuffer[jano][page=3,frame=on,width=\measure{combination}]}{}
+ {\typesetbuffer[jano][page=4,frame=on,width=\measure{combination}]}{}
+ {\typesetbuffer[jano][page=5,frame=on,width=\measure{combination}]}{}
+ {\typesetbuffer[jano][page=6,frame=on,width=\measure{combination}]}{}
+ \stopcombination
+\stopplacefigure
+
\stopsection
% \startsection[title=Linebreaks]
@@ -936,6 +999,18 @@ keyword in the next code. The result is shown in \in {figure} [fig:shape:skips].
\snapshotpar
\wrapuppar
+% \starttext
+% \tracingoutput1 \tracingonline1
+% \pretolerance9000 test \pretolerance8000 test \par
+% \pretolerance9000 test \pretolerance7000 \updateparagraphproperties test \par
+% \pretolerance9000 test \pretolerance6000 \snapshotpar\frozentolerancecode test \par
+% \pretolerance9000 test {\pretolerance5000 \snapshotpar\frozentolerancecode}test \par
+% \stoptext
+
+% \par[newgraf][16=1,17=1], .... pretolerance 9000, ....
+% \par[newgraf][16=1,17=1], .... pretolerance 7000, ....
+% \par[newgraf][16=1,17=1], .... pretolerance 6000, ....
+
% \parfillleftskip
% I rewarded myself after writing a section by watching the video "Final Thing On
@@ -946,3 +1021,5 @@ keyword in the next code. The result is shown in \in {figure} [fig:shape:skips].
% Gavin Harrison: Soundcheck, Drummerworld Jan 27, 2021 ... I wish I could make
% something called a check into pefect solo. Okay, another section and I'll check
% out the latest Simon Phillips and other favourite dummer uploads.
+
+
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-differences.tex b/doc/context/sources/general/manuals/luametatex/luametatex-differences.tex
index 5be5463e9..aaa2fce50 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-differences.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-differences.tex
@@ -6,8 +6,11 @@
\startchapter[reference=differences,title={Differences with \LUATEX}]
-As \LUAMETATEX\ is a leaner and meaner \LUATEX, this chapter will discuss
-what is gone. We start with the primitives that were dropped.
+As \LUAMETATEX\ is a leaner and meaner \LUATEX. This means that substantial parts and
+dependencies are gone: quite some font code, all backend code with related frontend
+code and of course image and font inclusion. There is also new functionality which
+makes for less lean but in the end we still have less, also in terms of dependencies.
+This chapter will discuss what is gone. We start with the primitives that were dropped.
\starttabulate[|l|pl|]
\BC fonts \NC \type {\letterspacefont}
@@ -97,6 +100,9 @@ as macros that (via \LUA) inject nodes in the input that suit the macro package
and backend. The three||letter direction primitives are gone and the numeric
variants are now leading. There is no need for page and body related directions
and they don't work well in \LUATEX\ anyway. We only have two directions left.
+Because we can hook in \LUA\ functions that get information about what is expected
+(consumer or provider) there are plenty possibilities for adding functionality
+using this scripting langauge.
The primitive related extensions were not that useful and reliable so they have
been removed. There are some new variants that will be discussed later. The \type
@@ -178,6 +184,13 @@ Because we use a more generic whatsit model, there is a new callback:
show_whatsit
\stoptyping
+Because tracing boxes now reports a lot more information, we have a plug in for
+detail:
+
+\starttyping
+get_attribute
+\stoptyping
+
Being the core of extensibility, the typesetting callbacks of course stayed. This
is what we ended up with:
@@ -195,12 +208,13 @@ 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. All input goes via \LUA, even the console.
+left. All input goes via \LUA, even the console. One can program a terminal if
+needed.
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 years of work to
-decide what to keep and how to do things. Of course there are places when things
-can be improved and it might happen in \LUAMETATEX. Contrary to what is sometimes
+fact that most was experimented with in \CONTEXT. It took many years to decide
+what to keep and how to do things. Of course there are places when things can be
+improved and it might happen in \LUAMETATEX. Contrary to what is sometimes
suggested, the \LUATEX|-|\CONTEXT\ \MKIV\ combination (assuming matched versions)
has been quite stable. It made no sense otherwise. Most \CONTEXT\ functionality
didn't change much at the user level. Of course there have been issues, as is
@@ -214,11 +228,13 @@ before a long term stable is defined. The good news is that, the source code
being part of the \CONTEXT\ distribution, there is always a properly working,
more or less long term stable, snapshot.
-The error reporting subsystem has been redone a little but is still fundamentally
-the same. We don't really assume interactive usage but if someone uses it, it
-might be noticed that it is not possible to backtrack or inject something. Of
-course it is no big deal to implement all that in \LUA\ if needed. It removes a
-system dependency and makes for a bit cleaner code.
+The error reporting subsystem has been redone quite a bit but is still
+fundamentally the same. We don't really assume interactive usage but if someone
+uses it, it might be noticed that it is not possible to backtrack or inject
+something. Of course it is no big deal to implement all that in \LUA\ if needed.
+It removes a system dependency and makes for a bit cleaner code. In \CONTEXT\
+we quit on an error simply because one has to fix source anyway and runs are
+fast enough.
There are new primitives as well as some extensions to existing primitive
functionality. These are described in following chapters but there might be
@@ -258,6 +274,7 @@ if luatex and luametatex then
context("The following primitives are available in \\LUATEX\\ but not in \\LUAMETATEX. ")
context("Some of these are emulated in \\CONTEXT.")
+ context.blank()
context.startcolumns { n = 2 }
for k, v in table.sortedhash(luatex) do
if not luametatex[k] then
@@ -266,13 +283,14 @@ if luatex and luametatex then
end
end
context.stopcolumns()
-
+ context.blank()
-- context.page()
context("The following primitives are available in \\LUAMETATEX\\ only. ")
context("At some point in time some might be added to \\LUATEX.")
+ context.blank()
context.startcolumns { n = 2 }
for k, v in table.sortedhash(luametatex) do
if not luatex[k] then
@@ -281,11 +299,73 @@ if luatex and luametatex then
end
end
context.stopcolumns()
+ context.blank()
end
\stopluacode
+As part of a bit more consistency some function names also changed. Names with an
+\type {_} got that removed (as that was the minority). It's easy to provide a
+back mapping if needed (just alias the functions).
+
+{\em Todo: only mention the \LUATEX\ ones.}
+
+\starttabulate[|l|l|l|l|]
+\DB library \BC old name \BC new name \BC comment \NC \NR
+\TB
+\NC language \NC clear_patterns \NC clearpatterns \NC \NR
+\NC \NC clear_hyphenation \NC clearhyphenation \NC \NR
+\NC mplib \NC italcor \NC italic \NC \NR
+\NC \NC pen_info \NC peninfo \NC \NR
+\NC \NC solve_path \NC solvepath \NC \NR
+\NC texio \NC write_nl \NC writenl \NC old name stays \NC \NR
+\NC node \NC protect_glyph \NC protectglyph \NC \NR
+\NC \NC protect_glyphs \NC protectglyphs \NC \NR
+\NC \NC unprotect_glyph \NC unprotectglyph \NC \NR
+\NC \NC unprotect_glyphs \NC unprotectglyphs \NC \NR
+\NC \NC end_of_math \NC endofmath \NC \NR
+\NC \NC mlist_to_hlist \NC mlisttohlist \NC \NR
+\NC \NC effective_glue \NC effectiveglue \NC \NR
+\NC \NC has_glyph \NC hasglyph \NC \NR
+\NC \NC first_glyph \NC firstglyph \NC \NR
+\NC \NC has_field \NC hasfield \NC \NR
+\NC \NC copy_list \NC copylist \NC \NR
+\NC \NC flush_node \NC flushnode \NC \NR
+\NC \NC flush_list \NC flushlist \NC \NR
+\NC \NC insert_before \NC insertbefore \NC \NR
+\NC \NC insert_after \NC insertafter \NC \NR
+\NC \NC last_node \NC lastnode \NC \NR
+\NC \NC is_zero_glue \NC iszeroglue \NC \NR
+\NC \NC make_extensible \NC makeextensible \NC \NR
+\NC \NC uses_font \NC usesfont \NC \NR
+\NC \NC is_char \NC ischar \NC \NR
+\NC \NC is_direct \NC isdirect \NC \NR
+\NC \NC is_glyph \NC isglyph \NC \NR
+\NC \NC is_node \NC isnode \NC \NR
+\NC token \NC scan_keyword \NC scankeyword \NC \NR
+\NC \NC scan_keywordcs \NC scankeywordcs \NC \NR
+\NC \NC scan_int \NC scanint \NC \NR
+\NC \NC scan_real \NC scanreal \NC \NR
+\NC \NC scan_float \NC scanfloat \NC \NR
+\NC \NC scan_dimen \NC scandimen \NC \NR
+\NC \NC scan_glue \NC scanglue \NC \NR
+\NC \NC scan_toks \NC scantoks \NC \NR
+\NC \NC scan_code \NC scancode \NC \NR
+\NC \NC scan_string \NC scanstring \NC \NR
+\NC \NC scan_argument \NC scanargument \NC \NR
+\NC \NC scan_word \NC scanword \NC \NR
+\NC \NC scan_csname \NC scancsname \NC \NR
+\NC \NC scan_list \NC scanlist \NC \NR
+\NC \NC scan_box \NC scanbox \NC \NR
+\LL
+\stoptabulate
+
+It's all part of trying to make the code base consistent but it is sometimes a
+bit annoying. However, that's why we develop this engine independent of the
+\LUATEX\ code base. It's anyway a change that has been on my todo list for quite
+a while because those inconsistencies annoyed me.
+
\stopchapter
\stopcomponent
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-internals.tex b/doc/context/sources/general/manuals/luametatex/luametatex-internals.tex
new file mode 100644
index 000000000..70d45cfeb
--- /dev/null
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-internals.tex
@@ -0,0 +1,244 @@
+% language=uk
+
+\environment luametatex-style
+
+\startcomponent luametatex-internals
+
+\startchapter[reference=internals,title={The internals}]
+
+\topicindex{nodes}
+\topicindex{boxes}
+\topicindex{\LUA}
+
+This is a reference manual and not a tutorial. This means that we discuss changes
+relative to traditional \TEX\ and also present new (or extended) functionality.
+As a consequence we will refer to concepts that we assume to be known or that
+might be explained later. Because the \LUATEX\ and \LUAMETATEX\ engines open up
+\TEX\ there's suddenly quite some more to explain, especially about the way a (to
+be) typeset stream moves through the machinery. However, discussing all that in
+detail makes not much sense, because deep knowledge is only relevant for those
+who write code not possible with regular \TEX\ and who are already familiar with
+these internals (or willing to spend time on figuring it out).
+
+So, the average user doesn't need to know much about what is in this manual. For
+instance fonts and languages are normally dealt with in the macro package that
+you use. Messing around with node lists is also often not really needed at the
+user level. If you do mess around, you'd better know what you're dealing with.
+Reading \quotation {The \TEX\ Book} by Donald Knuth is a good investment of time
+then also because it's good to know where it all started. A more summarizing
+overview is given by \quotation {\TEX\ by Topic} by Victor Eijkhout. You might
+want to peek in \quotation {The \ETEX\ manual} too.
+
+But \unknown\ if you're here because of \LUA, then all you need to know is that
+you can call it from within a run. If you want to learn the language, just read
+the well written \LUA\ book. The macro package that you use probably will provide
+a few wrapper mechanisms but the basic \lpr {directlua} command that does the job
+is:
+
+\starttyping
+\directlua{tex.print("Hi there")}
+\stoptyping
+
+You can put code between curly braces but if it's a lot you can also put it in a
+file and load that file with the usual \LUA\ commands. If you don't know what
+this means, you definitely need to have a look at the \LUA\ book first.
+
+If you still decide to read on, then it's good to know what nodes are, so we do a
+quick introduction here. If you input this text:
+
+\starttyping
+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 ...
+\stoptyping
+
+When we have a paragraph, we actually get something like this, where a \type
+{par} node stores some metadata and is followed by a \type {hlist} flagged as
+indent box:
+
+\starttyping
+[par] <=> [hlist] <=> H <=> i <=> [glue] <=> T <=> h <=> e <=> r <=> e ...
+\stoptyping
+
+Each character becomes a so called glyph node, a record with properties like the
+current font, the character code and the current language. Spaces become glue
+nodes. There are many node types and nodes can have many properties but that will
+be discussed later. Each node points back to a previous node or next node, given
+that these exist. Sometimes multiple characters are represented by one glyph
+(shape), so one can also get:
+
+\starttyping
+[par] <=> [hlist] <=> H <=> i <=> [glue] <=> Th <=> e <=> r <=> e ...
+\stoptyping
+
+And maybe some characters get positioned relative to each other, so we might
+see:
+
+\starttyping
+[par] <=> [hlist] <=> H <=> [kern] <=> i <=> [glue] <=> Th <=> e <=> r <=> e ...
+\stoptyping
+
+Actually, the above representation is one view, because in \LUAMETATEX\ we can
+choose for this:
+
+\starttyping
+[par] <=> [glue] <=> H <=> [kern] <=> i <=> [glue] <=> Th <=> e <=> r <=> e ...
+\stoptyping
+
+where glue (currently fixed) is used instead of an empty hlist (think of a \type
+{\hbox}). Options like this are available because want a certain view on these
+lists from the \LUA\ end and the result being predicable is part of that.
+
+It's also good to know beforehand that \TEX\ is basically centered around
+creating paragraphs and pages. The par builder takes a list and breaks it into
+lines. At some point horizontal blobs are wrapped into vertical ones. Lines are
+so called boxes and can be separated by glue, penalties and more. The page
+builder accumulates lines and when feasible triggers an output routine that will
+take the list so far. Constructing the actual page is not part of \TEX\ but done
+using primitives that permit manipulation of boxes. The result is handled back to
+\TEX\ and flushed to a (often \PDF) file.
+
+\starttyping
+\setbox\scratchbox\vbox\bgroup
+ line 1\par line 2
+\egroup
+
+\showbox\scratchbox
+\stoptyping
+
+The above code produces the next log lines that reveal how the engines sees a
+paragraph (wrapped in a \type {\vbox}):
+
+\starttyping[style=small]
+1:4: > \box257=
+1:4: \vbox[normal][16=1,17=1,47=1], width 483.69687, height 27.58083, depth 0.1416, direction l2r
+1:4: .\list
+1:4: ..\hbox[line][16=1,17=1,47=1], width 483.69687, height 7.59766, depth 0.1416, glue 455.40097fil, direction l2r
+1:4: ...\list
+1:4: ....\glue[left hang][16=1,17=1,47=1] 0.0pt
+1:4: ....\glue[left][16=1,17=1,47=1] 0.0pt
+1:4: ....\glue[parfillleft][16=1,17=1,47=1] 0.0pt
+1:4: ....\par[newgraf][16=1,17=1,47=1], hangafter 1, hsize 483.69687, pretolerance 100, tolerance 3000, adjdemerits 10000, linepenalty 10, doublehyphendemerits 10000, finalhyphendemerits 5000, clubpenalty 2000, widowpenalty 2000, brokenpenalty 100, emergencystretch 12.0, parfillskip 0.0pt plus 1.0fil, hyphenationmode 499519
+1:4: ....\glue[indent][16=1,17=1,47=1] 0.0pt
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+00006C l
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+000069 i
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+00006E n
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+000065 e
+1:4: ....\glue[space][16=1,17=1,47=1] 3.17871pt plus 1.58936pt minus 1.05957pt, font 30
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+000031 1
+1:4: ....\penalty[line][16=1,17=1,47=1] 10000
+1:4: ....\glue[parfill][16=1,17=1,47=1] 0.0pt plus 1.0fil
+1:4: ....\glue[right][16=1,17=1,47=1] 0.0pt
+1:4: ....\glue[right hang][16=1,17=1,47=1] 0.0pt
+1:4: ..\glue[par][16=1,17=1,47=1] 5.44995pt plus 1.81665pt minus 1.81665pt
+1:4: ..\glue[baseline][16=1,17=1,47=1] 6.79396pt
+1:4: ..\hbox[line][16=1,17=1,47=1], width 483.69687, height 7.59766, depth 0.1416, glue 455.40097fil, direction l2r
+1:4: ...\list
+1:4: ....\glue[left hang][16=1,17=1,47=1] 0.0pt
+1:4: ....\glue[left][16=1,17=1,47=1] 0.0pt
+1:4: ....\glue[parfillleft][16=1,17=1,47=1] 0.0pt
+1:4: ....\par[newgraf][16=1,17=1,47=1], hangafter 1, hsize 483.69687, pretolerance 100, tolerance 3000, adjdemerits 10000, linepenalty 10, doublehyphendemerits 10000, finalhyphendemerits 5000, clubpenalty 2000, widowpenalty 2000, brokenpenalty 100, emergencystretch 12.0, parfillskip 0.0pt plus 1.0fil, hyphenationmode 499519
+1:4: ....\glue[indent][16=1,17=1,47=1] 0.0pt
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+00006C l
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+000069 i
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+00006E n
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+000065 e
+1:4: ....\glue[space][16=1,17=1,47=1] 3.17871pt plus 1.58936pt minus 1.05957pt, font 30
+1:4: ....\glyph[32768][16=1,17=1,47=1], language (n=1,l=2,r=3), hyphenationmode 499519, options 128 , font <30: DejaVuSerif @ 10.0pt>, glyph U+000032 2
+1:4: ....\penalty[line][16=1,17=1,47=1] 10000
+1:4: ....\glue[parfill][16=1,17=1,47=1] 0.0pt plus 1.0fil
+1:4: ....\glue[right][16=1,17=1,47=1] 0.0pt
+1:4: ....\glue[right hang][16=1,17=1,47=1] 0.0pt
+\stoptyping
+
+The \LUATEX\ engine provides hooks for \LUA\ code at nearly every reasonable
+point in the process: collecting content, hyphenating, applying font features,
+breaking into lines, etc. This means that you can overload \TEX's natural
+behaviour, which still is the benchmark. When we refer to \quote {callbacks} we
+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 of ways to achieve goals. For that reason:
+take remarks about \LUATEX, features, potential, performance etc.\ with a natural
+grain of salt.
+
+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
+additional tools to make documents look good. They hide the dirty details of font
+management, language support, turning structure into typeset results, wrapping
+pages, including images, and so on. You should be aware of the fact that when you
+hook in your own code to manipulate lists, this can interfere with the macro
+package that you use. Each successive step expects a certain result and if you
+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
+what commands relate to them. Here are a few:
+
+\starttabulate[|l|l|p|]
+\DB command \BC node \BC explanation \NC \NR
+\TB
+\NC \prm {hbox} \NC \nod {hlist} \NC horizontal box \NC \NR
+\NC \prm {vbox} \NC \nod {vlist} \NC vertical box with the baseline at the bottom \NC \NR
+\NC \prm {vtop} \NC \nod {vlist} \NC vertical box with the baseline at the top \NC \NR
+\NC \prm {hskip} \NC \nod {glue} \NC horizontal skip with optional stretch and shrink \NC \NR
+\NC \prm {vskip} \NC \nod {glue} \NC vertical skip with optional stretch and shrink \NC \NR
+\NC \prm {kern} \NC \nod {kern} \NC horizontal or vertical fixed skip \NC \NR
+\NC \prm {discretionary} \NC \nod {disc} \NC hyphenation point (pre, post, replace) \NC \NR
+\NC \prm {char} \NC \nod {glyph} \NC a character \NC \NR
+\NC \prm {hrule} \NC \nod {rule} \NC a horizontal rule \NC \NR
+\NC \prm {vrule} \NC \nod {rule} \NC a vertical rule \NC \NR
+\NC \prm {textdirection} \NC \nod {dir} \NC a change in text direction \NC \NR
+\LL
+\stoptabulate
+
+Whatever we feed into \TEX\ at some point becomes a token which is either
+interpreted directly or stored in a linked list. A token is just a number that
+encodes a specific command (operator) and some value (operand) that further
+specifies what that command is supposed to do. In addition to an interface to
+nodes, there is an interface to tokens, as later chapters will demonstrate.
+
+Text (interspersed with macros) comes from an input medium. This can be a file,
+token list, macro body cq.\ arguments, some internal quantity (like a number),
+\LUA, etc. Macros get expanded. In the process \TEX\ can enter a group. Inside
+the group, changes to registers get saved on a stack, and restored after leaving
+the group. When conditionals are encountered, another kind of nesting happens,
+and again there is a stack involved. Tokens, expansion, stacks, input levels are
+all terms used in the next chapters. Don't worry, they loose their magic once you
+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 pack(ag)ing it can mean two things. When \TEX\ has consumed
+some tokens that represent text they are added to the current list. When the text
+is put into a so called \type {\hbox} (for instance a line in a paragraph) it
+(normally) first gets hyphenated, 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 information is stored in a leading \type {par} 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
+into builders. For now this should be enough to enable you to understand the next
+chapters. The text is not as enlightening and entertaining as Don Knuths books,
+sorry.
+
+\stopchapter
+
+\stopcomponent
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex b/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
index 2339bd342..f78b9f3e7 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-introduction.tex
@@ -6,7 +6,7 @@
\startchapter[title=Introduction]
-Around 2005 we started the \LUATEX\ projects and it took about a decade to reach
+Around 2005 we started the \LUATEX\ project and it took about a decade to reach
a state where we could consider the experiments to have reached a stable state.
Pretty soon \LUATEX\ could be used in production, even if some of the interfaces
evolved, but \CONTEXT\ was kept in sync so that was not really a problem. In 2018
@@ -16,17 +16,17 @@ reasonable feature complete. Among the reasons is that this engine is now used
outside \CONTEXT\ too which means that we cannot simply change much without
affecting other macro packages.
-However, in reaching that state some decisions were delayed because they didn't
-go well with a current stable version. This is why at the 2018 \CONTEXT\ meeting
-those present agreed that we could move on with a follow up tagged \METATEX, a
-name we already had in mind for a while, but as \LUA\ is an important component,
-it got expanded to \LUAMETATEX. This follow up is a lightweight companion to
-\LUATEX\ that will be maintained alongside. More about the reasons for this
-follow up as well as the philosophy behind it can be found in the document(s)
-describing the development. During \LUATEX\ development I kept track of what
-happened in a series of documents, parts of which were published as articles in
-user group journals, but all are in the \CONTEXT\ distribution. I did the same
-with the development of \LUAMETATEX.
+In reaching that state some decisions were delayed because they didn't go well
+with a current stable version. This is why at the 2018 \CONTEXT\ meeting those
+present agreed that we could move on with a follow up tagged \METATEX, a name we
+already had in mind for a while, but as \LUA\ is an important component, it got
+expanded to \LUAMETATEX. This follow up is a lightweight companion to \LUATEX\
+that will be maintained alongside. More about the reasons for this follow up as
+well as the philosophy behind it can be found in the document(s) describing the
+development. During \LUATEX\ development I kept track of what happened in a
+series of documents, parts of which were published as articles in user group
+journals, but all are in the \CONTEXT\ distribution. I did the same with the
+development of \LUAMETATEX.
The \LUAMETATEX\ engine is, as said, a follow up on \LUATEX. Just as we have
\CONTEXT\ \MKII\ for \PDFTEX\ and \XETEX, we have \MKIV\ for \LUATEX. For
@@ -42,18 +42,19 @@ ported back to \LUATEX, but only when there are good reasons for doing so and
when no compatibility issues are involved.
By now the code of these two related engines differs a lot so in retrospect it
-makes less sense to waste time on backporting anyway. When considering this
-follow up one consideration was that a lean and mean version with an extension
-mechanism is a bit closer to original \TEX. Of course, because we also have new
-primitives, this is not entirely true. The basic algorithms remain the same but
-code got reshuffled and because we expose internals names of variables and such
-are sometimes changed, something that is noticeable in the token and node
-interfaces. Delegating tasks to \LUA\ already meant that some aspects, especially
-system dependent ones, no longer made sense and therefore had consequences for
-the interface at the system level. In \LUAMETATEX\ more got delegated, like all
-file related operations. The penalty of moving more responsibility to \LUA\ has
+makes less sense to waste time on porting back. When considering this follow up
+one consideration was that a lean and mean version with an extension mechanism is
+a bit closer to original \TEX. Of course, because we also have new primitives,
+this is not entirely true. The basic algorithms remain the same but code got
+reshuffled and because we expose internal names of variables and such that is
+reflected in the code base (like more granularity in nodes and token commands).
+Delegating tasks to \LUA\ already meant that some aspects, especially system
+dependent ones, no longer made sense and therefore had consequences for the
+interface at the system level. In \LUAMETATEX\ more got delegated, like all file
+related operations. The penalty of moving even more responsibility to \LUA\ has
been compensated by (hopefully) harmless optimization of code in the engine and
-some more core functionality.
+some more core functionality. In the process system dependencies have been
+minimalized.
This manual started as an adaptation of the \LUATEX\ manual and therefore looks
similar. Some chapters are removed, others were added and the rest has been (and
@@ -70,11 +71,11 @@ mentioned, the \CONTEXT\ variant for this engine is tagged \LMTX. The pair can b
used in 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. Memory consumption is also less. The timeline of development is roughly:
-from 2018 upto 2020 engine development, 2019 upto 2021 the stepwise code split
-between \MKIV\ and \LMTX, while in 2020 we will (mostly) freeze \MKIV\ and \LMTX\
-will be the default.
+performance is much be better, due to some changes below the hood of the engine.
+Memory consumption is also less. The timeline of development is roughly: from
+2018 upto 2020 engine development, 2019 upto 2021 the stepwise code split between
+\MKIV\ and \LMTX, while in 2021 and 2022 we will (mostly) freeze \MKIV\ and
+\LMTX\ will be the default.
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
@@ -94,7 +95,7 @@ you can always consider contacting the developers.
% this 'always need to be present' negative remark (nagging) about the program,
% documentation, development, support, etc. present, probably to put the writer on
% a higher stand, or maybe to compensate some other personal shortcoming ... who
-% knows. This 'i need to make my stupid point' behaviour seems to come with the
+% knows. This 'I need to make my stupid point' behaviour seems to come with the
% internet and it also seems to increase, but that doesn't mean that I want to deal
% with those unpleasant people for the sake of the larger "tex good". Therefore, I'm
% quite happy in the nearly always positive and motivating ConTeXt bubble. It's also
@@ -136,14 +137,14 @@ real problem as there's not much demand for that anyway.
{\bf remark:} Most \CONTEXT\ users seem always willing to keep up with the latest
versions which means that \LMTX\ is tested well. We can therefore safely claim
-that end of 2019 the code has become quite stable. There are no complaints about
-performance (on my 2013 laptop this manual compiles at 24.5 pps with \LMTX\
-versus 20.7 pps for the \LUATEX\ manual with \MKIV). After updating some of the
-\CONTEXT\ code to use recently added features by the end of 2020 I could do more
-than 25.5 pps but don't expect spectacular bumps in performance (I need a new
-machine for that to happen). Probably no one notices it, but memory consumption
-stepwise got reduced too. And \unknown\ the binary is still below 3~MegaBytes on
-all platforms.
+that end of 2019 the code has become quite stable, although after that in some
+areas there were substantial additions. There are no complaints about performance
+(on my 2013 laptop this manual compiles at 24.5 pps with \LMTX\ versus 20.7 pps
+for the \LUATEX\ manual with \MKIV). After updating some of the \CONTEXT\ code to
+use recently added features by the end of 2020 I could do more than 25.5 pps but
+don't expect spectacular bumps in performance (I need a new machine for that to
+happen). Probably no one notices it, but memory consumption stepwise got reduced
+too. And \unknown\ the binary is still below 3~MegaBytes on all platforms.
\stopchapter
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex b/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
index b60079477..1adab5c3a 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-languages.tex
@@ -814,9 +814,9 @@ language.hyphenation( l, n)
When no string is given (the first example) a string with all exceptions is
returned.
-\subsection {\type {clear_hyphenation} and \type {clean}}
+\subsection {\type {clearhyphenation} and \type {clean}}
-\libindex {clear_hyphenation}
+\libindex {clearhyphenation}
\libindex {clean}
This either returns the current hyphenation exceptions for this language, or adds
@@ -824,7 +824,7 @@ new ones. The syntax of the string is explained in~\in {section}
[patternsexceptions].
\startfunctioncall
-language.clear_hyphenation( l)
+language.clearhyphenation( l)
\stopfunctioncall
This call clears the exception dictionary (string) for this language.
@@ -839,10 +839,10 @@ syntax of the argument string is explained in \in {section} [patternsexceptions]
This function is useful if you want to do something else based on the words in a
dictionary file, like spell|-|checking.
-\subsection {\type {patterns} and \type {clear_patterns}}
+\subsection {\type {patterns} and \type {clearpatterns}}
\libindex {patterns}
-\libindex {clear_patterns}
+\libindex {clearpatterns}
\startfunctioncall
n = language.patterns( l)
@@ -854,7 +854,7 @@ set. The syntax of this string is explained in \in {section}
[patternsexceptions].
\startfunctioncall
-language.clear_patterns( l)
+language.clearpatterns( l)
\stopfunctioncall
This can be used to clear the pattern dictionary for a language.
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-metapost.tex b/doc/context/sources/general/manuals/luametatex/luametatex-metapost.tex
index c687a5a46..646894dbd 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-metapost.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-metapost.tex
@@ -20,6 +20,9 @@
The \METAPOST\ library interface registers itself in the table \type {mplib}. It
is based on \MPLIB\ version \ctxlua {context(mplib.version())}.
+Not all functionality is described here. Once we're out of the experimental stage
+some more information will be added.
+
\subsection{\type {new}}
\libindex{new}
@@ -219,15 +222,13 @@ you can call:
\type {prologues} \NC \NR
\NC \type{objects} \NC function \NC returns the actual array of graphic objects in
this \type {fig} \NC \NR
-\NC \type{copy_objects} \NC function \NC returns a deep copy of the array of graphic
- objects in this \type {fig} \NC \NR
\NC \type{filename} \NC function \NC the filename this \type {fig}'s \POSTSCRIPT\
output would have written to in stand alone
mode \NC \NR
\NC \type{width} \NC function \NC the \type {fontcharwd} value \NC \NR
\NC \type{height} \NC function \NC the \type {fontcharht} value \NC \NR
\NC \type{depth} \NC function \NC the \type {fontchardp} value \NC \NR
-\NC \type{italcorr} \NC function \NC the \type {fontcharit} value \NC \NR
+\NC \type{italic} \NC function \NC the \type {fontcharit} value \NC \NR
\NC \type{charcode} \NC function \NC the (rounded) \type {charcode} value \NC \NR
\LL
\stoptabulate
@@ -409,11 +410,11 @@ and \quote {off}, values, and \type {offset} is the phase of the pattern.
\LL
\stoptabulate
-\subsection{Pens and \type {pen_info}}
+\subsection{Pens and \type {peninfo}}
-\libindex{pen_info}
+\libindex{peninfo}
-There is helper function (\type {pen_info(obj)}) that returns a table containing
+There is helper function (\type {peninfo(obj)}) that returns a table containing
a bunch of vital characteristics of the used pen (all values are floats):
\starttabulate[|l|l|p|]
@@ -457,20 +458,20 @@ still preliminary and mostly provided as reminder.
\starttabulate[|l|l|p|]
\DB scanner \BC argument \BC returns \NC \NR
\TB
-\NC \type{scan_next} \NC instance, keep \NC token, mode, type \NC \NR
-\NC \type{scan_expression} \NC instance, keep \NC type \NC \NR
-\NC \type{scan_token} \NC instance, keep \NC token, mode, kind \NC \NR
-\NC \type{scan_symbol} \NC instance, keep, expand \NC string \NC \NR
-\NC \type{scan_numeric} \NC instance, type \NC number \NC \NR
-\NC \type{scan_integer} \NC instance, type \NC integer \NC \NR
-\NC \type{scan_boolean} \NC instance, type \NC boolean \NC \NR
-\NC \type{scan_string} \NC instance, type \NC string \NC \NR
-\NC \type{scan_pair} \NC instance, hashed, type \NC table or two numbers \NC \NR
-\NC \type{scan_color} \NC instance, hashed, type \NC table or three numbers \NC \NR
-\NC \type{scan_cmykcolor} \NC instance, hashed, type \NC table or four numbers \NC \NR
-\NC \type{scan_transform} \NC instance, hashed, type \NC table or six numbers \NC \NR
-\NC \type{scan_path} \NC instance, hashed, type \NC table with hashes or arrays \NC \NR
-\NC \type{scan_pen} \NC instance, hashed, type \NC table with hashes or arrays \NC \NR
+\NC \type{scannext} \NC instance, keep \NC token, mode, type \NC \NR
+\NC \type{scanexpression} \NC instance, keep \NC type \NC \NR
+\NC \type{scantoken} \NC instance, keep \NC token, mode, kind \NC \NR
+\NC \type{scansymbol} \NC instance, keep, expand \NC string \NC \NR
+\NC \type{scannumeric} \NC instance, type \NC number \NC \NR
+\NC \type{scaninteger} \NC instance, type \NC integer \NC \NR
+\NC \type{scanboolean} \NC instance, type \NC boolean \NC \NR
+\NC \type{scanstring} \NC instance, type \NC string \NC \NR
+\NC \type{scanpair} \NC instance, hashed, type \NC table or two numbers \NC \NR
+\NC \type{scancolor} \NC instance, hashed, type \NC table or three numbers \NC \NR
+\NC \type{scancmykcolor} \NC instance, hashed, type \NC table or four numbers \NC \NR
+\NC \type{scantransform} \NC instance, hashed, type \NC table or six numbers \NC \NR
+\NC \type{scanpath} \NC instance, hashed, type \NC table with hashes or arrays \NC \NR
+\NC \type{scanpen} \NC instance, hashed, type \NC table with hashes or arrays \NC \NR
\LL
\stoptabulate
@@ -521,15 +522,15 @@ optimized. The other data structures were then added for completeness.}
\starttabulate[|l|l|]
\DB scanner \BC argument \NC \NR
\TB
-\NC \type{inject_numeric} \NC instance, number \NC \NR
-\NC \type{inject_integer} \NC instance, number \NC \NR
-\NC \type{inject_boolean} \NC instance, boolean \NC \NR
-\NC \type{inject_string} \NC instance, string \NC \NR
-\NC \type{inject_pair} \NC instance, (table with) two numbers \NC \NR
-\NC \type{inject_color} \NC instance, (table with) three numbers \NC \NR
-\NC \type{inject_cmykcolor} \NC instance, (table with) four numbers \NC \NR
-\NC \type{inject_transform} \NC instance, (table with) six numbers \NC \NR
-\NC \type{inject_path} \NC instance, table with hashes or arrays, cycle, variant \NC \NR
+\NC \type{injectnumeric} \NC instance, number \NC \NR
+\NC \type{injectinteger} \NC instance, number \NC \NR
+\NC \type{injectboolean} \NC instance, boolean \NC \NR
+\NC \type{injectstring} \NC instance, string \NC \NR
+\NC \type{injectpair} \NC instance, (table with) two numbers \NC \NR
+\NC \type{injectcolor} \NC instance, (table with) three numbers \NC \NR
+\NC \type{injectcmykcolor} \NC instance, (table with) four numbers \NC \NR
+\NC \type{injecttransform} \NC instance, (table with) six numbers \NC \NR
+\NC \type{injectpath} \NC instance, table with hashes or arrays, cycle, variant \NC \NR
\LL
\stoptabulate
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex b/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
index 6773d346d..bcdac0d39 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-nodes.tex
@@ -350,7 +350,7 @@ suits the \TEX\ internals well so we decided to stick to that naming.
The effective width of some glue subtypes depends on the stretch or shrink needed
to make the encapsulating box fit its dimensions. For instance, in a paragraph
lines normally have glue representing spaces and these stretch or shrink to make
-the content fit in the available space. The \type {effective_glue} function that
+the content fit in the available space. The \type {effectiveglue} function that
takes a glue node and a parent (hlist or vlist) returns the effective width of
that glue item. When you pass \type {true} as third argument the value will be
rounded.
@@ -1027,10 +1027,10 @@ there is no node with that id.
\stopsubsubsection
-\startsubsubsection[title={\type {fields} and \type {has_field}}]
+\startsubsubsection[title={\type {fields} and \type {hasfield}}]
\libindex {fields}
-\libindex {has_field}
+\libindex {hasfield}
This function returns an indexed table with valid field names for a particular
type of node.
@@ -1043,11 +1043,11 @@ The function accepts a string or number, so \typ {node.fields ("glyph")} returns
\inlineluavalue { node.fields ("glyph") } and \typ {node.fields (12)} gives
\inlineluavalue { node.fields (12) }.
-The \type {has_field} function returns a boolean that is only true if \type {n}
+The \type {hasfield} function returns a boolean that is only true if \type {n}
is actually a node, and it has the field.
\startfunctioncall
- t = node.has_field( n, field)
+ t = node.hasfield( n, field)
\stopfunctioncall
This function probably is not that useful but some nodes don't have a \type
@@ -1090,11 +1090,11 @@ back somehow.
\stopsubsubsection
-\startsubsubsection[title={\type {free}, \type {flush_node} and \type {flush_list}}]
+\startsubsubsection[title={\type {free}, \type {flushnode} and \type {flushlist}}]
\libindex{free}
-\libindex{flush_node}
-\libindex{flush_list}
+\libindex{flushnode}
+\libindex{flushlist}
The next one frees node \type {n} from \TEX's memory. Be careful: no checks are
done on whether this node is still pointed to from a register or some \type
@@ -1104,11 +1104,11 @@ you used their content for something else you need to set them to nil first.
\startfunctioncall
next = node.free( n)
-flush_node( n)
+flushnode( n)
\stopfunctioncall
The \type {free} function returns the next field of the freed node, while the
-\type {flush_node} alternative returns nothing.
+\type {flushnode} alternative returns nothing.
A list starting with node \type {n} can be flushed from \TEX's memory too. Be
careful: no checks are done on whether any of these nodes is still pointed to
@@ -1116,19 +1116,19 @@ from a register or some \type {next} field: it is up to you to make sure that th
internal data structures remain correct.
\startfunctioncall
-node.flush_list( n)
+node.flushlist( n)
\stopfunctioncall
-When you free for instance a discretionary node, \type {flush_list} is applied to
+When you free for instance a discretionary node, \type {flushlist} is applied to
the \type {pre}, \type {post}, \type {replace} so you don't need to do that
yourself. Assigning them \type {nil} won't free those lists!
\stopsubsubsection
-\startsubsubsection[title={\type {copy} and \type {copy_list}}]
+\startsubsubsection[title={\type {copy} and \type {copylist}}]
\libindex{copy}
-\libindex{copy_list}
+\libindex{copylist}
This creates a deep copy of node \type {n}, including all nested lists as in the case
of a hlist or vlist node. Only the \type {next} field is not copied.
@@ -1141,8 +1141,8 @@ A deep copy of the node list that starts at \type {n} can be created too. If
\type {m} is also given, the copy stops just before node \type {m}.
\startfunctioncall
- m = node.copy_list( n)
- m = node.copy_list( n, m)
+ m = node.copylist( n)
+ m = node.copylist( n, m)
\stopfunctioncall
Note that you cannot copy attribute lists this way. However, there is normally no
@@ -1248,12 +1248,12 @@ changed. When the third argument is passed, the node is freed.
\stopsubsubsection
-\startsubsubsection[title={\type {insert_before}}]
+\startsubsubsection[title={\type {insertbefore}}]
-\libindex {insert_before}
+\libindex {insertbefore}
\startfunctioncall
- head, new = node.insert_before( head, current, new)
+ head, new = node.insertbefore( head, current, new)
\stopfunctioncall
This function inserts the node \type {new} before \type {current} into the list
@@ -1265,12 +1265,12 @@ will become \type {new}.
\stopsubsubsection
-\startsubsubsection[title={\type {insert_after}}]
+\startsubsubsection[title={\type {insertafter}}]
-\libindex {insert_after}
+\libindex {insertafter}
\startfunctioncall
- head, new = node.insert_after( head, current, new)
+ head, new = node.insertafter( head, current, new)
\stopfunctioncall
This function inserts the node \type {new} after \type {current} into the list
@@ -1281,12 +1281,12 @@ field). If \type {head} is initially \type {nil}, it will become \type {new}.
\stopsubsubsection
-\startsubsubsection[title={\type {last_node}}]
+\startsubsubsection[title={\type {lastnode}}]
-\libindex {last_node}
+\libindex {lastnode}
\startfunctioncall
- n = node.last_node()
+ n = node.lastnode()
\stopfunctioncall
This function pops the last node from \TEX's \quote{current list}. It returns
@@ -1559,15 +1559,15 @@ glue and the sign.
\stopsubsubsection
-\startsubsubsection[title={\type {is_zero_glue}}]
+\startsubsubsection[title={\type {iszeroglue}}]
-\libindex {is_zero_glue}
+\libindex {iszeroglue}
This function returns \type {true} when the width, stretch and shrink properties
are zero.
\startfunctioncall
- isglue = node.is_zero_glue( n)
+ isglue = node.iszeroglue( n)
\stopfunctioncall
\stopsubsubsection
@@ -1626,23 +1626,23 @@ and there is no double linked list.
\stopsubsubsection
-\startsubsubsection[title={\type {current_attr}}]
+\startsubsubsection[title={\type {currentattr}}]
-\libindex{current_attr}
+\libindex{currentattr}
This returns the currently active list of attributes, if there is one.
\startfunctioncall
- m = node.current_attr()
+ m = node.currentattr()
\stopfunctioncall
-The intended usage of \type {current_attr} is as follows:
+The intended usage of \type {currentattr} is as follows:
\starttyping
local x1 = node.new("glyph")
-x1.attr = node.current_attr()
+x1.attr = node.currentattr()
local x2 = node.new("glyph")
-x2.attr = node.current_attr()
+x2.attr = node.currentattr()
\stoptyping
or:
@@ -1650,7 +1650,7 @@ or:
\starttyping
local x1 = node.new("glyph")
local x2 = node.new("glyph")
-local ca = node.current_attr()
+local ca = node.currentattr()
x1.attr = ca
x2.attr = ca
\stoptyping
@@ -1662,13 +1662,13 @@ passed back to \TEX.
\stopsubsubsection
-\startsubsubsection[title={\type {has_attribute}}]
+\startsubsubsection[title={\type {hasattribute}}]
-\libindex {has_attribute}
+\libindex {hasattribute}
\startfunctioncall
- v = node.has_attribute( n, id)
- v = node.has_attribute( n, id, val)
+ v = node.hasattribute( n, id)
+ v = node.hasattribute( n, id, val)
\stopfunctioncall
Tests if a node has the attribute with number \type {id} set. If \type {val} is
@@ -1677,12 +1677,12 @@ or, if no match is found, \type {nil}.
\stopsubsubsection
-\startsubsubsection[title={\type {get_attribute}}]
+\startsubsubsection[title={\type {getattribute}}]
-\libindex {get_attribute}
+\libindex {getattribute}
\startfunctioncall
- v = node.get_attribute( n, id)
+ v = node.getattribute( n, id)
\stopfunctioncall
Tests if a node has an attribute with number \type {id} set. It returns the
@@ -1691,12 +1691,12 @@ zero attributes is assumed.
\stopsubsubsection
-\startsubsubsection[title={\type {find_attribute}}]
+\startsubsubsection[title={\type {findattribute}}]
-\libindex {find_attribute}
+\libindex {findattribute}
\startfunctioncall
- v, n = node.find_attribute( n, id)
+ v, n = node.findattribute( n, id)
\stopfunctioncall
Finds the first node that has attribute with number \type {id} set. It returns
@@ -1704,12 +1704,12 @@ the value and the node if there is a match and otherwise nothing.
\stopsubsubsection
-\startsubsubsection[title={\type {set_attribute}}]
+\startsubsubsection[title={\type {setattribute}}]
-\libindex {set_attribute}
+\libindex {setattribute}
\startfunctioncall
-node.set_attribute( n, id, val)
+node.setattribute( n, id, val)
\stopfunctioncall
Sets the attribute with number \type {id} to the value \type {val}. Duplicate
@@ -1717,15 +1717,15 @@ assignments are ignored.
\stopsubsubsection
-\startsubsubsection[title={\type {unset_attribute}}]
+\startsubsubsection[title={\type {unsetattribute}}]
-\libindex {unset_attribute}
+\libindex {unsetattribute}
\startfunctioncall
v =
- node.unset_attribute( n, id)
+ node.unsetattribute( n, id)
v =
- node.unset_attribute( n, id, val)
+ node.unsetattribute( n, id, val)
\stopfunctioncall
Unsets the attribute with number \type {id}. If \type {val} is also supplied, it
@@ -1741,13 +1741,13 @@ If the attribute was actually deleted, returns its old value. Otherwise, returns
\startsubsection[title={Glyph handling}][library=node]
-\startsubsubsection[title={\type {first_glyph}}]
+\startsubsubsection[title={\type {firstglyph}}]
-\libindex {first_glyph}
+\libindex {firstglyph}
\startfunctioncall
- n = node.first_glyph( n)
- n = node.first_glyph( n, m)
+ n = node.firstglyph( n)
+ n = node.firstglyph( n, m)
\stopfunctioncall
Returns the first node in the list starting at \type {n} that is a glyph node
@@ -1772,14 +1772,14 @@ or not.
\stopsubsubsection
-\startsubsubsection[title={\type {has_glyph}}]
+\startsubsubsection[title={\type {hasglyph}}]
-\libindex {has_glyph}
+\libindex {hasglyph}
This function returns the first glyph or disc node in the given list:
\startfunctioncall
- n = node.has_glyph( n)
+ n = node.hasglyph( n)
\stopfunctioncall
\stopsubsubsection
@@ -1815,14 +1815,14 @@ word boundaries are possible).
\stopsubsubsection
-\startsubsubsection[title={\type {unprotect_glyph[s]}}]
+\startsubsubsection[title={\type {unprotectglyph[s]}}]
-\libindex {unprotect_glyphs}
-\libindex {unprotect_glyph}
+\libindex {unprotectglyphs}
+\libindex {unprotectglyph}
\startfunctioncall
-node.unprotect_glyph( n)
-node.unprotect_glyphs( n,[ n])
+node.unprotectglyph( n)
+node.unprotectglyphs( n,[ n])
\stopfunctioncall
Subtracts 256 from all glyph node subtypes. This and the next function are
@@ -1831,14 +1831,14 @@ processing. The second argument is optional and indicates the end of a range.
\stopsubsubsection
-\startsubsubsection[title={\type {protect_glyph[s]}}]
+\startsubsubsection[title={\type {protectglyph[s]}}]
-\libindex {protect_glyphs}
-\libindex {protect_glyph}
+\libindex {protectglyphs}
+\libindex {protectglyph}
\startfunctioncall
-node.protect_glyph( n)
-node.protect_glyphs( n,[ n])
+node.protectglyph( n)
+node.protectglyphs( n,[ n])
\stopfunctioncall
Adds 256 to all glyph node subtypes in the node list starting at \type {n},
@@ -1849,12 +1849,12 @@ optional and indicates the end of a range.
\stopsubsubsection
-\startsubsubsection[title={\type {protrusion_skippable}}]
+\startsubsubsection[title={\type {protrusionskippable}}]
-\libindex {protrusion_skippable}
+\libindex {protrusionskippable}
\startfunctioncall
- skippable = node.protrusion_skippable( n)
+ skippable = node.protrusionskippable( n)
\stopfunctioncall
Returns \type {true} if, for the purpose of line boundary discovery when
@@ -1862,10 +1862,10 @@ character protrusion is active, this node can be skipped.
\stopsubsubsection
-\startsubsubsection[title={\type {check_discretionary}, \type {check_discretionaries}}]
+\startsubsubsection[title={\type {checkdiscretionary}, \type {checkdiscretionaries}}]
-\libindex{check_discretionary}
-\libindex{check_discretionaries}
+\libindex{checkdiscretionary}
+\libindex{checkdiscretionaries}
When you fool around with disc nodes you need to be aware of the fact that they
have a special internal data structure. As long as you reassign the fields when
@@ -1875,8 +1875,8 @@ the linebreak routine kicks in. You can call this function to check the list for
issues with disc nodes.
\startfunctioncall
-node.check_discretionary( n)
-node.check_discretionaries( head)
+node.checkdiscretionary( n)
+node.checkdiscretionaries( head)
\stopfunctioncall
The plural variant runs over all disc nodes in a list, the singular variant
@@ -1884,15 +1884,15 @@ checks one node only (it also checks if the node is a disc node).
\stopsubsubsection
-\startsubsubsection[title={\type {flatten_discretionaries}}]
+\startsubsubsection[title={\type {flattendiscretionaries}}]
-\libindex {flatten_discretionaries}
+\libindex {flattendiscretionaries}
This function will remove the discretionaries in the list and inject the replace
field when set.
\startfunctioncall
- head, count = node.flatten_discretionaries( n)
+ head, count = node.flattendiscretionaries( n)
\stopfunctioncall
\stopsubsubsection
@@ -2040,18 +2040,18 @@ A simple and somewhat more efficient variant is this:
\startsubsection[title={Math}][library=node]
-\startsubsubsection[title={\type {mlist_to_hlist}}]
+\startsubsubsection[title={\type {mlisttohlist}}]
-\libindex {mlist_to_hlist}
+\libindex {mlisttohlist}
\startfunctioncall
h =
- node.mlist_to_hlist( n, display_type, penalties)
+ node.mlisttohlist( n, display_type, penalties)
\stopfunctioncall
This runs the internal mlist to hlist conversion, converting the math list in
\type {n} into the horizontal list \type {h}. The interface is exactly the same
-as for the callback \cbk {mlist_to_hlist}.
+as for the callback \cbk {mlisttohlist}.
\stopsubsubsection
@@ -2204,28 +2204,28 @@ emulated in \LUA\ and not in the engine, so we retain downward compatibility.
\starttabulate[|l|c|c|]
\DB function \BC node \BC direct \NC emulated \NC \NR
\TB
-\supported {check_discretionaries} \nop \yes \yes
-\supported {check_discretionary} \nop \yes \yes
-\supported {copy_list} \yes \yes \relax
-%supported {copy_only} \nop \yes \relax
+\supported {checkdiscretionaries} \nop \yes \yes
+\supported {checkdiscretionary} \nop \yes \yes
+\supported {copylist} \yes \yes \relax
+%supported {copyonly} \nop \yes \relax
\supported {copy} \yes \yes \relax
\supported {count} \nop \yes \yes
-\supported {current_attributes} \yes \yes \relax
+\supported {currentattributes} \yes \yes \relax
\supported {dimensions} \nop \yes \yes
-\supported {effective_glue} \nop \yes \yes
-\supported {end_of_math} \nop \yes \yes
-\supported {find_attribute_range} \nop \yes \relax
-\supported {find_attribute} \nop \yes \yes
-\supported {find_node} \nop \yes \relax
-\supported {first_glyph} \nop \yes \yes
-\supported {flatten_discretionaries} \nop \yes \yes
-\supported {flush_list} \yes \yes \relax
-\supported {flush_node} \yes \yes \relax
+\supported {effectiveglue} \nop \yes \yes
+\supported {endofmath} \nop \yes \yes
+\supported {findattributerange} \nop \yes \relax
+\supported {findattribute} \nop \yes \yes
+\supported {findnode} \nop \yes \relax
+\supported {firstglyph} \nop \yes \yes
+\supported {flattendiscretionaries} \nop \yes \yes
+\supported {flushlist} \yes \yes \relax
+\supported {flushnode} \yes \yes \relax
\supported {free} \yes \yes \relax
-\supported {get_attributes} \nop \yes \relax
-\supported {get_attribute} \yes \yes \relax
-\supported {get_properties_table} \yes \yes \relax
-\supported {get_synctex_fields} \nop \yes \relax
+\supported {getattributes} \nop \yes \relax
+\supported {getattribute} \yes \yes \relax
+\supported {getpropertiestable} \yes \yes \relax
+\supported {getsynctexfields} \nop \yes \relax
\supported {getattributelist} \nop \yes \relax
\supported {getboth} \nop \yes \relax
\supported {getbox} \nop \yes \relax
@@ -2280,44 +2280,44 @@ emulated in \LUA\ and not in the engine, so we retain downward compatibility.
\supported {getxscale} \nop \yes \relax
\supported {getxyscale} \nop \yes \relax
\supported {getyscale} \nop \yes \relax
-\supported {has_attribute} \yes \yes \relax
-\supported {has_dimensions} \nop \yes \relax
-\supported {has_field} \yes \yes \relax
-\supported {has_glyph_option} \nop \yes \yes
-\supported {has_glyph} \nop \yes \yes
+\supported {hasattribute} \yes \yes \relax
+\supported {hasdimensions} \nop \yes \relax
+\supported {hasfield} \yes \yes \relax
+\supported {hasglyphoption} \nop \yes \yes
+\supported {hasglyph} \nop \yes \yes
\supported {hpack} \nop \yes \yes
\supported {hyphenating} \nop \yes \yes
-\supported {ignore_math_skip} \nop \yes \relax
-\supported {insert_after} \yes \yes \relax
-\supported {insert_before} \yes \yes \relax
-\supported {is_char} \nop \yes \relax
-\supported {is_direct} \nop \yes \relax
-\supported {is_glyph} \nop \yes \relax
-\supported {is_next_char} \nop \yes \relax
-\supported {is_next_glyph} \nop \yes \relax
-\supported {is_node} \yes \yes \relax
-\supported {is_prev_char} \nop \yes \relax
-\supported {is_prev_glyph} \nop \yes \relax
-\supported {is_valid} \nop \yes \relax
-\supported {is_zero_glue} \nop \yes \yes
+\supported {ignoremathskip} \nop \yes \relax
+\supported {insertafter} \yes \yes \relax
+\supported {insertbefore} \yes \yes \relax
+\supported {ischar} \nop \yes \relax
+\supported {isdirect} \nop \yes \relax
+\supported {isglyph} \nop \yes \relax
+\supported {isnextchar} \nop \yes \relax
+\supported {isnextglyph} \nop \yes \relax
+\supported {isnode} \yes \yes \relax
+\supported {isprevchar} \nop \yes \relax
+\supported {isprevglyph} \nop \yes \relax
+\supported {isvalid} \nop \yes \relax
+\supported {iszeroglue} \nop \yes \yes
\supported {kerning} \nop \yes \yes
-\supported {last_node} \nop \yes \yes
+\supported {lastnode} \nop \yes \yes
\supported {length} \nop \yes \yes
\supported {ligaturing} \nop \yes \yes
-\supported {make_extensible} \nop \yes \yes
+\supported {makeextensible} \nop \yes \yes
\supported {migrate} \nop \yes \relax
-\supported {mlist_to_hlist} \nop \yes \yes
+\supported {mlisttohlist} \nop \yes \yes
\supported {naturalwidth} \nop \yes \yes
\supported {new} \yes \yes \relax
%supported {prepend_prevdepth} \nop \yes \yes
-\supported {protect_glyphs} \nop \yes \yes
-\supported {protect_glyph} \nop \yes \yes
-\supported {protrusion_skippable} \nop \yes \yes
+\supported {protectglyphs} \nop \yes \yes
+\supported {protectglyph} \nop \yes \yes
+\supported {protrusionskippable} \nop \yes \yes
\supported {rangedimensions} \nop \yes \yes
\supported {remove} \yes \yes \relax
-\supported {set_attributes} \nop \yes \relax
-\supported {set_attribute} \yes \yes \relax
-\supported {set_synctex_fields} \nop \yes \relax
+\supported {setattributes} \nop \yes \relax
+\supported {setattribute} \yes \yes \relax
+\supported {setsynctexfields} \nop \yes \relax
\supported {setattributelist} \nop \yes \relax
\supported {setboth} \nop \yes \relax
\supported {setbox} \nop \yes \relax
@@ -2365,7 +2365,7 @@ emulated in \LUA\ and not in the engine, so we retain downward compatibility.
\supported {setwhd} \nop \yes \relax
\supported {setwidth} \nop \yes \relax
\supported {slide} \nop \yes \yes
-\supported {start_of_par} \nop \yes \relax
+\supported {startofpar} \nop \yes \relax
\supported {subtype} \nop \nop \relax
\supported {tail} \yes \yes \relax
\supported {todirect} \nop \yes \relax
@@ -2380,13 +2380,13 @@ emulated in \LUA\ and not in the engine, so we retain downward compatibility.
\supported {traverse_list} \yes \yes \relax
\supported {traverse} \yes \yes \relax
\supported {type} \yes \nop \relax
-\supported {unprotect_glyphs} \nop \yes \yes
-\supported {unprotect_glyph} \nop \yes \yes
-\supported {unset_attributes} \nop \yes \relax
-\supported {unset_attribute} \yes \yes \relax
+\supported {unprotectglyphs} \nop \yes \yes
+\supported {unprotectglyph} \nop \yes \yes
+\supported {unsetattributes} \nop \yes \relax
+\supported {unsetattribute} \yes \yes \relax
\supported {usedlist} \nop \yes \yes
-\supported {uses_font} \nop \yes \yes
-\supported {vertical_break} \nop \yes \relax
+\supported {usesfont} \nop \yes \yes
+\supported {verticalbreak} \nop \yes \relax
\supported {vpack} \nop \yes \yes
\supported {write} \yes \yes \relax
\LL
@@ -2425,9 +2425,9 @@ number, for a glue, kern, hlist, vlist, rule and math nodes as well as glyph
nodes (although this last one is not used in native \SYNCTEX).
\startfunctioncall
-node.set_synctex_fields( f, l)
+node.setsynctexfields( f, l)
f, l =
- node.get_synctex_fields( n)
+ node.getsynctexfields( n)
\stopfunctioncall
Of course you need to know what you're doing as no checking on sane values takes
@@ -2477,9 +2477,8 @@ This is experimental code and might take a while to become frozen.
\topicindex {nodes+properties}
\topicindex {properties}
-\libindex{flush_properties_table}
-\libindex{get_properties_table}
-\libindex{set_properties_mode}
+\libindex{getpropertiestable}
+\libindex{setpropertiesmode}
Attributes are a convenient way to relate extra information to a node. You can
assign them at the \TEX\ end as well as at the \LUA\ end and consult them at the
@@ -2576,8 +2575,7 @@ with \CONTEXT\ uses the \type {injections} subtable and you should not mess with
that one!
There are a few helper functions that you normally should not touch as user: \typ
-{flush_properties_table} will wipe the table (normally a bad idea), \typ
-{get_properties_table} and will give the table that stores properties (using
+{getpropertiestable} and will give the table that stores properties (using
direct entries) and you can best not mess too much with that one either because
\LUATEX\ itself will make sure that entries related to nodes will get wiped when
nodes get freed, so that the \LUA\ garbage collector can do its job. In fact, the
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex b/doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex
deleted file mode 100644
index 5a2dae818..000000000
--- a/doc/context/sources/general/manuals/luametatex/luametatex-preamble.tex
+++ /dev/null
@@ -1,189 +0,0 @@
-% language=uk
-
-\environment luametatex-style
-
-\startcomponent luametatex-preamble
-
-\startchapter[reference=preamble,title={The internals}]
-
-\topicindex{nodes}
-\topicindex{boxes}
-\topicindex{\LUA}
-
-This is a reference manual and not a tutorial. This means that we discuss changes
-relative to traditional \TEX\ and also present new (or extended) functionality.
-As a consequence we will refer to concepts that we assume to be known or that
-might be explained later. Because the \LUATEX\ and \LUAMETATEX\ engines open up
-\TEX\ there's suddenly quite some more to explain, especially about the way a (to
-be) typeset stream moves through the machinery. However, discussing all that in
-detail makes not much sense, because deep knowledge is only relevant for those
-who write code not possible with regular \TEX\ and who are already familiar with
-these internals (or willing to spend time on figuring it out).
-
-So, the average user doesn't need to know much about what is in this manual. For
-instance fonts and languages are normally dealt with in the macro package that
-you use. Messing around with node lists is also often not really needed at the
-user level. If you do mess around, you'd better know what you're dealing with.
-Reading \quotation {The \TEX\ Book} by Donald Knuth is a good investment of time
-then also because it's good to know where it all started. A more summarizing
-overview is given by \quotation {\TEX\ by Topic} by Victor Eijkhout. You might
-want to peek in \quotation {The \ETEX\ manual} too.
-
-But \unknown\ if you're here because of \LUA, then all you need to know is that
-you can call it from within a run. If you want to learn the language, just read
-the well written \LUA\ book. The macro package that you use probably will provide
-a few wrapper mechanisms but the basic \lpr {directlua} command that does the job
-is:
-
-\starttyping
-\directlua{tex.print("Hi there")}
-\stoptyping
-
-You can put code between curly braces but if it's a lot you can also put it in a
-file and load that file with the usual \LUA\ commands. If you don't know what
-this means, you definitely need to have a look at the \LUA\ book first.
-
-If you still decide to read on, then it's good to know what nodes are, so we do a
-quick introduction here. If you input this text:
-
-\starttyping
-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 ...
-\stoptyping
-
-When we have a paragraph, we actually get something like this, where a \type
-{par} node stores some metadata and is followed by a \type {hlist} flagged as
-indent box:
-
-\starttyping
-[par] <=> [hlist] <=> H <=> i <=> [glue] <=> T <=> h <=> e <=> r <=> e ...
-\stoptyping
-
-Each character becomes a so called glyph node, a record with properties like the
-current font, the character code and the current language. Spaces become glue
-nodes. There are many node types that we will discuss later. Each node points
-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
-[par] <=> [hlist] <=> H <=> i <=> [glue] <=> Th <=> e <=> r <=> e ...
-\stoptyping
-
-And maybe some characters get positioned relative to each other, so we might
-see:
-
-\starttyping
-[par] <=> [hlist] <=> H <=> [kern] <=> i <=> [glue] <=> Th <=> e <=> r <=> e ...
-\stoptyping
-
-Actually, the above representation is one view, because in \LUAMETATEX\ we can
-choose for this:
-
-\starttyping
-[par] <=> [glue] <=> H <=> [kern] <=> i <=> [glue] <=> Th <=> e <=> r <=> e ...
-\stoptyping
-
-where glue (currently fixed) is used instead of an empty hlist (think of a \type
-{\hbox}). Options like this are available because want a certain view on these
-lists from the \LUA\ end and the result being predicable is part of that.
-
-It's also good to know beforehand that \TEX\ is basically centered around
-creating paragraphs and pages. The par builder takes a list and breaks it into
-lines. At some point horizontal blobs are wrapped into vertical ones. Lines are
-so called boxes and can be separated by glue, penalties and more. The page
-builder accumulates lines and when feasible triggers an output routine that will
-take the list so far. Constructing the actual page is not part of \TEX\ but done
-using primitives that permit manipulation of boxes. The result is handled back to
-\TEX\ and flushed to a (often \PDF) file.
-
-The \LUATEX\ engine provides hooks for \LUA\ code at nearly every reasonable
-point in the process: collecting content, hyphenating, applying font features,
-breaking into lines, etc. This means that you can overload \TEX's natural
-behaviour, which still is the benchmark. When we refer to \quote {callbacks} we
-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. For that reason:
-take remarks about \LUATEX, features, potential, performance etc.\ with a natural
-grain of salt.
-
-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
-additional tools to make documents look good. They hide the dirty details of font
-management, language demands, turning structure into typeset results, wrapping
-pages, including images, and so on. You should be aware of the fact that when you
-hook in your own code to manipulate lists, this can interfere with the macro
-package that you use. Each successive step expects a certain result and if you
-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
-what commands relate to them. Here are a few:
-
-\starttabulate[|l|l|p|]
-\DB command \BC node \BC explanation \NC \NR
-\TB
-\NC \prm {hbox} \NC \nod {hlist} \NC horizontal box \NC \NR
-\NC \prm {vbox} \NC \nod {vlist} \NC vertical box with the baseline at the bottom \NC \NR
-\NC \prm {vtop} \NC \nod {vlist} \NC vertical box with the baseline at the top \NC \NR
-\NC \prm {hskip} \NC \nod {glue} \NC horizontal skip with optional stretch and shrink \NC \NR
-\NC \prm {vskip} \NC \nod {glue} \NC vertical skip with optional stretch and shrink \NC \NR
-\NC \prm {kern} \NC \nod {kern} \NC horizontal or vertical fixed skip \NC \NR
-\NC \prm {discretionary} \NC \nod {disc} \NC hyphenation point (pre, post, replace) \NC \NR
-\NC \prm {char} \NC \nod {glyph} \NC a character \NC \NR
-\NC \prm {hrule} \NC \nod {rule} \NC a horizontal rule \NC \NR
-\NC \prm {vrule} \NC \nod {rule} \NC a vertical rule \NC \NR
-\NC \prm {textdirection} \NC \nod {dir} \NC a change in text direction \NC \NR
-\LL
-\stoptabulate
-
-Whatever we feed into \TEX\ at some point becomes a token which is either
-interpreted directly or stored in a linked list. A token is just a number that
-encodes a specific command (operator) and some value (operand) that further
-specifies what that command is supposed to do. In addition to an interface to
-nodes, there is an interface to tokens, as later chapters will demonstrate.
-
-Text (interspersed with macros) comes from an input medium. This can be a file,
-token list, macro body cq.\ arguments, \ some internal quantity (like a number),
-\LUA, etc. Macros get expanded. In the process \TEX\ can enter a group. Inside
-the group, changes to registers get saved on a stack, and restored after leaving
-the group. When conditionals are encountered, another kind of nesting happens,
-and again there is a stack involved. Tokens, expansion, stacks, input levels are
-all terms used in the next chapters. Don't worry, they loose their magic once you
-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 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 information is stored in a leading \type {par} 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
-into builders. For now this should be enough to enable you to understand the next
-chapters. The text is not as enlightening and entertaining as Don Knuths books,
-sorry.
-
-\stopchapter
-
-\stopcomponent
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex b/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
index 503bbfd82..decabbca7 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-tex.tex
@@ -1637,61 +1637,35 @@ debugging and the (relative state) numbers can change with the implementation.
\stopsubsection
-\startsubsection[title={Randomizers}]
-
-\libindex{lua_math_random}
-\libindex{lua_math_randomseed}
-\libindex{init_rand}
-\libindex{normal_rand}
-\libindex{uniform_rand}
-\libindex{uniformdeviate}
-
-For practical reasons \LUATEX\ has its own random number generator. The original
-\LUA\ random function is available as \typ {tex.lua_math_random}. You can
-initialize with a new seed with \type {init_rand} (\typ {lua_math_randomseed} is
-equivalent to this one).
-
-There are three generators: \type {normal_rand} (no argument is used), \type
-{uniform_rand} (takes a number that will get rounded before being used) and \type
-{uniformdeviate} which behaves like the primitive and expects a scaled integer, so
-
-\startfunctioncall
-tex.print(tex.uniformdeviate(65536)/65536)
-\stopfunctioncall
-
-will give a random number between zero and one.
-
-\stopsubsection
-
\startsubsection[reference=synctex,title={Functions related to synctex}]
\topicindex {synctex}
-\libindex{set_synctex_mode} \libindex{get_synctex_mode}
-\libindex{set_synctex_no_files}
-\libindex{set_synctex_tag} \libindex{get_synctex_tag} \libindex{force_synctex_tag}
-\libindex{set_synctex_line} \libindex{get_synctex_line} \libindex{force_synctex_line}
+\libindex{setsynctexmode} \libindex{getsynctexmode}
+\libindex{setsynctexnofiles}
+\libindex{setsynctextag} \libindex{getsynctextag} \libindex{forcesynctextag}
+\libindex{setsynctexline} \libindex{getsynctexline} \libindex{forcesynctexline}
The next helpers only make sense when you implement your own synctex logic. Keep in
mind that the library used in editors assumes a certain logic and is geared for
plain and \LATEX, so after a decade users expect a certain behaviour.
\starttabulate[|l|p|]
-\DB name \BC explanation \NC \NR
+\DB name \BC explanation \NC \NR
\TB
-\NC \type{set_synctex_mode} \NC \type {0} is the default and used normal synctex
- logic, \type {1} uses the values set by the next
- helpers while \type {2} also sets these for glyph
- nodes; \type{3} sets glyphs and glue and \type {4}
- sets only glyphs \NC \NR
-\NC \type{set_synctex_tag} \NC set the current tag (file) value (obeys save stack) \NC \NR
-\NC \type{set_synctex_line} \NC set the current line value (obeys save stack) \NC \NR
-\NC \type{set_synctex_no_files} \NC disable synctex file logging \NC \NR
-\NC \type{get_synctex_mode} \NC returns the current mode (for values see above) \NC \NR
-\NC \type{get_synctex_tag} \NC get the currently set value of tag (file) \NC \NR
-\NC \type{get_synctex_line} \NC get the currently set value of line \NC \NR
-\NC \type{force_synctex_tag} \NC overload the tag (file) value (\type {0} resets) \NC \NR
-\NC \type{force_synctex_line} \NC overload the line value (\type {0} resets) \NC \NR
+\NC \type{setsynctexmode} \NC \type {0} is the default and used normal synctex
+ logic, \type {1} uses the values set by the next
+ helpers while \type {2} also sets these for glyph
+ nodes; \type{3} sets glyphs and glue and \type {4}
+ sets only glyphs \NC \NR
+\NC \type{setsynctextag} \NC set the current tag (file) value (obeys save stack) \NC \NR
+\NC \type{setsynctexline} \NC set the current line value (obeys save stack) \NC \NR
+\NC \type{setsynctexnofiles} \NC disable synctex file logging \NC \NR
+\NC \type{getsynctexmode} \NC returns the current mode (for values see above) \NC \NR
+\NC \type{getsynctextag} \NC get the currently set value of tag (file) \NC \NR
+\NC \type{getsynctexline} \NC get the currently set value of line \NC \NR
+\NC \type{forcesynctextag} \NC overload the tag (file) value (\type {0} resets) \NC \NR
+\NC \type{forcesynctexline} \NC overload the line value (\type {0} resets) \NC \NR
\LL
\stoptabulate
@@ -1746,13 +1720,15 @@ be tested first instead of simply quitting.
This library takes care of the low|-|level I/O interface: writing to the log file
and|/|or console.
-\startsubsection[title={\type {write}}]
+\startsubsection[title={\type {write} and \type {writeselector}}]
\libindex{write}
+\libindex{writeselector}
\startfunctioncall
texio.write( target, s, ...)
texio.write( s, ...)
+texio.writeselector( s, ...)
\stopfunctioncall
Without the \type {target} argument, writes all given strings to the same
@@ -1767,19 +1743,24 @@ prevent \LUA\ from interpreting the first string as the target.
\stopsubsection
-\startsubsection[title={\type {write_nl}}]
+\startsubsection[title={\type {writenl} and \type {writeselectornl}}]
-\libindex{write_nl}
+\libindex{writenl}
+\libindex{writeselectornl}
\startfunctioncall
-texio.write_nl( target, s, ...)
-texio.write_nl( s, ...)
+texio.writenl( target, s, ...)
+texio.writenl( s, ...)
+texio.writeselectornl( target, ...)
\stopfunctioncall
This function behaves like \type {texio.write}, but makes sure that the given
strings will appear at the beginning of a new line. You can pass a single empty
string if you only want to move to the next line.
+The selector variants always expect a selector, so there is no misunderstanding
+if \type {logfile} is a string or selector.
+
\stopsubsection
\startsubsection[title={\type {setescape}}]
@@ -1812,20 +1793,20 @@ to know what you're doing (or more precise: what \TEX\ is doing with input).
\topicindex{libraries+\type{token}}
\topicindex{tokens}
-\libindex{scan_keyword}
-\libindex{scan_keywordcs}
-\libindex{scan_int}
-\libindex{scan_real}
-\libindex{scan_float}
-\libindex{scan_dimen}
-\libindex{scan_glue}
-\libindex{scan_toks}
-\libindex{scan_code}
-\libindex{scan_string}
-\libindex{scan_argument}
-\libindex{scan_word}
-\libindex{scan_csname}
-\libindex{scan_list}
+\libindex{scankeyword}
+\libindex{scankeywordcs}
+\libindex{scanint}
+\libindex{scanreal}
+\libindex{scanfloat}
+\libindex{scandimen}
+\libindex{scanglue}
+\libindex{scantoks}
+\libindex{scancode}
+\libindex{scanstring}
+\libindex{scanargument}
+\libindex{scanword}
+\libindex{scancsname}
+\libindex{scanlist}
The token library provides means to intercept the input and deal with it at the
\LUA\ level. The library provides a basic scanner infrastructure that can be used
@@ -1837,26 +1818,26 @@ minimal set of tools and no solutions. The scanner functions are probably the
most intriguing.
\starttabulate[|l|l|p|]
-\DB function \BC argument \BC result \NC \NR
+\DB function \BC argument \BC result \NC \NR
\TB
-\NC \type{scan_keyword} \NC string \NC returns true if the given keyword is gobbled; as with
- the regular \TEX\ keyword scanner this is case insensitive
- (and \ASCII\ based) \NC \NR
-\NC \type{scan_keywordcs} \NC string \NC returns true if the given keyword is gobbled; this variant
- is case sensitive and also suitable for \UTF8 \NC \NR
-\NC \type{scan_int} \NC \NC returns an integer \NC \NR
-\NC \type{scan_real} \NC \NC returns a number from e.g.\ \type {1}, \type {1.1}, \type {.1} with optional collapsed signs \NC \NR
-\NC \type{scan_float} \NC \NC returns a number from e.g.\ \type {1}, \type {1.1}, \type {.1}, \type {1.1E10}, , \type {.1e-10} with optional collapsed signs \NC \NR
-\NC \type{scan_dimen} \NC infinity, mu-units \NC returns a number representing a dimension or two numbers being the filler and order \NC \NR
-\NC \type{scan_glue} \NC mu-units \NC returns a glue spec node \NC \NR
-\NC \type{scan_toks} \NC definer, expand \NC returns a table of tokens \NC \NR
-\NC \type{scan_code} \NC bitset \NC returns a character if its category is in the given bitset (representing catcodes) \NC \NR
-\NC \type{scan_string} \NC \NC returns a string given between \type {{}}, as \type {\macro} or as sequence of characters with catcode 11 or 12 \NC \NR
-\NC \type{scan_argument} \NC \NC this one is simular to \type {scanstring} but also accepts a \type {\cs}
- (which then get expanded) \NC \NR
-\NC \type{scan_word} \NC \NC returns a sequence of characters with catcode 11 or 12 as string \NC \NR
-\NC \type{scan_csname} \NC \NC returns \type {foo} after scanning \type {\foo} \NC \NR
-\NC \type{scan_list} \NC \NC picks up a box specification and returns a \type {[h|v]list} node \NC \NR
+\NC \type{scankeyword} \NC string \NC returns true if the given keyword is gobbled; as with
+ the regular \TEX\ keyword scanner this is case insensitive
+ (and \ASCII\ based) \NC \NR
+\NC \type{scankeywordcs} \NC string \NC returns true if the given keyword is gobbled; this variant
+ is case sensitive and also suitable for \UTF8 \NC \NR
+\NC \type{scanint} \NC \NC returns an integer \NC \NR
+\NC \type{scanreal} \NC \NC returns a number from e.g.\ \type {1}, \type {1.1}, \type {.1} with optional collapsed signs \NC \NR
+\NC \type{scanfloat} \NC \NC returns a number from e.g.\ \type {1}, \type {1.1}, \type {.1}, \type {1.1E10}, , \type {.1e-10} with optional collapsed signs \NC \NR
+\NC \type{scandimen} \NC infinity, mu-units \NC returns a number representing a dimension or two numbers being the filler and order \NC \NR
+\NC \type{scanglue} \NC mu-units \NC returns a glue spec node \NC \NR
+\NC \type{scantoks} \NC definer, expand \NC returns a table of tokens \NC \NR
+\NC \type{scancode} \NC bitset \NC returns a character if its category is in the given bitset (representing catcodes) \NC \NR
+\NC \type{scanstring} \NC \NC returns a string given between \type {{}}, as \type {\macro} or as sequence of characters with catcode 11 or 12 \NC \NR
+\NC \type{scanargument} \NC \NC this one is simular to \type {scanstring} but also accepts a \type {\cs}
+ (which then get expanded) \NC \NR
+\NC \type{scanword} \NC \NC returns a sequence of characters with catcode 11 or 12 as string \NC \NR
+\NC \type{scancsname} \NC \NC returns \type {foo} after scanning \type {\foo} \NC \NR
+\NC \type{scanlist} \NC \NC picks up a box specification and returns a \type {[h|v]list} node \NC \NR
\LL
\stoptabulate
@@ -1864,7 +1845,7 @@ The integer, dimension and glue scanners take an extra optional argument that
signals that en optional equal is permitted.
The scanners can be considered stable apart from the one scanning for a token.
-The \type {scan_code} function takes an optional number, the \type {scan_keyword}
+The \type {scancode} function takes an optional number, the \type {scankeyword}
function a normal \LUA\ string. The \type {infinity} boolean signals that we also
permit \type {fill} as dimension and the \type {mu-units} flags the scanner that
we expect math units. When scanning tokens we can indicate that we are defining a
@@ -1872,7 +1853,7 @@ macro, in which case the result will also provide information about what
arguments are expected and in the result this is separated from the meaning by a
separator token. The \type {expand} flag determines if the list will be expanded.
-The \type {scan_argument} function expands the given argument. When a braced
+The \type {scanargument} function expands the given argument. When a braced
argument is scanned, expansion can be prohibited by passing \type {false}
(default is \type {true}). In case of a control sequence passing \type {false}
will result in a one|-|level expansion (the meaning of the macro).
@@ -1894,9 +1875,9 @@ we get:
\starttabulate[|l|Tl|l|]
\DB name \BC result \NC \NR
\TB
-\NC \type {\directlua{token.scan_string()}{foo}} \NC \directlua{context("{\\red\\type {"..token.scan_string().."}}")} {foo} \NC full expansion \NC \NR
-\NC \type {\directlua{token.scan_string()}foo} \NC \directlua{context("{\\red\\type {"..token.scan_string().."}}")} foo \NC letters and others \NC \NR
-\NC \type {\directlua{token.scan_string()}\foo} \NC \directlua{context("{\\red\\type {"..token.scan_string().."}}")}\foo \NC meaning \NC \NR
+\NC \type {\directlua{token.scanstring()}{foo}} \NC \directlua{context("{\\red\\type {"..token.scanstring().."}}")} {foo} \NC full expansion \NC \NR
+\NC \type {\directlua{token.scanstring()}foo} \NC \directlua{context("{\\red\\type {"..token.scanstring().."}}")} foo \NC letters and others \NC \NR
+\NC \type {\directlua{token.scanstring()}\foo} \NC \directlua{context("{\\red\\type {"..token.scanstring().."}}")}\foo \NC meaning \NC \NR
\LL
\stoptabulate
@@ -1905,13 +1886,13 @@ expanded definition (\prm {edef}'d). In the case of the braced variant one can o
course use the \prm {detokenize} and \prm {unexpanded} primitives since there we
do expand.
-The \type {scan_word} scanner can be used to implement for instance a number
+The \type {scanword} scanner can be used to implement for instance a number
scanner. An optional boolean argument can signal that a trailing space or \type
{\relax} should be gobbled:
\starttyping
-function token.scan_number(base)
- return tonumber(token.scan_word(),base)
+function token.scannumber(base)
+ return tonumber(token.scanword(),base)
end
\stoptyping
@@ -1942,7 +1923,7 @@ You can also do this:
\starttyping
\directlua {
function mymacro()
- local d = token.scan_dimen()
+ local d = token.scandimen()
...
end
}
@@ -1975,19 +1956,19 @@ a bit but for passing strings conversion to and from tokens has to be done anywa
\startsubsection[title={Picking up one token}]
-\libindex {scan_next}
-\libindex {scan_next_expanded}
-\libindex {skip_next}
-\libindex {skip_next_expanded}
-\libindex {peek_next}
-\libindex {peek_next_expanded}
-\libindex {scan_token}
+\libindex {scannext}
+\libindex {scannextexpanded}
+\libindex {skipnext}
+\libindex {skipnextexpanded}
+\libindex {peeknext}
+\libindex {peeknextexpanded}
+\libindex {scantoken}
\libindex {expand}
The scanners look for a sequence. When you want to pick up one token from the
-input you use \type {scan_next}. This creates a token with the (low level)
+input you use \type {scannext}. This creates a token with the (low level)
properties as discussed next. This token is just the next one. If you want to
-enforce expansion first you can use \type {scan_token} or the \type {_expanded}
+enforce expansion first you can use \type {scantoken} or the \type {_expanded}
variants. Internally tokens are characterized by a number that packs a lot of
information. In order to access the bits of information a token is wrapped in a
userdata object.
@@ -1998,14 +1979,14 @@ enough about \TEX\ not to be too worried about that. It basically is a call to
the internal expand related function.
\starttabulate[|lT|p|]
-\DB name \BC explanation \NC \NR
+\DB name \BC explanation \NC \NR
\TB
-\NC scan_next \NC get the next token \NC \NR
-\NC scan_next_expanded \NC get the next expanded token \NC \NR
-\NC skip_next \NC skip the next token \NC \NR
-\NC skip_next_expanded \NC skip the next expanded token \NC \NR
-\NC peek_next \NC get the next token and put it back in the input \NC \NR
-\NC peek_next_expanded \NC get the next expanded token and put it back in the input \NC \NR
+\NC scannext \NC get the next token \NC \NR
+\NC scannextexpanded \NC get the next expanded token \NC \NR
+\NC skipnext \NC skip the next token \NC \NR
+\NC skipnextexpanded \NC skip the next expanded token \NC \NR
+\NC peeknext \NC get the next token and put it back in the input \NC \NR
+\NC peeknextexpanded \NC get the next expanded token and put it back in the input \NC \NR
\LL
\stoptabulate
@@ -2026,20 +2007,20 @@ alike.
\libindex{commands}
\libindex{command_id}
-\libindex{get_command}
-\libindex{get_cmdname}
-\libindex{get_csname}
-\libindex{get_id}
-\libindex{get_active}
-\libindex{get_expandable}
-\libindex{get_protected}
-\libindex{get_mode}
-\libindex{get_index}
-\libindex{get_tok}
-\libindex{get_frozen}
-\libindex{get_user}
-
-\libindex{scan_next}
+\libindex{getcommand}
+\libindex{getcmdname}
+\libindex{getcsname}
+\libindex{getid}
+\libindex{getactive}
+\libindex{getexpandable}
+\libindex{getprotected}
+\libindex{getmode}
+\libindex{getindex}
+\libindex{gettok}
+\libindex{getfrozen}
+\libindex{getuser}
+
+\libindex{scannext}
The creator function can be used as follows:
@@ -2069,7 +2050,7 @@ primitive. The possible properties of tokens are:
\LL
\stoptabulate
-Alternatively you can use a getter \type {get_} to access a property
+Alternatively you can use a getter \type {get} to access a property
of a token.
The numbers that represent a catcode are the same as in \TEX\ itself, so using
@@ -2124,14 +2105,14 @@ need to know that boundary condition.
\topicindex {macros}
-\libindex{set_macro}
-\libindex{get_macro}
-\libindex{get_meaning}
-\libindex{set_char}
-\libindex{set_lua}
-\libindex{get_functions_table}
-\libindex{push_macro}
-\libindex{pop_macro}
+\libindex{setmacro}
+\libindex{getmacro}
+\libindex{getmeaning}
+\libindex{setchar}
+\libindex{setlua}
+\libindex{getfunctionstable}
+\libindex{pushmacro}
+\libindex{popmacro}
The \type {set_macro} function can get upto 4 arguments:
@@ -2157,8 +2138,8 @@ The results are like:
\def\csname{}
\stoptyping
-The \type {get_macro} function can be used to get the content of a macro while
-the \type {get_meaning} function gives the meaning including the argument
+The \type {getmacro} function can be used to get the content of a macro while
+the \type {getmeaning} function gives the meaning including the argument
specification (as usual in \TEX\ separated by \type {->}).
The \type {set_char} function can be used to do a \prm {chardef} at the
@@ -2177,11 +2158,11 @@ set_lua("mycode",id,"global","protected")
\stoptyping
This creates a token that refers to a \LUA\ function with an entry in the table
-that you can access with \type {lua.get_functions_table}. It is the companion
+that you can access with \type {lua.getfunctions_table}. It is the companion
to \lpr {luadef}. When the first (and only) argument is true the size will preset
to the value of \type {texconfig.function_size}.
-The \type {push_macro} and \type {pop_macro} function are very experimental and
+The \type {pushmacro} and \type {popmacro} function are very experimental and
can be used to get and set an existing macro. The push call returns a user data
object and the pop takes such a userdata object. These object have no accessors
and are to be seen as abstractions.
@@ -2190,20 +2171,20 @@ and are to be seen as abstractions.
\startsubsection[title={Pushing back}]
-\libindex{scan_next}
-\libindex{put_next}
+\libindex{scannext}
+\libindex{putnext}
There is a (for now) experimental putter:
\starttyping
-local t1 = token.scan_next()
-local t2 = token.scan_next()
-local t3 = token.scan_next()
-local t4 = token.scan_next()
+local t1 = token.scannext()
+local t2 = token.scannext()
+local t3 = token.scannext()
+local t4 = token.scannext()
-- watch out, we flush in sequence
-token.put_next { t1, t2 }
+token.putnext { t1, t2 }
-- but this one gets pushed in front
-token.put_next ( t3, t4 )
+token.putnext ( t3, t4 )
\stoptyping
When we scan \type {wxyz!} we get \type {yzwx!} back. The argument is either a
@@ -2218,11 +2199,11 @@ works out okay:
\directlua {
local list = { 101, 102, 103, token.create("foo"), "{abracadabra}" }
- token.put_next("(the)")
- token.put_next(list)
- token.put_next("(order)")
- token.put_next(unpack(list))
- token.put_next("(is reversed)")
+ token.putnext("(the)")
+ token.putnext(list)
+ token.putnext("(order)")
+ token.putnext(unpack(list))
+ token.putnext("(is reversed)")
}
\stopbuffer
@@ -2259,9 +2240,9 @@ create a hash entry and when later it gets defined that entry will be reused. So
\type {\oof} really exists but can be in an undefined state.
\startbuffer[demo]
-oof : \directlua{tex.print(token.scan_csname())}\oof
-foo : \directlua{tex.print(token.scan_csname())}\foo
-myfirstoof : \directlua{tex.print(token.scan_csname())}\myfirstoof
+oof : \directlua{tex.print(token.scancsname())}\oof
+foo : \directlua{tex.print(token.scancsname())}\foo
+myfirstoof : \directlua{tex.print(token.scancsname())}\myfirstoof
\stopbuffer
\startlines
@@ -2307,9 +2288,9 @@ When scanning from \LUA\ we are not in a mode that defines (undefined) macros at
all. There we just get the real primitive undefined macro token.
\startbuffer
-\directlua{local t = token.scan_next() tex.print(t.id.." "..t.tok)}\myfirstoof
-\directlua{local t = token.scan_next() tex.print(t.id.." "..t.tok)}\mysecondoof
-\directlua{local t = token.scan_next() tex.print(t.id.." "..t.tok)}\mythirdoof
+\directlua{local t = token.scannext() tex.print(t.id.." "..t.tok)}\myfirstoof
+\directlua{local t = token.scannext() tex.print(t.id.." "..t.tok)}\mysecondoof
+\directlua{local t = token.scannext() tex.print(t.id.." "..t.tok)}\mythirdoof
\stopbuffer
\startlines
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex.tex b/doc/context/sources/general/manuals/luametatex/luametatex.tex
index b7b0ab749..48279e1a8 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex.tex
@@ -106,7 +106,7 @@
\stopfrontmatter
\startbodymatter
- \component luametatex-preamble
+ \component luametatex-internals
\component luametatex-differences
\component luametatex-modifications
\component luametatex-lua
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 1f315e007..d419dd25e 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -855,7 +855,7 @@ function scripts.context.run(ctxdata,filename)
-- kindofrun: 1:first run, 2:successive run, 3:once, 4:last of maxruns
--
local engine = analysis.engine or "luametatex"
- if engine == "luametatex" and (mainfile == usedfiles.yes or mainfile == usedfiles.nop) then
+ if engine == "luametatex" and (mainfile == usedfiles.yes or mainfile == usedfiles.nop) and not getargument("redirected") then
mainfile = "" -- we don't need that
end
--
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua
index 324da841b..c0d59832b 100644
--- a/scripts/context/lua/mtx-fonts.lua
+++ b/scripts/context/lua/mtx-fonts.lua
@@ -16,7 +16,7 @@ local lower = string.lower
local concat = table.concat
local write_nl = (logs and logs.writer) or (texio and texio.write_nl) or print
-local otlversion = 3.113
+local otlversion = 3.114
local helpinfo = [[
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 133f5ce71..5aa85c926 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{2021.05.09 17:12}
+\newcontextversion{2021.05.15 22:41}
%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 f5a02b246..dcfe88c5a 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{2021.05.09 17:12}
+\edef\contextversion{2021.05.15 22:41}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii
index 409add42f..e9ebb1256 100644
--- a/tex/context/base/mkii/mult-fr.mkii
+++ b/tex/context/base/mkii/mult-fr.mkii
@@ -141,6 +141,7 @@
\setinterfacevariable{chemistry}{chimie}
\setinterfacevariable{cite}{cite}
\setinterfacevariable{closed}{ferme}
+\setinterfacevariable{collapsed}{collapsed}
\setinterfacevariable{color}{couleur}
\setinterfacevariable{column}{colonne}
\setinterfacevariable{columns}{colonnes}
@@ -392,6 +393,7 @@
\setinterfacevariable{nostopper}{sansstoppeur}
\setinterfacevariable{not}{pas}
\setinterfacevariable{notation}{notation}
+\setinterfacevariable{notcollapsed}{notcollapsed}
\setinterfacevariable{note}{note}
\setinterfacevariable{nothanging}{sanssuspension}
\setinterfacevariable{nothyphenated}{sanscesure}
diff --git a/tex/context/base/mkiv/anch-pgr.lua b/tex/context/base/mkiv/anch-pgr.lua
index 8e400cd12..e822f12b4 100644
--- a/tex/context/base/mkiv/anch-pgr.lua
+++ b/tex/context/base/mkiv/anch-pgr.lua
@@ -24,6 +24,7 @@ local lpegmatch = lpeg.match
local jobpositions = job.positions
local formatters = string.formatters
local setmetatableindex = table.setmetatableindex
+local settings_to_array = utilities.parsers.settings_to_array
local enableaction = nodes.tasks.enableaction
@@ -32,6 +33,7 @@ local context = context
local implement = interfaces.implement
+local texgetcount = tex.getcount
local report_graphics = logs.reporter("backgrounds")
local report_shapes = logs.reporter("backgrounds","shapes")
local report_free = logs.reporter("backgrounds","free")
@@ -78,9 +80,10 @@ local getdepth = nuts.getdepth
local nodecodes = nodes.nodecodes
local par_code = nodecodes.par
-local start_of_par = nuts.start_of_par
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local startofpar = nuts.startofpar
+
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local processranges = nuts.processranges
@@ -165,12 +168,12 @@ local function flush(head,f,l,a,parent,depth)
ln = new_hlist(setlink(new_rule(65536,65536*4,0),new_kern(-65536),ln))
rn = new_hlist(setlink(new_rule(65536,0,65536*4),new_kern(-65536),rn))
end
- if getid(f) == par_code and start_of_par(f) then -- we need to clean this mess
- insert_after(head,f,ln)
+ if getid(f) == par_code and startofpar(f) then -- we need to clean this mess
+ insertafter(head,f,ln)
else
- head, f = insert_before(head,f,ln)
+ head, f = insertbefore(head,f,ln)
end
- insert_after(head,l,rn)
+ insertafter(head,l,rn)
end
return head, true
end
@@ -222,7 +225,8 @@ end
nodes.handlers.textbackgrounds = function(head,where,parent) -- we have hlistdir and local dir
-- todo enable action in register
- index = index + 1
+ index = index + 1
+ realpage = texgetcount("realpageno")
return processranges(a_textbackground,flush,head,parent)
end
@@ -235,8 +239,6 @@ interfaces.implement {
-- optimized already but we can assume a cycle i.e. prune the last point and then
-- even less code .. we could merge some loops but his is more robust
--- use idiv here
-
local function topairs(t,n)
local r = { }
for i=1,n do
@@ -1213,7 +1215,7 @@ implement {
actions = function(tags,anchor,page) -- no caching (yet) / page
local collected = jobpositions.collected
if type(tags) == "string" then
- tags = utilities.parsers.settings_to_array(tags)
+ tags = settings_to_array(tags)
end
local list = { }
local nofboxes = 0
diff --git a/tex/context/base/mkiv/attr-ini.lua b/tex/context/base/mkiv/attr-ini.lua
index 5507f2a70..b05c343e5 100644
--- a/tex/context/base/mkiv/attr-ini.lua
+++ b/tex/context/base/mkiv/attr-ini.lua
@@ -35,8 +35,8 @@ attributes.states = attributes.states or { }
attributes.handlers = attributes.handlers or { }
attributes.unsetvalue = -0x7FFFFFFF
-local currentfont = font.current -- mabe nicer is attributes.current
-local currentattributes = node.current_attributes -- mabe nicer is fonts .current
+local currentfont = font.current
+local currentattributes = nodes and nodes.currentattributes or node.currentattributes or node.current_attr -- no nodes table yet
local names = attributes.names
local numbers = attributes.numbers
diff --git a/tex/context/base/mkiv/attr-ini.mkiv b/tex/context/base/mkiv/attr-ini.mkiv
index 71c6478f8..ad40a1ffe 100644
--- a/tex/context/base/mkiv/attr-ini.mkiv
+++ b/tex/context/base/mkiv/attr-ini.mkiv
@@ -168,19 +168,3 @@
% \to \everyafterpagebreak
\protect \endinput
-
-% for the luatex list:
-%
-% \attributedef\zeroattribute=0
-% \attributedef\someattribute=999
-%
-% \directlua {
-% local createtoken = newtoken.create
-% function attributenumber(name)
-% local n = createtoken(name).mode - createtoken("zeroattribute").mode
-% return n >= 0 and n or false
-% end
-% }
-%
-% \directlua{print(attributenumber("noneattribute"))}
-% \directlua{print(attributenumber("someattribute"))}
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 7a37cc948..5928da538 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -3020,7 +3020,7 @@ local collectresults do -- too many locals otherwise
local getkern = nuts.getkern
local getwidth = nuts.getwidth
- local start_of_par = nuts.start_of_par
+ local startofpar = nuts.startofpar
local nexthlist = nuts.traversers.hlist
local nextnode = nuts.traversers.node
@@ -3390,7 +3390,7 @@ end
last = nil
currentparagraph = nil
end
- elseif not paragraph and id == par_code and start_of_par(n) then
+ elseif not paragraph and id == par_code and startofpar(n) then
paragraph = getattr(n,a_taggedpar)
elseif id == disc_code then
-- very unlikely because we stripped them
diff --git a/tex/context/base/mkiv/blob-ini.lua b/tex/context/base/mkiv/blob-ini.lua
index 0b35c3b65..012b4ddb0 100644
--- a/tex/context/base/mkiv/blob-ini.lua
+++ b/tex/context/base/mkiv/blob-ini.lua
@@ -25,28 +25,26 @@ if not modules then modules = { } end modules ['blob-ini'] = {
local type, tostring = type, tostring
local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
-local report_blobs = logs.reporter("blobs")
+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 flushnodelist = nodes.flushlist
+local hpacknodelist = nodes.hpack
-local typesetters = nodes.typesetters
-local tonodes = typesetters.tonodes
-local tohpack = typesetters.tohpack
-local tovpack = typesetters.tovpack
+local typesetters = nodes.typesetters
+local tonodes = typesetters.tonodes
+local tohpack = typesetters.tohpack
+local tovpack = typesetters.tovpack
-local implement = interfaces.implement
+local context = context
--- provide copies here (nicer for manuals)
+local implement = interfaces.implement
-blobs = blobs or { }
-local blobs = blobs
+blobs = blobs or { }
+local blobs = blobs
-blobs.tonodes = tonodes
-blobs.tohpack = tohpack
-blobs.tovpack = tovpack
+blobs.tonodes = tonodes
+blobs.tohpack = tohpack
+blobs.tovpack = tovpack
-- end of helpers
@@ -68,7 +66,7 @@ function blobs.dispose(t)
local li = list[i]
local pack = li.pack
if pack then
- flush_node_list(pack)
+ flushnodelist(pack)
li.pack = nil
end
end
@@ -96,14 +94,14 @@ function blobs.pack(t,how)
for i=1,#list do
local pack = list[i].pack
if pack then
- flush_node_list(node.pack)
+ flushnodelist(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")
+ list[i].pack = hpacknodelist(list[i].head,"exactly")
end
end
end
@@ -114,8 +112,8 @@ function blobs.write(t)
local li = list[i]
local pack = li.pack
if pack then
- write_node(pack)
- flush_node_list(pack)
+ context(pack)
+ flushnodelist(pack)
li.pack = nil
end
end
@@ -158,28 +156,28 @@ end
local function strwd(str)
local l = tohpack(str)
local w = l.width
- flush_node_list(l)
+ flushnodelist(l)
return w
end
local function strht(str)
local l = tohpack(str)
local h = l.height
- flush_node_list(l)
+ flushnodelist(l)
return h
end
local function strdp(str)
local l = tohpack(str)
local d = l.depth
- flush_node_list(l)
+ flushnodelist(l)
return d
end
local function strhd(str)
local l = tohpack(str)
local s = l.height + l.depth
- flush_node_list(l)
+ flushnodelist(l)
return s
end
@@ -192,7 +190,7 @@ blobs.strhd = strhd
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 }
+implement { name = "strwd", actions = function() local l = scan_hbox() context(l.width) flushnodelist(l) end }
+implement { name = "strht", actions = function() local l = scan_hbox() context(l.height) flushnodelist(l) end }
+implement { name = "strdp", actions = function() local l = scan_hbox() context(l.depth) flushnodelist(l) end }
+implement { name = "strhd", actions = function() local l = scan_hbox() context(l.height + l.depth) flushnodelist(l) end }
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua
index 5d4b3d8a8..10d87e139 100644
--- a/tex/context/base/mkiv/cldf-ini.lua
+++ b/tex/context/base/mkiv/cldf-ini.lua
@@ -98,16 +98,21 @@ local texsprint = tex.sprint -- just appended (no space,eol treatment
local texprint = tex.print -- each arg a separate line (not last in directlua)
----- texwrite = tex.write -- all 'space' and 'character'
-local isnode = node.is_node
+-- In this stage we don't yet have nodes populated so we access the library directly ...
+
+local isnode = node.isnode or node.is_node
+local copynodelist = node.copylist or node.copy_list
local writenode = node.write
-local copynodelist = node.copy_list
local tonut = node.direct.todirect
local tonode = node.direct.tonode
-local istoken = token.is_token
local newtoken = token.new
local createtoken = token.create
-local setluatoken = token.set_lua
+
+local istoken = token.istoken or token.is_token
+local setluatoken = token.setlua or token.set_lua
+
+-- ... till here.
local isprintable = tex.isprintable or function(n)
return n and (type(n) == "string" or isnode(n) or istoken(n))
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 9d7c8e584..26567e338 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{2021.05.09 17:12}
+\newcontextversion{2021.05.15 22:41}
%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/context.mkiv b/tex/context/base/mkiv/context.mkiv
index b0a0aae71..57c7c2001 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{2021.05.09 17:12}
+\edef\contextversion{2021.05.15 22:41}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-cff.lua b/tex/context/base/mkiv/font-cff.lua
index 4e2981011..ff87292ba 100644
--- a/tex/context/base/mkiv/font-cff.lua
+++ b/tex/context/base/mkiv/font-cff.lua
@@ -29,7 +29,7 @@ if not modules then modules = { } end modules ['font-cff'] = {
local next, type, tonumber, rawget = next, type, tonumber, rawget
local byte, char, gmatch, sub = string.byte, string.char, string.gmatch, string.sub
-local concat, remove, unpack = table.concat, table.remove, table.unpack
+local concat, insert, remove, unpack = table.concat, table.insert, table.remove, table.unpack
local floor, abs, round, ceil, min, max = math.floor, math.abs, math.round, math.ceil, math.min, math.max
local P, C, R, S, C, Cs, Ct = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpeg.Ct
local lpegmatch = lpeg.match
@@ -745,6 +745,13 @@ do
-- some back. I inlined some of then and a bit speed can be gained by more
-- inlining but not that much.
+ -- Maybe have several action tables:
+ --
+ -- keep curve / checked
+ -- keep curve / not checked
+ -- checked
+ -- not checked
+
local function xymoveto()
if keepcurve then
r = r + 1
@@ -1968,8 +1975,38 @@ do
showstate(reverse[t] or "")
end
if top > 0 then
- for i=1,top do
- r = r + 1 ; result[r] = encode[stack[i]]
+ -- if t == 8 and top > 42 then
+ if t == 8 and top > 48 then
+ -- let's assume this only happens for rrcurveto .. the other ones would need some more
+ -- complex handling (cff2 stuff)
+ local n = 0
+ for i=1,top do
+ -- if n == 42 then
+ if n == 48 then
+ local zero = encode[0]
+ local res3 = result[r-3]
+ local res2 = result[r-2]
+ local res1 = result[r-1]
+ local res0 = result[r]
+ result[r-3] = zero
+ result[r-2] = zero
+ r = r + 1 ; result[r] = chars[t]
+ r = r + 1 ; result[r] = zero
+ r = r + 1 ; result[r] = zero
+ r = r + 1 ; result[r] = res3
+ r = r + 1 ; result[r] = res2
+ r = r + 1 ; result[r] = res1
+ r = r + 1 ; result[r] = res0
+ n = 1
+ else
+ n = n + 1
+ end
+ r = r + 1 ; result[r] = encode[stack[i]]
+ end
+ else
+ for i=1,top do
+ r = r + 1 ; result[r] = encode[stack[i]]
+ end
end
top = 0
end
diff --git a/tex/context/base/mkiv/font-chk.lua b/tex/context/base/mkiv/font-chk.lua
index e18e4b804..693823a86 100644
--- a/tex/context/base/mkiv/font-chk.lua
+++ b/tex/context/base/mkiv/font-chk.lua
@@ -64,7 +64,7 @@ local implement = interfaces.implement
local glyph_code = nodes.nodecodes.glyph
local new_special = nodes.pool.special -- todo: literal
-local hpack_node = node.hpack
+local hpack_node = nodes.hpack
local nuts = nodes.nuts
local tonut = nuts.tonut
@@ -75,7 +75,7 @@ local setchar = nuts.setchar
local nextglyph = nuts.traversers.glyph
local remove_node = nuts.remove
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
-- maybe in fonts namespace
-- deletion can be option
@@ -324,7 +324,7 @@ function checkers.missing(head)
local char, font = isglyph(node)
local kind, char = placeholder(font,char)
if kind == "node" then
- insert_node_after(head,node,tonut(char))
+ insertnodeafter(head,node,tonut(char))
head = remove_node(head,node,true)
elseif kind == "char" then
setchar(node,char)
diff --git a/tex/context/base/mkiv/font-col.lua b/tex/context/base/mkiv/font-col.lua
index c47a29906..ea9b9c98c 100644
--- a/tex/context/base/mkiv/font-col.lua
+++ b/tex/context/base/mkiv/font-col.lua
@@ -22,7 +22,6 @@ local nuts = nodes.nuts
local setfont = nuts.setfont
------ traverse_char = nuts.traverse_char
local nextchar = nuts.traversers.char
local settings_to_hash = utilities.parsers.settings_to_hash
diff --git a/tex/context/base/mkiv/font-lib.mkvi b/tex/context/base/mkiv/font-lib.mkvi
index d05872653..dcb1ff1bb 100644
--- a/tex/context/base/mkiv/font-lib.mkvi
+++ b/tex/context/base/mkiv/font-lib.mkvi
@@ -52,9 +52,9 @@
% \ifcase\directlua{tex.print(callback.list()["provide_charproc_data"] == false and 1 or 0)}\relax
% % this is the generic variant that will become luatex-fonts-ocl once we have
% % more recent versions of luatex 1.13/1.14 on the garden
- \registerctxluafile{font-ocl}{}
+% \registerctxluafile{font-ocl}{}
% \else
-% \registerctxluafile{font-ocm}{}
+ \registerctxluafile{font-ocm}{}
% \fi
% we use otf code for type one
diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua
index 18120f524..8404c04f6 100644
--- a/tex/context/base/mkiv/font-mis.lua
+++ b/tex/context/base/mkiv/font-mis.lua
@@ -21,7 +21,7 @@ local readers = otf.readers
if readers then
- otf.version = otf.version or 3.113
+ otf.version = otf.version or 3.114
otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true)
function fonts.helpers.getfeatures(name,save)
diff --git a/tex/context/base/mkiv/font-mps.lua b/tex/context/base/mkiv/font-mps.lua
index 8bfe23b89..d75267a09 100644
--- a/tex/context/base/mkiv/font-mps.lua
+++ b/tex/context/base/mkiv/font-mps.lua
@@ -279,7 +279,7 @@ local getdepth = nuts.getdepth
local getexpansion = nuts.getexpansion
local isglyph = nuts.isglyph
-local effective_glue = nuts.effective_glue
+local effectiveglue = nuts.effectiveglue
local characters = fonts.hashes.characters
local parameters = fonts.hashes.parameters
@@ -362,7 +362,7 @@ function fonts.metapost.boxtomp(n,kind)
elseif id == kern_code then
dx = dx + getkern(current) * fc
elseif id == glue_code then
- dx = dx + effective_glue(current,parent) * fc
+ dx = dx + effectiveglue(current,parent) * fc
elseif id == hlist_code then
local list = getlist(current)
if list then
@@ -420,7 +420,7 @@ function fonts.metapost.boxtomp(n,kind)
elseif id == kern_code then
dy = dy - getkern(current) * fc
elseif id == glue_code then
- dy = dy - effective_glue(current,parent) * fc
+ dy = dy - effectiveglue(current,parent) * fc
elseif id == rule_code then
local wd, ht, dp = getwhd(current)
local hd = (ht + dp) * fc
diff --git a/tex/context/base/mkiv/font-nod.lua b/tex/context/base/mkiv/font-nod.lua
index ed307e7c5..a7dcfd9b0 100644
--- a/tex/context/base/mkiv/font-nod.lua
+++ b/tex/context/base/mkiv/font-nod.lua
@@ -70,11 +70,11 @@ local setbox = nuts.setbox
local setchar = nuts.setchar
local setsubtype = nuts.setsubtype
-local copy_node_list = nuts.copy_list
-local hpack_node_list = nuts.hpack
-local flush_node_list = nuts.flush_list
-local protect_glyphs = nuts.protect_glyphs
-local start_of_par = nuts.start_of_par
+local copy_node_list = nuts.copylist
+local hpacknodelist = nuts.hpack
+local flushnodelist = nuts.flushlist
+local protectglyphs = nuts.protectglyphs
+local startofpar = nuts.startofpar
local nextnode = nuts.traversers.node
local nextglyph = nuts.traversers.glyph
@@ -144,7 +144,7 @@ function step_tracers.reset()
for i=1,#collection do
local c = collection[i]
if c then
- flush_node_list(c)
+ flushnodelist(c)
end
end
collection, messages = { }, { }
@@ -158,7 +158,7 @@ function step_tracers.glyphs(n,i)
local c = collection[i]
if c then
local c = copy_node_list(c)
- local b = hpack_node_list(c) -- multiple arguments
+ local b = hpacknodelist(c) -- multiple arguments
setbox(n,b)
end
end
@@ -266,7 +266,7 @@ function step_tracers.codes(i,command,space)
local char, id = isglyph(c)
if char then
showchar(char,id)
- elseif id == dir_code or (id == par_code and start_of_par(c)) then
+ elseif id == dir_code or (id == par_code and startofpar(c)) then
context("[%s]",getdirection(c) or "?")
elseif id == disc_code then
local pre, post, replace = getdisc(c)
@@ -317,7 +317,7 @@ function step_tracers.check(head)
if l then -- hm, can be false
n = l
end
- protect_glyphs(n)
+ protectglyphs(n)
collection[1] = n
end
end
@@ -333,7 +333,7 @@ function step_tracers.register(head)
if l then -- hm, can be false
n = l
end
- protect_glyphs(n)
+ protectglyphs(n)
collection[nc] = n
end
end
diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua
index e6a38af5c..9e1f49433 100644
--- a/tex/context/base/mkiv/font-ocl.lua
+++ b/tex/context/base/mkiv/font-ocl.lua
@@ -370,13 +370,24 @@ if context then
local xmlconvert = xml.convert
local xmlfirst = xml.first
+ -- function otfsvg.filterglyph(entry,index)
+ -- -- we only support decompression in lmtx, so one needs to wipe the
+ -- -- cache when invalid xml is reported
+ -- local svg = xmlconvert(entry.data)
+ -- local root = svg and xmlfirst(svg,"/svg[@id='glyph"..index.."']")
+ -- local data = root and tostring(root)
+ -- -- report_svg("data for glyph %04X: %s",index,data)
+ -- return data
+ -- end
+
function otfsvg.filterglyph(entry,index)
- -- we only support decompression in lmtx, so one needs to wipe the
- -- cache when invalid xml is reported
- local svg = xmlconvert(entry.data)
+ local d = entry.data
+ if gzip.compressed(d) then
+ d = gzip.decompress(d) or d
+ end
+ local svg = xmlconvert(d)
local root = svg and xmlfirst(svg,"/svg[@id='glyph"..index.."']")
local data = root and tostring(root)
- -- report_svg("data for glyph %04X: %s",index,data)
return data
end
@@ -412,6 +423,9 @@ end
--
-- Because a generic setup can be flawed we need to catch bad inkscape runs which add a bit of
-- ugly overhead. Bah.
+ --
+ -- In the long run this method is a dead end because we cannot rely on command line arguments
+ -- etc to be upward compatible (so no real batch tool).
local new = nil
@@ -432,7 +446,7 @@ end
local nofshapes = #svgshapes
local f_svgfile = formatters["temp-otf-svg-shape-%i.svg"]
local f_pdffile = formatters["temp-otf-svg-shape-%i.pdf"]
- local f_convert = formatters["%s --export-%s=%s\n"]
+ local f_convert = formatters[new and "file-open:%s; export-%s:%s; export-do\n" or "%s --export-%s=%s\n"]
local filterglyph = otfsvg.filterglyph
local nofdone = 0
local processed = { }
diff --git a/tex/context/base/mkiv/font-ocm.lua b/tex/context/base/mkiv/font-ocm.lua
index 2f6c29e65..bb1550ac9 100644
--- a/tex/context/base/mkiv/font-ocm.lua
+++ b/tex/context/base/mkiv/font-ocm.lua
@@ -408,6 +408,7 @@ local pdftovirtual do
scale = scale * (width / (xform.width * bpfactor))
dy = - depth + dy
+-- png .. no time to figure it out now
-- dx = 0
-- dy = 0
local object = pdf.immediateobj("stream",f_stream(width,scale,scale,dx,dy,c)), width
@@ -558,6 +559,9 @@ local initializesvg do
--
-- Because a generic setup can be flawed we need to catch bad inkscape runs which add a bit of
-- ugly overhead. Bah.
+ --
+ -- In the long run this method is a dead end because we cannot rely on command line arguments
+ -- etc to be upward compatible (so no real batch tool).
local new = nil
@@ -578,7 +582,7 @@ local initializesvg do
local nofshapes = #svgshapes
local f_svgfile = formatters["temp-otf-svg-shape-%i.svg"]
local f_pdffile = formatters["temp-otf-svg-shape-%i.pdf"]
- local f_convert = formatters["%s --export-%s=%s\n"]
+ local f_convert = formatters[new and "file-open:%s; export-%s:%s; export-do\n" or "%s --export-%s=%s\n"]
local filterglyph = otfsvg.filterglyph
local nofdone = 0
local processed = { }
@@ -695,34 +699,53 @@ end
local initializepng do
- local otfpng = otf.png or { }
- otf.png = otfpng
- otf.pngenabled = true
+ -- Alternatively we can create a single pdf file with -adjoin and then pick up pages from
+ -- that file but creating thousands of small files is no fun either.
+ local otfpng = otf.png or { }
+ otf.png = otfpng
+ otf.pngenabled = true
local report_png = logs.reporter("fonts","png conversion")
-
local loaddata = io.loaddata
local savedata = io.savedata
local remove = os.remove
-
- local runner = sandbox and sandbox.registerrunner {
- name = "otfpng",
- program = "gm",
- template = "convert -quality 100 temp-otf-png-shape.png temp-otf-png-shape.pdf > temp-otf-svg-shape.log",
- -- reporter = report_png,
- }
-
- if not runner then
- --
- -- poor mans variant for generic:
- --
- runner = function()
- return os.execute("gm convert -quality 100 temp-otf-png-shape.png temp-otf-png-shape.pdf > temp-otf-svg-shape.log")
+ local texhack = [[\startTEXpage\externalfigure[temp-otf-png-shape.png]\stopTEXpage]]
+ local runner = false
+ local method = "gm"
+
+ local function initialize(v)
+ if v == "lmtx" then
+ report_png("using lmtx converter, slow but okay")
+ runner = sandbox.registerrunner {
+ -- reporter = report_png,
+ name = "otfpng",
+ program = "mtxrun --script context",
+ template = "--once --batch --silent temp-otf-png-shape.tex > temp-otf-svg-shape.log",
+ }
+ method = v
+ elseif v == "mutool" then
+ report_png("using lmtx converter, no mask, black background")
+ runner = sandbox.registerrunner {
+ -- reporter = report_png,
+ name = "otfpng",
+ program = "mutool",
+ template = "convert -o temp-otf-png-shape.pdf temp-otf-png-shape.png",
+ }
+ method = v
+ else
+ report_png("using lmtx converter, no mask, white background")
+ runner = sandbox.registerrunner {
+ -- reporter = report_png,
+ name = "otfpng",
+ program = "gm",
+ template = "convert -quality 100 temp-otf-png-shape.png temp-otf-png-shape.pdf > temp-otf-svg-shape.log",
+ }
+ method = "gm"
end
+ return runner
end
- -- Alternatively we can create a single pdf file with -adjoin and then pick up pages from
- -- that file but creating thousands of small files is no fun either.
+ directives.register("backend.otfpng.method",initialize)
local files = utilities.files
local openfile = files.open
@@ -735,12 +758,19 @@ local initializepng do
local pdfshapes = { }
local pngfile = "temp-otf-png-shape.png"
local pdffile = "temp-otf-png-shape.pdf"
+ local logfile = "temp-otf-png-shape.log"
+ local texfile = "temp-otf-png-shape.tex"
+ local tucfile = "temp-otf-png-shape.tuc"
local nofdone = 0
local indices = sortedkeys(pngshapes) -- can be sparse
local nofindices = #indices
report_png("processing %i png containers",nofindices)
statistics.starttiming()
local filehandle = openfile(filename)
+ savedata(texfile,texhack) -- not always used but who cares
+ if not runner then
+ initialize()
+ end
for i=1,nofindices do
local index = indices[i]
local entry = pngshapes[index]
@@ -771,6 +801,9 @@ local initializepng do
report_png("processing %i pdf results",nofindices)
remove(pngfile)
remove(pdffile)
+ remove(logfile)
+ remove(texfile)
+ remove(tucfile)
statistics.stoptiming()
if statistics.elapsedseconds then
report_png("png conversion time %s",statistics.elapsedseconds() or "-")
@@ -789,7 +822,7 @@ local initializepng do
end
local pdffile = containers.read(otf.pdfcache,hash)
local pdfshapes = pdffile and pdffile.pdfshapes
- if not pdfshapes or pdffile.timestamp ~= timestamp then
+ if not pdfshapes or pdffile.timestamp ~= timestamp or pdffile.timestamp ~= method then
local pngfile = containers.read(otf.pngcache,hash)
local filename = tfmdata.resources.filename
local pngshapes = pngfile and pngfile.pngshapes
@@ -797,6 +830,7 @@ local initializepng do
containers.write(otf.pdfcache, hash, {
pdfshapes = pdfshapes,
timestamp = timestamp,
+ method = method,
})
end
--
diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua
index 87453d9e2..2d0e685c1 100644
--- a/tex/context/base/mkiv/font-osd.lua
+++ b/tex/context/base/mkiv/font-osd.lua
@@ -118,11 +118,11 @@ local setstate = nuts.setstate
local ischar = nuts.ischar
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
local copy_node = nuts.copy
local remove_node = nuts.remove
-local flush_list = nuts.flush_list
-local flush_node = nuts.flush_node
+local flushlist = nuts.flushlist
+local flushnode = nuts.flushnode
local copyinjection = nodes.injections.copy -- KE: is this necessary? HH: probably not as positioning comes later and we rawget/set
@@ -826,7 +826,7 @@ local function inject_syntax_error(head,current,char)
else
setchar(current,dotted_circle)
end
- return insert_node_after(head,current,signal)
+ return insertnodeafter(head,current,signal)
end
-- hm, this is applied to one character:
@@ -968,7 +968,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
if current == stop then
stop = getprev(stop)
head = remove_node(head,current)
- flush_node(current)
+ flushnode(current)
return head, stop, nbspaces
else
nbspaces = nbspaces + 1
@@ -998,7 +998,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
tempcurrent = processcharacters(tempcurrent,font)
setstate(tempcurrent,unsetvalue)
if getchar(next) == getchar(tempcurrent) then
- flush_list(tempcurrent)
+ flushlist(tempcurrent)
if show_syntax_errors then
head, current = inject_syntax_error(head,current,char)
end
@@ -1006,8 +1006,8 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
setchar(current,getchar(tempcurrent)) -- we assumes that the result of blwf consists of one node
local freenode = getnext(current)
setlink(current,tmp)
- flush_node(freenode)
- flush_list(tempcurrent)
+ flushnode(freenode)
+ flushlist(tempcurrent)
if changestop then
stop = current
end
@@ -1154,7 +1154,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
ch = tpm[1]
setchar(n,ch)
setchar(extra,tpm[2])
- head = insert_node_after(head,current,extra)
+ head = insertnodeafter(head,current,extra)
tpm = twopart_mark[ch]
end
while c ~= stop and dependent_vowel[ch] do
@@ -1335,7 +1335,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
stop = getprev(stop)
end
head = remove_node(head,base)
- flush_node(base)
+ flushnode(base)
end
return head, stop, nbspaces
@@ -1712,7 +1712,7 @@ function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replaceme
if head == start then
head = stop
end
- flush_list(start)
+ flushlist(start)
return head, stop, true
end
@@ -1876,7 +1876,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
if current == stop then
stop = getprev(stop)
head = remove_node(head,current)
- flush_node(current)
+ flushnode(current)
return head, stop, nbspaces
else
nbspaces = nbspaces + 1
@@ -1979,7 +1979,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
char = tpm[1]
setchar(current,char)
setchar(extra,tpm[2])
- head = insert_node_after(head,current,extra)
+ head = insertnodeafter(head,current,extra)
tpm = twopart_mark[char]
end
--
@@ -2154,7 +2154,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
end
nbspaces = nbspaces - 1
head = remove_node(head, base)
- flush_node(base)
+ flushnode(base)
end
return head, stop, nbspaces
diff --git a/tex/context/base/mkiv/font-ota.lua b/tex/context/base/mkiv/font-ota.lua
index ce1b22b50..a8f9f0047 100644
--- a/tex/context/base/mkiv/font-ota.lua
+++ b/tex/context/base/mkiv/font-ota.lua
@@ -40,7 +40,7 @@ local getsubtype = nuts.getsubtype
local getchar = nuts.getchar
local ischar = nuts.ischar
-local end_of_math = nuts.end_of_math
+local endofmath = nuts.endofmath
local nodecodes = nodes.nodecodes
----- glyph_code = nodecodes.glyph
@@ -173,7 +173,7 @@ function analyzers.setstate(head,font)
end
first, last, n = nil, nil, 0
if id == math_code then
- current = end_of_math(current)
+ current = endofmath(current)
end
elseif id == disc_code then
-- always in the middle .. it doesn't make much sense to assign a property
@@ -189,7 +189,7 @@ function analyzers.setstate(head,font)
end
first, last, n = nil, nil, 0
if id == math_code then
- current = end_of_math(current)
+ current = endofmath(current)
end
end
current = getnext(current)
@@ -435,7 +435,7 @@ function methods.arab(head,font,attr)
first = nil
end
if id == math_code then -- a bit duplicate as we test for glyphs twice
- current = end_of_math(current)
+ current = endofmath(current)
end
end
current = getnext(current)
@@ -562,7 +562,7 @@ do
wrapup()
end
if id == math_code then -- a bit duplicate as we test for glyphs twice
- current = end_of_math(current)
+ current = endofmath(current)
end
end
current = getnext(current)
diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua
index bb02044dc..c21790100 100644
--- a/tex/context/base/mkiv/font-otj.lua
+++ b/tex/context/base/mkiv/font-otj.lua
@@ -98,13 +98,11 @@ local setlink = nuts.setlink
local setwidth = nuts.setwidth
local getwidth = nuts.getwidth
------ traverse_id = nuts.traverse_id
------ traverse_char = nuts.traverse_char
local nextchar = nuts.traversers.char
local nextglue = nuts.traversers.glue
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local properties = nodes.properties.data
@@ -124,7 +122,7 @@ if not fontkern then -- generic
local thekern = nuts.new("kern",0) -- fontkern
local setkern = nuts.setkern
- local copy_node = nuts.copy_node
+ local copy_node = nuts.copy
fontkern = function(k)
local n = copy_node(thekern)
@@ -138,7 +136,7 @@ if not italickern then -- generic
local thekern = nuts.new("kern",3) -- italiccorrection
local setkern = nuts.setkern
- local copy_node = nuts.copy_node
+ local copy_node = nuts.copy
italickern = function(k)
local n = copy_node(thekern)
@@ -667,12 +665,12 @@ local function inject_kerns_only(head,where)
if leftkern and leftkern ~= 0 then
if prev and getid(prev) == glue_code then
if useitalickerns then
- head = insert_node_before(head,current,italickern(leftkern))
+ head = insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev, getwidth(prev) + leftkern)
end
else
- head = insert_node_before(head,current,fontkern(leftkern))
+ head = insertnodebefore(head,current,fontkern(leftkern))
end
end
end
@@ -731,7 +729,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,fontkern(leftkern))
+ pre = insertnodebefore(pre,n,fontkern(leftkern))
done = true
end
end
@@ -747,7 +745,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,fontkern(leftkern))
+ post = insertnodebefore(post,n,fontkern(leftkern))
done = true
end
end
@@ -763,7 +761,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,fontkern(leftkern))
+ replace = insertnodebefore(replace,n,fontkern(leftkern))
done = true
end
end
@@ -830,23 +828,23 @@ local function inject_positions_only(head,where)
rightkern = 0
elseif prev and getid(prev) == glue_code then
if useitalickerns then
- head = insert_node_before(head,current,italickern(leftkern))
+ head = insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev, getwidth(prev) + leftkern)
end
else
- head = insert_node_before(head,current,fontkern(leftkern))
+ head = insertnodebefore(head,current,fontkern(leftkern))
end
end
if rightkern and rightkern ~= 0 then
if next and getid(next) == glue_code then
if useitalickerns then
- insert_node_after(head,current,italickern(rightkern))
+ insertnodeafter(head,current,italickern(rightkern))
else
setwidth(next, getwidth(next) + rightkern)
end
else
- insert_node_after(head,current,fontkern(rightkern))
+ insertnodeafter(head,current,fontkern(rightkern))
end
end
else
@@ -925,12 +923,12 @@ local function inject_positions_only(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,fontkern(leftkern))
+ pre = insertnodebefore(pre,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(pre,n,fontkern(rightkern))
+ insertnodeafter(pre,n,fontkern(rightkern))
done = true
end
end
@@ -950,12 +948,12 @@ local function inject_positions_only(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,fontkern(leftkern))
+ post = insertnodebefore(post,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(post,n,fontkern(rightkern))
+ insertnodeafter(post,n,fontkern(rightkern))
done = true
end
end
@@ -975,12 +973,12 @@ local function inject_positions_only(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,fontkern(leftkern))
+ replace = insertnodebefore(replace,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(replace,n,fontkern(rightkern))
+ insertnodeafter(replace,n,fontkern(rightkern))
done = true
end
end
@@ -996,7 +994,7 @@ local function inject_positions_only(head,where)
-- glyph|pre glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- pre = insert_node_before(pre,pre,fontkern(rightkern))
+ pre = insertnodebefore(pre,pre,fontkern(rightkern))
done = true
end
end
@@ -1010,7 +1008,7 @@ local function inject_positions_only(head,where)
-- glyph|replace glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- replace = insert_node_before(replace,replace,fontkern(rightkern))
+ replace = insertnodebefore(replace,replace,fontkern(rightkern))
done = true
end
end
@@ -1144,8 +1142,8 @@ local function inject_everything(head,where)
--
-- todo: head and check for prev / next kern
--
- insert_node_before(n,n,fontkern(-wn))
- insert_node_after(n,n,fontkern(-wn))
+ insertnodebefore(n,n,fontkern(-wn))
+ insertnodeafter(n,n,fontkern(-wn))
end
end
end
@@ -1295,23 +1293,23 @@ local function inject_everything(head,where)
rightkern = 0
elseif prev and getid(prev) == glue_code then
if useitalickerns then
- head = insert_node_before(head,current,italickern(leftkern))
+ head = insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev, getwidth(prev) + leftkern)
end
else
- head = insert_node_before(head,current,fontkern(leftkern))
+ head = insertnodebefore(head,current,fontkern(leftkern))
end
end
if rightkern and rightkern ~= 0 then
if next and getid(next) == glue_code then
if useitalickerns then
- insert_node_after(head,current,italickern(rightkern))
+ insertnodeafter(head,current,italickern(rightkern))
else
setwidth(next, getwidth(next) + rightkern)
end
else
- insert_node_after(head,current,fontkern(rightkern))
+ insertnodeafter(head,current,fontkern(rightkern))
end
end
end
@@ -1406,12 +1404,12 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,fontkern(leftkern))
+ pre = insertnodebefore(pre,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(pre,n,fontkern(rightkern))
+ insertnodeafter(pre,n,fontkern(rightkern))
done = true
end
if hasmarks then
@@ -1437,12 +1435,12 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,fontkern(leftkern))
+ post = insertnodebefore(post,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(post,n,fontkern(rightkern))
+ insertnodeafter(post,n,fontkern(rightkern))
done = true
end
if hasmarks then
@@ -1468,12 +1466,12 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,fontkern(leftkern))
+ replace = insertnodebefore(replace,n,fontkern(leftkern))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(replace,n,fontkern(rightkern))
+ insertnodeafter(replace,n,fontkern(rightkern))
done = true
end
if hasmarks then
@@ -1495,7 +1493,7 @@ local function inject_everything(head,where)
-- glyph|pre glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- pre = insert_node_before(pre,pre,fontkern(rightkern))
+ pre = insertnodebefore(pre,pre,fontkern(rightkern))
done = true
end
end
@@ -1509,7 +1507,7 @@ local function inject_everything(head,where)
-- glyph|replace glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- replace = insert_node_before(replace,replace,fontkern(rightkern))
+ replace = insertnodebefore(replace,replace,fontkern(rightkern))
done = true
end
end
@@ -1711,8 +1709,8 @@ local function injectspaces(head)
if trace_spaces then
report_spaces("%C [%p + %p + %p] %C",prevchar,lnew,old,rnew,nextchar)
end
- head = insert_node_before(head,n,italickern(lnew))
- insert_node_after(head,n,italickern(rnew))
+ head = insertnodebefore(head,n,italickern(lnew))
+ insertnodeafter(head,n,italickern(rnew))
else
local new = old + (leftkern + rightkern) * factor
if trace_spaces then
@@ -1727,7 +1725,7 @@ local function injectspaces(head)
if trace_spaces then
report_spaces("%C [%p + %p]",prevchar,old,new)
end
- insert_node_after(head,n,italickern(new)) -- tricky with traverse but ok
+ insertnodeafter(head,n,italickern(new)) -- tricky with traverse but ok
else
local new = old + leftkern * factor
if trace_spaces then
@@ -1746,7 +1744,7 @@ local function injectspaces(head)
if trace_spaces then
report_spaces("[%p + %p] %C",old,new,nextchar)
end
- insert_node_after(head,n,italickern(new))
+ insertnodeafter(head,n,italickern(new))
else
local new = old + rightkern * factor
if trace_spaces then
diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua
index 8159db180..51111fa71 100644
--- a/tex/context/base/mkiv/font-otl.lua
+++ b/tex/context/base/mkiv/font-otl.lua
@@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading")
local fonts = fonts
local otf = fonts.handlers.otf
-otf.version = 3.113 -- beware: also sync font-mis.lua and in mtx-fonts
+otf.version = 3.114 -- beware: also sync font-mis.lua and in mtx-fonts
otf.cache = containers.define("fonts", "otl", otf.version, true)
otf.svgcache = containers.define("fonts", "svg", otf.version, true)
otf.pngcache = containers.define("fonts", "png", otf.version, true)
diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua
index 531f665de..4b154b256 100644
--- a/tex/context/base/mkiv/font-otr.lua
+++ b/tex/context/base/mkiv/font-otr.lua
@@ -1292,8 +1292,8 @@ readers.post = function(f,fontdata,specification)
if length > 0 then
glyphs[mapping].name = readstring(f,length)
else
- report("quit post name fetching at %a of %a: %s",i,maxnames,"overflow")
- break
+ -- report("quit post name fetching at %a of %a: %s",i,maxnames,"overflow")
+ -- break
end
end
end
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 47e2e93d4..30d79c407 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -213,27 +213,29 @@ local getglyphdata = nuts.getglyphdata
-- their positions because some complex ligatures might need that. For the moment we
-- use an x_ prefix because for now generic follows the other approach.
-local copy_no_components = nuts.copy_no_components
-local copy_only_glyphs = nuts.copy_only_glyphs
-local count_components = nuts.count_components
-local set_components = nuts.set_components
-local get_components = nuts.get_components
-local flush_components = nuts.flush_components
+local components = nuts.components
+local copynocomponents = components.copynocomponents
+local copyonlyglyphs = components.copyonlyglyphs
+local countcomponents = components.count
+local setcomponents = components.set
+local getcomponents = components.get
+local flushcomponents = components.flush
---------------------------------------------------------------------------------------
local ischar = nuts.ischar
-local usesfont = nuts.uses_font
+local usesfont = nuts.usesfont
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
local copy_node = nuts.copy
-local copy_node_list = nuts.copy_list
+local copy_node_list = nuts.copylist
local remove_node = nuts.remove
local find_node_tail = nuts.tail
-local flush_node_list = nuts.flush_list
-local flush_node = nuts.flush_node
-local end_of_math = nuts.end_of_math
-local start_of_par = nuts.start_of_par
+local flushnodelist = nuts.flushlist
+local flushnode = nuts.flushnode
+local endofmath = nuts.endofmath
+
+local startofpar = nuts.startofpar
local setmetatable = setmetatable
local setmetatableindex = table.setmetatableindex
@@ -317,13 +319,6 @@ local checkstep = (tracers and tracers.steppers.check) or function()
local registerstep = (tracers and tracers.steppers.register) or function() end
local registermessage = (tracers and tracers.steppers.message) or function() end
--- local function checkdisccontent(d)
--- local pre, post, replace = getdisc(d)
--- if pre then for n in traverse_id(glue_code,pre) do report("pre: %s",nodes.idstostring(pre)) break end end
--- if post then for n in traverse_id(glue_code,post) do report("pos: %s",nodes.idstostring(post)) break end end
--- if replace then for n in traverse_id(glue_code,replace) do report("rep: %s",nodes.idstostring(replace)) break end end
--- end
-
local function logprocess(...)
if trace_steps then
registermessage(...)
@@ -423,12 +418,12 @@ local function flattendisk(head,disc)
local prev, next = getboth(disc)
local ishead = head == disc
setdisc(disc)
- flush_node(disc)
+ flushnode(disc)
if pre then
- flush_node_list(pre)
+ flushnodelist(pre)
end
if post then
- flush_node_list(post)
+ flushnodelist(post)
end
if ishead then
if replace then
@@ -480,16 +475,16 @@ local function markstoligature(head,start,stop,char)
local next = getnext(stop)
setprev(start)
setnext(stop)
- local base = copy_no_components(start,copyinjection)
+ local base = copynocomponents(start,copyinjection)
if head == start then
head = base
end
resetinjection(base)
setchar(base,char)
setsubtype(base,ligatureglyph_code)
- set_components(base,start)
+ setcomponents(base,start)
setlink(prev,base,next)
- flush_components(start)
+ flushcomponents(start)
return head, base
end
end
@@ -509,7 +504,7 @@ local no_right_ligature_code = 2
local no_left_kern_code = 4
local no_right_kern_code = 8
-local has_glyph_option = node.direct.has_glyph_option or function(n,c)
+local hasglyphoption = function(n,c)
if c == no_left_ligature_code or c == no_right_ligature_code then
return getattr(n,a_noligature) == 1
else
@@ -520,7 +515,7 @@ end
-- in lmtx we need to check the components and can be slightly more clever
local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfound,hasmarks) -- brr head
- if has_glyph_option(start,no_right_ligature_code) then
+ if hasglyphoption(start,no_right_ligature_code) then
return head, start
end
if start == stop and getchar(start) == char then
@@ -533,14 +528,14 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
local comp = start
setprev(start)
setnext(stop)
- local base = copy_no_components(start,copyinjection)
+ local base = copynocomponents(start,copyinjection)
if start == head then
head = base
end
resetinjection(base)
setchar(base,char)
setsubtype(base,ligatureglyph_code)
- set_components(base,comp)
+ setcomponents(base,comp)
setlink(prev,base,next)
if not discfound then
local deletemarks = not skiphash or hasmarks
@@ -554,7 +549,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
local char = getchar(start)
if not marks[char] then
baseindex = baseindex + componentindex
- componentindex = count_components(start,marks)
+ componentindex = countcomponents(start,marks)
-- we can be more clever here: "not deletemarks or (skiphash and not skiphash[char])"
-- and such:
elseif not deletemarks then
@@ -565,7 +560,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
end
local n = copy_node(start)
copyinjection(n,start) -- is this ok ? we position later anyway
- head, current = insert_node_after(head,current,n) -- unlikely that mark has components
+ head, current = insertnodeafter(head,current,n) -- unlikely that mark has components
elseif trace_marks then
logwarning("%s: delete ligature mark %s",pref(dataset,sequence),gref(char))
end
@@ -590,7 +585,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
break
end
end
- flush_components(components)
+ flushcomponents(components)
else
-- discfound ... forget about marks .. probably no scripts that hyphenate and have marks
local discprev, discnext = getboth(discfound)
@@ -602,8 +597,8 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
if not replace then
-- looks like we never come here as it's not okay
local prev = getprev(base)
- -- local comp = get_components(base) -- already set
- local copied = copy_only_glyphs(comp)
+ -- local comp = getcomponents(base) -- already set
+ local copied = copyonlyglyphs(comp)
if pre then
setlink(discprev,pre)
else
@@ -620,7 +615,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
setlink(prev,discfound,next)
setboth(base)
-- here components have a pointer so we can't free it!
- set_components(base,copied)
+ setcomponents(base,copied)
replace = base
if forcediscretionaries then
setdisc(discfound,pre,post,replace,discretionarydisc_code)
@@ -650,7 +645,7 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what t
local n = copy_node(start) -- ignore components
resetinjection(n)
setchar(n,multiple[k])
- insert_node_after(head,start,n)
+ insertnodeafter(head,start,n)
start = n
end
if what == true then
@@ -661,7 +656,7 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what t
local n = copy_node(start) -- ignore components
resetinjection(n)
setchar(n,m)
- insert_node_after(head,start,n)
+ insertnodeafter(head,start,n)
start = n
end
end
@@ -924,7 +919,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
end
function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection)
- if has_glyph_option(start,no_right_kern_code) then
+ if hasglyphoption(start,no_right_kern_code) then
return head, start, false
else
local startchar = getchar(start)
@@ -945,7 +940,7 @@ function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash,
end
function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection)
- if has_glyph_option(start,no_right_kern_code) then
+ if hasglyphoption(start,no_right_kern_code) then
return head, start, false
else
local snext = getnext(start)
@@ -1536,7 +1531,7 @@ end
function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
-- we actually should check no_left_kern_code with next
- if not has_glyph_option(start,no_right_kern_code) then
+ if not hasglyphoption(start,no_right_kern_code) then
local mapping = currentlookup.mapping
if mapping == nil then
mapping = getmapping(dataset,sequence,currentlookup)
@@ -1566,7 +1561,7 @@ end
function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) -- todo: injections ?
-- we actually should check no_left_kern_code with next
- if not has_glyph_option(start,no_right_kern_code) then
+ if not hasglyphoption(start,no_right_kern_code) then
local mapping = currentlookup.mapping
if mapping == nil then
mapping = getmapping(dataset,sequence,currentlookup)
@@ -1934,13 +1929,13 @@ local function checked(head)
if next then
setlink(kern,next)
end
- flush_node(current)
+ flushnode(current)
head = kern
current = next
else
local prev, next = getboth(current)
setlink(prev,kern,next)
- flush_node(current)
+ flushnode(current)
current = next
end
else
@@ -3795,7 +3790,7 @@ do
local initialrl = 0
- if getid(head) == par_code and start_of_par(head) then
+ if getid(head) == par_code and startofpar(head) then
initialrl = pardirstate(head)
elseif direction == righttoleft_code then
initialrl = -1
@@ -3945,11 +3940,11 @@ do
start = getnext(start)
end
elseif id == math_code then
- start = getnext(end_of_math(start))
+ start = getnext(endofmath(start))
elseif id == dir_code then
topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode)
start = getnext(start)
- -- elseif id == par_code and start_of_par(start) then
+ -- elseif id == par_code and startofpar(start) then
-- rlparmode, rlmode = pardirstate(start)
-- start = getnext(start)
else
@@ -4029,11 +4024,11 @@ do
start = getnext(start)
end
elseif id == math_code then
- start = getnext(end_of_math(start))
+ start = getnext(endofmath(start))
elseif id == dir_code then
topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode)
start = getnext(start)
- -- elseif id == par_code and start_of_par(start) then
+ -- elseif id == par_code and startofpar(start) then
-- rlparmode, rlmode = pardirstate(start)
-- start = getnext(start)
else
@@ -4140,11 +4135,11 @@ do
-- a different font|state or glue (happens often)
start = getnext(start)
elseif id == math_code then
- start = getnext(end_of_math(start))
+ start = getnext(endofmath(start))
elseif id == dir_code then
topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode)
start = getnext(start)
- -- elseif id == par_code and start_of_par(start) then
+ -- elseif id == par_code and startofpar(start) then
-- rlparmode, rlmode = pardirstate(start)
-- start = getnext(start)
else
diff --git a/tex/context/base/mkiv/font-phb.lua b/tex/context/base/mkiv/font-phb.lua
index 42ebfcbc6..ce42e5a59 100644
--- a/tex/context/base/mkiv/font-phb.lua
+++ b/tex/context/base/mkiv/font-phb.lua
@@ -513,7 +513,7 @@ local function harfbuzz(head,font,attr,rlmode,start,stop,text,leading,trailing)
if trace_colors then
resetcolor(g)
end
- setlink(current,g,getnext(current)) -- insert_before
+ setlink(current,g,getnext(current))
current = g
copied = true
else
diff --git a/tex/context/base/mkiv/font-sol.lua b/tex/context/base/mkiv/font-sol.lua
index c61873995..b3b514a16 100644
--- a/tex/context/base/mkiv/font-sol.lua
+++ b/tex/context/base/mkiv/font-sol.lua
@@ -75,14 +75,14 @@ local setnext = nuts.setnext
local setlist = nuts.setlist
local find_node_tail = nuts.tail
-local flush_node = nuts.flush_node
-local flush_node_list = nuts.flush_list
-local copy_node_list = nuts.copy_list
+local flushnode = nuts.flushnode
+local flushnodelist = nuts.flushlist
+local copy_node_list = nuts.copylist
local hpack_nodes = nuts.hpack
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
-local protect_glyphs = nuts.protect_glyphs
-local start_of_par = nuts.start_of_par
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
+local protectglyphs = nuts.protectglyphs
+local startofpar = nuts.startofpar
local nextnode = nuts.traversers.next
local nexthlist = nuts.traversers.hlist
@@ -92,7 +92,7 @@ local repack_hlist = nuts.repackhlist
local nodes_to_utf = nodes.listtoutf
------ protect_glyphs = nodes.handlers.protectglyphs
+----- protectglyphs = nodes.handlers.protectglyphs
local setnodecolor = nodes.tracers.colors.set
@@ -367,8 +367,8 @@ function splitters.split(head) -- best also pass the direction
if encapsulate then
local user_one = new_usernode(splitter_one,n)
local user_two = new_usernode(splitter_two,n)
- head, start = insert_node_before(head,start,user_one)
- insert_node_after(head,stop,user_two)
+ head, start = insertnodebefore(head,start,user_one)
+ insertnodeafter(head,stop,user_two)
else
local current = start
while true do
@@ -437,7 +437,7 @@ function splitters.split(head) -- best also pass the direction
end
local direction, pop = getdirection(current)
r2l = not pop and direction == righttoleft_code
- elseif id == par_code and start_of_par(current) then
+ elseif id == par_code and startofpar(current) then
if start then
flush() -- very unlikely as this starts a paragraph
end
@@ -636,7 +636,7 @@ local function doit(word,list,best,width,badness,line,set,listdir)
if getid(first) == whatsit_code then
local temp = first
first = getnext(first)
- flush_node(temp)
+ flushnode(temp)
end
local last = find_node_tail(first)
-- replace [u]h->t by [u]first->last
@@ -660,14 +660,14 @@ local function doit(word,list,best,width,badness,line,set,listdir)
setnext(t)
end
setnext(last)
- flush_node_list(first)
+ flushnodelist(first)
else
if trace_optimize then
report_optimizers("line %a, set %a, badness before: %a, after %a, criterium %a, verdict %a",line,set or "?",badness,b,criterium,"continue")
end
-- free old h->t
setnext(t)
- flush_node_list(h) -- somehow fails
+ flushnodelist(h) -- somehow fails
if not encapsulate then
word[2] = first
word[3] = last
@@ -784,7 +784,7 @@ function splitters.optimize(head)
if not encapsulate and getid(list) == glyph_code then
-- nasty .. we always assume a prev being there .. future luatex will always have a leftskip set
-- is this assignment ok ? .. needs checking
- list = insert_node_before(list,list,new_leftskip(0)) -- new_glue(0)
+ list = insertnodebefore(list,list,new_leftskip(0)) -- new_glue(0)
setlist(current,list)
end
local temp, badness = repack_hlist(list,width,"exactly",direction) -- it would be nice if the badness was stored in the node
@@ -813,7 +813,7 @@ function splitters.optimize(head)
local bb, base
for i=1,max do
if base then
- flush_node_list(base)
+ flushnodelist(base)
end
base = copy_node_list(list)
local words = collect_words(base) -- beware: words is adapted
@@ -841,7 +841,7 @@ function splitters.optimize(head)
break
end
end
- flush_node_list(base)
+ flushnodelist(base)
end
local words = collect_words(list)
for best=lastbest or 1,max do
@@ -852,7 +852,7 @@ function splitters.optimize(head)
end
if done then
if b <= criterium then -- was == 0
- protect_glyphs(list)
+ protectglyphs(list)
break
end
end
@@ -869,7 +869,7 @@ function splitters.optimize(head)
end
for i=1,nc do
local ci = cache[i]
- flush_node_list(ci.original)
+ flushnodelist(ci.original)
end
cache = { }
tex.hbadness = tex_hbadness
diff --git a/tex/context/base/mkiv/font-txt.lua b/tex/context/base/mkiv/font-txt.lua
index c52878ca7..b8614c8f5 100644
--- a/tex/context/base/mkiv/font-txt.lua
+++ b/tex/context/base/mkiv/font-txt.lua
@@ -101,15 +101,15 @@ local getwidth = nuts.getwidth
local ischar = nuts.ischar
local isglyph = nuts.isglyph
-local traverse_id = nuts.traverse_id
-local usesfont = nuts.uses_font
+local usesfont = nuts.usesfont
-local copy_node_list = nuts.copy_list
+local copy_node_list = nuts.copylist
local find_node_tail = nuts.tail
-local flush_list = nuts.flush_list
-local free_node = nuts.free
-local end_of_math = nuts.end_of_math
-local start_of_par = nuts.start_of_par
+local flushlist = nuts.flushlist
+local freenode = nuts.free
+local endofmath = nuts.endofmath
+
+local startofpar = nuts.startofpar
local nodecodes = nodes.nodecodes
@@ -138,10 +138,10 @@ local function deletedisc(head)
local pre, post, replace, pre_tail, post_tail, replace_tail = getdisc(current,true)
setdisc(current)
if pre then
- flush_list(pre)
+ flushlist(pre)
end
if post then
- flush_list(post)
+ flushlist(post)
end
local p, n = getboth(current)
if replace then
@@ -158,7 +158,7 @@ local function deletedisc(head)
else
setlink(p,n)
end
- free_node(current)
+ freenode(current)
end
current = next
end
@@ -260,7 +260,7 @@ do
stopspacing = false
end
- if getid(head) == par_code and start_of_par(head) then
+ if getid(head) == par_code and startofpar(head) then
rlmode = pardirstate(head)
elseif rlmode == righttoleft_code then
rlmode = -1
@@ -433,7 +433,7 @@ do
else
setnext(getprev(cpostnew))
end
- flush_list(cpostnew)
+ flushlist(cpostnew)
if creplacenew == current_replace then
current_replace = nil
else
@@ -466,7 +466,7 @@ do
setprev(current_pre)
end
setnext(cprenew)
- flush_list(cpre)
+ flushlist(cpre)
creplace = current_replace
current_replace = getnext(creplacenew)
if current_replace then
@@ -487,12 +487,12 @@ do
startspacing = false
stopspacing = false
if id == math_code then
- current = getnext(end_of_math(current))
+ current = getnext(endofmath(current))
elseif id == dir_code then
startspacing = false
topstack, rlmode = txtdirstate(current,dirstack,topstack,rlparmode)
current = getnext(current)
- -- elseif id == par_code and start_of_par(current) then
+ -- elseif id == par_code and startofpar(current) then
-- startspacing = false
-- rlparmode, rlmode = pardirstate(current)
-- current = getnext(current)
diff --git a/tex/context/base/mkiv/good-mth.lua b/tex/context/base/mkiv/good-mth.lua
index 3473cc205..efc7cb22a 100644
--- a/tex/context/base/mkiv/good-mth.lua
+++ b/tex/context/base/mkiv/good-mth.lua
@@ -36,7 +36,7 @@ local new_glyph = nodepool.glyph
local new_hlist = nodepool.hlist
local new_vlist = nodepool.vlist
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
local helpers = fonts.helpers
local upcommand = helpers.commands.up
@@ -361,7 +361,7 @@ local function mathradicalaction(n,h,v,font,mchar,echar)
local kern = new_kern(height-v)
list = setlink(kern,list)
local list = new_vlist(kern)
- insert_node_after(n,n,list)
+ insertnodeafter(n,n,list)
end
local function mathhruleaction(n,h,v,font,bchar,mchar,echar)
@@ -397,7 +397,7 @@ local function mathhruleaction(n,h,v,font,bchar,mchar,echar)
local kern = new_kern(height-v)
list = setlink(kern,list)
local list = new_vlist(kern)
- insert_node_after(n,n,list)
+ insertnodeafter(n,n,list)
end
local function initialize(tfmdata)
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index d4e382a21..c27dade9d 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -78,9 +78,10 @@ local resolveprefix = resolvers.resolve
local texgetbox = tex.getbox
local texsetbox = tex.setbox
-local hpack = node.hpack
+local hpack = nodes.hpack
local new_latelua = nodes.pool.latelua
+local new_hlist = nodes.pool.hlist
local context = context
@@ -1392,7 +1393,7 @@ end
function figures.dummy(data)
data = data or callstack[#callstack] or lastfiguredata
local dr, du, nr = data.request, data.used, figures.boxnumber
- local box = hpack(node.new("hlist")) -- we need to set the dir (luatex 0.60 buglet)
+ local box = hpack(new_hlist()) -- we need to set the dir (luatex 0.60 buglet)
du.width = du.width or figures.defaultwidth
du.height = du.height or figures.defaultheight
du.depth = du.depth or figures.defaultdepth
diff --git a/tex/context/base/mkiv/lang-dis.lua b/tex/context/base/mkiv/lang-dis.lua
index 3e4678801..f6b27175c 100644
--- a/tex/context/base/mkiv/lang-dis.lua
+++ b/tex/context/base/mkiv/lang-dis.lua
@@ -36,8 +36,7 @@ local isglyph = nuts.isglyph
local copy_node = nuts.copy
local remove_node = nuts.remove
-local flush_list = nuts.flush_list
-local flush_node = nuts.flush_node
+----- flushnode = nuts.flushnode
local nextdisc = nuts.traversers.disc
@@ -124,12 +123,12 @@ end
local wiped = 0
-local flatten_discretionaries = nuts.flatten_discretionaries -- todo in nodes
+local flattendiscretionaries = nuts.flattendiscretionaries -- todo in nodes
--- if flatten_discretionaries then
+-- if flattendiscretionaries then
function languages.flatten(head)
- local h, n = flatten_discretionaries(head)
+ local h, n = flattendiscretionaries(head)
wiped = wiped + n
return h, n > 0
end
@@ -152,7 +151,7 @@ local flatten_discretionaries = nuts.flatten_discretionaries -- todo in nodes
-- head = h
-- end
-- wiped = wiped + 1
--- flush_node(delayed)
+-- flushnode(delayed)
-- return head
-- end
--
@@ -202,7 +201,7 @@ function languages.explicithyphen(template)
local pre, post
local disc = new_disc()
if template then
- local langdata = getlanguagedata(getlang(template))
+ local langdata = getlanguagedata(getlanguage(template))
local instance = langdata and langdata.instance
if instance then
local prechr = prehyphenchar(instance)
diff --git a/tex/context/base/mkiv/lang-exp.lua b/tex/context/base/mkiv/lang-exp.lua
index c2eb46990..758ab0f77 100644
--- a/tex/context/base/mkiv/lang-exp.lua
+++ b/tex/context/base/mkiv/lang-exp.lua
@@ -46,7 +46,7 @@ if LUATEXVERSION < 1.005 then -- not loaded any more
local char = isglyph(pre)
if char and char <= 0 then
done = true
- flush_list(pre)
+ flushlist(pre)
pre = nil
end
end
@@ -54,7 +54,7 @@ if LUATEXVERSION < 1.005 then -- not loaded any more
local char = isglyph(post)
if char and char <= 0 then
done = true
- flush_list(post)
+ flushlist(post)
post = nil
end
end
@@ -179,7 +179,7 @@ languages.expanders = expanders
-- expanded = function(head)
-- local done = hyphenate(head)
-- if done then
--- for d in traverse_id(disc_code,head) do
+-- for d in traverseid(disc_code,head) do
-- local s = getsubtype(d)
-- if s ~= discretionary_code then
-- expanders[s](d,template)
diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua
index 01ffe2335..e098e93af 100644
--- a/tex/context/base/mkiv/lang-hyp.lua
+++ b/tex/context/base/mkiv/lang-hyp.lua
@@ -656,12 +656,12 @@ if context then
local setprev = nuts.setprev
local setnext = nuts.setnext
- local insert_before = nuts.insert_before
- local insert_after = nuts.insert_after
+ local insertbefore = nuts.insertbefore
+ local insertafter = nuts.insertafter
local copy_node = nuts.copy
- local copy_list = nuts.copy_list
+ local copylist = nuts.copylist
local remove_node = nuts.remove
- local end_of_math = nuts.end_of_math
+ local endofmath = nuts.endofmath
local node_tail = nuts.tail
local nexthlist = nuts.traversers.hlist
@@ -1087,7 +1087,7 @@ featureset.hyphenonly = hyphenonly == v_yes
nuts.setvisual(p,"penalty")
end
last = getprev(last)
- first, last = insert_after(first,last,p)
+ first, last = insertafter(first,last,p)
end
local function synchronizefeatureset(a)
@@ -1245,7 +1245,7 @@ featureset.hyphenonly = hyphenonly == v_yes
local glyph = copy_node(stop)
setchar(glyph,characters[replacement])
if head then
- insert_after(current,current,glyph)
+ insertafter(current,current,glyph)
else
head = glyph
end
@@ -1256,7 +1256,7 @@ featureset.hyphenonly = hyphenonly == v_yes
local glyph = copy_node(stop)
setchar(glyph,characters[list[i]])
if head then
- insert_after(current,current,glyph)
+ insertafter(current,current,glyph)
else
head = glyph
end
@@ -1265,7 +1265,7 @@ featureset.hyphenonly = hyphenonly == v_yes
end
if rightchar then
local glyph = copy_node(stop)
- insert_after(current,current,glyph)
+ insertafter(current,current,glyph)
setchar(glyph,rightchar)
end
return head
@@ -1291,7 +1291,7 @@ featureset.hyphenonly = hyphenonly == v_yes
setattrlist(disc,attrnode)
end
-- could be a replace as well
- insert_before(first,current,disc)
+ insertbefore(first,current,disc)
elseif type(r) == "table" then
local disc = new_disc()
local pre = r[1]
@@ -1325,7 +1325,7 @@ featureset.hyphenonly = hyphenonly == v_yes
if attrnode then
setattrlist(disc,attrnode)
end
- insert_before(first,current,disc)
+ insertbefore(first,current,disc)
else
setchar(current,characters[r])
if i < rsize then
@@ -1347,7 +1347,7 @@ featureset.hyphenonly = hyphenonly == v_yes
if first ~= current then
local disc = new_disc()
first, current, glyph = remove_node(first,current)
- first, current = insert_before(first,current,disc)
+ first, current = insertbefore(first,current,disc)
if trace_visualize then
setcolor(glyph,"darkred") -- these get checked
setcolor(disc,"darkgreen") -- in the colorizer
@@ -1372,7 +1372,7 @@ featureset.hyphenonly = hyphenonly == v_yes
local function injectseries(current,last,next,attrnode)
local disc = new_disc()
local start = current
- first, current = insert_before(first,current,disc)
+ first, current = insertbefore(first,current,disc)
setprev(start)
setnext(last)
if next then
@@ -1380,7 +1380,7 @@ featureset.hyphenonly = hyphenonly == v_yes
else
setnext(current)
end
- local pre = copy_list(start)
+ local pre = copylist(start)
local post = nil
local replace = start
setdisc(disc,pre,post,replace,automaticdisc_code,hyphenpenalty) -- ex ?
@@ -1547,10 +1547,10 @@ featureset.hyphenonly = hyphenonly == v_yes
skipping = true
end
-- elseif strict and strict[id] then
- -- current = id == math_code and getnext(end_of_math(current)) or getnext(current)
+ -- current = id == math_code and getnext(endofmath(current)) or getnext(current)
-- size = 0
else
- current = id == math_code and getnext(end_of_math(current)) or getnext(current)
+ current = id == math_code and getnext(endofmath(current)) or getnext(current)
end
if size > 0 then
if dictionary and size > charmin and leftmin + rightmin <= size then
diff --git a/tex/context/base/mkiv/lang-ini.lua b/tex/context/base/mkiv/lang-ini.lua
index 7a8aab818..c8b5ee158 100644
--- a/tex/context/base/mkiv/lang-ini.lua
+++ b/tex/context/base/mkiv/lang-ini.lua
@@ -36,19 +36,20 @@ local trace_patterns = false trackers.register("languages.patterns", function(v
local report_initialization = logs.reporter("languages","initialization")
local lang = lang
+language = lang -- we use that in lmtx
-local prehyphenchar = lang.prehyphenchar -- global per language
-local posthyphenchar = lang.posthyphenchar -- global per language
-local preexhyphenchar = lang.preexhyphenchar -- global per language
-local postexhyphenchar = lang.postexhyphenchar -- global per language
------ lefthyphenmin = lang.lefthyphenmin
------ righthyphenmin = lang.righthyphenmin
-local sethjcode = lang.sethjcode
+local prehyphenchar = language.prehyphenchar -- global per language
+local posthyphenchar = language.posthyphenchar -- global per language
+local preexhyphenchar = language.preexhyphenchar -- global per language
+local postexhyphenchar = language.postexhyphenchar -- global per language
+----- lefthyphenmin = language.lefthyphenmin
+----- righthyphenmin = language.righthyphenmin
+local sethjcode = language.sethjcode
local uccodes = characters.uccodes
local lccodes = characters.lccodes
-local new_language = lang.new
+local new_language = language.new
languages = languages or {}
local languages = languages
diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua
index 9f89fa248..d2c47f5ba 100644
--- a/tex/context/base/mkiv/lang-rep.lua
+++ b/tex/context/base/mkiv/lang-rep.lua
@@ -62,11 +62,11 @@ local setprev = nuts.setprev
local setchar = nuts.setchar
local setattrlist = nuts.setattrlist
-local insert_node_before = nuts.insert_before
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local remove_node = nuts.remove
local copy_node = nuts.copy
-local flush_list = nuts.flush_list
-local insert_after = nuts.insert_after
+local flushlist = nuts.flushlist
local nodepool = nuts.pool
local new_disc = nodepool.disc
@@ -170,7 +170,7 @@ local function tonodes(list,template)
local new = copy_node(template)
setchar(new,list[i])
if head then
- head, current = insert_after(head,current,new)
+ head, current = insertafter(head,current,new)
else
head, current = new, new
end
@@ -230,7 +230,7 @@ local function replace(head,first,last,final,hasspace,overload)
-- todo: also set attr
local new = new_disc(pre,post,replace)
setattrlist(new,first)
- head, current = insert_after(head,current,new)
+ head, current = insertafter(head,current,new)
elseif method == "noligature" then
-- not that efficient to copy but ok for testing
local list = codes[2]
@@ -239,12 +239,12 @@ local function replace(head,first,last,final,hasspace,overload)
local new = copy_node(first)
setchar(new,list[i])
setattr(new,a_noligature,1)
- head, current = insert_after(head,current,new)
+ head, current = insertafter(head,current,new)
end
else
local new = copy_node(first)
setchar(new,zwnj)
- head, current = insert_after(head,current,new)
+ head, current = insertafter(head,current,new)
end
else
report_replacement("unknown method %a",method or "?")
@@ -252,11 +252,11 @@ local function replace(head,first,last,final,hasspace,overload)
else
local new = copy_node(first)
setchar(new,codes)
- head, current = insert_after(head,current,new)
+ head, current = insertafter(head,current,new)
end
i = i + 1
end
- flush_list(list)
+ flushlist(list)
elseif newlength == 0 then
-- we overload
elseif oldlength == newlength then
@@ -271,7 +271,7 @@ local function replace(head,first,last,final,hasspace,overload)
for i=1,newlength-oldlength do
local n = copy_node(current)
setchar(n,newcodes[i])
- head, current = insert_node_before(head,current,n)
+ head, current = insertbefore(head,current,n)
current = getnext(current)
end
for i=newlength-oldlength+1,newlength do
diff --git a/tex/context/base/mkiv/lang-tra.lua b/tex/context/base/mkiv/lang-tra.lua
index 5fd123349..35e9344aa 100644
--- a/tex/context/base/mkiv/lang-tra.lua
+++ b/tex/context/base/mkiv/lang-tra.lua
@@ -15,7 +15,7 @@ local nextchar = nuts.traversers.char
local getattr = nuts.getattr
local setchar = nuts.setchar
-local insert_before = nuts.insert_before
+local insertbefore = nuts.insertbefore
local copy_node = nuts.copy
local texsetattribute = tex.setattribute
@@ -97,7 +97,7 @@ function transliteration.handler(head)
for i = n-1,1,-1 do
local g = copy_node(current)
setchar(g,t[i])
- head, p = insert_before(head, p, g)
+ head, p = insertbefore(head, p, g)
end
end
end
diff --git a/tex/context/base/mkiv/lpdf-fld.lua b/tex/context/base/mkiv/lpdf-fld.lua
index e14968eb8..50720c84a 100644
--- a/tex/context/base/mkiv/lpdf-fld.lua
+++ b/tex/context/base/mkiv/lpdf-fld.lua
@@ -97,7 +97,7 @@ local pdfcolor = lpdf.color
local pdfcolorvalues = lpdf.colorvalues
local pdflayerreference = lpdf.layerreference
-local hpack_node = node.hpack
+local hpack_node = nodes.hpack
local submitoutputformat = 0 -- 0=unknown 1=HTML 2=FDF 3=XML => not yet used, needs to be checked
diff --git a/tex/context/base/mkiv/lpdf-mov.lua b/tex/context/base/mkiv/lpdf-mov.lua
index 42ba6fb00..a0f82b25b 100644
--- a/tex/context/base/mkiv/lpdf-mov.lua
+++ b/tex/context/base/mkiv/lpdf-mov.lua
@@ -16,7 +16,6 @@ local pdfconstant = lpdf.constant
local pdfdictionary = lpdf.dictionary
local pdfarray = lpdf.array
local pdfborder = lpdf.border
-local write_node = node.write
function nodeinjections.insertmovie(specification)
-- managed in figure inclusion: width, height, factor, repeat, controls, preview, label, foundname
@@ -41,7 +40,7 @@ function nodeinjections.insertmovie(specification)
Movie = moviedict,
A = controldict,
}
- write_node(nodeinjections.annotation(width,height,0,action())) -- test: context(...)
+ context(nodeinjections.annotation(width,height,0,action())) -- test: context(...)
end
function nodeinjections.insertsound(specification)
@@ -63,6 +62,6 @@ function nodeinjections.insertsound(specification)
Movie = sounddict,
A = controldict,
}
- write_node(nodeinjections.annotation(0,0,0,action())) -- test: context(...)
+ context(nodeinjections.annotation(0,0,0,action())) -- test: context(...)
end
end
diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua
index 106eb98cc..a0e41e4d0 100644
--- a/tex/context/base/mkiv/lpdf-wid.lua
+++ b/tex/context/base/mkiv/lpdf-wid.lua
@@ -43,6 +43,8 @@ local context = context
local texgetcount = tex.getcount
+local hpacknode = nodes.hpack
+
local nodeinjections = backends.pdf.nodeinjections
local codeinjections = backends.pdf.codeinjections
local registrations = backends.pdf.registrations
@@ -76,9 +78,6 @@ local pdfborder = lpdf.border
local pdftransparencyvalue = lpdf.transparencyvalue
local pdfcolorvalues = lpdf.colorvalues
-local hpack_node = node.hpack
-local write_node = node.write -- test context(...) instead
-
-- symbols
local presets = { } -- xforms
@@ -453,7 +452,7 @@ function nodeinjections.attachfile(specification)
local width = specification.width or 0
local height = specification.height or 0
local depth = specification.depth or 0
- local box = hpack_node(nodeinjections.annotation(width,height,depth,d()))
+ local box = hpacknode(nodeinjections.annotation(width,height,depth,d()))
box.width = width
box.height = height
box.depth = depth
@@ -554,12 +553,12 @@ function nodeinjections.comment(specification) -- brrr: seems to be done twice
Parent = pdfreference(nd),
}
d.Popup = pdfreference(nc)
- box = hpack_node(
+ box = hpacknode(
nodeinjections.annotation(0,0,0,d(),nd),
nodeinjections.annotation(width,height,depth,c(),nc)
)
else
- box = hpack_node(nodeinjections.annotation(width,height,depth,d()))
+ box = hpacknode(nodeinjections.annotation(width,height,depth,d()))
end
box.width = width -- redundant
box.height = height -- redundant
@@ -652,7 +651,7 @@ local function insertrenderingwindow(specification)
if height == 0 or width == 0 then
-- todo: sound needs no window
end
- write_node(nodeinjections.annotation(width,height,0,d(),r)) -- save ref
+ context(nodeinjections.annotation(width,height,0,d(),r)) -- save ref
return pdfreference(r)
end
diff --git a/tex/context/base/mkiv/math-dir.lua b/tex/context/base/mkiv/math-dir.lua
index 38aa44358..f26324ed9 100644
--- a/tex/context/base/mkiv/math-dir.lua
+++ b/tex/context/base/mkiv/math-dir.lua
@@ -36,8 +36,8 @@ local getattr = nuts.getattr
local setchar = nuts.setchar
local setlist = nuts.setlist
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local nodecodes = nodes.nodecodes
local enableaction = nodes.tasks.enableaction
@@ -65,8 +65,8 @@ local function processmath(head)
local start = nil
local stop = nil
local function capsulate()
- head = insert_node_before(head,start,new_direction(lefttoright_code))
- insert_node_after(head,stop,new_direction(lefttoright_code,true))
+ head = insertnodebefore(head,start,new_direction(lefttoright_code))
+ insertnodeafter(head,stop,new_direction(lefttoright_code,true))
if trace_directions then
report_directions("reversed: %s",nodes.listtoutf(start,false,false,stop))
end
diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua
index 1fb763a3b..fdc2d0177 100644
--- a/tex/context/base/mkiv/math-noa.lua
+++ b/tex/context/base/mkiv/math-noa.lua
@@ -134,12 +134,12 @@ local setsup = nuts.setsup
local setsubpre = nuts.setsubpre
local setsuppre = nuts.setsuppre
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local copy_node = nuts.copy
local slide_nodes = nuts.slide
local set_visual = nuts.setvisual
-local mlist_to_hlist = nuts.mlist_to_hlist
+local mlisttohlist = nuts.mlisttohlist
local new_kern = nodepool.kern
local new_submlist = nodepool.submlist
@@ -884,7 +884,7 @@ do
end
setchar(d,chr)
setfam(d,fam)
- flush_node(sym)
+ flushnode(sym)
end
setattrlist(d,char)
setattrlist(f,char)
@@ -930,7 +930,7 @@ do
if midl then
local fence = makefence(middlefence_code,current)
setnucleus(current)
- flush_node(current)
+ flushnode(current)
middle[current] = nil
-- replace_node
setlink(prev,fence,next)
@@ -956,7 +956,7 @@ do
local f_c = makefence(rightfence_code,close)
makelist(middle,open,f_o,o_next,c_prev,f_c)
setnucleus(close)
- flush_node(close)
+ flushnode(close)
-- open is now a list
setlink(open,c_next)
return open
@@ -1883,7 +1883,7 @@ do
end
while c ~= l do
local n = getnext(c)
- flush_node(c)
+ flushnode(c)
c = n
end
setlink(parent,l)
@@ -2097,7 +2097,7 @@ do
end
setprev(next,pointer)
setnext(parent,getnext(next))
- flush_node(next)
+ flushnode(next)
end
end
end
@@ -2350,16 +2350,10 @@ do
-- force_penalties = v
-- end)
- function builders.kernel.mlist_to_hlist(head,style,penalties)
- return mlist_to_hlist(head,style,force_penalties or penalties)
+ function builders.kernel.mlisttohlist(head,style,penalties)
+ return mlisttohlist(head,style,force_penalties or penalties)
end
- -- function builders.kernel.mlist_to_hlist(head,style,penalties)
- -- local h = mlist_to_hlist(head,style,force_penalties or penalties)
- -- inspect(nodes.totree(h,true,true,true))
- -- return h
- -- end
-
implement {
name = "setmathpenalties",
arguments = "integer",
@@ -2374,14 +2368,14 @@ local actions = tasks.actions("math") -- head, style, penalties
local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming
-function processors.mlist_to_hlist(head,style,penalties)
+function processors.mlisttohlist(head,style,penalties)
starttiming(noads)
head = actions(head,style,penalties)
stoptiming(noads)
return head
end
-callbacks.register('mlist_to_hlist',processors.mlist_to_hlist,"preprocessing math list")
+callbacks.register('mlisttohlist',processors.mlisttohlist,"preprocessing math list")
-- tracing
diff --git a/tex/context/base/mkiv/math-tag.lua b/tex/context/base/mkiv/math-tag.lua
index 41373fcb5..3c53c2cc8 100644
--- a/tex/context/base/mkiv/math-tag.lua
+++ b/tex/context/base/mkiv/math-tag.lua
@@ -38,7 +38,7 @@ local getnucleus = nuts.getnucleus
local getsub = nuts.getsub
local getsup = nuts.getsup
-local set_attributes = nuts.setattributes
+local setattributes = nuts.setattributes
local nextnode = nuts.traversers.node
@@ -297,7 +297,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer
-- empty list
elseif not attr then
-- box comes from strange place
- set_attributes(list,a_tagged,text) -- only the first node ?
+ setattributes(list,a_tagged,text) -- only the first node ?
else
-- Beware, the first node in list is the actual list so we definitely
-- need to nest. This approach is a hack, maybe I'll make a proper
diff --git a/tex/context/base/mkiv/meta-blb.lua b/tex/context/base/mkiv/meta-blb.lua
index c690f3902..e57bc3c23 100644
--- a/tex/context/base/mkiv/meta-blb.lua
+++ b/tex/context/base/mkiv/meta-blb.lua
@@ -221,9 +221,9 @@ local getsubtype = nuts.getsubtype
local setlink = nuts.setlink
local setlist = nuts.setlist
local getnext = nuts.getnext
-local flatten_list = nuts.flatten_discretionaries
+local flatten_list = nuts.flattendiscretionaries
local remove_node = nuts.remove
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local addblob = mp.mf_blob_add
local newblob = mp.mf_blob_new
@@ -276,7 +276,7 @@ local function initialize(category,box)
end
setlist(wrap,head)
end
- flush_node(wrap)
+ flushnode(wrap)
end
end
diff --git a/tex/context/base/mkiv/meta-imp-txt.mkiv b/tex/context/base/mkiv/meta-imp-txt.mkiv
index 2c28acf72..8e7af88b7 100644
--- a/tex/context/base/mkiv/meta-imp-txt.mkiv
+++ b/tex/context/base/mkiv/meta-imp-txt.mkiv
@@ -243,7 +243,7 @@
if head then
n = { }
s = 0
- head = node.flatten_discretionaries(head)
+ head = nodes.flattendiscretionaries(head)
local current = head
while current do
local id = current.id
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index e737b5d86..7566d9310 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -23,9 +23,6 @@ local context = context
local allocate = utilities.storage.allocate
-local copy_node = node.copy
-local write_node = node.write
-
local pen_info = mplib.pen_info
local getfields = mplib.getfields or mplib.fields -- todo: in lmtx get them once and then use gettype
@@ -91,7 +88,7 @@ end
function metapost.flushliteral(d)
if savedliterals then
- write_node(mpsliteral(savedliterals[d]))
+ context(mpsliteral(savedliterals[d]))
else
report_metapost("problem flushing literal %a",d)
end
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua
index 8a6f4b4f8..122ca6f99 100644
--- a/tex/context/base/mkiv/mlib-pps.lua
+++ b/tex/context/base/mkiv/mlib-pps.lua
@@ -26,8 +26,8 @@ local setmacro = interfaces.setmacro
local texsetbox = tex.setbox
local textakebox = tex.takebox -- or: nodes.takebox
local texrunlocal = tex.runlocal
-local copy_list = node.copy_list
-local flush_list = node.flush_list
+local copylist = nodes.copylist
+local flushlist = nodes.flushlist
local setmetatableindex = table.setmetatableindex
local sortedhash = table.sortedhash
@@ -271,7 +271,7 @@ local function stopjob()
if top then
for slot, content in next, top.textexts do
if content then
- flush_list(content)
+ flushlist(content)
if trace_textexts then
report_textexts("freeing text %s",slot)
end
@@ -1078,7 +1078,7 @@ local tx_reset, tx_process do
end
box = cache[mp_hash]
if box then
- box = copy_list(box)
+ box = copylist(box)
else
texrunlocal("mptexttoks")
box = textakebox("mptextbox")
diff --git a/tex/context/base/mkiv/mult-fmt.lua b/tex/context/base/mkiv/mult-fmt.lua
index 0d11a4253..67133aab2 100644
--- a/tex/context/base/mkiv/mult-fmt.lua
+++ b/tex/context/base/mkiv/mult-fmt.lua
@@ -11,12 +11,12 @@ local concat, sortedhash = table.concat, table.sortedhash
local sub, formatters = string.sub, string.formatters
local utfsplit = utf.split
-local prtcatcodes = catcodes.numbers.prtcatcodes
-local contextsprint = context.sprint
-local implement = interfaces.implement
+local prtcatcodes = catcodes.numbers.prtcatcodes
+local contextsprint = context.sprint
+local implement = interfaces.implement
-local setmacro = token.set_macro
-local definedmacro = token.is_defined
+local setmacro = token.setmacro or token.set_macro
+local definedmacro = token.isdefined or token.is_defined
local report = logs.reporter("interface")
local report_interface = logs.reporter("interface","initialization")
diff --git a/tex/context/base/mkiv/node-acc.lua b/tex/context/base/mkiv/node-acc.lua
index d8f4b25bf..5849c045c 100644
--- a/tex/context/base/mkiv/node-acc.lua
+++ b/tex/context/base/mkiv/node-acc.lua
@@ -32,8 +32,8 @@ local nextglyph = nuts.traversers.glyph
local nextnode = nuts.traversers.node
----- copy_node = nuts.copy
-local insert_after = nuts.insert_after
-local copy_no_components = nuts.copy_no_components
+local insertafter = nuts.insertafter
+local copynocomponents = nuts.components.copynocomponents
local nodecodes = nodes.nodecodes
local gluecodes = nodes.gluecodes
@@ -71,7 +71,7 @@ local function injectspaces(head)
if s == spaceskip_code or s == xspaceskip_code then
-- unless we don't care about the little bit of overhead
-- we can just: local g = copy_node(g)
- local g = copy_no_components(p)
+ local g = copynocomponents(p)
local a = getattr(n,a_characters)
setchar(g,slot)
setlink(p,g,n)
@@ -163,8 +163,8 @@ end)
-- local str = codes[a]
-- local b = pageliteral(format("/Span << /ActualText %s >> BDC", lpdf.tosixteen(str)))
-- local e = pageliteral("EMC")
--- insert_before(head,n,b)
--- insert_after(head,n,e)
+-- insertbefore(head,n,b)
+-- insertafter(head,n,e)
-- done = true
-- end
-- elseif id == hlist_code or id == vlist_code then
diff --git a/tex/context/base/mkiv/node-aux.lua b/tex/context/base/mkiv/node-aux.lua
index d3c537a3b..5a98b2ea3 100644
--- a/tex/context/base/mkiv/node-aux.lua
+++ b/tex/context/base/mkiv/node-aux.lua
@@ -53,11 +53,11 @@ local traversers = nuts.traversers
local nextnode = traversers.node
local nextglyph = traversers.glyph
-local flush_node = nuts.flush
-local flush_list = nuts.flush_list
+local flushnode = nuts.flush
+local flushlist = nuts.flushlist
local hpack_nodes = nuts.hpack
-local unset_attribute = nuts.unset_attribute
-local first_glyph = nuts.first_glyph
+local unsetattribute = nuts.unsetattribute
+local firstglyph = nuts.firstglyph
local copy_node = nuts.copy
local find_tail = nuts.tail
local getbox = nuts.getbox
@@ -85,7 +85,7 @@ local report_error = logs.reporter("node-aux:error")
-- function tex.takebox(id)
-- local box = tex.getbox(id)
-- if box then
--- local copy = node.copy(box)
+-- local copy = nodes.copy(box)
-- local list = box.list
-- copy.list = list
-- box.list = nil
@@ -129,7 +129,7 @@ end
function nuts.takelist(n)
local l = getlist(n)
setlist(n)
- flush_node(n)
+ flushnode(n)
return l
end
@@ -142,7 +142,7 @@ local function repackhlist(list,...)
local temp, b = hpack_nodes(list,...)
list = getlist(temp)
setlist(temp)
- flush_node(temp)
+ flushnode(temp)
return list, b
end
@@ -153,50 +153,59 @@ function nodes.repackhlist(list,...)
return tonode(list), b
end
-local function set_attributes(head,attr,value)
- for n, id in nextnode, head do
- setattr(n,attr,value)
- if id == hlist_node or id == vlist_node then
- set_attributes(getlist(n),attr,value)
- end
- end
-end
+if not nuts.setattributes then
-local function set_unset_attributes(head,attr,value)
- for n, id in nextnode, head do
- if not getattr(n,attr) then
+ local function setattributes(head,attr,value)
+ for n, id in nextnode, head do
setattr(n,attr,value)
- end
- if id == hlist_code or id == vlist_code then
- set_unset_attributes(getlist(n),attr,value)
+ if id == hlist_node or id == vlist_node then
+ setattributes(getlist(n),attr,value)
+ end
end
end
+
+ nuts .setattributes = setattributes
+ nodes.setattributes = vianuts(setattributes)
+
end
-local function unset_attributes(head,attr)
- for n, id in nextnode, head do
- setattr(n,attr,unsetvalue)
- if id == hlist_code or id == vlist_code then
- unset_attributes(getlist(n),attr)
+if not nuts.setunsetattributes then
+
+ local function setunsetattributes(head,attr,value)
+ for n, id in nextnode, head do
+ if not getattr(n,attr) then
+ setattr(n,attr,value)
+ end
+ if id == hlist_code or id == vlist_code then
+ setunsetattributes(getlist(n),attr,value)
+ end
end
end
+
+ nuts .setunsetattributes = setunsetattributes
+ nodes.setunsetattributes = vianuts(setunsetattributes)
+
end
--- for old times sake
+if not nuts.unsetattributes then
-nuts.setattribute = nuts.setattr nodes.setattribute = nodes.setattr
-nuts.getattribute = nuts.getattr nodes.getattribute = nodes.getattr
-nuts.unsetattribute = nuts.unset_attribute nodes.unsetattribute = nodes.unset_attribute
-nuts.has_attribute = nuts.has_attribute nodes.has_attribute = nodes.has_attribute
-nuts.firstglyph = nuts.first_glyph nodes.firstglyph = nodes.first_glyph
+ local function unsetattributes(head,attr)
+ for n, id in nextnode, head do
+ setattr(n,attr,unsetvalue)
+ if id == hlist_code or id == vlist_code then
+ unsetattributes(getlist(n),attr)
+ end
+ end
+ end
+
+ nuts .unsetattributes = unsetattributes
+ nodes.unsetattributes = vianuts(unsetattributes)
-nuts.setattributes = set_attributes nodes.setattributes = vianuts(set_attributes)
-nuts.setunsetattributes = set_unset_attributes nodes.setunsetattributes = vianuts(set_unset_attributes)
-nuts.unsetattributes = unset_attributes nodes.unsetattributes = vianuts(unset_attributes)
+end
function nuts.firstcharacter(n,untagged) -- tagged == subtype > 255
if untagged then
- return first_glyph(n)
+ return firstglyph(n)
else
for g in nextglyph ,n do
return g
@@ -370,7 +379,7 @@ local function rehpack(n,width)
local set, order, sign = getboxglue(temp)
setboxglue(n,set,order,sign)
setlist(temp)
- flush_node(temp)
+ flushnode(temp)
return n
end
@@ -406,7 +415,7 @@ do
local getsubtype = nodes.getsubtype
- function nodes.start_of_par(n)
+ function nodes.startofpar(n)
local s = getsubtype(n)
return s == hmodepar_code or s == vmodepar_code
end
@@ -423,8 +432,6 @@ if not nuts.getnormalizedline then
local getlist = nuts.getlist
local getwidth = nuts.getwidth
- local direct = node.direct
-
local nodecodes = nodes.nodecodes
local skipcodes = nodes.skipcodes
@@ -438,7 +445,7 @@ if not nuts.getnormalizedline then
local indentskip_code = skipcodes.indentskip
local parfillskip_code = skipcodes.parfillskip
- local find_node = direct.find_node or function(h,t,s)
+ nuts.findnode = node.direct.find_node or function(h,t,s)
if h then
if s then
for node, subtype in traversers[t] do
@@ -454,7 +461,6 @@ if not nuts.getnormalizedline then
end
end
- nuts.find_node = find_node
function nuts.getnormalizedline(h)
if getid(h) == hlist_code and getsubtype(h) == line_code then
diff --git a/tex/context/base/mkiv/node-bck.lua b/tex/context/base/mkiv/node-bck.lua
index ec84a3db5..d81d2a27b 100644
--- a/tex/context/base/mkiv/node-bck.lua
+++ b/tex/context/base/mkiv/node-bck.lua
@@ -52,7 +52,7 @@ local nextnode = nuts.traversers.node
local nexthlist = nuts.traversers.hlist
local nextlist = nuts.traversers.list
-local flush_node_list = nuts.flush_list
+local flushnodelist = nuts.flushlist
local new_rule = nodepool.rule
local new_kern = nodepool.kern
@@ -160,7 +160,7 @@ local function add_alignbackgrounds(head,list)
local template = getprop(head,"alignmentchecked")
if template then
list = colored_b(head,list,template[1],hlist_code,template[2])
- flush_node_list(template)
+ flushnodelist(template)
templates[currentrow] = false
return list
end
diff --git a/tex/context/base/mkiv/node-bwc.lua b/tex/context/base/mkiv/node-bwc.lua
new file mode 100644
index 000000000..e287de68e
--- /dev/null
+++ b/tex/context/base/mkiv/node-bwc.lua
@@ -0,0 +1,92 @@
+if not modules then modules = { } end modules ['node-bwc'] = {
+ 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"
+}
+
+-- This is a backward compatibility list.
+
+local nodes = nodes
+local nuts = nodes.nuts
+
+nuts .check_discretionaries = nuts .checkdiscretionaries
+nuts .copy_list = nuts .copylist
+nuts .copy_node = nuts .copynode
+nuts .copy_only = nuts .copyonly
+nuts .current_attr = nuts .currentattributes
+nuts .effective_glue = nuts .effectiveglue
+nuts .end_of_math = nuts .endofmath
+nuts .find_attribute = nuts .findattribute
+nuts .first_glyph = nuts .firstglyph
+nuts .flatten_discretionaries = nuts .flattendiscretionaries
+nuts .flush_list = nuts .flushlist
+nuts .flush_node = nuts .flushnode
+nuts .get_attribute = nuts .getattribute
+nuts .get_synctex_fields = nuts .getsynctexfields
+nuts .has_attribute = nuts .hasattribute
+nuts .has_dimensions = nuts .hasdimensions
+nuts .has_field = nuts .hasfield
+nuts .has_glyph = nuts .hasglyph
+nuts .insert_after = nuts .insertafter
+nuts .insert_before = nuts .insertbefore
+nuts .is_direct = nuts .isdirect
+nuts .is_node = nuts .isnode
+nuts .is_nut = nuts .isnut
+nuts .is_zero_glue = nuts .iszeroglue
+nuts .mlist_to_hlist = nuts .mlisttohlist
+nuts .protect_glyph = nuts .protectglyph
+nuts .protect_glyphs = nuts .protectglyphs
+-----.protrusion_skippable = nuts .protrusionskippable
+nuts .set_attribute = nuts .setattribute
+-----.set_synctex_fields = nuts .setsynctexfields
+nuts .start_of_par = nuts .startofpar
+nuts .traverse_id = nuts .traverseid
+nuts .traverse_char = nuts .traversechar
+nuts .traverse_glyph = nuts .traverseglyph
+nuts .traverse_id = nuts .traverseid
+nuts .traverse_list = nuts .traverselist
+nuts .unprotect_glyph = nuts .unprotectglyph
+nuts .unprotect_glyphs = nuts .unprotectglyphs
+nuts .unset_attribute = nuts .unsetattribute
+nuts .uses_font = nuts .usesfont
+nuts .getattr = nuts .getattribute
+nuts .getattrs = nuts .getattributes
+nuts .getattrlist = nuts .getattributelist
+
+-----.check_discretionaries = nodes.checkdiscretionaries
+nodes.copy_list = nodes.copylist
+nodes.copy_node = nodes.copynode
+nodes.current_attributes = nodes.currentattributes
+nodes.effective_glue = nodes.effectiveglue
+nodes.end_of_math = nodes.endofmath
+nodes.find_attribute = nodes.findattribute
+nodes.first_glyph = nodes.firstglyph
+-----.flatten_discretionaries = nodes.flattendiscretionaries
+nodes.flush_list = nodes.flushlist
+nodes.flush_node = nodes.flushnode
+nodes.has_attribute = nodes.hasattribute
+nodes.has_field = nodes.hasfield
+nodes.has_glyph = nodes.hasglyph
+nodes.insert_after = nodes.insertafter
+nodes.insert_before = nodes.insertbefore
+nodes.is_node = nodes.isnode
+nodes.is_direct = nodes.isdirect
+nodes.is_nut = nodes.isnut
+nodes.is_zero_glue = nodes.iszeroglue
+nodes.last_node = nodes.lastnode
+nodes.mlist_to_hlist = nodes.mlisttohlist
+nodes.protect_glyph = nodes.protectglyph
+nodes.protect_glyphs = nodes.protectglyphs
+nodes.protrusion_skippable = nodes.protrusionskippable
+nodes.set_attribute = nodes.setattribute
+nodes.traverse_id = nodes.traverseid
+nodes.traverse_char = nodes.traversechar
+nodes.traverse_glyph = nodes.traverseglyph
+nodes.traverse_id = nodes.traverseid
+nodes.traverse_list = nodes.traverselist
+nodes.unprotect_glyph = nodes.unprotectglyph
+nodes.unprotect_glyphs = nodes.unprotectglyphs
+nodes.unset_attribute = nodes.unsetattribute
+nodes.uses_font = nodes.usesfont
diff --git a/tex/context/base/mkiv/node-fin.lua b/tex/context/base/mkiv/node-fin.lua
index 373cce3ce..42c24378f 100644
--- a/tex/context/base/mkiv/node-fin.lua
+++ b/tex/context/base/mkiv/node-fin.lua
@@ -17,57 +17,57 @@ local setmetatableindex = table.setmetatableindex
local attributes, nodes, node = attributes, nodes, node
-local nuts = nodes.nuts
-local tonut = nodes.tonut
-
-local getnext = nuts.getnext
-local getid = nuts.getid
-local getlist = nuts.getlist
-local getleader = nuts.getleader
-local getattr = nuts.getattr
-local getwidth = nuts.getwidth
-local getwhd = nuts.getwhd
-local getorientation = nuts.getorientation
-local has_dimensions = nuts.has_dimensions
-local getbox = nuts.getbox
-
-local setlist = nuts.setlist
-local setleader = nuts.setleader
-
-local copy_node = nuts.copy
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
-
-local nextnode = nuts.traversers.node
-
-local nodecodes = nodes.nodecodes
-local rulecodes = nodes.rulecodes
-
-local boxrule_code = rulecodes.box
-local imagerule_code = rulecodes.image
-local emptyrule_code = rulecodes.empty
-
-local glyph_code = nodecodes.glyph
-local disc_code = nodecodes.disc
-local glue_code = nodecodes.glue
-local rule_code = nodecodes.rule
-local hlist_code = nodecodes.hlist
-local vlist_code = nodecodes.vlist
-
-local texlists = tex.lists
-local texgetnest = tex.getnest
-
-local states = attributes.states
-local numbers = attributes.numbers
-local a_trigger = attributes.private('trigger')
-local triggering = false
-
-local implement = interfaces.implement
-
-local starttiming = statistics.starttiming
-local stoptiming = statistics.stoptiming
-local loadstripped = utilities.lua.loadstripped
-local unsetvalue = attributes.unsetvalue
+local nuts = nodes.nuts
+local tonut = nodes.tonut
+
+local getnext = nuts.getnext
+local getid = nuts.getid
+local getlist = nuts.getlist
+local getleader = nuts.getleader
+local getattr = nuts.getattr
+local getwidth = nuts.getwidth
+local getwhd = nuts.getwhd
+local getorientation = nuts.getorientation
+local hasdimensions = nuts.hasdimensions
+local getbox = nuts.getbox
+
+local setlist = nuts.setlist
+local setleader = nuts.setleader
+
+local copy_node = nuts.copy
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
+
+local nextnode = nuts.traversers.node
+
+local nodecodes = nodes.nodecodes
+local rulecodes = nodes.rulecodes
+
+local boxrule_code = rulecodes.box
+local imagerule_code = rulecodes.image
+local emptyrule_code = rulecodes.empty
+
+local glyph_code = nodecodes.glyph
+local disc_code = nodecodes.disc
+local glue_code = nodecodes.glue
+local rule_code = nodecodes.rule
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+
+local texlists = tex.lists
+local texgetnest = tex.getnest
+
+local states = attributes.states
+local numbers = attributes.numbers
+local a_trigger = attributes.private('trigger')
+local triggering = false
+
+local implement = interfaces.implement
+
+local starttiming = statistics.starttiming
+local stoptiming = statistics.stoptiming
+local loadstripped = utilities.lua.loadstripped
+local unsetvalue = attributes.unsetvalue
-- these two will be like trackers
@@ -163,13 +163,13 @@ function states.finalize(namespace,attribute,head) -- is this one ok?
if id == hlist_code or id == vlist_code then
local content = getlist(head)
if content then
- local list = insert_node_before(content,content,copy_node(nsnone)) -- two return values
+ local list = insertnodebefore(content,content,copy_node(nsnone)) -- two return values
if list ~= content then
setlist(head,list)
end
end
else
- head = insert_node_before(head,head,copy_node(nsnone))
+ head = insertnodebefore(head,head,copy_node(nsnone))
end
return head, true
end
@@ -199,20 +199,20 @@ local function process(attribute,head,inheritance,default) -- one attribute
if outer then
if default and outer == inheritance then
if current ~= default then
- head = insert_node_before(head,stack,copy_node(nsdata[default]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[default]))
current = default
end
elseif current ~= outer then
- head = insert_node_before(head,stack,copy_node(nsdata[c]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[c]))
current = outer
end
elseif default and inheritance then
if current ~= default then
- head = insert_node_before(head,stack,copy_node(nsdata[default]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[default]))
current = default
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current = 0
end
end
@@ -236,7 +236,7 @@ local function process(attribute,head,inheritance,default) -- one attribute
-- end nested --
end
elseif id == rule_code then
- check = has_dimensions(stack)
+ check = hasdimensions(stack)
end
-- much faster this way than using a check() and nested() function
if check then
@@ -244,11 +244,11 @@ local function process(attribute,head,inheritance,default) -- one attribute
if c then
if default and c == inheritance then
if current ~= default then
- head = insert_node_before(head,stack,copy_node(nsdata[default]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[default]))
current = default
end
elseif current ~= c then
- head = insert_node_before(head,stack,copy_node(nsdata[c]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[c]))
current = c
end
if leader then
@@ -281,11 +281,11 @@ local function process(attribute,head,inheritance,default) -- one attribute
end
elseif default and inheritance then
if current ~= default then
- head = insert_node_before(head,stack,copy_node(nsdata[default]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[default]))
current = default
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current = 0
end
check = false
@@ -326,7 +326,7 @@ local function selective(attribute,head,inheritance,default) -- two attributes
if default and outer == inheritance then
if current ~= default then
local data = nsdata[default]
- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
current = default
end
else
@@ -334,7 +334,7 @@ local function selective(attribute,head,inheritance,default) -- two attributes
-- local s = nsforced or getattr(stack,nsselector)
if current ~= outer or current_selector ~= s then
local data = nsdata[outer]
- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
current = outer
current_selector = s
end
@@ -342,11 +342,11 @@ local function selective(attribute,head,inheritance,default) -- two attributes
elseif default and inheritance then
if current ~= default then
local data = nsdata[default]
- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
current = default
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current, current_selector = 0, 0
end
end
@@ -374,7 +374,7 @@ local function selective(attribute,head,inheritance,default) -- two attributes
-- so no redundant color stuff (only here, layers for instance should obey)
check = false
else
- check = has_dimensions(stack)
+ check = hasdimensions(stack)
end
else
end
@@ -384,7 +384,7 @@ local function selective(attribute,head,inheritance,default) -- two attributes
if default and c == inheritance then
if current ~= default then
local data = nsdata[default]
- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
current = default
end
else
@@ -392,7 +392,7 @@ local function selective(attribute,head,inheritance,default) -- two attributes
-- local s = nsforced or getattr(stack,nsselector)
if current ~= c or current_selector ~= s then
local data = nsdata[c]
- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
current = c
current_selector = s
end
@@ -419,11 +419,11 @@ local function selective(attribute,head,inheritance,default) -- two attributes
elseif default and inheritance then
if current ~= default then
local data = nsdata[default]
- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
current = default
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current, current_selector = 0, 0
end
check = false
@@ -470,9 +470,9 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance,
if a and current ~= a and nslistwise[a] then -- viewerlayer / needs checking, see below
local p = current
current = a
- head = insert_node_before(head,stack,copy_node(nsdata[a]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[a]))
list = stacked(attribute,content,current) -- two return values
- head, stack = insert_node_after(head,stack,copy_node(nsnone))
+ head, stack = insertnodeafter(head,stack,copy_node(nsnone))
current = p
else
list = stacked(attribute,content,current)
@@ -485,13 +485,13 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance,
end
end
elseif id == rule_code then
- check = has_dimensions(stack)
+ check = hasdimensions(stack)
end
if check then
local a = getattr(stack,attribute)
if a then
if current ~= a then
- head = insert_node_before(head,stack,copy_node(nsdata[a]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[a]))
depth = depth + 1
current = a
end
@@ -508,7 +508,7 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance,
elseif default > 0 then
--
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
depth = depth - 1
current = 0
end
@@ -517,7 +517,7 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance,
stack = getnext(stack)
end
while depth > 0 do
- head = insert_node_after(head,stack,copy_node(nsnone))
+ head = insertnodeafter(head,stack,copy_node(nsnone))
depth = depth - 1
end
return head
@@ -556,12 +556,12 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
if nslistwise then
local a = getattr(current,attribute)
if a and attrib ~= a and nslistwise[a] then -- viewerlayer
- head = insert_node_before(head,current,copy_node(nsdata[a]))
+ head = insertnodebefore(head,current,copy_node(nsdata[a]))
list = stacker(attribute,content,a)
if list ~= content then
setlist(current,list)
end
- head, current = insert_node_after(head,current,copy_node(nsnone))
+ head, current = insertnodeafter(head,current,copy_node(nsnone))
else
list = stacker(attribute,content,attrib)
if list ~= content then
@@ -576,7 +576,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
end
end
elseif id == rule_code then
- check = has_dimensions(current)
+ check = hasdimensions(current)
end
if check then
@@ -588,7 +588,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
end
local n = nsstep(a)
if n then
- head = insert_node_before(head,current,n) -- a
+ head = insertnodebefore(head,current,n) -- a
end
attrib = a
if leader then
@@ -617,7 +617,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
if stacked then
local n = nsend()
while n do
- head = insert_node_after(head,previous,n)
+ head = insertnodeafter(head,previous,n)
n = nsend()
end
end
diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua
index f3bb6228f..b3a8ccc1e 100644
--- a/tex/context/base/mkiv/node-fnt.lua
+++ b/tex/context/base/mkiv/node-fnt.lua
@@ -60,21 +60,19 @@ local setprev = nuts.setprev
local isglyph = nuts.isglyph -- unchecked
local ischar = nuts.ischar -- checked
------ traverse_id = nuts.traverse_id
------ traverse_char = nuts.traverse_char
local nextboundary = nuts.traversers.boundary
local nextdisc = nuts.traversers.disc
local nextchar = nuts.traversers.char
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local disc_code = nodecodes.disc
local boundary_code = nodecodes.boundary
local wordboundary_code = boundarycodes.word
-local protect_glyphs = nuts.protect_glyphs
-local unprotect_glyphs = nuts.unprotect_glyphs
+local protectglyphs = nuts.protectglyphs
+local unprotectglyphs = nuts.unprotectglyphs
local setmetatableindex = table.setmetatableindex
@@ -196,7 +194,7 @@ do
local a, u, b, r
local function protectnone()
- protect_glyphs(firstnone,lastnone)
+ protectglyphs(firstnone,lastnone)
firstnone = nil
end
@@ -392,7 +390,7 @@ do
end
end
end
- flush_node(r)
+ flushnode(r)
end
end
@@ -542,5 +540,5 @@ do
end
-handlers.protectglyphs = protect_glyphs
-handlers.unprotectglyphs = unprotect_glyphs
+handlers.protectglyphs = protectglyphs
+handlers.unprotectglyphs = unprotectglyphs
diff --git a/tex/context/base/mkiv/node-gcm.lua b/tex/context/base/mkiv/node-gcm.lua
index 5b598f6b0..de0018b4c 100644
--- a/tex/context/base/mkiv/node-gcm.lua
+++ b/tex/context/base/mkiv/node-gcm.lua
@@ -8,37 +8,37 @@ if not modules then modules = { } end modules ['node-gmc'] = {
local type, tostring = type, tostring
-local nodes = nodes
-local nodecodes = nodes.nodecodes
-local ligature_code = nodes.glyphcodes.ligature
-local nuts = nodes.nuts
+local nodes = nodes
+local nodecodes = nodes.nodecodes
+local ligature_code = nodes.glyphcodes.ligature
+local nuts = nodes.nuts
-local getnext = nuts.getnext
-local getsubtype = nuts.getsubtype
-local getprev = nuts.getprev
-local setlink = nuts.setlink
-local nextglyph = nuts.traversers.glyph
-local copy_node = nuts.copy
-local isglyph = nuts.isglyph
+local getnext = nuts.getnext
+local getsubtype = nuts.getsubtype
+local getprev = nuts.getprev
+local setlink = nuts.setlink
+local nextglyph = nuts.traversers.glyph
+local copynode = nuts.copy
+local isglyph = nuts.isglyph
-local report_error = logs.reporter("node-aux:error")
+local report_error = logs.reporter("node-aux:error")
-local get_components = node.direct.getcomponents
-local set_components = node.direct.setcomponents
+local getcomponents = node.direct.getcomponents
+local setcomponents = node.direct.setcomponents
-local function copy_no_components(g,copyinjection)
- local components = get_components(g)
+local function copynocomponents(g,copyinjection)
+ local components = getcomponents(g)
if components then
- set_components(g)
- local n = copy_node(g)
+ setcomponents(g)
+ local n = copynode(g)
if copyinjection then
copyinjection(n,g)
end
- set_components(g,components)
+ setcomponents(g,components)
-- maybe also upgrade the subtype but we don't use it anyway
return n
else
- local n = copy_node(g)
+ local n = copynode(g)
if copyinjection then
copyinjection(n,g)
end
@@ -46,11 +46,11 @@ local function copy_no_components(g,copyinjection)
end
end
-local function copy_only_glyphs(current)
+local function copyonlyglyphs(current)
local head = nil
local previous = nil
for n in nextglyph, current do
- n = copy_node(n)
+ n = copynode(n)
if head then
setlink(previous,n)
else
@@ -63,14 +63,14 @@ end
-- start is a mark and we need to keep that one
-local function count_components(start,marks)
+local function countcomponents(start,marks)
local char = isglyph(start)
if char then
if getsubtype(start) == ligature_code then
local n = 0
- local components = get_components(start)
+ local components = getcomponents(start)
while components do
- n = n + count_components(components,marks)
+ n = n + countcomponents(components,marks)
components = getnext(components)
end
return n
@@ -81,16 +81,18 @@ local function count_components(start,marks)
return 0
end
-local function flush_components()
+local function flushcomponents()
-- this is a no-op in mkiv / generic
end
-nuts.set_components = set_components
-nuts.get_components = get_components
-nuts.copy_only_glyphs = copy_only_glyphs
-nuts.copy_no_components = copy_no_components
-nuts.count_components = count_components
-nuts.flush_components = flush_components
+nuts.components = {
+ set = setcomponents,
+ get = getcomponents,
+ copyonlyglyphs = copyonlyglyphs,
+ copynocomponents = copynocomponents,
+ count = countcomponents,
+ flush = flushcomponents,
+}
nuts.setcomponents = function() report_error("unsupported: %a","setcomponents") end
nuts.getcomponents = function() report_error("unsupported: %a","getcomponents") end
diff --git a/tex/context/base/mkiv/node-ini.mkiv b/tex/context/base/mkiv/node-ini.mkiv
index 38ec753cd..10998d060 100644
--- a/tex/context/base/mkiv/node-ini.mkiv
+++ b/tex/context/base/mkiv/node-ini.mkiv
@@ -37,6 +37,7 @@
\registerctxluafile{node-scn}{}
\registerctxluafile{node-syn}{}
\registerctxluafile{node-par}{}
+\registerctxluafile{node-bwc}{} % might stay
\newcount\c_node_tracers_show_box % box number
diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua
index ecfd1fb6b..f008422e0 100644
--- a/tex/context/base/mkiv/node-ltp.lua
+++ b/tex/context/base/mkiv/node-ltp.lua
@@ -220,7 +220,7 @@ local getpre = nuts.getpre
local setpre = nuts.setpre
local isglyph = nuts.isglyph
-local start_of_par = nuts.start_of_par
+local startofpar = nuts.startofpar
local setfield = nuts.setfield
local setlink = nuts.setlink
@@ -240,16 +240,16 @@ local setexpansion = nuts.setexpansion
local find_tail = nuts.tail
local copy_node = nuts.copy
-local flush_node = nuts.flush
-local flush_node_list = nuts.flush_list
+local flushnode = nuts.flush
+local flushnodelist = nuts.flushlist
----- hpack_nodes = nuts.hpack
local xpack_nodes = nuts.hpack
local replace_node = nuts.replace
local remove_node = nuts.remove
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
-local is_zero_glue = nuts.is_zero_glue
-local is_skipable = nuts.protrusion_skippable
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
+local iszeroglue = nuts.iszeroglue
+local protrusionskippable = nuts.protrusionskippable
local setattributelist = nuts.setattributelist
local find_node = nuts.find_node
@@ -386,7 +386,7 @@ local function inject_dirs_at_begin_of_line(stack,current)
for i=1,n do
local d = new_direction(stack[i])
setattributelist(d,current)
- h, current = insert_node_after(h,current,d)
+ h, current = insertnodeafter(h,current,d)
end
stack.n = 0
return h
@@ -421,14 +421,14 @@ end
for i=n,1,-1 do
local d = new_direction(stack[i],true)
setattributelist(d,start)
- h, current = insert_node_after(h,current,d)
+ h, current = insertnodeafter(h,current,d)
end
end
stack.n = n
return current
end
-local ignore_math_skip = node.direct.ignore_math_skip or function(current)
+local ignoremathskip = nuts.ignoremathskip or function(current)
local mode = texget("mathskipmode")
if mode == 6 or mode == 7 then
local b = true
@@ -744,7 +744,7 @@ local function find(head) -- do we really want to recurse into an hlist?
else
return head
end
- elseif is_skipable(head) then
+ elseif protrusionskippable(head) then
head = getnext(head)
else
return head
@@ -798,7 +798,7 @@ local function find(head,tail)
else
return tail
end
- elseif is_skipable(tail) then
+ elseif protrusionskippable(tail) then
tail = getprev(tail)
else
return tail
@@ -1010,7 +1010,7 @@ do
end
local function used_skip(s)
- return s and not is_zero_glue(s) and s
+ return s and not iszeroglue(s) and s
end
local function initialize_line_break(head,display)
@@ -1357,7 +1357,7 @@ do
report_parbuilders('unsupported disc at location %a',3)
end
if pre then
- flush_node_list(pre)
+ flushnodelist(pre)
pre = nil -- signal
end
if replace then
@@ -1368,13 +1368,13 @@ do
setdisc(lastnode,pre,post,replace)
local pre, post, replace = getdisc(prevlast)
if pre then
- flush_node_list(pre)
+ flushnodelist(pre)
end
if replace then
- flush_node_list(replace)
+ flushnodelist(replace)
end
if post then
- flush_node_list(post)
+ flushnodelist(post)
end
setdisc(prevlast) -- nil,nil,nil
elseif subtype == firstdisc_code then
@@ -1387,7 +1387,7 @@ do
setpost(lastnode)
end
if replace then
- flush_node_list(replace)
+ flushnodelist(replace)
end
if pre then
setlink(prevlast,pre)
@@ -1414,7 +1414,7 @@ do
lastnode = inject_dirs_at_end_of_line(dirstack,lastnode,getnext(head),current_break.cur_break)
local rightbox = current_break.passive_right_box
if rightbox then
- lastnode = insert_node_after(lastnode,lastnode,copy_node(rightbox))
+ lastnode = insertnodeafter(lastnode,lastnode,copy_node(rightbox))
end
if not lineend then
lineend = lastnode
@@ -1495,8 +1495,8 @@ do
-- so we inherit attributes, lineend is new pseudo head
local k = new_rightmarginkern(copy_node(last_rightmost_char),-w)
setattributelist(k,p)
--- insert_node_after(c,c,k)
- insert_node_after(p,p,k)
+-- insertnodeafter(c,c,k)
+ insertnodeafter(p,p,k)
-- if c == lineend then
-- lineend = getnext(c)
-- end
@@ -1512,7 +1512,7 @@ do
if not glue_break then
local rs = new_rightskip(unpack(rightskip))
setattributelist(rs,lineend)
- start, lineend = insert_node_after(start,lineend,rs)
+ start, lineend = insertnodeafter(start,lineend,rs)
end
local rs = lineend
-- insert leftbox (if needed after parindent)
@@ -1520,9 +1520,9 @@ do
if leftbox then
local first = getnext(start)
if first and current_line == (par.first_line + 1) and getid(first) == hlist_code and not getlist(first) then
- insert_node_after(start,start,copy_node(leftbox))
+ insertnodeafter(start,start,copy_node(leftbox))
else
- start = insert_node_before(start,start,copy_node(leftbox))
+ start = insertnodebefore(start,start,copy_node(leftbox))
end
end
if protrude_chars > 0 then
@@ -1534,7 +1534,7 @@ do
if last_leftmost_char and w ~= 0 then
local k = new_rightmarginkern(copy_node(last_leftmost_char),-w)
setattributelist(k,p)
- start = insert_node_before(start,start,k)
+ start = insertnodebefore(start,start,k)
end
end
end
@@ -1546,7 +1546,7 @@ do
-- so we inherit attributes, start is pseudo head and moves back
local k = new_leftmarginkern(copy_node(last_leftmost_char),-w)
setattributelist(k,p)
- start = insert_node_before(start,start,k)
+ start = insertnodebefore(start,start,k)
end
end
end
@@ -1556,7 +1556,7 @@ do
-- we could check for non zero but we will normalize anyway
ls = new_leftskip(unpack(leftskip))
setattributelist(ls,start)
- start = insert_node_before(start,start,ls)
+ start = insertnodebefore(start,start,ls)
end
if normalize > 0 then
local par = nil
@@ -1570,7 +1570,7 @@ do
indent = n
end
elseif id == par_code then
- if start_of_par(n) then --- maybe subtype check instead
+ if startofpar(n) then --- maybe subtype check instead
par = n
elseif noflocals then
noflocals = noflocals + 1
@@ -1635,11 +1635,11 @@ do
setattributelist(r,start)
if normalize > 3 then
-- makes most sense
- start = insert_node_after(start,ls,l)
- start = insert_node_before(start,rs,r)
+ start = insertnodeafter(start,ls,l)
+ start = insertnodebefore(start,rs,r)
else
- start = insert_node_before(start,ls,l)
- start = insert_node_after(start,rs,r)
+ start = insertnodebefore(start,ls,l)
+ start = insertnodeafter(start,rs,r)
end
cur_width = hsize
cur_indent = 0
@@ -1740,7 +1740,7 @@ do
end
if current ~= head then
setnext(current)
- flush_node_list(getnext(head))
+ flushnodelist(getnext(head))
setlink(head,next)
end
end
@@ -1759,7 +1759,7 @@ par.head = head
report_parbuilders("no local par node")
end
end
- flush_node(h)
+ flushnode(h)
par.head = nil -- needs checking
end
current_line = current_line - 1
@@ -1799,7 +1799,7 @@ par.head = head
if next then
setprev(next)
end
- flush_node(head)
+ flushnode(head)
end
post_line_break(par)
reset_meta(par)
@@ -2600,7 +2600,7 @@ par.head = head
end
elseif id == math_code then
auto_breaking = getsubtype(current) == endmath_code
- if is_zero_glue(current) or ignore_math_skip(current) then
+ if iszeroglue(current) or ignoremathskip(current) then
local v = getnext(current)
if auto_breaking and getid(v) == glue_code then
p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion)
@@ -3090,7 +3090,7 @@ do
end
natural = natural + wd
elseif id == math_code then
- if is_zero_glue(current) or ignore_math_skip(current) then
+ if iszeroglue(current) or ignoremathskip(current) then
natural = natural + getkern(current)
else
local wd, stretch, shrink, stretch_order, shrink_order = getglue(current)
@@ -3272,7 +3272,7 @@ do
if p and getid(p) == marginkern_code then
found = p
end
- insert_node_before(head,found,g)
+ insertnodebefore(head,found,g)
end
end
end
diff --git a/tex/context/base/mkiv/node-met.lua b/tex/context/base/mkiv/node-met.lua
index 31f9a16b2..c39c9dd86 100644
--- a/tex/context/base/mkiv/node-met.lua
+++ b/tex/context/base/mkiv/node-met.lua
@@ -1,4 +1,4 @@
-if not modules then modules = { } end modules ['node-MET'] = {
+ if not modules then modules = { } end modules ['node-MET'] = {
version = 1.001,
comment = "companion to node-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
@@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['node-MET'] = {
-- the regular code is proven stable. No support otherwise.
-- luatex: todo: copylist should return h, t
--- todo: see if using insert_before and insert_after makes sense here
+-- todo: see if using insertbefore and insertafter makes sense here
-- This file is a side effect of the \LUATEX\ speed optimization project of Luigi
-- Scarso and me. As \CONTEXT\ spends over half its time in \LUA, we though that
@@ -65,73 +65,75 @@ end
-- We start with some helpers and provide all relevant basic functions in the
-- node namespace as well.
-nodes = nodes or { }
-local nodes = nodes
-
-local nodecodes = nodes.nodecodes
-
-nodes.tostring = node.tostring or tostring
-nodes.copy = node.copy
-nodes.copy_node = node.copy
-nodes.copy_list = node.copy_list
-nodes.delete = node.delete
-nodes.dimensions = node.dimensions
-nodes.rangedimensions = node.rangedimensions
-nodes.end_of_math = node.end_of_math
-nodes.flush = node.flush_node
-nodes.flush_node = node.flush_node
-nodes.flush_list = node.flush_list
-nodes.free = node.free
-nodes.insert_after = node.insert_after
-nodes.insert_before = node.insert_before
-nodes.hpack = node.hpack
-nodes.new = node.new
-nodes.tail = node.tail
-nodes.traverse = node.traverse
-nodes.traverse_id = node.traverse_id
-nodes.traverse_char = node.traverse_char
-nodes.traverse_glyph = node.traverse_glyph
-nodes.traverse_list = node.traverse_list
-nodes.slide = node.slide
-nodes.vpack = node.vpack
-nodes.fields = node.fields
-nodes.is_node = node.is_node
-nodes.setglue = node.setglue
-nodes.uses_font = node.uses_font
-
-nodes.first_glyph = node.first_glyph
-nodes.has_glyph = node.has_glyph or node.first_glyph
-
-nodes.current_attributes = node.current_attributes or node.current_attr
-nodes.has_field = node.has_field
-nodes.last_node = node.last_node
-nodes.usedlist = node.usedlist
-nodes.protrusion_skippable = node.protrusion_skippable
-nodes.check_discretionaries = node.check_discretionaries
-nodes.write = node.write
-nodes.flatten_discretionaries = node.flatten_discretionaries
-
-nodes.count = node.count
-nodes.length = node.length
-
-nodes.has_attribute = node.has_attribute
-nodes.set_attribute = node.set_attribute
-nodes.find_attribute = node.find_attribute
-nodes.unset_attribute = node.unset_attribute
-
-nodes.protect_glyph = node.protect_glyph
-nodes.protect_glyphs = node.protect_glyphs
-nodes.unprotect_glyph = node.unprotect_glyph
-nodes.unprotect_glyphs = node.unprotect_glyphs
-nodes.kerning = node.kerning
-nodes.ligaturing = node.ligaturing
-nodes.hyphenating = node.hyphenating
-nodes.mlist_to_hlist = node.mlist_to_hlist
-
-nodes.effective_glue = node.effective_glue
-nodes.getglue = node.getglue
-nodes.setglue = node.setglue
-nodes.is_zero_glue = node.is_zero_glue
+nodes = nodes or { }
+local nodes = nodes
+
+local nodecodes = nodes.nodecodes
+
+nodes.tostring = node.tostring or tostring
+nodes.copy = node.copy
+nodes.copynode = node.copy
+nodes.copylist = node.copy_list
+nodes.delete = node.delete
+nodes.dimensions = node.dimensions
+nodes.rangedimensions = node.rangedimensions
+nodes.endofmath = node.end_of_math
+nodes.flush = node.flush_node
+nodes.flushnode = node.flush_node
+nodes.flushlist = node.flush_list
+nodes.free = node.free
+nodes.insertafter = node.insert_after
+nodes.insertbefore = node.insert_before
+nodes.hpack = node.hpack
+nodes.new = node.new
+nodes.tail = node.tail
+nodes.traverse = node.traverse
+nodes.traverseid = node.traverse_id
+nodes.traversechar = node.traverse_char
+nodes.traverseglyph = node.traverse_glyph
+nodes.traverselist = node.traverse_list
+nodes.slide = node.slide
+nodes.vpack = node.vpack
+nodes.fields = node.fields
+nodes.isnode = node.is_node
+nodes.isdirect = node.is_direct
+nodes.isnut = node.is_direct
+nodes.setglue = node.setglue
+nodes.usesfont = node.uses_font
+
+nodes.firstglyph = node.first_glyph
+nodes.hasglyph = node.has_glyph
+
+nodes.currentattributes = node.current_attributes or node.current_attr
+nodes.hasfield = node.has_field
+nodes.last_node = node.last_node
+nodes.usedlist = node.usedlist
+nodes.protrusionskippable = node.protrusion_skippable
+nodes.checkdiscretionaries = node.check_discretionaries
+nodes.write = node.write
+nodes.flattendiscretionaries = node.flatten_discretionaries
+
+nodes.count = node.count
+nodes.length = node.length
+
+nodes.hasattribute = node.has_attribute
+nodes.setattribute = node.set_attribute
+nodes.findattribute = node.find_attribute
+nodes.unsetattribute = node.unset_attribute
+
+nodes.protectglyph = node.protect_glyph
+nodes.protectglyphs = node.protect_glyphs
+nodes.unprotectglyph = node.unprotect_glyph
+nodes.unprotectglyphs = node.unprotect_glyphs
+nodes.kerning = node.kerning
+nodes.ligaturing = node.ligaturing
+nodes.hyphenating = node.hyphenating
+nodes.mlisttohlist = node.mlist_to_hlist
+
+nodes.effectiveglue = node.effective_glue
+nodes.getglue = node.getglue
+nodes.setglue = node.setglue
+nodes.iszeroglue = node.iszeroglue
nodes.tonode = function(n) return n end
nodes.tonut = function(n) return n end
@@ -149,7 +151,7 @@ nodes.getfield = n_getfield
nodes.setfield = n_setfield
nodes.getattr = n_getattr
nodes.setattr = n_setattr
-nodes.takeattr = nodes.unset_attribute
+nodes.takeattr = nodes.unsetattribute
local function n_getid (n) return n_getfield(n,"id") end
local function n_getsubtype(n) return n_getfield(n,"subtype") end
@@ -213,13 +215,13 @@ nodes.setlink = n_setlink
nodes.getbox = node.getbox or tex.getbox
nodes.setbox = node.setbox or tex.setbox
-local n_flush_node = nodes.flush
-local n_copy_node = nodes.copy
-local n_copy_list = nodes.copy_list
-local n_find_tail = nodes.tail
-local n_insert_after = nodes.insert_after
-local n_insert_before = nodes.insert_before
-local n_slide = nodes.slide
+local n_flushnode = nodes.flush
+local n_copynode = nodes.copy
+local n_copylist = nodes.copylist
+local n_findtail = nodes.tail
+local n_insertafter = nodes.insertafter
+local n_insertbefore = nodes.insertbefore
+local n_slide = nodes.slide
local n_remove_node = node.remove -- not yet nodes.remove
@@ -229,7 +231,7 @@ local function remove(head,current,free_too)
if not t then
-- forget about it
elseif free_too then
- n_flush_node(t)
+ n_flushnode(t)
t = nil
else
n_setboth(t)
@@ -266,10 +268,10 @@ function nodes.replace(head,current,new) -- no head returned if false
if head == current then
head = new
end
- n_flush_node(current)
+ n_flushnode(current)
return head, new
else
- n_flush_node(current)
+ n_flushnode(current)
return new
end
end
@@ -278,14 +280,14 @@ end
function nodes.append(head,current,...)
for i=1,select("#",...) do
- head, current = n_insert_after(head,current,(select(i,...)))
+ head, current = n_insertafter(head,current,(select(i,...)))
end
return head, current
end
function nodes.prepend(head,current,...)
for i=1,select("#",...) do
- head, current = n_insert_before(head,current,(select(i,...)))
+ head, current = n_insertbefore(head,current,(select(i,...)))
end
return head, current
end
@@ -300,7 +302,7 @@ function nodes.linked(...)
else
head = next
end
- last = n_find_tail(next) -- we could skip the last one
+ last = n_findtail(next) -- we could skip the last one
end
end
return head
@@ -391,7 +393,7 @@ metatable.__concat = function(n1,n2) -- todo: accept nut on one end
-- or abort
return n2 -- or n2 * 2
else
- local tail = n_find_tail(n1)
+ local tail = n_findtail(n1)
n_setlink(tail,n2)
return n1
end
@@ -406,19 +408,19 @@ metatable.__mul = function(n,multiplier)
elseif n_getnext(n) then
local head
for i=2,multiplier do
- local h = n_copy_list(n)
+ local h = n_copylist(n)
if head then
- local t = n_find_tail(h)
+ local t = n_findtail(h)
n_setlink(t,head)
end
head = h
end
- local t = n_find_tail(n)
+ local t = n_findtail(n)
n_setlink(t,head)
else
local head
for i=2,multiplier do
- local c = n_copy_node(n)
+ local c = n_copynode(n)
if head then
n_setlink(c,head)
end
@@ -431,10 +433,10 @@ end
metatable.__sub = function(first,second)
if type(second) == "number" then
- local tail = n_find_tail(first)
+ local tail = n_findtail(first)
for i=1,second do
local prev = n_getprev(tail)
- n_flush_node(tail) -- can become flushlist/flushnode
+ n_flushnode(tail) -- can become flushlist/flushnode
if prev then
tail = prev
else
@@ -449,15 +451,15 @@ metatable.__sub = function(first,second)
end
else
-- aaaaa - bbb => aaaabbba
- local firsttail = n_find_tail(first)
+ local firsttail = n_findtail(first)
local prev = n_getprev(firsttail)
if prev then
- local secondtail = n_find_tail(second)
+ local secondtail = n_findtail(second)
n_setlink(secondtail,firsttail)
n_setlink(prev,second)
return first
else
- local secondtail = n_find_tail(second)
+ local secondtail = n_findtail(second)
n_setlink(secondtail,first)
return second
end
@@ -469,7 +471,7 @@ metatable.__add = function(first,second)
local head = second
for i=1,first do
local second = n_getnext(head)
- n_flush_node(head) -- can become flushlist/flushnode
+ n_flushnode(head) -- can become flushlist/flushnode
if second then
head = second
else
@@ -486,7 +488,7 @@ metatable.__add = function(first,second)
-- aaaaa + bbb => abbbaaaa
local next = n_getnext(first)
if next then
- local secondtail = n_find_tail(second)
+ local secondtail = n_findtail(second)
n_setlink(first,second)
n_setlink(secondtail,next)
else
@@ -514,12 +516,12 @@ metatable.__pow = function(n,multiplier)
local head = nil
if n_getnext(n) then
if multiplier == 1 then
- head = n_copy_list(n)
+ head = n_copylist(n)
else
for i=1,multiplier do
- local h = n_copy_list(n)
+ local h = n_copylist(n)
if head then
- local t = n_find_tail(h)
+ local t = n_findtail(h)
n_setlink(t,head)
end
head = h
@@ -527,10 +529,10 @@ metatable.__pow = function(n,multiplier)
end
else
if multiplier == 1 then
- head = n_copy_node(n)
+ head = n_copynode(n)
else
for i=2,multiplier do
- local c = n_copy_node(n)
+ local c = n_copynode(n)
if head then
n_setlink(head,c)
end
diff --git a/tex/context/base/mkiv/node-mig.lua b/tex/context/base/mkiv/node-mig.lua
index 13414c560..064003269 100644
--- a/tex/context/base/mkiv/node-mig.lua
+++ b/tex/context/base/mkiv/node-mig.lua
@@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['node-mig'] = {
license = "see context related readme files"
}
--- todo: insert_after
-
local format = string.format
local trace_migrations = false trackers.register("nodes.migrations", function(v) trace_migrations = v end)
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index 9909194e7..e789fae2b 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -1,4 +1,4 @@
-if not modules then modules = { } end modules ['node-nut'] = {
+ if not modules then modules = { } end modules ['node-nut'] = {
version = 1.001,
comment = "companion to node-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
@@ -88,131 +88,106 @@ if not modules then modules = { } end modules ['node-nut'] = {
local type, rawget = type, rawget
-local nodes = nodes
-local direct = node.direct
+local nodes = nodes
+local direct = node.direct
-local fastcopy = table.fastcopy
+local fastcopy = table.fastcopy
-local nodecodes = nodes.nodecodes
-local hlist_code = nodecodes.hlist
-local vlist_code = nodecodes.vlist
-local glyph_code = nodecodes.glyph
+local nodecodes = nodes.nodecodes
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local glyph_code = nodecodes.glyph
-local nuts = nodes.nuts or { }
-nodes.nuts = nuts
+local nuts = nodes.nuts or { }
+nodes.nuts = nuts
-nodes.is_node = direct.is_node or function() return true end
-nodes.is_direct = direct.is_direct or function() return false end
-nodes.is_nut = nodes.is_direct
+nodes.isnode = direct.isnode or function() return true end
+nodes.isdirect = direct.isdirect or function() return false end
+nodes.isnut = nodes.isdirect
-- casters
-local tonode = direct.tonode or function(n) return n end
-local tonut = direct.todirect or function(n) return n end
+local tonode = direct.tonode or function(n) return n end
+local tonut = direct.todirect or function(n) return n end
-nuts.tonode = tonode
-nuts.tonut = tonut
+nuts.tonode = tonode
+nuts.tonut = tonut
-nodes.tonode = tonode
-nodes.tonut = tonut
-
--- -- some tracing:
---
--- local hash = table.setmetatableindex("number")
--- local ga = direct.get_attribute
--- function direct.get_attribute(n,a)
--- hash[a] = hash[a] + 1
--- return ga(n,a)
--- end
--- function nuts.reportattr()
--- inspect(hash)
--- end
-
--- local function track(name)
--- local n = 0
--- local f = direct[name]
--- direct[name] = function(...)
--- n = n + 1
--- if n % 1000 == 0 then
--- print(name,n)
--- end
--- return f(...)
--- end
--- end
--- track("getfield")
+nodes.tonode = tonode
+nodes.tonut = tonut
-- helpers
local nuts = nodes.nuts
-nuts.check_discretionaries = direct.check_discretionaries
+nuts.checkdiscretionaries = direct.check_discretionaries
nuts.copy = direct.copy
-nuts.copy_node = direct.copy
-nuts.copy_only = direct.copy_only or direct.copy
-nuts.copy_list = direct.copy_list
+nuts.copynode = direct.copy
+nuts.copyonly = direct.copy_only or direct.copy
+nuts.copylist = direct.copy_list
nuts.count = direct.count
-nuts.current_attr = direct.current_attr
+nuts.currentattribute = direct.current_attr
+nuts.currentattr = direct.current_attr
nuts.delete = direct.delete
nuts.dimensions = direct.dimensions
-nuts.end_of_math = direct.end_of_math
-nuts.find_attribute = direct.find_attribute
-nuts.first_glyph = direct.first_glyph
-nuts.flatten_discretionaries = direct.flatten_discretionaries
+nuts.endofmath = direct.end_of_math
+nuts.findattribute = direct.find_attribute
+nuts.firstglyph = direct.first_glyph
+nuts.flattendiscretionaries = direct.flatten_discretionaries
nuts.flush = direct.flush_node
-nuts.flush_list = direct.flush_list
-nuts.flush_node = direct.flush_node
+nuts.flushlist = direct.flush_list
+nuts.flushnode = direct.flush_node
nuts.free = direct.free
-nuts.get_synctex_fields = direct.get_synctex_fields
-nuts.has_attribute = direct.has_attribute
-nuts.has_field = direct.has_field
-nuts.has_glyph = direct.has_glyph or direct.first_glyph
+nuts.getsynctexfields = direct.get_synctex_fields
+nuts.hasattribute = direct.has_attribute
+nuts.hasfield = direct.has_field
+nuts.hasglyph = direct.has_glyph or direct.first_glyph
nuts.hpack = direct.hpack
-nuts.insert_after = direct.insert_after
-nuts.insert_before = direct.insert_before
-nuts.is_direct = direct.is_direct
-nuts.is_node = direct.is_node
-nuts.is_nut = direct.is_direct
+nuts.insertafter = direct.insert_after
+nuts.insertbefore = direct.insert_before
+nuts.isdirect = direct.is_direct
+nuts.isnode = direct.is_node
+nuts.isnut = direct.is_direct
nuts.kerning = direct.kerning
nuts.hyphenating = direct.hyphenating
-nuts.last_node = direct.last_node
+nuts.lastnode = direct.last_node
nuts.length = direct.length
nuts.ligaturing = direct.ligaturing
nuts.new = direct.new
-nuts.protect_glyph = direct.protect_glyph
-nuts.protect_glyphs = direct.protect_glyphs
-nuts.flush_components = direct.flush_components
-nuts.protrusion_skippable = direct.protrusion_skippable
+nuts.protectglyph = direct.protect_glyph
+nuts.protectglyphs = direct.protect_glyphs
+nuts.protrusionskippable = direct.protrusion_skippable
nuts.rangedimensions = direct.rangedimensions
-nuts.set_attribute = direct.set_attribute
-nuts.set_synctex_fields = direct.set_synctex_fields
+nuts.setattribute = direct.set_attribute
+nuts.setsynctexfields = direct.set_synctex_fields
nuts.slide = direct.slide
nuts.tail = direct.tail
nuts.tostring = direct.tostring
nuts.traverse = direct.traverse
-nuts.traverse_char = direct.traverse_char
-nuts.traverse_glyph = direct.traverse_glyph
-nuts.traverse_id = direct.traverse_id
-nuts.traverse_list = direct.traverse_list
-nuts.unprotect_glyph = direct.unprotect_glyph
-nuts.unprotect_glyphs = direct.unprotect_glyphs
-nuts.unset_attribute = direct.unset_attribute
-nuts.unset_attribute = direct.unset_attribute
+nuts.traversechar = direct.traverse_char
+nuts.traverseglyph = direct.traverse_glyph
+nuts.traverseid = direct.traverse_id
+nuts.traverselist = direct.traverse_list
+nuts.unprotectglyph = direct.unprotect_glyph
+nuts.unprotectglyphs = direct.unprotect_glyphs
+nuts.unsetattribute = direct.unset_attribute
+nuts.unsetattribute = direct.unset_attribute
nuts.usedlist = direct.usedlist
-nuts.uses_font = direct.uses_font
+nuts.usesfont = direct.uses_font
nuts.vpack = direct.vpack
nuts.write = direct.write
-nuts.mlist_to_hlist = direct.mlist_to_hlist
-nuts.has_dimensions = direct.has_dimensions
-nuts.start_of_par = direct.start_of_par
+nuts.mlisttohlist = direct.mlist_to_hlist
+nuts.hasdimensions = direct.has_dimensions
+nuts.startofpar = direct.start_of_par
nuts.migrate = direct.migrate
-if not nuts.mlist_to_hlist then
+if not nuts.mlisttohlist then
- local n_mlist_to_hlist = node.mlist_to_hlist
+ local n_mlisttohlist = node.mlist_to_hlist
- function nuts.mlist_to_hlist(head,...)
+ function nuts.mlisttohlist(head,...)
if head then
- local head = n_mlist_to_hlist(tonode(head),...)
+ local head = n_mlisttohlist(tonode(head),...)
if head then
return tonut(head)
end
@@ -221,11 +196,11 @@ if not nuts.mlist_to_hlist then
end
-if not nuts.has_dimensions then
+if not nuts.hasdimensions then
local getwhd = direct.getwhd
- function nuts.has_dimensions(n)
+ function nuts.hasdimensions(n)
local wd, ht, dp = getwhd(n)
return wd ~= 0 or (ht + dp) ~= 0
end
@@ -246,16 +221,20 @@ nuts.getid = direct.getid
nuts.getprev = direct.getprev
nuts.setprev = direct.setprev
-local get_attribute = direct.get_attribute
-local set_attribute = direct.set_attribute
-local unset_attribute = direct.unset_attribute
+local getattribute = direct.get_attribute
+local setattribute = direct.set_attribute
+local unsetattribute = direct.unset_attribute
+
+nuts.getattr = getattribute
+nuts.setattr = setattribute
+nuts.takeattr = unsetattribute -- ?
-nuts.getattr = get_attribute
-nuts.setattr = set_attribute
-nuts.takeattr = unset_attribute -- ?
+nuts.getattribute = getattribute
+nuts.setattribute = setattribute
+nuts.unsetattribute = unsetattribute -- ?
-nuts.is_zero_glue = direct.is_zero_glue
-nuts.effective_glue = direct.effective_glue
+nuts.iszeroglue = direct.is_zero_glue
+nuts.effectiveglue = direct.effective_glue
nuts.getglue = direct.getglue
nuts.setglue = direct.setglue
@@ -302,8 +281,8 @@ nuts.gettotal = direct.gettotal
nuts.getorientation = direct.getorientation or function() end
nuts.setorientation = direct.setorientation or function() end
-nuts.getglyphdata = direct.getglyphdata or get_attribute
-nuts.setglyphdata = direct.setglyphdata or function(n,d) set_attribute(n,0,d) end
+nuts.getglyphdata = direct.getglyphdata or getattribute
+nuts.setglyphdata = direct.setglyphdata or function(n,d) setattribute(n,0,d) end
nuts.getruledata = direct.getglyphdata and getdata or function(n) return getfield(n,"transform") end
nuts.setruledata = direct.setglyphdata and setdata or function(n,d) return setfield(n,"transform",d) end
@@ -381,20 +360,16 @@ nuts.setbox = direct.setbox
nuts.ischar = direct.is_char
nuts.isglyph = direct.is_glyph
-----.is_char = nuts.ischar
-----.is_glyph = nuts.isglyph
-
local d_remove_node = direct.remove
-local d_flush_node = direct.flush_node
+local d_flushnode = direct.flush_node
local d_getnext = direct.getnext
local d_getprev = direct.getprev
local d_getid = direct.getid
local d_getlist = direct.getlist
local d_find_tail = direct.tail
-local d_insert_after = direct.insert_after
-local d_insert_before = direct.insert_before
+local d_insertafter = direct.insert_after
+local d_insertbefore = direct.insert_before
local d_slide = direct.slide
------ d_copy_node = direct.copy
local d_traverse = direct.traverse
local d_setlink = direct.setlink
local d_setboth = direct.setboth
@@ -404,7 +379,7 @@ local remove = function(head,current,free_too)
if current then
local h, c = d_remove_node(head,current)
if free_too then
- d_flush_node(current)
+ d_flushnode(current)
return h, c
else
d_setboth(current)
@@ -416,7 +391,7 @@ end
-- for now
-if not nuts.start_of_par then
+if not nuts.startofpar then
local parcodes = nodes.parcodes
local hmodepar_code = parcodes.vmode_par
@@ -424,7 +399,7 @@ if not nuts.start_of_par then
local getsubtype = nuts.getsubtype
- function nuts.start_of_par(n)
+ function nuts.startofpar(n)
local s = getsubtype(n)
return s == hmodepar_code or s == vmodepar_code
end
@@ -507,10 +482,10 @@ function nuts.replace(head,current,new) -- no head returned if false
if head == current then
head = new
end
- d_flush_node(current)
+ d_flushnode(current)
return head, new
else
- d_flush_node(current)
+ d_flushnode(current)
return new
end
end
@@ -542,14 +517,14 @@ end
function nuts.append(head,current,...)
for i=1,select("#",...) do
- head, current = d_insert_after(head,current,(select(i,...)))
+ head, current = d_insertafter(head,current,(select(i,...)))
end
return head, current
end
function nuts.prepend(head,current,...)
for i=1,select("#",...) do
- head, current = d_insert_before(head,current,(select(i,...)))
+ head, current = d_insertbefore(head,current,(select(i,...)))
end
return head, current
end
@@ -604,43 +579,7 @@ function nodes.vianodes(f) return function(n,...) return tonut (f(tonode(n),...)
nuts.vianuts = nodes.vianuts
nuts.vianodes = nodes.vianodes
--- function nodes.insert_before(h,c,n)
--- if c then
--- if c == h then
--- n_setfield(n,"next",h)
--- n_setfield(n,"prev",nil)
--- n_setfield(h,"prev",n)
--- else
--- local cp = n_getprev(c)
--- n_setfield(n,"next",c)
--- n_setfield(n,"prev",cp)
--- if cp then
--- n_setfield(cp,"next",n)
--- end
--- n_setfield(c,"prev",n)
--- return h, n
--- end
--- end
--- return n, n
--- end
-
--- function nodes.insert_after(h,c,n)
--- if c then
--- local cn = n_getnext(c)
--- if cn then
--- n_setfield(n,"next",cn)
--- n_setfield(cn,"prev",n)
--- else
--- n_setfield(n,"next",nil)
--- end
--- n_setfield(c,"next",n)
--- n_setfield(n,"prev",c)
--- return h, n
--- end
--- return n, n
--- end
-
-function nodes.insert_list_after(h,c,n)
+function nodes.insertlistafter(h,c,n)
local t = n_tail(n)
if c then
local cn = n_getnext(c)
@@ -658,41 +597,7 @@ function nodes.insert_list_after(h,c,n)
return n, t
end
--- function nuts.insert_before(h,c,n)
--- if c then
--- if c == h then
--- d_setnext(n,h)
--- d_setprev(n)
--- d_setprev(h,n)
--- else
--- local cp = d_getprev(c)
--- d_setnext(n,c)
--- d_setprev(n,cp)
--- if cp then
--- d_setnext(cp,n)
--- end
--- d_setprev(c,n)
--- return h, n
--- end
--- end
--- return n, n
--- end
-
--- function nuts.insert_after(h,c,n)
--- if c then
--- local cn = d_getnext(c)
--- if cn then
--- d_setlink(n,cn)
--- else
--- d_setnext(n,nil)
--- end
--- d_setlink(c,n)
--- return h, n
--- end
--- return n, n
--- end
-
-function nuts.insert_list_after(h,c,n)
+function nuts.insertlistafter(h,c,n)
local t = d_tail(n)
if c then
local cn = d_getnext(c)
diff --git a/tex/context/base/mkiv/node-ppt.lua b/tex/context/base/mkiv/node-ppt.lua
index 485e742b6..35dc07d55 100644
--- a/tex/context/base/mkiv/node-ppt.lua
+++ b/tex/context/base/mkiv/node-ppt.lua
@@ -77,7 +77,7 @@ local function register(where,data,...)
end
end
-local writenode = node.write
+local writenode = nodes.write
local flushnode = context.nodes.flush
function commands.deferredproperty(...)
diff --git a/tex/context/base/mkiv/node-pro.lua b/tex/context/base/mkiv/node-pro.lua
index 4d748af89..6613555f8 100644
--- a/tex/context/base/mkiv/node-pro.lua
+++ b/tex/context/base/mkiv/node-pro.lua
@@ -69,7 +69,7 @@ processors.enabled = true -- this will become a proper state (like trackers)
do
- local has_glyph = nodes.has_glyph
+ local hasglyph = nodes.hasglyph
local count_nodes = nodes.countall
local texget = tex.get
@@ -77,7 +77,7 @@ do
local tracer = processors.tracer
local function pre_linebreak_filter(head,groupcode)
- local found = force_processors or has_glyph(head)
+ local found = force_processors or hasglyph(head)
if found then
if trace_callbacks then
local before = count_nodes(head,true)
@@ -95,7 +95,7 @@ do
end
local function hpack_filter(head,groupcode,size,packtype,direction,attributes)
- local found = force_processors or has_glyph(head)
+ local found = force_processors or hasglyph(head)
if found then
--
-- yes or no or maybe an option
@@ -148,7 +148,7 @@ do
end
do
- -- Beware, these are packaged boxes so no first_glyph test needed. Maybe some day I'll add a hash
+ -- Beware, these are packaged boxes so no firstglyph test needed. Maybe some day I'll add a hash
-- with valid groupcodes. Watch out, much can pass twice, for instance vadjust passes two times,
local actions = tasks.actions("finalizers") -- head, where
diff --git a/tex/context/base/mkiv/node-ref.lua b/tex/context/base/mkiv/node-ref.lua
index 098ed50c2..2cade31de 100644
--- a/tex/context/base/mkiv/node-ref.lua
+++ b/tex/context/base/mkiv/node-ref.lua
@@ -78,7 +78,8 @@ local getdimensions = nuts.dimensions
local getrangedimensions = nuts.rangedimensions
local traverse = nuts.traverse
local find_node_tail = nuts.tail
-local start_of_par = nuts.start_of_par
+
+local startofpar = nuts.startofpar
local nodecodes = nodes.nodecodes
local gluecodes = nodes.gluecodes
@@ -107,7 +108,7 @@ local new_rule = nodepool.rule
local new_kern = nodepool.kern
local new_hlist = nodepool.hlist
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local tosequence = nodes.tosequence
@@ -135,7 +136,7 @@ local function vlist_dimensions(start,stop) -- also needs the stretch and so
local v = vpack_list(start)
local w, h, d = getwhd(v)
setlist(v) -- not needed
- flush_node(v)
+ flushnode(v)
if temp then
setnext(stop,temp)
end
@@ -421,7 +422,7 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
local direction, pop = getdirection(current)
txtdir = not pop and direction -- we might need a stack
elseif id == par_code then
- if start_of_par(current) then
+ if startofpar(current) then
pardir = getdirection(current)
end
elseif id == glue_code and getsubtype(current) == leftskip_code then -- any glue at the left?
diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua
index 478a46906..684a8cc77 100644
--- a/tex/context/base/mkiv/node-res.lua
+++ b/tex/context/base/mkiv/node-res.lua
@@ -99,7 +99,7 @@ local setdata = nuts.setdata
local setruledata = nuts.setruledata
local setvalue = nuts.setvalue
-local copy_nut = nuts.copy_only or nuts.copy
+local copy_nut = nuts.copy
local new_nut = nuts.new
local flush_nut = nuts.flush
@@ -617,19 +617,19 @@ lua.registerfinalizer(cleanup, "cleanup reserved nodes")
do
- local glyph = tonode(glyph)
- local traverse_id = nodes.traverse_id
+ local glyph = tonode(glyph)
+ local traverseid = nodes.traverseid
- local traversers = table.setmetatableindex(function(t,k)
- local v = traverse_id(type(k) == "number" and k or nodecodes[k],glyph)
+ local traversers = table.setmetatableindex(function(t,k)
+ local v = traverseid(type(k) == "number" and k or nodecodes[k],glyph)
t[k] = v
return v
end)
- traversers.node = nodes.traverse (glyph)
- traversers.char = nodes.traverse_char (glyph)
- if nodes.traverse_glyph then traversers.glyph = nodes.traverse_glyph(glyph) end
- if nodes.traverse_list then traversers.list = nodes.traverse_list (glyph) end
+ traversers.node = nodes.traverse (glyph)
+ traversers.char = nodes.traversechar (glyph)
+ if nodes.traverseglyph then traversers.glyph = nodes.traverseglyph(glyph) end
+ if nodes.traverselist then traversers.list = nodes.traverselist (glyph) end
nodes.traversers = traversers
@@ -637,20 +637,20 @@ end
do
- local glyph = glyph
- local traverse_id = nuts.traverse_id
+ local glyph = glyph
+ local traverseid = nuts.traverseid
- local traversers = table.setmetatableindex(function(t,k)
- local v = traverse_id(type(k) == "number" and k or nodecodes[k],glyph)
+ local traversers = table.setmetatableindex(function(t,k)
+ local v = traverseid(type(k) == "number" and k or nodecodes[k],glyph)
t[k] = v
return v
end)
- traversers.node = nuts.traverse (glyph)
- traversers.char = nuts.traverse_char (glyph)
- if nuts.traverse_glyph then traversers.glyph = nuts.traverse_glyph (glyph) end
- if nuts.traverse_list then traversers.list = nuts.traverse_list (glyph) end
- if nuts.traverse_content then traversers.content = nuts.traverse_content(glyph) end
+ traversers.node = nuts.traverse (glyph)
+ traversers.char = nuts.traversechar (glyph)
+ if nuts.traverseglyph then traversers.glyph = nuts.traverseglyph (glyph) end
+ if nuts.traverselist then traversers.list = nuts.traverselist (glyph) end
+ if nuts.traversecontent then traversers.content = nuts.traversecontent(glyph) end
nuts.traversers = traversers
diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua
index f60fb2406..7ef58e970 100644
--- a/tex/context/base/mkiv/node-rul.lua
+++ b/tex/context/base/mkiv/node-rul.lua
@@ -57,15 +57,15 @@ local getruledata = nuts.getruledata
local isglyph = nuts.isglyph
-local flushlist = nuts.flush_list
-local effective_glue = nuts.effective_glue
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
+local flushlist = nuts.flushlist
+local effectiveglue = nuts.effectiveglue
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
local find_tail = nuts.tail
local setglue = nuts.setglue
local getrangedimensions = nuts.rangedimensions
local hpack_nodes = nuts.hpack
-local copy_list = nuts.copy_list
+local copylist = nuts.copylist
local nexthlist = nuts.traversers.hlist
@@ -317,7 +317,7 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
setattr(r,a_viewerlayer,layer)
end
if empty then
- head = insert_node_before(head,f,r)
+ head = insertnodebefore(head,f,r)
setlink(r,getnext(l))
setprev(f)
setnext(l)
@@ -325,12 +325,12 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
else
local k = new_kern(-wd)
if foreground then
- insert_node_after(head,l,k)
- insert_node_after(head,k,r)
+ insertnodeafter(head,l,k)
+ insertnodeafter(head,k,r)
l = r
else
- head = insert_node_before(head,f,r)
- insert_node_after(head,r,k)
+ head = insertnodebefore(head,f,r)
+ insertnodeafter(head,r,k)
end
end
if trace_ruled then
@@ -356,7 +356,7 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
else
local tx = d.text
if tx then
- local l = copy_list(tx)
+ local l = copylist(tx)
if d["repeat"] == v_yes then
l = new_leader(wd,l)
setattrlist(l,tx)
@@ -603,7 +603,7 @@ function linefillers.handler(head)
if head then
local indentation = iskip and getwidth(iskip) or 0
local leftfixed = lskip and getwidth(lskip) or 0
- local lefttotal = lskip and effective_glue(lskip,current) or 0
+ local lefttotal = lskip and effectiveglue(lskip,current) or 0
local width = lefttotal - (leftlocal and leftfixed or 0) + indentation - distance
if width > threshold then
if iskip then
@@ -612,13 +612,13 @@ function linefillers.handler(head)
if lskip then
setglue(lskip,leftlocal and getwidth(lskip) or nil)
if distance > 0 then
- insert_node_after(list,lskip,new_kern(distance))
+ insertnodeafter(list,lskip,new_kern(distance))
end
- insert_node_after(list,lskip,linefiller(current,data,width,"left"))
+ insertnodeafter(list,lskip,linefiller(current,data,width,"left"))
else
- insert_node_before(list,head,linefiller(current,data,width,"left"))
+ insertnodebefore(list,head,linefiller(current,data,width,"left"))
if distance > 0 then
- insert_node_before(list,head,new_kern(distance))
+ insertnodebefore(list,head,new_kern(distance))
end
end
end
@@ -642,9 +642,9 @@ function linefillers.handler(head)
end
if tail then
local rightfixed = rskip and getwidth(rskip) or 0
- local righttotal = rskip and effective_glue(rskip,current) or 0
+ local righttotal = rskip and effectiveglue(rskip,current) or 0
local parfixed = pskip and getwidth(pskip) or 0
- local partotal = pskip and effective_glue(pskip,current) or 0
+ local partotal = pskip and effectiveglue(pskip,current) or 0
local width = righttotal - (rightlocal and rightfixed or 0) + partotal - distance
if width > threshold then
if pskip then
@@ -653,13 +653,13 @@ function linefillers.handler(head)
if rskip then
setglue(rskip,rightlocal and getwidth(rskip) or nil)
if distance > 0 then
- insert_node_before(list,rskip,new_kern(distance))
+ insertnodebefore(list,rskip,new_kern(distance))
end
- insert_node_before(list,rskip,linefiller(current,data,width,"right"))
+ insertnodebefore(list,rskip,linefiller(current,data,width,"right"))
else
- insert_node_after(list,tail,linefiller(current,data,width,"right"))
+ insertnodeafter(list,tail,linefiller(current,data,width,"right"))
if distance > 0 then
- insert_node_after(list,tail,new_kern(distance))
+ insertnodeafter(list,tail,new_kern(distance))
end
end
end
diff --git a/tex/context/base/mkiv/node-scn.lua b/tex/context/base/mkiv/node-scn.lua
index 3c1dd2d88..55f39a74b 100644
--- a/tex/context/base/mkiv/node-scn.lua
+++ b/tex/context/base/mkiv/node-scn.lua
@@ -21,8 +21,6 @@ local getsubtype = nuts.getsubtype
local getlist = nuts.getlist
local setlist = nuts.setlist
-local end_of_math = nuts.end_of_math
-
local nodecodes = nodes.nodecodes
local gluecodes = nodes.gluecodes
local kerncodes = nodes.kerncodes
diff --git a/tex/context/base/mkiv/node-ser.lua b/tex/context/base/mkiv/node-ser.lua
index 25a6dd6c3..0f4d13bb6 100644
--- a/tex/context/base/mkiv/node-ser.lua
+++ b/tex/context/base/mkiv/node-ser.lua
@@ -17,14 +17,11 @@ local allocate = utilities.storage.allocate
local context = context
local nodes = nodes
-local node = node
-
-local is_node = nodes.is_node
+local isnode = nodes.isnode
local nodecodes = nodes.nodecodes
local subtcodes = nodes.codes
local getfields = nodes.fields
-
local tonode = nodes.tonode
local tonut = nodes.tonut
@@ -130,7 +127,7 @@ end
nodes.astable = astable
-setinspector("node",function(v) if is_node(v) then printtable(astable(v),tostring(v)) return true end end)
+setinspector("node",function(v) if isnode(v) then printtable(astable(v),tostring(v)) return true end end)
-- under construction:
diff --git a/tex/context/base/mkiv/node-shp.lua b/tex/context/base/mkiv/node-shp.lua
index 58dc94495..b867f564a 100644
--- a/tex/context/base/mkiv/node-shp.lua
+++ b/tex/context/base/mkiv/node-shp.lua
@@ -121,7 +121,7 @@ local removables = {
--
-- handlers.cleanuppage = cleanup_redundant -- nut
-handlers.cleanuppage = nuts.flatten_discretionaries
+handlers.cleanuppage = nuts.flattendiscretionaries
local function cleanup_flushed(head) -- rough
local start = head
diff --git a/tex/context/base/mkiv/node-syn.lua b/tex/context/base/mkiv/node-syn.lua
index d9c653abb..d2eec6714 100644
--- a/tex/context/base/mkiv/node-syn.lua
+++ b/tex/context/base/mkiv/node-syn.lua
@@ -159,8 +159,8 @@ local fontkern_code = kerncodes.fontkern
local cancel_code = nodes.dircodes.cancel
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local nodepool = nuts.pool
local new_latelua = nodepool.latelua
@@ -170,7 +170,7 @@ local new_kern = nodepool.kern
local getdimensions = nuts.dimensions
local getrangedimensions = nuts.rangedimensions
-local getsynctexfields = nuts.getsynctexfields or nuts.get_synctex_fields
+local getsynctexfields = nuts.getsynctexfields
local forcesynctextag = tex.forcesynctextag or tex.force_synctex_tag
local forcesynctexline = tex.forcesynctexline or tex.force_synctex_line
local getsynctexline = tex.getsynctexline or tex.get_synctex_line
@@ -391,27 +391,27 @@ end
-- end
--
-- local function b_vlist(head,current,t,l,w,h,d)
--- return insert_before(head,current,new_latelua(function() doaction(f_vlist,t,l,w,h,d) end))
+-- return insertbefore(head,current,new_latelua(function() doaction(f_vlist,t,l,w,h,d) end))
-- end
--
-- local function b_hlist(head,current,t,l,w,h,d)
--- return insert_before(head,current,new_latelua(function() doaction(f_hlist,t,l,w,h,d) end))
+-- return insertbefore(head,current,new_latelua(function() doaction(f_hlist,t,l,w,h,d) end))
-- end
--
-- local function e_vlist(head,current)
--- return insert_after(head,current,new_latelua(noaction(s_vlist)))
+-- return insertafter(head,current,new_latelua(noaction(s_vlist)))
-- end
--
-- local function e_hlist(head,current)
--- return insert_after(head,current,new_latelua(noaction(s_hlist)))
+-- return insertafter(head,current,new_latelua(noaction(s_hlist)))
-- end
--
-- local function x_vlist(head,current,t,l,w,h,d)
--- return insert_before(head,current,new_latelua(function() doaction(f_vlist_1,t,l,w,h,d) end))
+-- return insertbefore(head,current,new_latelua(function() doaction(f_vlist_1,t,l,w,h,d) end))
-- end
--
-- local function x_hlist(head,current,t,l,w,h,d)
--- return insert_before(head,current,new_latelua(function() doaction(f_hlist_1,t,l,w,h,d) end))
+-- return insertbefore(head,current,new_latelua(function() doaction(f_hlist_1,t,l,w,h,d) end))
-- end
--
-- generic
@@ -466,7 +466,7 @@ local x_hlist do
x_hlist = function(head,current,t,l,w,h,d)
if filehandle then
- return insert_before(head,current,new_latelua(function() doaction(t,l,w,h,d) end))
+ return insertbefore(head,current,new_latelua(function() doaction(t,l,w,h,d) end))
else
return head
end
@@ -502,8 +502,8 @@ local function inject(head,first,last,tag,line)
d = depth
end
if trace then
- head = insert_before(head,first,new_rule(w,fulltrace and h or traceheight,fulltrace and d or tracedepth))
- head = insert_before(head,first,new_kern(-w))
+ head = insertbefore(head,first,new_rule(w,fulltrace and h or traceheight,fulltrace and d or tracedepth))
+ head = insertbefore(head,first,new_kern(-w))
end
head = x_hlist(head,first,tag,line,w,h,d)
return head
@@ -569,8 +569,8 @@ local function inject(parent,head,first,last,tag,line)
d = depth
end
if trace then
- head = insert_before(head,first,new_rule(w,fulltrace and h or traceheight,fulltrace and d or tracedepth))
- head = insert_before(head,first,new_kern(-w))
+ head = insertbefore(head,first,new_rule(w,fulltrace and h or traceheight,fulltrace and d or tracedepth))
+ head = insertbefore(head,first,new_kern(-w))
end
head = x_hlist(head,first,tag,line,w,h,d)
return head
diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua
index 83c072c19..d3d35dae0 100644
--- a/tex/context/base/mkiv/node-tra.lua
+++ b/tex/context/base/mkiv/node-tra.lua
@@ -50,8 +50,6 @@ local getglue = nuts.getglue
local isglyph = nuts.isglyph
local getdirection = nuts.getdirection
local getwidth = nuts.getwidth
-
-local flush_list = nuts.flush_list
local count_nodes = nuts.countall
local used_nodes = nuts.usedlist
@@ -83,7 +81,7 @@ local whatsit_code = nodecodes.whatsit
local dimenfactors = number.dimenfactors
local formatters = string.formatters
-local start_of_par = nuts.start_of_par
+local startofpar = nuts.startofpar
-- this will be reorganized:
@@ -154,7 +152,7 @@ local function tosequence(start,stop,compact)
elseif id == dir_code then
local d, p = getdirection(start)
n = n + 1 ; t[n] = "[<" .. (p and "-" or "+") .. d .. ">]" -- todo l2r etc
- elseif id == par_code and start_of_par(current) then
+ elseif id == par_code and startofpar(current) then
n = n + 1 ; t[n] = "[<" .. getdirection(start) .. ">]" -- todo l2r etc
elseif compact then
n = n + 1 ; t[n] = "[]"
diff --git a/tex/context/base/mkiv/node-typ.lua b/tex/context/base/mkiv/node-typ.lua
index 2f00c9413..f1eceb8f3 100644
--- a/tex/context/base/mkiv/node-typ.lua
+++ b/tex/context/base/mkiv/node-typ.lua
@@ -32,13 +32,10 @@ local new_glue = nodepool.glue
local utfvalues = utf.values
-local currentfont = font.current -- mabe nicer is fonts .current
-local currentattributes = node.current_attributes -- mabe nicer is attributes.current
-
+local currentfont = font.current
+local currentattributes = nodes.currentattributes
local fontparameters = fonts.hashes.parameters
-if not currentattributes then currentattributes = node.current_attr end -- CONTEXTLMTXMODE == 0
-
-- when attrid == true then take from glyph or current else use the given value
local function tonodes(str,fontid,spacing,templateglyph,attrid) -- quick and dirty
@@ -133,9 +130,9 @@ typesetters.hpack = typesetters.tohpack -- obsolete
typesetters.hbox = typesetters.tohbox -- obsolete
typesetters.vpack = typesetters.tovpack -- obsolete
--- node.write(nodes.typesetters.tohpack("Hello World!"))
--- node.write(nodes.typesetters.tohbox ("Hello World!"))
--- node.write(nodes.typesetters.tohpack("Hello World!",1,100*1024*10))
--- node.write(nodes.typesetters.tohbox ("Hello World!",1,100*1024*10))
+-- context(nodes.typesetters.tohpack("Hello World!"))
+-- context(nodes.typesetters.tohbox ("Hello World!"))
+-- context(nodes.typesetters.tohpack("Hello World!",1,100*1024*10))
+-- context(nodes.typesetters.tohbox ("Hello World!",1,100*1024*10))
string.tonodes = function(...) return tonode(tonodes(...)) end -- quite convenient
diff --git a/tex/context/base/mkiv/pack-rul.lua b/tex/context/base/mkiv/pack-rul.lua
index 8e410f0cf..98117867c 100644
--- a/tex/context/base/mkiv/pack-rul.lua
+++ b/tex/context/base/mkiv/pack-rul.lua
@@ -57,7 +57,7 @@ local getboxglue = nuts.getboxglue
local hpack = nuts.hpack
local getdimensions = nuts.dimensions
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local traversers = nuts.traversers
local nexthlist = traversers.hlist
@@ -131,7 +131,7 @@ local function doreshapeframedbox(n)
local set, order, sign = getboxglue(p)
setboxglue(h,set,order,sign)
setlist(p)
- flush_node(p)
+ flushnode(p)
elseif checkformath and subtype == equationlist_code then
-- display formulas use a shift
if nofnonzero == 1 then
@@ -165,7 +165,7 @@ local function doreshapeframedbox(n)
texsetdimen("global","framedaveragewidth",averagewidth)
end
-local function doanalyzeframedbox(n) -- traverse_list
+local function doanalyzeframedbox(n)
local box = getbox(n)
local noflines = 0
local firstheight = nil
diff --git a/tex/context/base/mkiv/page-cst.lua b/tex/context/base/mkiv/page-cst.lua
index a6315ff05..5106f1fef 100644
--- a/tex/context/base/mkiv/page-cst.lua
+++ b/tex/context/base/mkiv/page-cst.lua
@@ -37,8 +37,7 @@ local tonode = nuts.tonode
local tonut = nuts.tonut
local vpack = nuts.vpack
-local flushlist = nuts.flush_list
------ removenode = nuts.remove
+local flushlist = nuts.flushlist
local setlink = nuts.setlink
local setlist = nuts.setlist
@@ -62,7 +61,7 @@ local takebox = nuts.takebox
local takelist = nuts.takelist
local splitbox = nuts.splitbox
local getattribute = nuts.getattribute
-local copylist = nuts.copy_list
+local copylist = nuts.copylist
local getbox = nuts.getbox
local getcount = tex.getcount
diff --git a/tex/context/base/mkiv/page-ini.lua b/tex/context/base/mkiv/page-ini.lua
index 924e01b2a..bcabc0d6b 100644
--- a/tex/context/base/mkiv/page-ini.lua
+++ b/tex/context/base/mkiv/page-ini.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['page-ini'] = {
license = "see context related readme files"
}
+-- Some day I need to make this more efficient.
+
local tonumber, rawget, rawset, type, next = tonumber, rawget, rawset, type, next
local match = string.match
local sort, tohash, insert, remove, sortedkeys = table.sort, table.tohash, table.insert, table.remove, table.sortedkeys
@@ -13,7 +15,12 @@ local settings_to_array, settings_to_hash = utilities.parsers.settings_to_array,
local texgetcount = tex.getcount
+local tonut = nodes.tonut
+local nextlist = nodes.nuts.traversers.list
+local texlists = tex.lists
+
local context = context
+local ctx_doif = commands.doif
local ctx_doifelse = commands.doifelse
local implement = interfaces.implement
@@ -23,16 +30,22 @@ local last = 0
local pages = structures.pages
local autolist = { }
local report = logs.reporter("pages","mark")
+local active = false
local trace = false trackers.register("pages.mark",function(v) trace = v end)
-function pages.mark(name,list)
+function pages.mark(name,list,settings)
+ active = true
+ --
local realpage = texgetcount("realpageno")
+ if type(settings) == "string" then
+ settings = settings_to_hash(settings)
+ end
if not list or list == "" then
if trace then
report("marking current page %i as %a",realpage,name)
end
- data[realpage][name] = true
+ data[realpage][name] = settings or true
return
end
if type(list) == "string" then
@@ -51,7 +64,7 @@ function pages.mark(name,list)
report("marking page %i upto %i as %a",f,t,name)
end
for page=f,t do
- data[page][name] = true
+ data[page][name] = settings or true
end
end
page = false
@@ -74,7 +87,7 @@ function pages.mark(name,list)
if trace then
report("marking page %i as %a",page,name)
end
- data[page][name] = true
+ data[page][name] = settings or true
end
end
end
@@ -83,30 +96,51 @@ function pages.mark(name,list)
if trace then
report("marking current page %i as %a",realpage,name)
end
- data[realpage][name] = true
+ data[realpage][name] = settings or true
end
end
local tobemarked = { }
function pages.markedlist(realpage)
- if realpage then
+ if active and realpage then
local m = rawget(tobemarked,realpage) or rawget(data,realpage)
return m and next(m) and sortedkeys(m)
end
end
local function marked(name)
- local realpage = texgetcount("realpageno")
- for i=last,realpage-1 do
- local di = data[i]
- if di then
- tobemarked[i] = di
- rawset(data,i,nil)
+ if active then
+ local realpage = texgetcount("realpageno")
+ if last ~= 0 then
+ for i=last,realpage-1 do
+ -- print(last)
+ local di = data[i]
+ if di then
+ tobemarked[i] = di
+ rawset(data,i,nil)
+ end
+ end
+ last = 0 -- needs checking
+ end
+ local pagedata = rawget(data,realpage)
+ return pagedata and pagedata[name] and true or false
+ else
+ return false
+ end
+end
+
+local function markedparameter(name,key)
+ if active then
+ local pagedata = rawget(data,texgetcount("realpageno"))
+ if pagedata then
+ pagedata = pagedata[name]
+ if pagedata then
+ pagedata = pagedata[key]
+ end
end
+ return pagedata
end
- local pagedata = rawget(data,realpage)
- return pagedata and pagedata[name] and true or false
end
local function toranges(marked)
@@ -124,12 +158,14 @@ local function toranges(marked)
last = page
end
list[#list+1] = { first, last }
+ --
+ active = true
end
return list
end
local function allmarked(list)
- if list then
+ if active and list then
local collected = pages.collected
if collected then
if type(list) == "string" then
@@ -175,26 +211,77 @@ pages.allmarked = allmarked
-- An alternative is to use an attribute and identify the state by parsing the node
-- list but that's a bit overkill for a hardly used feature like this.
-luatex.registerpageactions(function()
+-- Page actions are bound to a real page. When we set one, we need to bind to the
+-- current page unless we just flushed. So we also need to check the current page.
+
+-- \page ... \start : sync realpage
+-- \page \start : sync realpage
+-- \page \stop : reset synced because no content yet
+-- \page ... \stop : keep sync
+
+local function autopageaction()
+ if active then
+ local nofauto = #autolist
+ if nofauto > 0 then
+ local realpage = texgetcount("realpageno")
+ for i=1,nofauto do
+ local entry = autolist[i]
+ local names = entry[1]
+ local settings = entry[2]
+ for j=1,#names do
+ local name = names[j]
+ local list = data[realpage]
+ if not list[name] then
+ if trace then
+ report("automatically marking page %i as %a",realpage,name)
+ end
+ list[name] = settings or true
+ end
+ end
+ end
+ end
+ end
+end
+
+local function startmarked(name,settings)
+ active = true
+ --
+ insert(autolist, { settings_to_array(name), settings_to_hash(settings) })
+ autopageaction(true)
+end
+
+local function stopmarked()
local nofauto = #autolist
if nofauto > 0 then
- local realpage = texgetcount("realpageno")
- for i=1,nofauto do
- local names = autolist[i]
- for j=1,#names do
- local name = names[j]
- data[realpage][name] = true
- if trace then
- report("automatically marking page %i as %a",realpage,name)
+ if not texlists.pagehead then
+ local realpage = texgetcount("realpageno")
+ for i=1,nofauto do
+ local entry = autolist[i]
+ local names = entry[1]
+ for j=1,#names do
+ local name = names[j]
+ local list = data[realpage]
+ if list[name] then
+ if trace then
+ report("automatically unmarking page %i as %a",realpage,name)
+ end
+ list[name] = nil
+ end
end
end
end
+ remove(autolist)
end
-end)
+end
+
+implement {
+ name = "checkmarkedpages",
+ actions = autopageaction,
+}
implement {
name = "markpage",
- arguments = "2 strings",
+ arguments = "3 strings",
actions = pages.mark
}
@@ -204,6 +291,23 @@ implement {
actions = { marked, ctx_doifelse }
}
+implement {
+ name = "doifmarkedpage",
+ arguments = "string",
+ actions = { marked, ctx_doif }
+}
+
+implement {
+ name = "markedpageparameter",
+ arguments = "strings",
+ actions = function(name,key)
+ local value = markedparameter(name,key)
+ if value then
+ context(value)
+ end
+ end
+}
+
implement {
name = "markedpages",
arguments = "string",
@@ -217,20 +321,13 @@ implement {
implement {
name = "startmarkpages",
- arguments = "string",
- actions = function(name)
- insert(autolist,settings_to_array(name))
- end
+ arguments = "2 strings",
+ actions = startmarked,
}
implement {
- name = "stopmarkpages",
- arguments = "string",
- actions = function(name)
- if #autolist > 0 then
- remove(autolist)
- end
- end
+ name = "stopmarkpages",
+ actions = stopmarked,
}
local tonut = nodes.tonut
diff --git a/tex/context/base/mkiv/page-ini.mkiv b/tex/context/base/mkiv/page-ini.mkiv
index e56c3ac04..0c444ffc2 100644
--- a/tex/context/base/mkiv/page-ini.mkiv
+++ b/tex/context/base/mkiv/page-ini.mkiv
@@ -333,10 +333,10 @@
\installcorenamespace{markedpage}
\unexpanded\def\markpage
- {\dodoubleempty\page_mark}
+ {\dotripleempty\page_mark}
-\def\page_mark[#1][#2]%
- {\clf_markpage{#1}{#2}}
+\def\page_mark[#1][#2][#3]%
+ {\clf_markpage{#1}{#2}{#3}}
\def\markedpages[#1]% expandable
{\clf_markedpages{#1}}
@@ -344,12 +344,28 @@
\unexpanded\def\doifelsemarkedpage#1%
{\clf_doifelsemarkedpage{#1}}
-\unexpanded\def\startmarkpages[#1]%
- {\clf_startmarkpages{#1}}
+\unexpanded\def\doifmarkedpage#1%
+ {\clf_doifmarkedpage{#1}}
+
+\unexpanded\def\startmarkpages
+ {\dodoubleempty\page_start_marked}
+
+\def\page_start_marked[#1][#2]%
+ {\clf_startmarkpages{#1}{#2}}
\unexpanded\def\stopmarkpages
{\clf_stopmarkpages}
+\unexpanded\def\checkmarkedpages
+ {\clf_checkmarkedpages}
+
+\def\markedpageparameter#1#2%
+ {\clf_markedpageparameter{#1}{#2}}
+
+\appendtoks
+ \checkmarkedpages
+\to \everyaftershipout
+
%D Experimental:
\newconstant\c_page_force_strut_depth_trace_mode
diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua
index c1f93b4bb..443f25e56 100644
--- a/tex/context/base/mkiv/page-mix.lua
+++ b/tex/context/base/mkiv/page-mix.lua
@@ -61,7 +61,7 @@ local getid = nuts.getid
local getlist = nuts.getlist
local getsubtype = nuts.getsubtype
local getbox = nuts.getbox
-local getattribute = nuts.getattribute
+local getattr = nuts.getattr
local getwhd = nuts.getwhd
local getkern = nuts.getkern
local getpenalty = nuts.getpenalty
@@ -589,7 +589,7 @@ local function preparesplit(specification) -- a rather large function
if penalty == 0 then
unlock(2,penalty)
elseif penalty == forcedbreak then
- local needed = getattribute(current,a_checkedbreak)
+ local needed = getattr(current,a_checkedbreak)
local proceed = not needed or needed == 0
if not proceed then
local available = target - height
diff --git a/tex/context/base/mkiv/page-mix.mkiv b/tex/context/base/mkiv/page-mix.mkiv
index e38ad7406..2bca9cbf5 100644
--- a/tex/context/base/mkiv/page-mix.mkiv
+++ b/tex/context/base/mkiv/page-mix.mkiv
@@ -31,10 +31,6 @@
% offsets (inner ones, so we change the hsize ... needed with backgrounds
% when no content we currently loose the page
-% luatex buglet:
-%
-% \ctxlua{tex.setbox("global",0,node.hpack(nodes.pool.glyph("a",font.current())))}\box0
-
\registerctxluafile{page-mix}{}
\unprotect
diff --git a/tex/context/base/mkiv/page-str.lua b/tex/context/base/mkiv/page-str.lua
index 73f1782d0..e136a38b4 100644
--- a/tex/context/base/mkiv/page-str.lua
+++ b/tex/context/base/mkiv/page-str.lua
@@ -24,8 +24,8 @@ local nuts = nodes.nuts
local tonut = nodes.tonut
local slide_node_list = nuts.slide
local write_node = nuts.write
-local flush_node = nuts.flush
-local copy_node_list = nuts.copy_list
+local flushnode = nuts.flush
+local copy_node_list = nuts.copylist
local vpack_node_list = nuts.vpack
local getbox = nuts.getbox
@@ -146,7 +146,7 @@ function streams.flush(name,copy) -- problem: we need to migrate afterwards
if di then
write_node(getlist(di)) -- list, will be option
setlist(di)
- flush_node(di)
+ flushnode(di)
end
end
end
@@ -237,7 +237,7 @@ function streams.synchronize(list) -- this is an experiment !
end
dana[m] = vpack_node_list(getlist(vbox))
setlist(vbox)
- flush_node(vbox)
+ flushnode(vbox)
if trace_flushing then
report_streams("slot %s:%s with delta (%p,%p) is compensated by %s lines",m,i,delta_height,delta_depth,n)
end
diff --git a/tex/context/base/mkiv/scrn-hlp.lua b/tex/context/base/mkiv/scrn-hlp.lua
index 8f6f6f746..a11ad48d2 100644
--- a/tex/context/base/mkiv/scrn-hlp.lua
+++ b/tex/context/base/mkiv/scrn-hlp.lua
@@ -18,8 +18,8 @@ local formatters = string.formatters
local a_help = attributes.private("help")
-local copy_node_list = node.copy_list
-local hpack_node_list = node.hpack
+local copy_node_list = nodes.copylist
+local hpack_node_list = nodes.hpack
local register_list = nodes.pool.register
diff --git a/tex/context/base/mkiv/scrp-cjk.lua b/tex/context/base/mkiv/scrp-cjk.lua
index 9e6e24f4d..541ea9f81 100644
--- a/tex/context/base/mkiv/scrp-cjk.lua
+++ b/tex/context/base/mkiv/scrp-cjk.lua
@@ -17,54 +17,54 @@ if not modules then modules = { } end modules ['scrp-cjk'] = {
-- endofline turned into spaces (would not make sense either because otherwise a
-- wanted space at the end of a line would have to be a hard coded ones.
-local nuts = nodes.nuts
+local nuts = nodes.nuts
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
-local copy_node = nuts.copy
-local remove_node = nuts.remove
-local nextglyph = nuts.traversers.glyph
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
+local copy_node = nuts.copy
+local remove_node = nuts.remove
+local nextglyph = nuts.traversers.glyph
-local getnext = nuts.getnext
-local getprev = nuts.getprev
-local getfont = nuts.getfont
-local getchar = nuts.getchar
-local getid = nuts.getid
-local getsubtype = nuts.getsubtype
-local getwidth = nuts.getwidth
+local getnext = nuts.getnext
+local getprev = nuts.getprev
+local getfont = nuts.getfont
+local getchar = nuts.getchar
+local getid = nuts.getid
+local getsubtype = nuts.getsubtype
+local getwidth = nuts.getwidth
-local setchar = nuts.setchar
+local setchar = nuts.setchar
-local nodepool = nuts.pool
-local new_glue = nodepool.glue
-local new_kern = nodepool.kern
-local new_penalty = nodepool.penalty
+local nodepool = nuts.pool
+local new_glue = nodepool.glue
+local new_kern = nodepool.kern
+local new_penalty = nodepool.penalty
-local nodecodes = nodes.nodecodes
-local gluecodes = nodes.gluecodes
+local nodecodes = nodes.nodecodes
+local gluecodes = nodes.gluecodes
-local glyph_code = nodecodes.glyph
-local glue_code = nodecodes.glue
+local glyph_code = nodecodes.glyph
+local glue_code = nodecodes.glue
-local userskip_code = gluecodes.userskip
-local spaceskip_code = gluecodes.spaceskip
-local xspaceskip_code = gluecodes.xspaceskip
+local userskip_code = gluecodes.userskip
+local spaceskip_code = gluecodes.spaceskip
+local xspaceskip_code = gluecodes.xspaceskip
-local hash = scripts.hash
+local hash = scripts.hash
-local getscriptstatus = scripts.getstatus
-local getscriptdata = scripts.getdata
-local scriptcolors = scripts.colors
+local getscriptstatus = scripts.getstatus
+local getscriptdata = scripts.getdata
+local scriptcolors = scripts.colors
-local fonthashes = fonts.hashes
-local quaddata = fonthashes.quads
-local spacedata = fonthashes.spaces
+local fonthashes = fonts.hashes
+local quaddata = fonthashes.quads
+local spacedata = fonthashes.spaces
-local decomposed = characters.hangul.decomposed
+local decomposed = characters.hangul.decomposed
-local trace_details = false trackers.register("scripts.details", function(v) trace_details = v end)
+local trace_details = false trackers.register("scripts.details", function(v) trace_details = v end)
-local report_details = logs.reporter("scripts","detail")
+local report_details = logs.reporter("scripts","detail")
-- raggedleft is controlled by leftskip and we might end up with a situation where
-- the intercharacter spacing interferes with this; the solution is to patch the
@@ -133,206 +133,206 @@ local function nobreak(head,current)
if trace_details then
trace_detail(current,"break")
end
- insert_node_before(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_penalty(10000))
end
local function stretch_break(head,current)
if trace_details then
trace_detail(current,"stretch break")
end
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
end
local function shrink_break(head,current)
if trace_details then
trace_detail(current,"shrink break")
end
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_stretch(head,current)
if trace_details then
trace_detail(current,"no break stretch")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
end
local function korean_break(head,current)
if trace_details then
trace_detail(current,"korean break")
end
- insert_node_before(head,current,new_penalty(inter_char_hangul_penalty))
+ insertnodebefore(head,current,new_penalty(inter_char_hangul_penalty))
end
local function nobreak_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak shrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_stretch_nobreak_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak stretch nobreak shrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_stretch_nobreak_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak stretch nobreak autoshrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_shrink_nobreak_stretch(head,current)
if trace_details then
trace_detail(current,"nobreak shrink nobreak stretch")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_autoshrink_nobreak_stretch(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink nobreak stretch")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_shrink_break_stretch(head,current)
if trace_details then
trace_detail(current,"nobreak shrink break stretch")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_autoshrink_break_stretch(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink break stretch")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_shrink_break_stretch_nobreak_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak shrink break stretch nobreak shrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
end
local function japanese_between_full_close_open(head,current) -- todo: check width
if trace_details then
trace_detail(current,"japanese between full close open")
end
- insert_node_before(head,current,new_kern(-half_char_width))
- insert_node_before(head,current,new_glue(half_char_width,0,inter_char_half_shrink))
- insert_node_before(head,current,new_kern(-half_char_width))
+ insertnodebefore(head,current,new_kern(-half_char_width))
+ insertnodebefore(head,current,new_glue(half_char_width,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_kern(-half_char_width))
end
local function japanese_between_full_close_full_close(head,current) -- todo: check width
if trace_details then
trace_detail(current,"japanese between full close full close")
end
- insert_node_before(head,current,new_kern(-half_char_width))
- -- insert_node_before(head,current,new_glue(half_char_width,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_kern(-half_char_width))
+ -- insertnodebefore(head,current,new_glue(half_char_width,0,inter_char_half_shrink))
end
local function japanese_before_full_width_punct(head,current) -- todo: check width
if trace_details then
trace_detail(current,"japanese before full width punct")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(quarter_char_width,0,inter_char_quarter_shrink))
- insert_node_before(head,current,new_kern(-quarter_char_width))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(quarter_char_width,0,inter_char_quarter_shrink))
+ insertnodebefore(head,current,new_kern(-quarter_char_width))
end
local function japanese_after_full_width_punct(head,current) -- todo: check width
if trace_details then
trace_detail(current,"japanese after full width punct")
end
- insert_node_before(head,current,new_kern(-quarter_char_width))
- insert_node_before(head,current,new_glue(quarter_char_width,0,inter_char_quarter_shrink))
+ insertnodebefore(head,current,new_kern(-quarter_char_width))
+ insertnodebefore(head,current,new_glue(quarter_char_width,0,inter_char_quarter_shrink))
end
local function nobreak_autoshrink_break_stretch_nobreak_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink break stretch nobreak autoshrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_autoshrink_break_stretch_nobreak_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak autoshrink break stretch nobreak shrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_shrink_break_stretch_nobreak_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak shrink break stretch nobreak autoshrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
end
local function nobreak_stretch_break_shrink(head,current)
if trace_details then
trace_detail(current,"nobreak stretch break shrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
local function nobreak_stretch_break_autoshrink(head,current)
if trace_details then
trace_detail(current,"nobreak stretch break autoshrink")
end
- insert_node_before(head,current,new_penalty(10000))
- insert_node_before(head,current,new_glue(0,inter_char_stretch,0))
- insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink))
+ insertnodebefore(head,current,new_penalty(10000))
+ insertnodebefore(head,current,new_glue(0,inter_char_stretch,0))
+ insertnodebefore(head,current,new_glue(0,0,inter_char_half_shrink))
end
-- Korean: hangul
@@ -535,11 +535,11 @@ function scripts.decomposehangul(head)
setchar(current,lead_consonant)
local m = copy_node(current)
setchar(m,medial_vowel)
- head, current = insert_node_after(head,current,m)
+ head, current = insertnodeafter(head,current,m)
if tail_consonant then
local t = copy_node(current)
setchar(t,tail_consonant)
- head, current = insert_node_after(head,current,t)
+ head, current = insertnodeafter(head,current,t)
end
done = true
end
@@ -961,7 +961,7 @@ local function process(head,first,last)
end
previous = current
-- elseif id == math_code then
- -- upcoming = getnext(end_of_math(current))
+ -- upcoming = getnext(endofmath(current))
-- previous = "start"
else -- glue
local p = getprev(first)
diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua
index ab6fca4db..0fafd9854 100644
--- a/tex/context/base/mkiv/scrp-ini.lua
+++ b/tex/context/base/mkiv/scrp-ini.lua
@@ -23,68 +23,68 @@ local report_preprocessing = logs.reporter("scripts","preprocessing")
local report_splitting = logs.reporter("scripts","splitting")
-local attributes = attributes
-local nodes = nodes
-local context = context
+local attributes = attributes
+local nodes = nodes
+local context = context
-local nodecodes = nodes.nodecodes
+local nodecodes = nodes.nodecodes
-local implement = interfaces.implement
+local implement = interfaces.implement
-local glyph_code = nodecodes.glyph
-local glue_code = nodecodes.glue
+local glyph_code = nodecodes.glyph
+local glue_code = nodecodes.glue
-local emwidths = fonts.hashes.emwidths
-local exheights = fonts.hashes.exheights
+local emwidths = fonts.hashes.emwidths
+local exheights = fonts.hashes.exheights
-local a_script = attributes.private('script')
+local a_script = attributes.private('script')
-local fontdata = fonts.hashes.identifiers
-local allocate = utilities.storage.allocate
-local setnodecolor = nodes.tracers.colors.set
+local fontdata = fonts.hashes.identifiers
+local allocate = utilities.storage.allocate
+local setnodecolor = nodes.tracers.colors.set
-local enableaction = nodes.tasks.enableaction
-local disableaction = nodes.tasks.disableaction
+local enableaction = nodes.tasks.enableaction
+local disableaction = nodes.tasks.disableaction
-local nuts = nodes.nuts
+local nuts = nodes.nuts
-local getnext = nuts.getnext
-local getchar = nuts.getchar
-local getfont = nuts.getfont
-local getid = nuts.getid
-local getglyphdata = nuts.getglyphdata
-local setglyphdata = nuts.setglyphdata
+local getnext = nuts.getnext
+local getchar = nuts.getchar
+local getfont = nuts.getfont
+local getid = nuts.getid
+local getglyphdata = nuts.getglyphdata
+local setglyphdata = nuts.setglyphdata
-local isglyph = nuts.isglyph
+local isglyph = nuts.isglyph
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
-local first_glyph = nuts.first_glyph
+local firstglyph = nuts.firstglyph
-local nextglyph = nuts.traversers.glyph
-local nextchar = nuts.traversers.char
+local nextglyph = nuts.traversers.glyph
+local nextchar = nuts.traversers.char
-local nodepool = nuts.pool
+local nodepool = nuts.pool
-local new_glue = nodepool.glue
-local new_rule = nodepool.rule
-local new_penalty = nodepool.penalty
+local new_glue = nodepool.glue
+local new_rule = nodepool.rule
+local new_penalty = nodepool.penalty
-scripts = scripts or { }
-local scripts = scripts
+scripts = scripts or { }
+local scripts = scripts
-scripts.hash = scripts.hash or { }
-local hash = scripts.hash
+scripts.hash = scripts.hash or { }
+local hash = scripts.hash
-local handlers = allocate()
-scripts.handlers = handlers
+local handlers = allocate()
+scripts.handlers = handlers
-local injectors = allocate()
-scripts.injectors = handlers
+local injectors = allocate()
+scripts.injectors = handlers
-local splitters = allocate()
-scripts.splitters = splitters
+local splitters = allocate()
+scripts.splitters = splitters
-- we need to fake it in luatex
@@ -511,7 +511,7 @@ local function traced_process(head,first,last,process,a)
end
function scripts.injectors.handler(head)
- local start = first_glyph(head) -- we already have glyphs here (subtype 1)
+ local start = firstglyph(head) -- we already have glyphs here (subtype 1)
if not start then
return head
else
@@ -791,7 +791,7 @@ end
local tree, attr, proc
-function splitters.handler(head) -- todo: also first_glyph test
+function splitters.handler(head) -- todo: also firstglyph test
local current = head
while current do
if getid(current) == glyph_code then
@@ -848,9 +848,9 @@ end
local function marker(head,current,font,color) -- could become: nodes.tracers.marker
local ex = exheights[font]
local em = emwidths [font]
- head, current = insert_node_after(head,current,new_penalty(10000))
- head, current = insert_node_after(head,current,new_glue(-0.05*em))
- head, current = insert_node_after(head,current,new_rule(0.05*em,1.5*ex,0.5*ex))
+ head, current = insertnodeafter(head,current,new_penalty(10000))
+ head, current = insertnodeafter(head,current,new_glue(-0.05*em))
+ head, current = insertnodeafter(head,current,new_rule(0.05*em,1.5*ex,0.5*ex))
setnodecolor(current,color)
return head, current
end
@@ -871,7 +871,7 @@ function splitters.insertafter(handler,head,first,last,detail)
if ignore then
return head, last
else
- return insert_node_after(head,last,new_glue(0,last_s))
+ return insertnodeafter(head,last,new_glue(0,last_s))
end
end
@@ -1046,30 +1046,30 @@ do
scripts.inserters = {
space_before = function(head,current)
- return insert_node_before(head,current,space_glue(current))
+ return insertnodebefore(head,current,space_glue(current))
end,
space_after = function(head,current)
- return insert_node_after(head,current,space_glue(current))
+ return insertnodeafter(head,current,space_glue(current))
end,
zerowidthspace_before = function(head,current)
- return insert_node_before(head,current,new_glue(0))
+ return insertnodebefore(head,current,new_glue(0))
end,
zerowidthspace_after = function(head,current)
- return insert_node_after(head,current,new_glue(0))
+ return insertnodeafter(head,current,new_glue(0))
end,
nobreakspace_before = function(head,current)
local g = space_glue(current)
local p = new_penalty(10000)
- head, current = insert_node_before(head,current,p)
- return insert_node_before(head,current,g)
+ head, current = insertnodebefore(head,current,p)
+ return insertnodebefore(head,current,g)
end,
nobreakspace_after = function(head,current)
local g = space_glue(current)
local p = new_penalty(10000)
- head, current = insert_node_after(head,current,g)
- return insert_node_after(head,current,p)
+ head, current = insertnodeafter(head,current,g)
+ return insertnodeafter(head,current,p)
end,
}
diff --git a/tex/context/base/mkiv/spac-ali.lua b/tex/context/base/mkiv/spac-ali.lua
index 2e2650f3b..448b0162b 100644
--- a/tex/context/base/mkiv/spac-ali.lua
+++ b/tex/context/base/mkiv/spac-ali.lua
@@ -68,7 +68,7 @@ local nofrealigned = 0
-- raggedright 0 0 fil
-- raggedcenter 0 + 0 + -
-local function handler(head,leftpage,realpageno) -- traverse_list
+local function handler(head,leftpage,realpageno) -- traverselist
local current = head
while current do
local id = getid(current)
diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua
index 7ec3e3cc4..233552460 100644
--- a/tex/context/base/mkiv/spac-chr.lua
+++ b/tex/context/base/mkiv/spac-chr.lua
@@ -42,11 +42,9 @@ local isglyph = nuts.isglyph
local setcolor = nodes.tracers.colors.set
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
------ traverse_id = nuts.traverse_id
------ traverse_char = nuts.traverse_char
local nextchar = nuts.traversers.char
local nextglyph = nuts.traversers.glyph
@@ -95,7 +93,7 @@ local function inject_quad_space(unicode,head,current,fraction)
setattrlist(glue,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode)
- return insert_node_after(head,current,glue)
+ return insertnodeafter(head,current,glue)
end
local function inject_char_space(unicode,head,current,parent)
@@ -105,7 +103,7 @@ local function inject_char_space(unicode,head,current,parent)
setattrlist(glue,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode)
- return insert_node_after(head,current,glue)
+ return insertnodeafter(head,current,glue)
end
local function inject_nobreak_space(unicode,head,current,space,spacestretch,spaceshrink)
@@ -114,17 +112,17 @@ local function inject_nobreak_space(unicode,head,current,space,spacestretch,spac
setattrlist(glue,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode) -- bombs
- head, current = insert_node_after(head,current,penalty)
+ head, current = insertnodeafter(head,current,penalty)
if trace_nbsp then
local rule = new_rule(space)
local kern = new_kern(-space)
local penalty = new_penalty(10000)
setcolor(rule,"orange")
- head, current = insert_node_after(head,current,rule)
- head, current = insert_node_after(head,current,kern)
- head, current = insert_node_after(head,current,penalty)
+ head, current = insertnodeafter(head,current,rule)
+ head, current = insertnodeafter(head,current,kern)
+ head, current = insertnodeafter(head,current,penalty)
end
- return insert_node_after(head,current,glue)
+ return insertnodeafter(head,current,glue)
end
local function nbsp(head,current)
@@ -148,7 +146,7 @@ end
function characters.replacenbspaces(head)
local wipe = false
- for current, char, font in nextglyph, head do -- can be anytime so no traverse_char
+ for current, char, font in nextglyph, head do -- can be anytime so no traversechar
if char == 0x00A0 then
if wipe then
head = remove_node(h,current,true)
@@ -192,7 +190,7 @@ local methods = {
head, current = remove_node(head,current,true)
if not is_punctuation[char] then
local p = fontparameters[font]
- head, current = insert_node_before(head,current,new_glue(p.space,p.space_stretch,p.space_shrink))
+ head, current = insertnodebefore(head,current,new_glue(p.space,p.space_stretch,p.space_shrink))
end
end
end
@@ -226,7 +224,7 @@ local methods = {
end,
[0x00AD] = function(head,current) -- softhyphen
- return insert_node_after(head,current,languages.explicithyphen(current))
+ return insertnodeafter(head,current,languages.explicithyphen(current))
end,
[0x2000] = function(head,current) -- enquad
diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua
index efa1dd967..5ab8196c8 100644
--- a/tex/context/base/mkiv/spac-ver.lua
+++ b/tex/context/base/mkiv/spac-ver.lua
@@ -148,14 +148,15 @@ local setdepth = nuts.setdepth
local getdepth = nuts.getdepth
local find_node_tail = nuts.tail
-local flush_node = nuts.flush_node
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
+local flushnode = nuts.flushnode
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
local remove_node = nuts.remove
local count_nodes = nuts.countall
local hpack_node = nuts.hpack
local vpack_node = nuts.vpack
-local start_of_par = nuts.start_of_par
+
+local startofpar = nuts.startofpar
local nextnode = nuts.traversers.node
local nexthlist = nuts.traversers.hlist
@@ -293,7 +294,7 @@ end
local function validvbox(parentid,list)
if parentid == hlist_code then
local id = getid(list)
- if id == par_code and start_of_par(list) then
+ if id == par_code and startofpar(list) then
list = getnext(list)
if not next then
return nil
@@ -329,7 +330,7 @@ local function already_done(parentid,list,a_snapmethod) -- todo: done when only
-- problem: any snapped vbox ends up in a line
if list and parentid == hlist_code then
local id = getid(list)
- if id == par_code and start_of_par(list) then
+ if id == par_code and startofpar(list) then
list = getnext(list)
if not list then
return false
@@ -1021,14 +1022,14 @@ do
if width == 0 then
-- do nothing
elseif where == "after" then
- head, current = insert_node_after(head,current,new_rule(w,h,d))
- head, current = insert_node_after(head,current,new_kern(width))
- head, current = insert_node_after(head,current,new_rule(w,h,d))
+ head, current = insertnodeafter(head,current,new_rule(w,h,d))
+ head, current = insertnodeafter(head,current,new_kern(width))
+ head, current = insertnodeafter(head,current,new_rule(w,h,d))
else
local c = current
- head, current = insert_node_before(head,current,new_rule(w,h,d))
- head, current = insert_node_before(head,current,new_kern(width))
- head, current = insert_node_before(head,current,new_rule(w,h,d))
+ head, current = insertnodebefore(head,current,new_rule(w,h,d))
+ head, current = insertnodebefore(head,current,new_kern(width))
+ head, current = insertnodebefore(head,current,new_rule(w,h,d))
current = c
end
if trace then
@@ -1203,10 +1204,10 @@ do
texsetdimen("global","d_spac_overlay",-delta) -- for tracing
-- we should adapt pagetotal ! (need a hook for that) .. now we have the wrong pagebreak
local k = new_kern(-delta)
- head = insert_node_before(head,n,k)
+ head = insertnodebefore(head,n,k)
if n_ht > p_ht then
local k = new_kern(n_ht-p_ht)
- head = insert_node_before(head,p,k)
+ head = insertnodebefore(head,p,k)
end
if trace_vspacing then
report_vspacing("overlaying, prev height: %p, prev depth: %p, next height: %p, skips: %p, move up: %p",p_ht,p_dp,n_ht,skips,delta)
@@ -1375,13 +1376,13 @@ do
if penalty_data >= 10000 then -- or whatever threshold?
local prev = getprev(current)
if getid(prev) == glue_code then -- maybe go back more, or maybe even push back before any glue
- -- tricky case: spacing/grid-007.tex: glue penalty glue
- head = insert_node_before(head,prev,p)
+ -- tricky case: spacing/grid-007.tex: glue penalty glue
+ head = insertnodebefore(head,prev,p)
else
- head = insert_node_before(head,current,p)
+ head = insertnodebefore(head,current,p)
end
else
- head = insert_node_before(head,current,p)
+ head = insertnodebefore(head,current,p)
end
-- if penalty_data > special_penalty_min and penalty_data < special_penalty_max then
local props = properties[p]
@@ -1400,22 +1401,22 @@ do
trace_done("flushed due to forced " .. why,glue_data)
end
head = forced_skip(head,current,getwidth(glue_data,width),"before",trace)
- flush_node(glue_data)
+ flushnode(glue_data)
else
local width, stretch, shrink = getglue(glue_data)
if width ~= 0 then
if trace then
trace_done("flushed due to non zero " .. why,glue_data)
end
- head = insert_node_before(head,current,glue_data)
+ head = insertnodebefore(head,current,glue_data)
elseif stretch ~= 0 or shrink ~= 0 then
if trace then
trace_done("flushed due to stretch/shrink in" .. why,glue_data)
end
- head = insert_node_before(head,current,glue_data)
+ head = insertnodebefore(head,current,glue_data)
else
-- report_vspacing("needs checking (%s): %p",gluecodes[getsubtype(glue_data)],w)
- flush_node(glue_data)
+ flushnode(glue_data)
end
end
end
@@ -1545,7 +1546,7 @@ do
if trace then
trace_done("flush",glue_data)
end
- head = insert_node_before(head,current,glue_data)
+ head = insertnodebefore(head,current,glue_data)
if trace then
trace_natural("natural",current)
end
@@ -1634,7 +1635,7 @@ do
trace_skip("force",sc,so,sp,current)
end
glue_order = so
- flush_node(glue_data)
+ flushnode(glue_data)
head, current, glue_data = remove_node(head,current)
elseif glue_order == so then
-- is now exclusive, maybe support goback as combi, else why a set
@@ -1645,7 +1646,7 @@ do
if trace then
trace_skip("largest",sc,so,sp,current)
end
- flush_node(glue_data)
+ flushnode(glue_data)
head, current, glue_data = remove_node(head,current)
else
if trace then
@@ -1657,7 +1658,7 @@ do
if trace then
trace_skip("goback",sc,so,sp,current)
end
- flush_node(glue_data)
+ flushnode(glue_data)
head, current, glue_data = remove_node(head,current)
elseif sc == force then
-- last one counts, some day we can provide an accumulator and largest etc
@@ -1665,13 +1666,13 @@ do
if trace then
trace_skip("force",sc,so,sp,current)
end
- flush_node(glue_data)
+ flushnode(glue_data)
head, current, glue_data = remove_node(head,current)
elseif sc == penalty then
if trace then
trace_skip("penalty",sc,so,sp,current)
end
- flush_node(glue_data)
+ flushnode(glue_data)
glue_data = nil
head, current = remove_node(head,current,true)
elseif sc == add then
@@ -1881,7 +1882,7 @@ do
end
if force_glue then
head, tail = forced_skip(head,tail,getwidth(glue_data),"after",trace)
- flush_node(glue_data)
+ flushnode(glue_data)
glue_data = nil
elseif tail then
setlink(tail,glue_data)
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index ae7b876b7..461037595 100644
Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index e5e48e356..cd95f9e07 100644
Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ
diff --git a/tex/context/base/mkiv/supp-box.lua b/tex/context/base/mkiv/supp-box.lua
index 4914b6818..4b9322ba7 100644
--- a/tex/context/base/mkiv/supp-box.lua
+++ b/tex/context/base/mkiv/supp-box.lua
@@ -7,8 +7,6 @@ if not modules then modules = { } end modules ['supp-box'] = {
license = "see context related readme files"
}
--- this is preliminary code, use insert_before etc
-
local report_hyphenation = logs.reporter("languages","hyphenation")
local tonumber, next, type = tonumber, next, type
@@ -69,15 +67,15 @@ local setshift = nuts.setshift
local setsplit = nuts.setsplit
local setattrlist = nuts.setattrlist
-local flush_node = nuts.flush_node
-local flush_list = nuts.flush_list
+local flushnode = nuts.flushnode
+local flushlist = nuts.flushlist
local copy_node = nuts.copy
-local copy_list = nuts.copy_list
+local copylist = nuts.copylist
local find_tail = nuts.tail
local getdimensions = nuts.dimensions
local hpack = nuts.hpack
local vpack = nuts.vpack
-local traverse_id = nuts.traverse_id
+local traverseid = nuts.traverseid
local traverse = nuts.traverse
local free = nuts.free
local findtail = nuts.tail
@@ -118,7 +116,7 @@ local function hyphenatedlist(head,usecolor)
setlistcolor(post,"darkyellow")
end
if replace then
- flush_list(replace)
+ flushlist(replace)
end
setdisc(current)
if pre then
@@ -152,9 +150,9 @@ implement {
-- for n in nextdisc, tonut(head) do
-- local hyphen = getfield(n,"pre")
-- if hyphen then
--- flush_list(hyphen)
+-- flushlist(hyphen)
-- end
--- setfield(n,"pre",copy_list(pre))
+-- setfield(n,"pre",copylist(pre))
-- end
-- end
--
@@ -200,7 +198,7 @@ local function applytowords(current,doaction,noaction,nested)
local id = getid(current)
if id == glue_code then
if start then
- doaction(tonode(copy_list(start,current)))
+ doaction(tonode(copylist(start,current)))
start = nil
end
noaction(tonode(copy_node(current)))
@@ -214,7 +212,7 @@ local function applytowords(current,doaction,noaction,nested)
current = getnext(current)
end
if start then
- doaction(tonode(copy_list(start)))
+ doaction(tonode(copylist(start)))
end
end
@@ -348,7 +346,7 @@ implement {
else
tail = prev
end
- flush_node(temp)
+ flushnode(temp)
end
-- done
setnext(tail)
@@ -430,7 +428,7 @@ local function setboxtonaturalwd(n)
local old = takebox(n)
local new = hpack(getlist(old))
setlist(old,nil)
- flush_node(old)
+ flushnode(old)
setbox(n,new)
end
@@ -482,20 +480,20 @@ end
do
- local nuts = nodes.nuts
- local tonode = nuts.tonode
- local takebox = nuts.takebox
- local flush_list = nuts.flush_list
- local copy_list = nuts.copy_list
- local getwhd = nuts.getwhd
- local setbox = nuts.setbox
- local new_hlist = nuts.pool.hlist
-
- local boxes = { }
- nodes.boxes = boxes
- local cache = table.setmetatableindex("table")
- local report = logs.reporter("boxes","cache")
- local trace = false
+ local nuts = nodes.nuts
+ local tonode = nuts.tonode
+ local takebox = nuts.takebox
+ local flushlist = nuts.flushlist
+ local copylist = nuts.copylist
+ local getwhd = nuts.getwhd
+ local setbox = nuts.setbox
+ local new_hlist = nuts.pool.hlist
+
+ local boxes = { }
+ nodes.boxes = boxes
+ local cache = table.setmetatableindex("table")
+ local report = logs.reporter("boxes","cache")
+ local trace = false
trackers.register("nodes.boxes",function(v) trace = v end)
@@ -528,7 +526,7 @@ do
if not b then
-- do nothing, maybe trace
elseif copy then
- b = copy_list(b)
+ b = copylist(b)
else
c[name] = false
end
@@ -545,13 +543,13 @@ do
local c = cache[category]
local b = takebox(box)
if b then
- flush_list(b)
+ flushlist(b)
end
local b = c[name]
if not b then
-- do nothing, maybe trace
elseif copy then
- b = copy_list(b)
+ b = copylist(b)
else
c[name] = false
end
@@ -577,7 +575,7 @@ do
if name and name ~= "" then
local b = c[name]
if b then
- flush_list(b)
+ flushlist(b)
c[name] = false
end
if trace then
@@ -586,7 +584,7 @@ do
else
for k, b in next, c do
if b then
- flush_list(b)
+ flushlist(b)
end
end
cache[category] = { }
@@ -697,7 +695,7 @@ local function stripglue(list)
if first and first ~= list then
-- we have discardables
setsplit(getprev(first),first)
- flush_list(list)
+ flushlist(list)
list = first
done = true
end
@@ -714,7 +712,7 @@ local function stripglue(list)
end
if last ~= tail then
-- we have discardables
- flush_list(getnext(last))
+ flushlist(getnext(last))
setnext(last)
done = true
end
@@ -767,7 +765,7 @@ local function limitate(t) -- don't pack the result !
else
maxleft = maxleft - swidth
end
- for n in traverse_id(glue_code,list) do
+ for n in traverseid(glue_code,list) do
local width = getdimensions(list,n)
if width > maxleft then
if not last then
@@ -779,7 +777,7 @@ local function limitate(t) -- don't pack the result !
end
end
if last and maxright > 0 then
- for n in traverse_id(glue_code,last) do
+ for n in traverseid(glue_code,last) do
local width = getdimensions(n)
if width < maxright then
first = n
@@ -808,7 +806,7 @@ local function limitate(t) -- don't pack the result !
end
setlink(last,sentinel)
setprev(rest)
- flush_list(rest)
+ flushlist(rest)
end
end
end
diff --git a/tex/context/base/mkiv/syst-lua.lua b/tex/context/base/mkiv/syst-lua.lua
index 085f75eca..1bd20214a 100644
--- a/tex/context/base/mkiv/syst-lua.lua
+++ b/tex/context/base/mkiv/syst-lua.lua
@@ -17,18 +17,15 @@ local xcomplex = xcomplex or { }
local cmd = tokens.commands
-local scan_next = token.scan_next or token.get_next
-local scan_cmdchr = token.scan_cmdchr_expanded
+local scannext = token.scan_next or token.get_next
-local get_command = token.get_command
-local get_mode = token.get_mode
-local get_index = token.get_index
-local get_csname = token.get_csname
-local get_macro = token.get_macro
-
-local put_next = token.put_next
-
-local scan_token = token.scan_token or token.get_token
+local getcommand = token.get_command
+local getmode = token.get_mode
+local getindex = token.get_index
+local getcsname = token.get_csname
+local getmacro = token.get_macro
+local putnext = token.put_next
+local scantoken = token.scan_token or token.get_token
local getdimen = tex.getdimen
local getglue = tex.getglue
@@ -209,12 +206,12 @@ do
local w = 0
local r = 1
while true do
- local t = scan_next()
- local n = get_command(t)
+ local t = scannext()
+ local n = getcommand(t)
local c = cmd[n]
-- todo, helper: returns number
if c == "letter" then
- w = w + 1 ; word[w] = utfchar(get_mode(t))
+ w = w + 1 ; word[w] = utfchar(getmode(t))
else
if w > 0 then
local s = concat(word,"",1,w)
@@ -233,23 +230,23 @@ do
w = 0
end
if c == "other_char" then
- r = r + 1 ; result[r] = utfchar(get_mode(t))
+ r = r + 1 ; result[r] = utfchar(getmode(t))
elseif c == "spacer" then
-- r = r + 1 ; result[r] = " "
elseif c == "relax" then
break
elseif c == "assign_int" then
- r = r + 1 ; result[r] = getcount(get_index(t))
+ r = r + 1 ; result[r] = getcount(getindex(t))
elseif c == "assign_dimen" then
- r = r + 1 ; result[r] = getdimen(get_index(t))
+ r = r + 1 ; result[r] = getdimen(getindex(t))
elseif c == "assign_glue" then
- r = r + 1 ; result[r] = getglue(get_index(t))
+ r = r + 1 ; result[r] = getglue(getindex(t))
elseif c == "assign_toks" then
- r = r + 1 ; result[r] = gettoks(get_index(t))
+ r = r + 1 ; result[r] = gettoks(getindex(t))
elseif c == "char_given" or c == "math_given" or c == "xmath_given" then
- r = r + 1 ; result[r] = get_mode(t)
+ r = r + 1 ; result[r] = getmode(t)
elseif c == "last_item" then
- local n = get_csname(t)
+ local n = getcsname(t)
if n then
local s = gettex(n)
if s then
@@ -261,9 +258,9 @@ do
unexpected(c)
end
elseif c == "call" then
- local n = get_csname(t)
+ local n = getcsname(t)
if n then
- local s = get_macro(n)
+ local s = getmacro(n)
if s then
r = r + 1 ; result[r] = s
else
@@ -273,8 +270,8 @@ do
unexpected(c)
end
elseif c == "the" or c == "convert" or c == "lua_expandable_call" then
- put_next(t)
- scan_token() -- expands
+ putnext(t)
+ scantoken() -- expands
else
unexpected(c)
end
diff --git a/tex/context/base/mkiv/tabl-xtb.lua b/tex/context/base/mkiv/tabl-xtb.lua
index c9dd1e4e5..32770141b 100644
--- a/tex/context/base/mkiv/tabl-xtb.lua
+++ b/tex/context/base/mkiv/tabl-xtb.lua
@@ -73,9 +73,9 @@ local setlink = nuts.setlink
local setdirection = nuts.setdirection
local setshift = nuts.setshift
-local copy_node_list = nuts.copy_list
-local hpack_node_list = nuts.hpack
-local flush_node_list = nuts.flush_list
+local copynodelist = nuts.copylist
+local hpacknodelist = nuts.hpack
+local flushnodelist = nuts.flushlist
local takebox = nuts.takebox
local nodepool = nuts.pool
@@ -273,7 +273,7 @@ function xtables.set_reflow_width()
local tb = getbox("b_tabl_x")
local drc = row[c]
--
- drc.list = true -- we don't need to keep the content around as we're in trial mode (no: copy_node_list(tb))
+ drc.list = true -- we don't need to keep the content around as we're in trial mode (no: copynodelist(tb))
--
local width, height, depth = getwhd(tb)
--
@@ -561,7 +561,7 @@ function xtables.reflow_width()
for c=1,nofcolumns do
local drc = row[c]
if drc.list then
- -- flush_node_list(drc.list)
+ -- flushnodelist(drc.list)
drc.list = false
end
end
@@ -853,7 +853,7 @@ function xtables.construct()
if list then
local w, h, d = getwhd(list)
setshift(list,h+d)
- -- list = hpack_node_list(list) -- is somehow needed
+ -- list = hpacknodelist(list) -- is somehow needed
-- setwhd(list,0,0,0)
-- faster:
local h = new_hlist(list)
@@ -900,9 +900,9 @@ function xtables.construct()
end
nofr = nofr + 1
local rp = rowproperties[r]
- -- we have a direction issue here but hpack_node_list(list,0,"exactly") cannot be used
+ -- we have a direction issue here but hpacknodelist(list,0,"exactly") cannot be used
-- due to the fact that we need the width
- local hbox = hpack_node_list(list)
+ local hbox = hpacknodelist(list)
setdirection(hbox,lefttoright_code)
result[nofr] = {
hbox,
@@ -949,7 +949,7 @@ end
local function inject(row,copy,package)
local list = row[1]
if copy then
- row[1] = copy_node_list(list)
+ row[1] = copynodelist(list)
end
if package then
ctx_beginvbox()
@@ -1186,7 +1186,7 @@ end
function xtables.cleanup()
for mode, result in next, data.results do
for _, r in next, result do
- flush_node_list(r[1])
+ flushnodelist(r[1])
end
end
diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua
index 4e94648e3..3697a4086 100644
--- a/tex/context/base/mkiv/task-ini.lua
+++ b/tex/context/base/mkiv/task-ini.lua
@@ -115,7 +115,7 @@ appendaction("math", "normalizers", "noads.handlers.italics",
appendaction("math", "normalizers", "noads.handlers.kernpairs", nil, "nonut", "disabled" )
appendaction("math", "normalizers", "noads.handlers.classes", nil, "nonut", "disabled" )
-appendaction("math", "builders", "builders.kernel.mlist_to_hlist", nil, "nut", "enabled" ) -- mandate
+appendaction("math", "builders", "builders.kernel.mlisttohlist", nil, "nut", "enabled" ) -- mandate
appendaction("math", "builders", "typesetters.directions.processmath", nil, "nut", "disabled" )
appendaction("math", "builders", "noads.handlers.makeup", nil, "nonut", "disabled" )
appendaction("math", "builders", "noads.handlers.align", nil, "nonut", "enabled" )
diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua
index 7120b47c3..96bf7d7b9 100644
--- a/tex/context/base/mkiv/toks-ini.lua
+++ b/tex/context/base/mkiv/toks-ini.lua
@@ -22,49 +22,49 @@ local commands = token.commands()
tokens.commands = utilities.storage.allocate(table.swapped(commands,commands))
tokens.values = { }
-local scan_toks = token.scan_toks
-local scan_string = token.scan_string
-local scan_argument = token.scan_argument
-local scan_delimited = token.scan_delimited
-local scan_tokenlist = token.scan_tokenlist or scan_string
-local scan_integer = token.scan_integer or token.scan_int
-local scan_cardinal = token.scan_cardinal
-local scan_code = token.scan_code
-local scan_token_code = token.scan_token_code
-local scan_dimen = token.scan_dimen
-local scan_glue = token.scan_glue
-local scan_skip = token.scan_skip
-local scan_keyword = token.scan_keyword
-local scan_keyword_cs = token.scan_keyword_cs or scan_keyword
-local scan_token = token.scan_token
-local scan_box = token.scan_box
-local scan_word = token.scan_word
-local scan_letters = token.scan_letters or scan_word -- lmtx
-local scan_key = token.scan_key
-local scan_value = token.scan_value
-local scan_char = token.scan_char
-local scan_number = token.scan_number -- not defined
-local scan_csname = token.scan_csname
-local scan_real = token.scan_real
-local scan_float = token.scan_float
-local scan_luanumber = token.scan_luanumber or scan_float -- only lmtx
-local scan_luainteger = token.scan_luainteger or scan_integer -- only lmtx
-local scan_luacardinal = token.scan_luacardinal or scan_cardinal -- only lmtx
-
-local set_macro = token.set_macro
-local set_char = token.set_char
-local set_lua = token.set_lua
-
-local create_token = token.create
-local new_token = token.new
-local is_defined = token.is_defined
-local is_token = token.is_token
-
-tokens.new = new_token
-tokens.create = create_token
-tokens.istoken = is_token
-tokens.isdefined = is_defined
-tokens.defined = is_defined
+local scantoks = token.scan_toks
+local scanstring = token.scan_string
+local scanargument = token.scan_argument
+local scandelimited = token.scan_delimited
+local scantokenlist = token.scan_tokenlist or scanstring
+local scaninteger = token.scan_integer or token.scan_int
+local scancardinal = token.scan_cardinal
+local scancode = token.scan_code
+local scantokencode = token.scan_token_code
+local scandimen = token.scan_dimen
+local scanglue = token.scan_glue
+local scanskip = token.scan_skip
+local scankeyword = token.scan_keyword
+local scankeywordcs = token.scan_keyword_cs or scankeyword
+local scantoken = token.scan_token
+local scanbox = token.scan_box
+local scanword = token.scan_word
+local scanletters = token.scan_letters or scanword -- lmtx
+local scankey = token.scan_key
+local scanvalue = token.scan_value
+local scanchar = token.scan_char
+local scannumber = token.scan_number -- not defined
+local scancsname = token.scan_csname
+local scanreal = token.scan_real
+local scanfloat = token.scan_float
+local scanluanumber = token.scan_luanumber or scanfloat -- only lmtx
+local scanluainteger = token.scan_luainteger or scaninteger -- only lmtx
+local scanluacardinal = token.scan_luacardinal or scancardinal -- only lmtx
+
+local setmacro = token.set_macro
+local setchar = token.set_char
+local setlua = token.set_lua
+
+local createtoken = token.create
+local newtoken = token.new
+local isdefined = token.is_defined
+local istoken = token.is_token
+
+tokens.new = newtoken
+tokens.create = createtoken
+tokens.istoken = istoken
+tokens.isdefined = isdefined
+tokens.defined = isdefined
local bits = {
escape = 0x00000001, -- 2^00
@@ -98,10 +98,10 @@ tokens.bits = bits
-- words are space or \relax terminated and the trailing space is gobbled; a word
-- can contain any non-space letter/other (see archive for implementation in lua)
-if not scan_number then
+if not scannumber then
- scan_number = function(base)
- local s = scan_word()
+ scannumber = function(base)
+ local s = scanword()
if not s then
return nil
elseif base then
@@ -113,8 +113,8 @@ if not scan_number then
end
-local function scan_boolean()
- local kw = scan_word()
+local function scanboolean()
+ local kw = scanword()
if kw == "true" then
return true
elseif kw == "false" then
@@ -124,64 +124,64 @@ local function scan_boolean()
end
end
-local function scan_verbatim()
- return scan_argument(false)
+local function scanverbatim()
+ return scanargument(false)
end
-if not scan_box then
+if not scanbox then
- local scan_list = token.scan_list
- local put_next = token.put_next
+ local scanlist = token.scan_list
+ local putnext = token.put_next
- scan_box = function(s)
+ scanbox = function(s)
if s == "hbox" or s == "vbox" or s == "vtop" then
- put_next(create_token(s))
+ putnext(createtoken(s))
end
- return scan_list()
+ return scanlist()
end
- token.scan_box = scan_box
+ token.scanbox = scanbox
end
tokens.scanners = { -- these expand
- token = scan_token,
- toks = scan_toks,
- tokens = scan_toks,
- box = scan_box,
- hbox = function() return scan_box("hbox") end,
- vbox = function() return scan_box("vbox") end,
- vtop = function() return scan_box("vtop") end,
- dimen = scan_dimen,
- dimension = scan_dimen,
- glue = scan_glue,
- gluevalues = function() return scan_glue(false,false,true) end,
- gluespec = scan_skip,
- integer = scan_integer,
- cardinal = scan_cardinal,
- real = scan_real,
- float = scan_float,
- luanumber = scan_luanumber,
- luainteger = scan_luainteger,
- luacardinal = scan_luacardinal,
- count = scan_integer,
- string = scan_string,
- argument = scan_argument,
- delimited = scan_delimited,
- tokenlist = scan_tokenlist,
- verbatim = scan_verbatim, -- detokenize
- code = scan_code,
- tokencode = scan_token_code,
- word = scan_word,
- letters = scan_letters,
- key = scan_key,
- value = scan_value,
- char = scan_char,
- number = scan_number,
- boolean = scan_boolean,
- keyword = scan_keyword,
- keywordcs = scan_keyword_cs,
- csname = scan_csname,
+ token = scantoken,
+ toks = scantoks,
+ tokens = scantoks,
+ box = scanbox,
+ hbox = function() return scanbox("hbox") end,
+ vbox = function() return scanbox("vbox") end,
+ vtop = function() return scanbox("vtop") end,
+ dimen = scandimen,
+ dimension = scandimen,
+ glue = scanglue,
+ gluevalues = function() return scanglue(false,false,true) end,
+ gluespec = scanskip,
+ integer = scaninteger,
+ cardinal = scancardinal,
+ real = scanreal,
+ float = scanfloat,
+ luanumber = scanluanumber,
+ luainteger = scanluainteger,
+ luacardinal = scanluacardinal,
+ count = scaninteger,
+ string = scanstring,
+ argument = scanargument,
+ delimited = scandelimited,
+ tokenlist = scantokenlist,
+ verbatim = scanverbatim, -- detokenize
+ code = scancode,
+ tokencode = scantokencode,
+ word = scanword,
+ letters = scanletters,
+ key = scankey,
+ value = scanvalue,
+ char = scanchar,
+ number = scannumber,
+ boolean = scanboolean,
+ keyword = scankeyword,
+ keywordcs = scankeywordcs,
+ csname = scancsname,
next = token.scan_next,
nextexpanded = token.scan_next_expanded,
@@ -214,9 +214,9 @@ tokens.getters = { -- these don't expand
}
tokens.setters = {
- macro = set_macro,
- char = set_char,
- lua = set_lua,
+ macro = setmacro,
+ char = setchar,
+ lua = setlua,
count = tex.setcount,
dimen = tex.setdimen,
skip = tex.setglue,
@@ -226,7 +226,7 @@ tokens.setters = {
box = tex.setbox,
}
-token.accessors = {
+tokens.accessors = {
command = token.get_command,
cmd = token.get_command,
cmdname = token.get_cmdname,
@@ -243,33 +243,12 @@ token.accessors = {
range = token.get_range,
}
--- static int run_scan_token(lua_State * L)
--- {
--- saved_tex_scanner texstate;
--- save_tex_scanner(texstate);
--- get_x_token();
--- make_new_token(L, cur_cmd, cur_chr, cur_cs);
--- unsave_tex_scanner(texstate);
--- return 1;
--- }
---
--- static int run_get_future(lua_State * L)
--- {
--- /* saved_tex_scanner texstate; */
--- /* save_tex_scanner(texstate); */
--- get_token();
--- make_new_token(L, cur_cmd, cur_chr, cur_cs);
--- back_input();
--- /* unsave_tex_scanner(texstate); */
--- return 1;
--- }
-
if setinspector then
local simple = { letter = "letter", other_char = "other" }
local astable = function(t)
- if t and is_token(t) then
+ if t and istoken(t) then
local cmdname = t.cmdname
local simple = simple[cmdname]
if simple then
@@ -304,10 +283,10 @@ if setinspector then
end
tokens.cache = table.setmetatableindex(function(t,k)
- if not is_defined(k) then
- set_macro(k,"","global")
+ if not isdefined(k) then
+ setmacro(k,"","global")
end
- local v = create_token(k)
+ local v = createtoken(k)
t[k] = v
return v
end)
diff --git a/tex/context/base/mkiv/trac-jus.lua b/tex/context/base/mkiv/trac-jus.lua
index aec1844ec..5f53b4c99 100644
--- a/tex/context/base/mkiv/trac-jus.lua
+++ b/tex/context/base/mkiv/trac-jus.lua
@@ -28,7 +28,7 @@ local findtail = nuts.tail
local nexthlist = nuts.traversers.hlist
local getdimensions = nuts.dimensions
-local copy_list = nuts.copy_list
+local copylist = nuts.copylist
local tracedrule = nodes.tracers.pool.nuts.rule
@@ -100,7 +100,7 @@ function checkers.handler(head)
setlist(current,rule)
elseif alignstate == 2 then
local lrule = new_hlist(tracedrule(-delta/2,naturalheight,naturaldepth,"trace:dy"))
- local rrule = copy_list(lrule)
+ local rrule = copylist(lrule)
setlink(lrule,list)
setlink(findtail(list),new_kern(delta/2),rrule)
setlist(current,lrule)
diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua
index fb5ef98d9..3bfbd1c76 100644
--- a/tex/context/base/mkiv/trac-vis.lua
+++ b/tex/context/base/mkiv/trac-vis.lua
@@ -70,14 +70,14 @@ local isglyph = nuts.isglyph
local hpack_nodes = nuts.hpack
local vpack_nodes = nuts.vpack
-local copy_list = nuts.copy_list
-local copy_node = nuts.copy_node
-local flush_node_list = nuts.flush_list
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local copylist = nuts.copylist
+local copy_node = nuts.copy
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local apply_to_nodes = nuts.apply
local find_tail = nuts.tail
-local effectiveglue = nuts.effective_glue
+local effectiveglue = nuts.effectiveglue
+local flushnodelist = nuts.flushlist
local hpack_string = nuts.typesetters.tohpack
@@ -500,7 +500,7 @@ local fontkern, italickern, marginkern, mathlistkern do
setattr(info,a_layer,layer)
f_cache[kern] = info
end
- head = insert_node_before(head,current,copy_list(info))
+ head = insertnodebefore(head,current,copylist(info))
return head, current
end
@@ -548,7 +548,7 @@ local glyphexpansion do
setattr(info,a_layer,l_expansion)
f_cache[extra] = info
end
- head = insert_node_before(head,current,copy_list(info))
+ head = insertnodebefore(head,current,copylist(info))
return head, current
end
return head, current
@@ -584,7 +584,7 @@ local kernexpansion do
setattr(info,a_layer,l_expansion)
f_cache[extra] = info
end
- head = insert_node_before(head,current,copy_list(info))
+ head = insertnodebefore(head,current,copylist(info))
return head, current
end
return head, current
@@ -621,7 +621,7 @@ local whatsit do
setattr(info,a_layer,l_whatsit)
w_cache[what] = info
end
- head, current = insert_node_after(head,current,copy_list(info))
+ head, current = insertnodeafter(head,current,copylist(info))
return head, current
end
@@ -694,7 +694,7 @@ local user do
setattr(info,a_layer,l_user)
u_cache[what] = info
end
- head, current = insert_node_after(head,current,copy_list(info))
+ head, current = insertnodeafter(head,current,copylist(info))
return head, current
end
@@ -733,7 +733,7 @@ local math do
setattr(info,a_layer,l_math)
m_cache[tag][skip] = info
end
- head, current = insert_node_after(head,current,copy_list(info))
+ head, current = insertnodeafter(head,current,copylist(info))
return head, current
end
@@ -791,7 +791,7 @@ local ruledbox do
end
-- we need to trigger the right mode (else sometimes no whatits)
local info = setlink(
- this and copy_list(this) or nil,
+ this and copylist(this) or nil,
(dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth)) or userrule {
width = wd,
height = ht,
@@ -812,7 +812,7 @@ local ruledbox do
elseif trace_origin then
local size = 2*size
local origin = o_cache[size]
- origin = copy_list(origin)
+ origin = copylist(origin)
if getid(parent) == vlist_code then
setshift(origin,-shift)
info = setlink(current,new_kern(-size),origin,new_kern(-size-dp),info)
@@ -832,7 +832,7 @@ local ruledbox do
elseif trace_origin then
local size = 2*size
local origin = o_cache[size]
- origin = copy_list(origin)
+ origin = copylist(origin)
if getid(parent) == vlist_code then
info = setlink(current,new_kern(-wd-size-shift),origin,new_kern(-size+shift),info)
else
@@ -1012,11 +1012,11 @@ local ruledglue do
end
(vertical and g_cache_v or g_cache_h)[amount] = info
end
- info = copy_list(info)
+ info = copylist(info)
if vertical then
info = vpack_nodes(info)
end
- head, current = insert_node_before(head,current,info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1032,8 +1032,8 @@ local ruledglue do
-- info = sometext(amount,l_glue,c_space)
-- g_cache_h[amount] = info
-- end
- -- info = copy_list(info)
- -- head, current = insert_node_before(head,current,info)
+ -- info = copylist(info)
+ -- head, current = insertnodebefore(head,current,info)
-- return head, getnext(current)
-- else
-- return head, current
@@ -1061,8 +1061,8 @@ local ruledglue do
g_cache_x[width] = info
end
end
- info = copy_list(info)
- head, current = insert_node_before(head,current,info)
+ info = copylist(info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
else
return head, current
@@ -1091,11 +1091,11 @@ local ruledkern do
end
cache[kern] = info
end
- info = copy_list(info)
+ info = copylist(info)
if vertical then
info = vpack_nodes(info)
end
- head, current = insert_node_before(head,current,info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1119,8 +1119,8 @@ local ruleditalic do
end
i_cache[kern] = info
end
- info = copy_list(info)
- head, current = insert_node_before(head,current,info)
+ info = copylist(info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1144,8 +1144,8 @@ local ruledmarginkern do
end
m_cache[kern] = info
end
- info = copy_list(info)
- head, current = insert_node_before(head,current,info)
+ info = copylist(info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1169,8 +1169,8 @@ local ruledmathlistkern do
end
l_cache[kern] = info
end
- info = copy_list(info)
- head, current = insert_node_before(head,current,info)
+ info = copylist(info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1192,7 +1192,7 @@ local ruleddiscretionary do
d = new_hlist(kern)
d_cache[true] = d
end
- insert_node_after(head,current,copy_list(d))
+ insertnodeafter(head,current,copylist(d))
return head, current
end
@@ -1223,13 +1223,13 @@ local ruledpenalty do
end
(vertical and p_cache_v or p_cache_h)[penalty] = info
end
- info = copy_list(info)
+ info = copylist(info)
if vertical then
info = vpack_nodes(info)
elseif raisepenalties then
setshift(info,-65536*4)
end
- head, current = insert_node_before(head,current,info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1503,7 +1503,7 @@ do
local function cleanup()
for tag, cache in next, caches do
for k, v in next, cache do
- flush_node_list(v)
+ flushnodelist(v)
end
end
cleanup = function()
diff --git a/tex/context/base/mkiv/typo-bld.lua b/tex/context/base/mkiv/typo-bld.lua
index 305032772..36371aa10 100644
--- a/tex/context/base/mkiv/typo-bld.lua
+++ b/tex/context/base/mkiv/typo-bld.lua
@@ -46,7 +46,7 @@ local nodeidstostring = nodes.idstostring
local nodepool = nodes.pool
local new_baselineskip = nodepool.baselineskip
local new_lineskip = nodepool.lineskip
-local insert_node_before = nodes.insert_before
+local insertnodebefore = nodes.insertbefore
local hpack_node = nodes.hpack
local nuts = nodes.nuts
@@ -157,9 +157,9 @@ function parbuilders.constructors.methods.oneline(head,followed_by_display)
t.prevdepth = h.depth
t.prevgraf = 1
if d < texget("lineskiplimit") then
- return insert_node_before(h,h,new_lineskip(texget("lineskip",false))) -- no stretch etc
+ return insertnodebefore(h,h,new_lineskip(texget("lineskip",false))) -- no stretch etc
else
- return insert_node_before(h,h,new_baselineskip(d))
+ return insertnodebefore(h,h,new_baselineskip(d))
end
end
diff --git a/tex/context/base/mkiv/typo-brk.lua b/tex/context/base/mkiv/typo-brk.lua
index 89eb7e52d..68d9f2f54 100644
--- a/tex/context/base/mkiv/typo-brk.lua
+++ b/tex/context/base/mkiv/typo-brk.lua
@@ -46,13 +46,13 @@ local setprev = nuts.setprev
local setboth = nuts.setboth
local setsubtype = nuts.setsubtype
-local copy_node = nuts.copy_node
-local copy_node_list = nuts.copy_list
-local flush_node = nuts.flush_node
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local copy_node = nuts.copy
+local copy_node_list = nuts.copylist
+local flushnode = nuts.flushnode
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
-local end_of_math = nuts.end_of_math
+local endofmath = nuts.endofmath
local tonodes = nuts.tonodes
@@ -116,15 +116,15 @@ local function insert_break(head,start,stop,before,after,kern)
local g = new_glue()
setattrlist(p,start)
setattrlist(g,start)
- insert_node_before(head,start,p)
- insert_node_before(head,start,g)
+ insertnodebefore(head,start,p)
+ insertnodebefore(head,start,g)
end
local p = new_penalty(after)
local g = new_glue()
setattrlist(p,start)
setattrlist(g,start)
- insert_node_after(head,stop,g)
- insert_node_after(head,stop,p)
+ insertnodeafter(head,stop,g)
+ insertnodeafter(head,stop,p)
end
methods[1] = function(head,start,stop,settings,kern)
@@ -170,7 +170,7 @@ methods[2] = function(head,start) -- ( => (-
local hyphen = copy_node(post)
setchar(hyphen,languages.prehyphenchar(getlanguage(post)))
setlink(post,hyphen)
- head, start = insert_node_before(head,start,new_disc(nil,post,replace))
+ head, start = insertnodebefore(head,start,new_disc(nil,post,replace))
setattrlist(start,replace)
insert_break(head,start,start,10000,10000)
end
@@ -186,7 +186,7 @@ methods[3] = function(head,start) -- ) => -)
local hyphen = copy_node(pre)
setchar(hyphen,languages.prehyphenchar(getlanguage(pre)))
setlink(hyphen,pre)
- head, start = insert_node_before(head,start,new_disc(hyphen,nil,replace)) -- so not pre !
+ head, start = insertnodebefore(head,start,new_disc(hyphen,nil,replace)) -- so not pre !
setattrlist(start,tmp)
insert_break(head,start,start,10000,10000)
end
@@ -198,7 +198,7 @@ methods[4] = function(head,start) -- - => - - -
if p and n then
local tmp
head, start, tmp = remove_node(head,start)
- head, start = insert_node_before(head,start,new_disc())
+ head, start = insertnodebefore(head,start,new_disc())
setattrlist(start,tmp)
setdisc(start,copy_node(tmp),copy_node(tmp),tmp)
insert_break(head,start,start,10000,10000)
@@ -211,7 +211,7 @@ methods[5] = function(head,start,stop,settings) -- x => p q r
if p and n then
local tmp
head, start, tmp = remove_node(head,start)
- head, start = insert_node_before(head,start,new_disc())
+ head, start = insertnodebefore(head,start,new_disc())
local attr = getattrlist(tmp)
local font = getfont(tmp)
local left = settings.left
@@ -228,7 +228,7 @@ methods[5] = function(head,start,stop,settings) -- x => p q r
end
setdisc(start,left,right,middle)
setattrlist(start,attr)
- flush_node(tmp)
+ flushnode(tmp)
insert_break(head,start,start,10000,10000)
end
return head, start
@@ -302,7 +302,7 @@ function breakpoints.handler(head)
end
elseif id == math_code then
attr = nil
- current = end_of_math(current)
+ current = endofmath(current)
if current then
current = getnext(current)
end
diff --git a/tex/context/base/mkiv/typo-cap.lua b/tex/context/base/mkiv/typo-cap.lua
index 3d0d6055a..b6338ce40 100644
--- a/tex/context/base/mkiv/typo-cap.lua
+++ b/tex/context/base/mkiv/typo-cap.lua
@@ -36,9 +36,9 @@ local setchar = nuts.setchar
local setfont = nuts.setfont
local copy_node = nuts.copy
-local end_of_math = nuts.end_of_math
-local insert_after = nuts.insert_after
-local find_attribute = nuts.find_attribute
+local endofmath = nuts.endofmath
+local insertafter = nuts.insertafter
+local findattribute = nuts.findattribute
local nextglyph = nuts.traversers.glyph
@@ -132,7 +132,7 @@ local function replacer(start,codes)
else
local g = copy_node(start)
setchar(g,chr)
- insert_after(start,start,g)
+ insertafter(start,start,g)
end
end
elseif ifc[dc] then
@@ -237,7 +237,7 @@ local function mixed(start,attr,lastfont,n,count,where,first)
if fp ~= fc then
local k = fonts.getkern(fontdata[fp],getchar(p),c)
if k ~= 0 then
- insert_after(p,p,newkern(k))
+ insertafter(p,p,newkern(k))
end
end
else
@@ -410,7 +410,7 @@ function cases.handler(head) -- not real fast but also not used on much data
count = count + 1
end
elseif id == math_code then
- start = end_of_math(start)
+ start = endofmath(start)
count = 0
elseif prev_id == kern_code and getsubtype(prev) == fontkern_code then
-- still inside a word ...normally kerns are added later
@@ -427,7 +427,7 @@ function cases.handler(head) -- not real fast but also not used on much data
end
-- function cases.handler(head) -- not real fast but also not used on much data
--- local attr, start = find_attribute(head,a_cases)
+-- local attr, start = findattribute(head,a_cases)
-- if not start then
-- return head, false
-- end
@@ -520,7 +520,7 @@ end
-- count = count + 1
-- end
-- elseif id == math_code then
--- start = end_of_math(start)
+-- start = endofmath(start)
-- count = 0
-- elseif prev_id == kern_code and getsubtype(prev) == fontkern_code then
-- -- still inside a word ...normally kerns are added later
@@ -536,7 +536,7 @@ end
-- end
-- end
-- if start then
--- attr, start = find_attribute(start,a_cases)
+-- attr, start = findattribute(start,a_cases)
-- end
-- end
-- return head
diff --git a/tex/context/base/mkiv/typo-chr.lua b/tex/context/base/mkiv/typo-chr.lua
index bb3883b33..c9ba0c7b9 100644
--- a/tex/context/base/mkiv/typo-chr.lua
+++ b/tex/context/base/mkiv/typo-chr.lua
@@ -99,8 +99,8 @@ local wordboundary_code = boundarycodes.word
local texgetnest = tex.getnest -- to be used
local texsetcount = tex.setcount
-local flush_node = nodes.flush_node
-local flush_list = nodes.flush_list
+local flushnode = nodes.flushnode
+local flushlist = nodes.flushlist
local settexattribute = tex.setattribute
local punctuation = characters.is_punctuation
@@ -140,7 +140,7 @@ local actions = {
remove = function(specification)
local n = pickup()
if n then
- flush_node(n)
+ flushnode(n)
end
end,
push = function(specification)
@@ -175,7 +175,7 @@ local function pickup(head,tail,str)
while true do
local prev = first.prev
if prev and prev[a_marked] == attr then
- if prev.id == par_code then -- and start_of_par(prev)
+ if prev.id == par_code then -- and startofpar(prev)
break
else
first = prev
@@ -212,7 +212,7 @@ local actions = {
list.tail = prev
prev.next = nil
end
- flush_list(first)
+ flushlist(first)
end
end
end,
diff --git a/tex/context/base/mkiv/typo-dha.lua b/tex/context/base/mkiv/typo-dha.lua
index ac72ae394..176ed7867 100644
--- a/tex/context/base/mkiv/typo-dha.lua
+++ b/tex/context/base/mkiv/typo-dha.lua
@@ -62,11 +62,12 @@ local setprop = nuts.setprop
local setstate = nuts.setstate
local setchar = nuts.setchar
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
-local end_of_math = nuts.end_of_math
-local start_of_par = nuts.start_of_par
+local endofmath = nuts.endofmath
+
+local startofpar = nuts.startofpar
local nodepool = nuts.pool
@@ -160,7 +161,7 @@ local function process(start)
local id = getid(current)
local next = getnext(current)
if id == math_code then
- current = getnext(end_of_math(next))
+ current = getnext(endofmath(next))
elseif getprop(current,"direction") then
-- this handles unhbox etc
current = next
@@ -332,7 +333,7 @@ local function process(start)
end
textdir = autodir
setprop(current,"direction",true)
- elseif id == par_code and start_of_par(current) then
+ elseif id == par_code and startofpar(current) then
local direction = getdirection(current)
if direction == righttoleft_code then
autodir = -1
@@ -376,13 +377,13 @@ local function process(start)
local id = getid(current)
if id == math_code then
-- todo: this might be tricky nesting
- current = getnext(end_of_math(getnext(current)))
+ current = getnext(endofmath(getnext(current)))
else
local cp = getprop(current,"direction")
if cp == "n" then
local swap = state == "r"
if swap then
- head = insert_node_before(head,current,startdir(lefttoright_code))
+ head = insertnodebefore(head,current,startdir(lefttoright_code))
end
setprop(current,"direction",true)
while true do
@@ -395,14 +396,14 @@ local function process(start)
end
end
if swap then
- head, current = insert_node_after(head,current,stopdir(lefttoright_code))
+ head, current = insertnodeafter(head,current,stopdir(lefttoright_code))
end
elseif cp == "l" then
if state ~= "l" then
if state == "r" then
- head = insert_node_before(head,last or current,stopdir(righttoleft_code))
+ head = insertnodebefore(head,last or current,stopdir(righttoleft_code))
end
- head = insert_node_before(head,current,startdir(lefttoright_code))
+ head = insertnodebefore(head,current,startdir(lefttoright_code))
state = "l"
done = true
end
@@ -410,9 +411,9 @@ local function process(start)
elseif cp == "r" then
if state ~= "r" then
if state == "l" then
- head = insert_node_before(head,last or current,stopdir(lefttoright_code))
+ head = insertnodebefore(head,last or current,stopdir(lefttoright_code))
end
- head = insert_node_before(head,current,startdir(righttoleft_code))
+ head = insertnodebefore(head,current,startdir(righttoleft_code))
state = "r"
done = true
end
@@ -425,9 +426,9 @@ local function process(start)
end
else
if state == "r" then
- head = insert_node_before(head,current,stopdir(righttoleft_code))
+ head = insertnodebefore(head,current,stopdir(righttoleft_code))
elseif state == "l" then
- head = insert_node_before(head,current,stopdir(lefttoright_code))
+ head = insertnodebefore(head,current,stopdir(lefttoright_code))
end
state = false
last = false
@@ -441,9 +442,9 @@ local function process(start)
local sd = (state == "r" and stopdir(righttoleft_code)) or (state == "l" and stopdir(lefttoright_code))
if sd then
if id == glue_code and getsubtype(current) == parfillskip_code then
- head = insert_node_before(head,current,sd)
+ head = insertnodebefore(head,current,sd)
else
- head = insert_node_after(head,current,sd)
+ head = insertnodeafter(head,current,sd)
end
end
break
diff --git a/tex/context/base/mkiv/typo-dig.lua b/tex/context/base/mkiv/typo-dig.lua
index a9294a38d..bbc9311c4 100644
--- a/tex/context/base/mkiv/typo-dig.lua
+++ b/tex/context/base/mkiv/typo-dig.lua
@@ -33,10 +33,9 @@ local setlink = nuts.setlink
local setnext = nuts.setnext
local setprev = nuts.setprev
-local hpack_node = nuts.hpack
-local traverse_id = nuts.traverse_id
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local hpacknode = nuts.hpack
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local texsetattribute = tex.setattribute
local unsetvalue = attributes.unsetvalue
@@ -73,16 +72,16 @@ local a_digits = attributes.private("digits")
function nodes.aligned(head,start,stop,width,how)
if how == "flushright" or how == "middle" then
- head, start = insert_node_before(head,start,new_glue(0,65536,65536))
+ head, start = insertnodebefore(head,start,new_glue(0,65536,65536))
end
if how == "flushleft" or how == "middle" then
- head, stop = insert_node_after(head,stop,new_glue(0,65536,65536))
+ head, stop = insertnodeafter(head,stop,new_glue(0,65536,65536))
end
local prv = getprev(start)
local nxt = getnext(stop)
setprev(start)
setnext(stop)
- local packed = hpack_node(start,width,"exactly") -- no directional mess here, just lr
+ local packed = hpacknode(start,width,"exactly") -- no directional mess here, just lr
if prv then
setlink(prv,packed)
end
diff --git a/tex/context/base/mkiv/typo-drp.lua b/tex/context/base/mkiv/typo-drp.lua
index ddc6d68ae..d56ba3da7 100644
--- a/tex/context/base/mkiv/typo-drp.lua
+++ b/tex/context/base/mkiv/typo-drp.lua
@@ -59,10 +59,11 @@ local nodecodes = nodes.nodecodes
local nodepool = nuts.pool
local new_kern = nodepool.kern
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local remove_node = nuts.remove
-local start_of_par = nuts.start_of_par
+
+local startofpar = nuts.startofpar
local nextnode = nuts.traversers.node
local nextglyph = nuts.traversers.glyph
@@ -325,7 +326,7 @@ actions[v_default] = function(head,setting)
texset("hangindent",hangindent)
end
if indent then
- insert_after(first,first,new_kern(-parindent))
+ insertafter(first,first,new_kern(-parindent))
end
end
return head
@@ -334,7 +335,7 @@ end
-- we can count ... when all done, we can disable ...
function initials.handler(head)
- if getid(head) == par_code and start_of_par(head) then
+ if getid(head) == par_code and startofpar(head) then
local settings = getprop(head,a_initial)
if settings then
disableaction("processors","typesetters.initials.handler")
diff --git a/tex/context/base/mkiv/typo-dua.lua b/tex/context/base/mkiv/typo-dua.lua
index 5e1d4c109..dd7515a37 100644
--- a/tex/context/base/mkiv/typo-dua.lua
+++ b/tex/context/base/mkiv/typo-dua.lua
@@ -83,9 +83,10 @@ local setdirection = nuts.setdirection
----- setattrlist = nuts.setattrlist
local remove_node = nuts.remove
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
-local start_of_par = nuts.start_of_par
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
+
+local startofpar = nuts.startofpar
local nodepool = nuts.pool
local new_direction = nodepool.direction
@@ -337,7 +338,7 @@ local function get_baselevel(head,list,size,direction)
-- This is an adapted version:
if direction == lefttoright_code or direction == righttoleft_code then
return direction, true
- elseif getid(head) == par_code and start_of_par(head) then
+ elseif getid(head) == par_code and startofpar(head) then
direction = getdirection(head)
if direction == lefttoright_code or direction == righttoleft_code then
return direction, true
@@ -765,16 +766,16 @@ local function apply_to_list(list,size,head,pardir)
local d = new_direction(enddir,true)
-- setprop(d,"directions",true)
-- setattrlist(d,current)
- head = insert_node_before(head,current,d)
+ head = insertnodebefore(head,current,d)
enddir = false
end
elseif begindir then
- if id == par_code and start_of_par(current) then
+ if id == par_code and startofpar(current) then
-- par should always be the 1st node
local d = new_direction(begindir)
-- setprop(d,"directions",true)
-- setattrlist(d,current)
- head, current = insert_node_after(head,current,d)
+ head, current = insertnodeafter(head,current,d)
begindir = nil
end
end
@@ -782,7 +783,7 @@ local function apply_to_list(list,size,head,pardir)
local d = new_direction(begindir)
-- setprop(d,"directions",true)
-- setattrlist(d,current)
- head = insert_node_before(head,current,d)
+ head = insertnodebefore(head,current,d)
end
local skip = entry.skip
if skip and skip > 0 then
@@ -795,7 +796,7 @@ local function apply_to_list(list,size,head,pardir)
local d = new_direction(enddir,true)
-- setprop(d,"directions",true)
-- setattrlist(d,current)
- head, current = insert_node_after(head,current,d)
+ head, current = insertnodeafter(head,current,d)
end
if not entry.remove then
current = getnext(current)
diff --git a/tex/context/base/mkiv/typo-dub.lua b/tex/context/base/mkiv/typo-dub.lua
index 88b3361da..dc45a2785 100644
--- a/tex/context/base/mkiv/typo-dub.lua
+++ b/tex/context/base/mkiv/typo-dub.lua
@@ -71,9 +71,10 @@ local setdirection = nuts.setdirection
local setattrlist = nuts.setattrlist
local remove_node = nuts.remove
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
-local start_of_par = nuts.start_of_par
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
+
+local startofpar = nuts.startofpar
local nodepool = nuts.pool
local new_direction = nodepool.direction
@@ -398,7 +399,7 @@ end
local function get_baselevel(head,list,size,direction)
if direction == lefttoright_code or direction == righttoleft_code then
return direction, true
- elseif getid(head) == par_code and start_of_par(head) then
+ elseif getid(head) == par_code and startofpar(head) then
direction = getdirection(head)
if direction == lefttoright_code or direction == righttoleft_code then
return direction, true
@@ -898,16 +899,16 @@ local function apply_to_list(list,size,head,pardir)
local d = new_direction(enddir,true)
-- setprop(d,"directions",true)
-- setattrlist(d,current)
- head = insert_node_before(head,current,d)
+ head = insertnodebefore(head,current,d)
enddir = false
end
elseif begindir then
- if id == par_code and start_of_par(current) then
+ if id == par_code and startofpar(current) then
-- par should always be the 1st node
local d = new_direction(begindir)
-- setprop(d,"directions",true)
-- setattrlist(d,current)
- head, current = insert_node_after(head,current,d)
+ head, current = insertnodeafter(head,current,d)
begindir = nil
end
end
@@ -915,7 +916,7 @@ local function apply_to_list(list,size,head,pardir)
local d = new_direction(begindir)
-- setprop(d,"directions",true)
-- setattrlist(d,current)
- head = insert_node_before(head,current,d)
+ head = insertnodebefore(head,current,d)
end
local skip = entry.skip
if skip and skip > 0 then
@@ -928,7 +929,7 @@ local function apply_to_list(list,size,head,pardir)
local d = new_direction(enddir,true)
-- setprop(d,"directions",true)
-- setattrlist(d,current)
- head, current = insert_node_after(head,current,d)
+ head, current = insertnodeafter(head,current,d)
end
if not entry.remove then
current = getnext(current)
diff --git a/tex/context/base/mkiv/typo-duc.lua b/tex/context/base/mkiv/typo-duc.lua
index 6e4f27de2..614defeb6 100644
--- a/tex/context/base/mkiv/typo-duc.lua
+++ b/tex/context/base/mkiv/typo-duc.lua
@@ -76,9 +76,10 @@ local setattrlist = nuts.setattrlist
local properties = nodes.properties.data
local remove_node = nuts.remove
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
-local start_of_par = nuts.start_of_par
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
+
+local startofpar = nuts.startofpar
local nodepool = nuts.pool
local new_direction = nodepool.direction
@@ -416,7 +417,7 @@ end
local function get_baselevel(head,list,size,direction)
if direction == lefttoright_code or direction == righttoleft_code then
return direction, true
- elseif getid(head) == par_code and start_of_par(head) then
+ elseif getid(head) == par_code and startofpar(head) then
direction = getdirection(head)
if direction == lefttoright_code or direction == righttoleft_code then
return direction, true
@@ -959,18 +960,18 @@ local function apply_to_list(list,size,head,pardir)
c = p
end
-- there is always a par nodes so head will stay
- head = insert_node_before(head,c,new_direction(enddir,true))
+ head = insertnodebefore(head,c,new_direction(enddir,true))
enddir = false
end
elseif begindir then
- if id == par_code and start_of_par(current) then
+ if id == par_code and startofpar(current) then
-- par should always be the 1st node
- head, current = insert_node_after(head,current,new_direction(begindir))
+ head, current = insertnodeafter(head,current,new_direction(begindir))
begindir = nil
end
end
if begindir then
- head = insert_node_before(head,current,new_direction(begindir))
+ head = insertnodebefore(head,current,new_direction(begindir))
end
local skip = entry.skip
if skip and skip > 0 then
@@ -985,7 +986,7 @@ local function apply_to_list(list,size,head,pardir)
end
end
if enddir then
- head, current = insert_node_after(head,current,new_direction(enddir,true))
+ head, current = insertnodeafter(head,current,new_direction(enddir,true))
end
if not entry.remove then
current = getnext(current)
diff --git a/tex/context/base/mkiv/typo-fkr.lua b/tex/context/base/mkiv/typo-fkr.lua
index 1fd08526c..628818b6a 100644
--- a/tex/context/base/mkiv/typo-fkr.lua
+++ b/tex/context/base/mkiv/typo-fkr.lua
@@ -18,7 +18,7 @@ local glyph_code = nodecodes.glyph
local fontdata = fonts.hashes.identifiers
local getkernpair = fonts.handlers.otf.getkern
-local insert_before = nuts.insert_before
+local insertbefore = nuts.insertbefore
local new_kern = nuts.pool.fontkern
local enableaction = nodes.tasks.enableaction
@@ -56,7 +56,7 @@ function typesetters.fontkerns.handler(head)
kern = (kern1 + kern2)/2 -- mixed
end
if kern ~= 0 then
- head, current = insert_before(head,current,new_kern(kern))
+ head, current = insertbefore(head,current,new_kern(kern))
end
lastdata = data
else
@@ -68,7 +68,7 @@ function typesetters.fontkerns.handler(head)
end
local kern = getkernpair(lastdata,lastchar,char)
if kern ~= 0 then
- head, current = insert_before(head,current,new_kern(kern))
+ head, current = insertbefore(head,current,new_kern(kern))
end
end
lastchar = char
diff --git a/tex/context/base/mkiv/typo-fln.lua b/tex/context/base/mkiv/typo-fln.lua
index 3941e65ef..0ee77fe87 100644
--- a/tex/context/base/mkiv/typo-fln.lua
+++ b/tex/context/base/mkiv/typo-fln.lua
@@ -63,15 +63,15 @@ local spaceskip_code = nodes.gluecodes.spaceskip
local nextglyph = nuts.traversers.glyph
local nextdisc = nuts.traversers.disc
-local flush_node_list = nuts.flush_list
-local flush_node = nuts.flush_node
-local copy_node_list = nuts.copy_list
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local flushnodelist = nuts.flushlist
+local flushnode = nuts.flushnode
+local copy_node_list = nuts.copylist
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
local getdimensions = nuts.dimensions
local hpack_node_list = nuts.hpack
-local start_of_par = nuts.start_of_par
+local startofpar = nuts.startofpar
local nodepool = nuts.pool
local newpenalty = nodepool.penalty
@@ -182,7 +182,7 @@ actions[v_line] = function(head,setting)
-- temp = typesetters.kerns.handler(temp) -- maybe when enabled
-- temp = typesetters.cases.handler(temp) -- maybe when enabled
local width = getdimensions(temp)
- flush_node_list(temp)
+ flushnodelist(temp)
return width
end
@@ -230,7 +230,7 @@ actions[v_line] = function(head,setting)
end
end
- flush_node_list(temp)
+ flushnodelist(temp)
local start = head
local n = 0
@@ -296,11 +296,11 @@ actions[v_line] = function(head,setting)
end
end
setdisc(disc,pre,post,replace)
- flush_node(disc)
+ flushnode(disc)
elseif id == glue_code then
n = n + 1
if linebreak ~= n then
- head = insert_node_before(head,start,newpenalty(10000)) -- nobreak
+ head = insertnodebefore(head,start,newpenalty(10000)) -- nobreak
end
end
local next = getnext(start)
@@ -308,11 +308,11 @@ actions[v_line] = function(head,setting)
if start ~= head then
local where = id == glue_code and getprev(start) or start
if trace_firstlines then
- head, where = insert_node_after(head,where,newpenalty(10000)) -- nobreak
- head, where = insert_node_after(head,where,newkern(-65536))
- head, where = insert_node_after(head,where,tracerrule(65536,4*65536,2*65536,"darkblue"))
+ head, where = insertnodeafter(head,where,newpenalty(10000)) -- nobreak
+ head, where = insertnodeafter(head,where,newkern(-65536))
+ head, where = insertnodeafter(head,where,tracerrule(65536,4*65536,2*65536,"darkblue"))
end
- head, where = insert_node_after(head,where,newpenalty(-10000)) -- break
+ head, where = insertnodeafter(head,where,newpenalty(-10000)) -- break
end
start = next
break
@@ -372,7 +372,7 @@ end
actions[v_default] = actions[v_line]
function firstlines.handler(head)
- if getid(head) == par_code and start_of_par(head) then
+ if getid(head) == par_code and startofpar(head) then
local settings = getprop(head,a_firstline)
if settings then
disableaction("processors","typesetters.firstlines.handler")
diff --git a/tex/context/base/mkiv/typo-itc.lua b/tex/context/base/mkiv/typo-itc.lua
index c3a583fe4..0cf847846 100644
--- a/tex/context/base/mkiv/typo-itc.lua
+++ b/tex/context/base/mkiv/typo-itc.lua
@@ -44,9 +44,9 @@ local setkern = nuts.setkern
local getkern = nuts.getkern
local getheight = nuts.getheight
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
-local end_of_math = nuts.end_of_math
+local endofmath = nuts.endofmath
local texgetattribute = tex.getattribute
local texsetattribute = tex.setattribute
@@ -182,7 +182,7 @@ local enablemath = false
local enabletext = false
local function domath(head,current)
- current = end_of_math(current)
+ current = endofmath(current)
local next = getnext(current)
if next then
local char, id = isglyph(next)
@@ -251,7 +251,7 @@ local function domath(head,current)
if trace_italics then
report_italics("%s italic %p between math %C and non punctuation %C","adding",a,getchar(glyph),char)
end
- insert_node_after(head,glyph,correction_kern(a,glyph))
+ insertnodeafter(head,glyph,correction_kern(a,glyph))
end
end
end
@@ -309,7 +309,7 @@ local function texthandler(head)
if font ~= lastfont then
if previtalic ~= 0 then
if okay(data,current,font,prevchar,previtalic,char,"glyph") then
- insert_node_after(prevhead,prev,correction_kern(previtalic,current))
+ insertnodeafter(prevhead,prev,correction_kern(previtalic,current))
end
elseif previnserted and data then
if trace_italics then
@@ -320,7 +320,7 @@ local function texthandler(head)
--
if replaceitalic ~= 0 then
if okay(data,replace,font,replacechar,replaceitalic,char,"replace") then
- insert_node_after(replacehead,replace,correction_kern(replaceitalic,current))
+ insertnodeafter(replacehead,replace,correction_kern(replaceitalic,current))
end
replaceitalic = 0
elseif replaceinserted and data then
@@ -332,7 +332,7 @@ local function texthandler(head)
--
if postitalic ~= 0 then
if okay(data,post,font,postchar,postitalic,char,"post") then
- insert_node_after(posthead,post,correction_kern(postitalic,current))
+ insertnodeafter(posthead,post,correction_kern(postitalic,current))
end
postitalic = 0
elseif postinserted and data then
@@ -484,7 +484,7 @@ local function texthandler(head)
end
previnserted = correction_glue(previtalic,current) -- maybe just add ? else problem with penalties
previtalic = 0
- insert_node_after(prevhead,prev,previnserted)
+ insertnodeafter(prevhead,prev,previnserted)
else
if replaceitalic ~= 0 then
if trace_italics then
@@ -492,7 +492,7 @@ local function texthandler(head)
end
replaceinserted = correction_kern(replaceitalic,current) -- needs to be a kern
replaceitalic = 0
- insert_node_after(replacehead,replace,replaceinserted)
+ insertnodeafter(replacehead,replace,replaceinserted)
end
if postitalic ~= 0 then
if trace_italics then
@@ -500,7 +500,7 @@ local function texthandler(head)
end
postinserted = correction_kern(postitalic,current) -- needs to be a kern
postitalic = 0
- insert_node_after(posthead,post,postinserted)
+ insertnodeafter(posthead,post,postinserted)
end
end
elseif id == math_code then
@@ -514,14 +514,14 @@ local function texthandler(head)
if mathokay then
current = domath(head,current)
else
- current = end_of_math(current)
+ current = endofmath(current)
end
else
if previtalic ~= 0 then
if trace_italics then
report_italics("inserting %p between %s italic %C and whatever",previtalic,"glyph",prevchar)
end
- insert_node_after(prevhead,prev,correction_kern(previtalic,current))
+ insertnodeafter(prevhead,prev,correction_kern(previtalic,current))
previnserted = nil
previtalic = 0
replaceinserted = nil
@@ -533,7 +533,7 @@ local function texthandler(head)
if trace_italics then
report_italics("inserting %p between %s italic %C and whatever",replaceitalic,"replace",replacechar)
end
- insert_node_after(replacehead,replace,correction_kern(replaceitalic,current))
+ insertnodeafter(replacehead,replace,correction_kern(replaceitalic,current))
previnserted = nil
previtalic = 0
replaceinserted = nil
@@ -545,7 +545,7 @@ local function texthandler(head)
if trace_italics then
report_italics("inserting %p between %s italic %C and whatever",postitalic,"post",postchar)
end
- insert_node_after(posthead,post,correction_kern(postitalic,current))
+ insertnodeafter(posthead,post,correction_kern(postitalic,current))
previnserted = nil
previtalic = 0
replaceinserted = nil
@@ -562,19 +562,19 @@ local function texthandler(head)
if trace_italics then
report_italics("inserting %p between %s italic %C and end of list",previtalic,"glyph",prevchar)
end
- insert_node_after(prevhead,prev,correction_kern(previtalic,current))
+ insertnodeafter(prevhead,prev,correction_kern(previtalic,current))
else
if replaceitalic ~= 0 then
if trace_italics then
report_italics("inserting %p between %s italic %C and end of list",replaceitalic,"replace",replacechar)
end
- insert_node_after(replacehead,replace,correction_kern(replaceitalic,current))
+ insertnodeafter(replacehead,replace,correction_kern(replaceitalic,current))
end
if postitalic ~= 0 then
if trace_italics then
report_italics("inserting %p between %s italic %C and end of list",postitalic,"post",postchar)
end
- insert_node_after(posthead,post,correction_kern(postitalic,current))
+ insertnodeafter(posthead,post,correction_kern(postitalic,current))
end
end
end
diff --git a/tex/context/base/mkiv/typo-krn.lua b/tex/context/base/mkiv/typo-krn.lua
index 489375e9b..58d6c091c 100644
--- a/tex/context/base/mkiv/typo-krn.lua
+++ b/tex/context/base/mkiv/typo-krn.lua
@@ -1,4 +1,4 @@
-if not modules then modules = { } end modules ['typo-krn'] = {
+ if not modules then modules = { } end modules ['typo-krn'] = {
version = 1.001,
comment = "companion to typo-krn.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
@@ -24,10 +24,9 @@ local nodepool = nuts.pool
-- check what is used
local find_node_tail = nuts.tail
-local flush_node = nuts.flush_node
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
-local end_of_math = nuts.end_of_math
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
+local endofmath = nuts.endofmath
local copy_node = nuts.copy
local getnext = nuts.getnext
@@ -129,7 +128,7 @@ local factors = kerns.factors
-- make sure it runs after all others
-- there will be a width adaptor field in nodes so this will change
-- todo: interchar kerns / disc nodes / can be made faster
--- todo: use insert_before etc
+-- todo: use insertbefore etc
local gluefactor = 4 -- assumes quad = .5 enspace
@@ -331,7 +330,7 @@ local function process_list(head,keeptogether,krn,font,okay)
-- if kerns then
-- print("it happens indeed, basemode kerns not yet injected")
-- end
- insert_node_before(head,start,new_kern((kerns and kerns[char] or 0) + kern))
+ insertnodebefore(head,start,new_kern((kerns and kerns[char] or 0) + kern))
okay = true
end
end
@@ -412,7 +411,7 @@ function kerns.handler(head)
setattr(n,a_kerns,attr) -- we took away the attr
end
setchar(n,unicode[i])
- insert_node_after(head,s,n)
+ insertnodeafter(head,s,n)
s = n
end
end
@@ -444,10 +443,10 @@ function kerns.handler(head)
local data = chardata[font][prevchar]
local kerns = data and data.kerns
local kern = (kerns and kerns[char] or 0) + quaddata[font]*krn
- insert_node_before(head,start,kern_injector(fillup,kern))
+ insertnodebefore(head,start,kern_injector(fillup,kern))
end
else
- insert_node_before(head,start,kern_injector(fillup,quaddata[font]*krn))
+ insertnodebefore(head,start,kern_injector(fillup,quaddata[font]*krn))
end
end
prev = start
@@ -557,16 +556,16 @@ function kerns.handler(head)
-- special case
local b, f = closest_bound(start,getprev)
if b then
- insert_node_before(head,start,kern_injector(fillup,quaddata[f]*krn))
+ insertnodebefore(head,start,kern_injector(fillup,quaddata[f]*krn))
end
local b, f = closest_bound(start,getnext)
if b then
- insert_node_after(head,start,kern_injector(fillup,quaddata[f]*krn))
+ insertnodeafter(head,start,kern_injector(fillup,quaddata[f]*krn))
end
end
bound = false
elseif id == math_code then
- start = end_of_math(start)
+ start = endofmath(start)
bound = false
end
if start then
diff --git a/tex/context/base/mkiv/typo-lin.lua b/tex/context/base/mkiv/typo-lin.lua
index 84d622e1e..40247c457 100644
--- a/tex/context/base/mkiv/typo-lin.lua
+++ b/tex/context/base/mkiv/typo-lin.lua
@@ -74,8 +74,8 @@ local tonut = nodes.tonut
local tonode = nodes.tonode
local nexthlist = nuts.traversers.hlist
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local find_tail = nuts.tail
local rehpack = nuts.rehpack
----- remove_node = nuts.remove
@@ -99,7 +99,7 @@ local setwidth = nuts.setwidth
local setprop = nuts.setprop
local getprop = nuts.rawprop -- getprop
-local effectiveglue = nuts.effective_glue
+local effectiveglue = nuts.effectiveglue
local nodepool = nuts.pool
local new_kern = nodepool.kern
@@ -147,9 +147,9 @@ local function finalize(prop,key) -- delayed calculations
end
local kern1 = new_kern(delta)
local kern2 = new_kern(-delta)
- head = insert_before(head,head,kern1)
- head = insert_before(head,head,pack)
- head = insert_before(head,head,kern2)
+ head = insertbefore(head,head,kern1)
+ head = insertbefore(head,head,pack)
+ head = insertbefore(head,head,kern2)
setlist(line,head)
local where = {
pack = pack,
@@ -207,11 +207,11 @@ local function normalize(line,islocal) -- assumes prestine lines, nothing pre/ap
if addskips then
if rightskip and not leftskip then
leftskip = new_leftskip(lskip)
- head = insert_before(head,head,leftskip)
+ head = insertbefore(head,head,leftskip)
end
if leftskip and not rightskip then
rightskip = new_rightskip(0)
- head, tail = insert_after(head,tail,rightskip)
+ head, tail = insertafter(head,tail,rightskip)
end
end
if head ~= oldhead then
@@ -267,7 +267,7 @@ function paragraphs.normalize(head,islocal)
current = getnext(current)
end
if current then
- head, current = insert_before(head,current,new_glue(l_width,l_stretch,l_shrink))
+ head, current = insertbefore(head,current,new_glue(l_width,l_stretch,l_shrink))
if head == current then
setlist(last,head)
end
@@ -303,10 +303,10 @@ local function addtoline(n,list,option)
if trace_anchors and not line.traced then
line.traced = true
local rule = new_rule(2*65536,2*65536,1*65536)
- local list = insert_before(rule,rule,new_kern(-1*65536))
+ local list = insertbefore(rule,rule,new_kern(-1*65536))
addtoline(n,list)
local rule = new_rule(2*65536,6*65536,-3*65536)
- local list = insert_before(rule,rule,new_kern(-1*65536))
+ local list = insertbefore(rule,rule,new_kern(-1*65536))
addtoline(n,list,"internal")
else
line.traced = true
@@ -329,14 +329,14 @@ local function addtoline(n,list,option)
-- optimize now .. we can also decide to put each blob in a hlist
local kern = new_kern(delta)
if tail then
- head, tail = insert_after(head,tail,kern)
+ head, tail = insertafter(head,tail,kern)
else
head, tail = kern, kern
setlist(where.pack,head)
end
- head, tail = insert_after(head,tail,blob)
+ head, tail = insertafter(head,tail,blob)
local kern = new_kern(-delta)
- head, tail = insert_after(head,tail,kern)
+ head, tail = insertafter(head,tail,kern)
--
where.head = head
where.tail = tail
@@ -366,7 +366,7 @@ local function addanchortoline(n,anchor)
end
if where.tail then
local head = where.head
- insert_before(head,head,anchor)
+ insertbefore(head,head,anchor)
else
where.tail = anchor
end
diff --git a/tex/context/base/mkiv/typo-mar.lua b/tex/context/base/mkiv/typo-mar.lua
index 7e69162a9..f8c135fa7 100644
--- a/tex/context/base/mkiv/typo-mar.lua
+++ b/tex/context/base/mkiv/typo-mar.lua
@@ -61,9 +61,9 @@ local v_line = variables.line
local nuts = nodes.nuts
local tonode = nuts.tonode
-local hpack_nodes = nuts.hpack
-local traverse_id = nuts.traverse_id
-local flush_node_list = nuts.flush_list
+local hpacknodes = nuts.hpack
+local traverseid = nuts.traverseid
+local flushnodelist = nuts.flushlist
local getnext = nuts.getnext
local getprev = nuts.getprev
@@ -251,7 +251,7 @@ function margins.save(t)
local si = store[i]
if si.name == name then
local s = remove(store,i)
- flush_node_list(s.box)
+ flushnodelist(s.box)
end
end
else
@@ -259,7 +259,7 @@ function margins.save(t)
local si = store[i]
if si.name == name then
local s = remove(store,i)
- flush_node_list(s.box)
+ flushnodelist(s.box)
end
end
end
@@ -492,9 +492,9 @@ local function markovershoot(current) -- todo: alleen als offset > line
v_anchors = v_anchors + 1
cache[v_anchors] = fastcopy(stacked)
local anchor = setanchor(v_anchors)
- -- local list = hpack_nodes(setlink(anchor,getlist(current))) -- not ok, we need to retain width
+ -- local list = hpacknodes(setlink(anchor,getlist(current))) -- not ok, we need to retain width
-- local list = setlink(anchor,getlist(current)) -- why not this ... better play safe
- local list = hpack_nodes(setlink(anchor,getlist(current)),getwidth(current),"exactly")--
+ local list = hpacknodes(setlink(anchor,getlist(current)),getwidth(current),"exactly")--
if trace_marginstack then
report_margindata("marking anchor %a",v_anchors)
end
@@ -790,7 +790,7 @@ local function flushed(scope,parent) -- current is hlist
if done then
local a = getattr(head,a_linenumber) -- hack .. we need a more decent critical attribute inheritance mechanism
if false then
- local l = hpack_nodes(head,getwidth(parent),"exactly")
+ local l = hpacknodes(head,getwidth(parent),"exactly")
setlist(parent,l)
if a then
setattr(l,a_linenumber,a)
@@ -905,7 +905,7 @@ end
local function finalhandler(head)
if nofdelayed > 0 then
local current = head
- while current and nofdelayed > 0 do -- traverse_list
+ while current and nofdelayed > 0 do
local id = getid(current)
if id == hlist_code then -- only lines?
local a = getprop(current,"margindata")
diff --git a/tex/context/base/mkiv/typo-pag.lua b/tex/context/base/mkiv/typo-pag.lua
index ea4b1574c..b6a27f167 100644
--- a/tex/context/base/mkiv/typo-pag.lua
+++ b/tex/context/base/mkiv/typo-pag.lua
@@ -39,7 +39,7 @@ local setpenalty = nuts.setpenalty
local getwidth = nuts.getwidth
local getdepth = nuts.getdepth
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
local new_penalty = nuts.pool.penalty
local trace_keeptogether = false
@@ -129,7 +129,7 @@ local function keeptogether(start,a,specification)
if getid(previous) == penalty_code then
setpenalty(previous,10000)
else
- insert_node_after(head,previous,new_penalty(10000))
+ insertnodeafter(head,previous,new_penalty(10000))
end
else
break
@@ -144,7 +144,7 @@ local function keeptogether(start,a,specification)
if getid(previous) == penalty_code then
setpenalty(previous,10000)
else
- insert_node_after(head,previous,new_penalty(10000))
+ insertnodeafter(head,previous,new_penalty(10000))
end
else
break
@@ -158,7 +158,7 @@ local function keeptogether(start,a,specification)
if getid(previous) == penalty_code then
setpenalty(previous,10000)
else
- insert_node_after(head,previous,new_penalty(10000))
+ insertnodeafter(head,previous,new_penalty(10000))
end
else
break
diff --git a/tex/context/base/mkiv/typo-pnc.lua b/tex/context/base/mkiv/typo-pnc.lua
index 732970884..79ca4f577 100644
--- a/tex/context/base/mkiv/typo-pnc.lua
+++ b/tex/context/base/mkiv/typo-pnc.lua
@@ -21,7 +21,7 @@ local glue_code = nodecodes.glue
local spaceskip_code = gluecodes.spaceskip
local new_kern = nuts.pool.kern
-local insert_after = nuts.insert_after
+local insertafter = nuts.insertafter
local nextglyph = nuts.traversers.glyph
@@ -89,7 +89,7 @@ function periodkerns.handler(head)
if factor ~= 0 then
fontspace = parameters[getfont(current)].space -- can be sped up
inserted = factor * fontspace
- insert_after(head,current,new_kern(inserted))
+ insertafter(head,current,new_kern(inserted))
if trace then
report("inserting space at %C . [%p] %C .",pchar,inserted,nchar)
end
diff --git a/tex/context/base/mkiv/typo-rep.lua b/tex/context/base/mkiv/typo-rep.lua
index 2538a014d..a116a3f5d 100644
--- a/tex/context/base/mkiv/typo-rep.lua
+++ b/tex/context/base/mkiv/typo-rep.lua
@@ -38,6 +38,7 @@ local chardata = characters.data
local collected = false
local a_stripping = attributes.private("stripping")
+
local texsetattribute = tex.setattribute
local unsetvalue = attributes.unsetvalue
diff --git a/tex/context/base/mkiv/typo-rub.lua b/tex/context/base/mkiv/typo-rub.lua
index 6c6ab9a33..14acfdbd7 100644
--- a/tex/context/base/mkiv/typo-rub.lua
+++ b/tex/context/base/mkiv/typo-rub.lua
@@ -49,7 +49,6 @@ local getwidth = nuts.getwidth
local setwidth = nuts.setwidth
local hpack = nuts.hpack
-local insert_after = nuts.insert_after
local takebox = nuts.takebox
local nexthlist = nuts.traversers.hlist
@@ -368,7 +367,7 @@ local function whatever(current)
end
end
-attach = function(head) -- traverse_list
+attach = function(head)
for current in nexthlist, head do
whatever(current)
end
diff --git a/tex/context/base/mkiv/typo-spa.lua b/tex/context/base/mkiv/typo-spa.lua
index 78fc22964..db05963eb 100644
--- a/tex/context/base/mkiv/typo-spa.lua
+++ b/tex/context/base/mkiv/typo-spa.lua
@@ -29,10 +29,10 @@ local getprev = nuts.getprev
local takeattr = nuts.takeattr
local isglyph = nuts.isglyph
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
-local end_of_math = nuts.end_of_math
+local endofmath = nuts.endofmath
local nodepool = nuts.pool
local new_penalty = nodepool.penalty
@@ -116,8 +116,8 @@ function spacings.handler(head)
if trace_spacing then
report_spacing("inserting penalty and space before %C (left)",char)
end
- insert_node_before(head,start,new_penalty(10000))
- insert_node_before(head,start,new_glue(left*quad))
+ insertnodebefore(head,start,new_penalty(10000))
+ insertnodebefore(head,start,new_glue(left*quad))
end
end
local next = getnext(start)
@@ -152,15 +152,15 @@ function spacings.handler(head)
if trace_spacing then
report_spacing("inserting penalty and space after %C (right)",char)
end
- insert_node_after(head,start,new_glue(right*quad))
- insert_node_after(head,start,new_penalty(10000))
+ insertnodeafter(head,start,new_glue(right*quad))
+ insertnodeafter(head,start,new_penalty(10000))
end
end
end
end
end
elseif id == math_code then
- start = end_of_math(start) -- weird, can return nil .. no math end?
+ start = endofmath(start) -- weird, can return nil .. no math end?
end
if start then
start = getnext(start)
diff --git a/tex/context/base/mkiv/typo-sus.lua b/tex/context/base/mkiv/typo-sus.lua
index bb5b03912..993f4c798 100644
--- a/tex/context/base/mkiv/typo-sus.lua
+++ b/tex/context/base/mkiv/typo-sus.lua
@@ -57,9 +57,9 @@ local setattr = nuts.setattr
local setlist = nuts.setlist
local setcolor = nodes.tracers.colors.set
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
-local end_of_math = nuts.end_of_math
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
+local endofmath = nuts.endofmath
local nodepool = nuts.pool
@@ -123,22 +123,22 @@ local function mark(head,current,id,color)
local width = getwidth(current)
local rule = new_rule(width)
local kern = new_kern(-width)
- head = insert_before(head,current,rule)
- head = insert_before(head,current,kern)
+ head = insertbefore(head,current,rule)
+ head = insertbefore(head,current,kern)
setcolor(rule,color)
-- elseif id == kern_code then
-- local width = getkern(current)
-- local rule = new_rule(width)
-- local kern = new_kern(-width)
- -- head = insert_before(head,current,rule)
- -- head = insert_before(head,current,kern)
+ -- head = insertbefore(head,current,rule)
+ -- head = insertbefore(head,current,kern)
-- setcolor(rule,color)
else
local width, height, depth = getwhd(current)
local extra = fonts.hashes.xheights[getfont(current)] / 2
local rule = new_rule(width,height+extra,depth+extra)
local hlist = new_hlist(rule)
- head = insert_before(head,current,hlist)
+ head = insertbefore(head,current,hlist)
setcolor(rule,color)
setcolor(current,"white")
end
@@ -226,7 +226,7 @@ function typesetters.marksuspects(head)
end
current = getnext(current)
elseif id == math_code then
- current = getnext(end_of_math(current))
+ current = getnext(endofmath(current))
elseif id == glue_code then
local a = getattr(current,a_characters)
if a then
@@ -270,7 +270,7 @@ local function showsuspects(head)
head, current = mark(head,current,id,colors[a])
end
elseif id == math_code then
- current = end_of_math(current)
+ current = endofmath(current)
elseif id == hlist_code or id == vlist_code then
local list = getlist(current)
if list then
diff --git a/tex/context/base/mkiv/typo-tal.lua b/tex/context/base/mkiv/typo-tal.lua
index db605a491..b827b8ef9 100644
--- a/tex/context/base/mkiv/typo-tal.lua
+++ b/tex/context/base/mkiv/typo-tal.lua
@@ -47,8 +47,8 @@ local isglyph = nuts.isglyph
local setattr = nuts.setattr
local setchar = nuts.setchar
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local nextglyph = nuts.traversers.glyph
local getdimensions = nuts.dimensions
@@ -376,46 +376,46 @@ function characteralign.handler(head,where)
local new_kern = trace_split and traced_kern or new_kern
if b_start then
if before < maxbefore then
- head = insert_node_before(head,b_start,new_kern(maxbefore-before))
+ head = insertnodebefore(head,b_start,new_kern(maxbefore-before))
end
if not c then
-- print("[before]")
if dataset.hasseparator then
local width = fontcharacters[getfont(b_start)][separator].width
- insert_node_after(head,b_stop,new_kern(maxafter+width))
+ insertnodeafter(head,b_stop,new_kern(maxafter+width))
end
elseif a_start then
-- print("[before] [separator] [after]")
if after < maxafter then
- insert_node_after(head,a_stop,new_kern(maxafter-after))
+ insertnodeafter(head,a_stop,new_kern(maxafter-after))
end
else
-- print("[before] [separator]")
if maxafter > 0 then
- insert_node_after(head,c,new_kern(maxafter))
+ insertnodeafter(head,c,new_kern(maxafter))
end
end
elseif a_start then
if c then
-- print("[separator] [after]")
if maxbefore > 0 then
- head = insert_node_before(head,c,new_kern(maxbefore))
+ head = insertnodebefore(head,c,new_kern(maxbefore))
end
else
-- print("[after]")
local width = fontcharacters[getfont(b_stop)][separator].width
- head = insert_node_before(head,a_start,new_kern(maxbefore+width))
+ head = insertnodebefore(head,a_start,new_kern(maxbefore+width))
end
if after < maxafter then
- insert_node_after(head,a_stop,new_kern(maxafter-after))
+ insertnodeafter(head,a_stop,new_kern(maxafter-after))
end
elseif c then
-- print("[separator]")
if maxbefore > 0 then
- head = insert_node_before(head,c,new_kern(maxbefore))
+ head = insertnodebefore(head,c,new_kern(maxbefore))
end
if maxafter > 0 then
- insert_node_after(head,c,new_kern(maxafter))
+ insertnodeafter(head,c,new_kern(maxafter))
end
end
return head
diff --git a/tex/context/base/mkiv/typo-wrp.lua b/tex/context/base/mkiv/typo-wrp.lua
index f2ca43b56..4ba3c3aff 100644
--- a/tex/context/base/mkiv/typo-wrp.lua
+++ b/tex/context/base/mkiv/typo-wrp.lua
@@ -53,6 +53,8 @@ local report = logs.reporter("paragraphs","wrappers")
-- If needed we can extend this checker for other cases but then we will also
-- use attributes.
+-- we can actually do better in lmtx
+
local function remove_dangling_crlf(head,tail)
if head and tail and getid(tail) == glue_code and getsubtype(tail) == parfillskip_code then
tail = getprev(tail)
diff --git a/tex/context/base/mkiv/typo-wrp.mkiv b/tex/context/base/mkiv/typo-wrp.mkiv
index 4e9ecf2e1..3a3bb4faf 100644
--- a/tex/context/base/mkiv/typo-wrp.mkiv
+++ b/tex/context/base/mkiv/typo-wrp.mkiv
@@ -49,7 +49,7 @@
\ignorespaces}
\unexpanded\def\spac_crlf_placeholder
- {\strut}
+ {\wordboundary\strut} % or \endstrut
\unexpanded\def\spac_crlf_placeholder_show
{\wordboundary
diff --git a/tex/context/base/mkxl/anch-bck.mklx b/tex/context/base/mkxl/anch-bck.mklx
index bf3885539..1d0009949 100644
--- a/tex/context/base/mkxl/anch-bck.mklx
+++ b/tex/context/base/mkxl/anch-bck.mklx
@@ -353,9 +353,6 @@
\definesystemattribute[textbackground][public]
-% \def\page_prepare_backgrounds#1%
-% {\clf_collectbackgrounds\realpageno#1\relax}
-
\def\anch_backgrounds_bpos
{\ifconditional\c_anch_backgrounds_pos_no_shape
\c_attr_textbackground\attributeunsetvalue
diff --git a/tex/context/base/mkxl/anch-pgr.lmt b/tex/context/base/mkxl/anch-pgr.lmt
index e561f8b79..8a329fd13 100644
--- a/tex/context/base/mkxl/anch-pgr.lmt
+++ b/tex/context/base/mkxl/anch-pgr.lmt
@@ -94,9 +94,9 @@ local getdepth = nuts.getdepth
local nodecodes = nodes.nodecodes
local par_code = nodecodes.par
-local start_of_par = nuts.start_of_par
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local startofpar = nuts.startofpar
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local processranges = nuts.processranges
@@ -115,6 +115,7 @@ local enabled = false
-- many pages but for an arbitrary background shape that is not so common.
local function check(specification)
+ --
local a = specification.attribute
local index = specification.index
local depth = specification.depth
@@ -181,12 +182,12 @@ local function flush(head,f,l,a,parent,depth)
ln = new_hlist(setlink(new_rule(65536,65536*4,0),new_kern(-65536),ln))
rn = new_hlist(setlink(new_rule(65536,0,65536*4),new_kern(-65536),rn))
end
- if getid(f) == par_code and start_of_par(f) then -- we need to clean this mess
- insert_after(head,f,ln)
+ if getid(f) == par_code and startofpar(f) then -- we need to clean this mess
+ insertafter(head,f,ln)
else
- head, f = insert_before(head,f,ln)
+ head, f = insertbefore(head,f,ln)
end
- insert_after(head,l,rn)
+ insertafter(head,l,rn)
end
return head, true
end
@@ -221,24 +222,10 @@ local function registerbackground(name)
end
end
--- local function collectbackgrounds(r,n)
--- if enabled then
--- local parent = getbox(n)
--- local head = getlist(parent)
--- realpage = r
--- processranges(a_textbackground,flush,head) -- ,parent)
--- end
--- end
---
--- interfaces.implement {
--- name = "collectbackgrounds",
--- actions = collectbackgrounds,
--- arguments = { "integer", "integer" }
--- }
-
nodes.handlers.textbackgrounds = function(head,where,parent) -- we have hlistdir and local dir
-- todo enable action in register
- index = index + 1
+ index = index + 1
+ realpage = texgetcount("realpageno")
return processranges(a_textbackground,flush,head,parent)
end
diff --git a/tex/context/base/mkxl/back-exp.lmt b/tex/context/base/mkxl/back-exp.lmt
index 1375d2655..f0d8e120e 100644
--- a/tex/context/base/mkxl/back-exp.lmt
+++ b/tex/context/base/mkxl/back-exp.lmt
@@ -1456,7 +1456,7 @@ local collectresults do -- too many locals otherwise
local getkern = nuts.getkern
local getwidth = nuts.getwidth
- local start_of_par = nuts.start_of_par
+ local startofpar = nuts.startofpar
local nexthlist = nuts.traversers.hlist
local nextnode = nuts.traversers.node
@@ -1826,7 +1826,7 @@ end
last = nil
currentparagraph = nil
end
- elseif not paragraph and id == par_code and start_of_par(n) then
+ elseif not paragraph and id == par_code and startofpar(n) then
paragraph = getattr(n,a_taggedpar)
elseif id == disc_code then
-- very unlikely because we stripped them
diff --git a/tex/context/base/mkxl/blob-ini.lmt b/tex/context/base/mkxl/blob-ini.lmt
index 42a18fddd..a2244dcdd 100644
--- a/tex/context/base/mkxl/blob-ini.lmt
+++ b/tex/context/base/mkxl/blob-ini.lmt
@@ -25,28 +25,26 @@ if not modules then modules = { } end modules ['blob-ini'] = {
local type, tostring = type, tostring
local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
-local report_blobs = logs.reporter("blobs")
+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 flushnodelist = nodes.flushlist
+local hpacknodelist = nodes.hpack
-local typesetters = nodes.typesetters
-local tonodes = typesetters.tonodes
-local tohpack = typesetters.tohpack
-local tovpack = typesetters.tovpack
+local typesetters = nodes.typesetters
+local tonodes = typesetters.tonodes
+local tohpack = typesetters.tohpack
+local tovpack = typesetters.tovpack
-local implement = interfaces.implement
+local context = context
--- provide copies here (nicer for manuals)
+local implement = interfaces.implement
-blobs = blobs or { }
-local blobs = blobs
+blobs = blobs or { }
+local blobs = blobs
-blobs.tonodes = tonodes
-blobs.tohpack = tohpack
-blobs.tovpack = tovpack
+blobs.tonodes = tonodes
+blobs.tohpack = tohpack
+blobs.tovpack = tovpack
-- end of helpers
@@ -68,7 +66,7 @@ function blobs.dispose(t)
local li = list[i]
local pack = li.pack
if pack then
- flush_node_list(pack)
+ flushnodelist(pack)
li.pack = nil
end
end
@@ -96,14 +94,14 @@ function blobs.pack(t,how)
for i=1,#list do
local pack = list[i].pack
if pack then
- flush_node_list(node.pack)
+ flushnodelist(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")
+ list[i].pack = hpacknodelist(list[i].head,"exactly")
end
end
end
@@ -114,8 +112,8 @@ function blobs.write(t)
local li = list[i]
local pack = li.pack
if pack then
- write_node(pack)
- flush_node_list(pack)
+ context(pack)
+ flushnodelist(pack)
li.pack = nil
end
end
@@ -158,28 +156,28 @@ end
local function strwd(str)
local l = tohpack(str)
local w = l.width
- flush_node_list(l)
+ flushnodelist(l)
return w
end
local function strht(str)
local l = tohpack(str)
local h = l.height
- flush_node_list(l)
+ flushnodelist(l)
return h
end
local function strdp(str)
local l = tohpack(str)
local d = l.depth
- flush_node_list(l)
+ flushnodelist(l)
return d
end
local function strhd(str)
local l = tohpack(str)
local s = l.height + l.depth
- flush_node_list(l)
+ flushnodelist(l)
return s
end
@@ -196,7 +194,7 @@ local scan_hbox = tokens.scanners.hbox
local function action(field,what)
local l = scan_hbox()
local d = l[field]
- flush_node_list(l)
+ flushnodelist(l)
if what == "value" then
return dimension_code, d
else
diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt
index 41e8a5078..107ff3fdd 100644
--- a/tex/context/base/mkxl/buff-ini.lmt
+++ b/tex/context/base/mkxl/buff-ini.lmt
@@ -38,14 +38,12 @@ local scaninteger = scanners.integer
local scanboolean = scanners.boolean
local scancode = scanners.code
local scantokencode = scanners.tokencode
------ scantoken = scanners.token
local getters = tokens.getters
local gettoken = getters.token
-local getcommand = token.get_command
------ getcsname = token.get_csname
-local getnextchar = token.scan_next_char or token.get_next_char
+local getcommand = tokens.accessors.command
+local getnextchar = tokens.scanners.nextchar
local variables = interfaces.variables
local settings_to_array = utilities.parsers.settings_to_array
diff --git a/tex/context/base/mkxl/cldf-lmt.lmt b/tex/context/base/mkxl/cldf-lmt.lmt
index 1c1b6a353..0c9da145f 100644
--- a/tex/context/base/mkxl/cldf-lmt.lmt
+++ b/tex/context/base/mkxl/cldf-lmt.lmt
@@ -41,7 +41,7 @@ local scankeyword = scanners.keyword
local peekchar = scanners.peekchar
local skipnext = scanners.skip
-local getindex = token.get_index
+local getindex = tokens.accessors.index
local texsetdimen = tex.setdimen
local texsetcount = tex.setcount
@@ -957,8 +957,8 @@ do
local global_code = tex.flagcodes.global
- local savelua = token.save_lua
- local isdefined = token.is_defined
+ local savelua = token.savelua
+ local isdefined = token.isdefined
local newsparse = sparse.new
local setsparse = sparse.set
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index bcd32fcda..fd33d7db1 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.05.09 17:12}
+\newcontextversion{2021.05.15 22:41}
%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/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 47f4f3e1a..0f19da913 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2021.05.09 17:12}
+\immutable\edef\contextversion{2021.05.15 22:41}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/core-env.lmt b/tex/context/base/mkxl/core-env.lmt
index 388e96787..486beeec4 100644
--- a/tex/context/base/mkxl/core-env.lmt
+++ b/tex/context/base/mkxl/core-env.lmt
@@ -19,7 +19,7 @@ local context = context
local ctxcore = context.core
local texgetcount = tex.getcount
-local texgetintegervalue = token.get_integer -- todo: in tex namespace
+local texgetintegervalue = token.getinteger -- todo
local allocate = utilities.storage.allocate
local setmetatableindex = table.setmetatableindex
diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt
index 0fe0e5f9f..3b865492f 100644
--- a/tex/context/base/mkxl/driv-shp.lmt
+++ b/tex/context/base/mkxl/driv-shp.lmt
@@ -55,9 +55,9 @@ local isglyph = nuts.isglyph
local nextdir = nuts.traversers.dir
local nextnode = nuts.traversers.node
------ rangedimensions = node.direct.rangedimensions -- nuts ?
-local effectiveglue = nuts.effective_glue
-local start_of_par = nuts.start_of_par
+----- rangedimensions = nuts.rangedimensions
+local effectiveglue = nuts.effectiveglue
+----- startofpar = nuts.startofpar
local dirdimensions = nuts.dirdimensions
local texget = tex.get
@@ -212,6 +212,8 @@ local flush_character do
end
end
+ local refactored = 1000000
+
for i=1,#vfcommands do
local packet = vfcommands[i]
local command = packet[1]
@@ -269,7 +271,7 @@ local flush_character do
local h = packet[2] -- already scaled
if h ~= 0 then
if factor ~= 0 then
- h = h + h * factor / 1000 -- expansion
+ h = h + h * factor / refactored -- expansion
end
pos_h = pos_h + h * sx
end
@@ -277,7 +279,7 @@ local flush_character do
local h = packet[2] -- already scaled
if h ~= 0 then
if factor ~= 0 then
- h = h + h * factor / 1000 -- expansion
+ h = h + h * factor / refactored -- expansion
end
pos_h = pos_h - h * sx
end
@@ -299,7 +301,7 @@ local flush_character do
local c = packet[4]
if h ~= 0 then
if factor ~= 0 then
- h = h + h * factor / 1000 -- expansion
+ h = h + h * factor / refactored -- expansion
end
pos_h = pos_h + h * sx
end
@@ -319,7 +321,7 @@ local flush_character do
local c = packet[4]
if h ~= 0 then
if factor ~= 0 then
- h = h + h * factor / 1000 -- expansion
+ h = h + h * factor / refactored -- expansion
end
pos_h = pos_h + h * sx
end
@@ -370,7 +372,7 @@ local flush_character do
local total = height + depth
if width > 0 and total > 0 then
if factor ~= 0 then
- width = width + width * factor / 1000
+ width = width + width * factor / refactored
end
if width > 0 then
local line = packet[5] or default
@@ -404,7 +406,7 @@ local flush_character do
local size_h = packet[3]
if size_h > 0 and size_v > 0 then
if factor ~= 0 then
- size_h = size_h + size_h * factor / 1000
+ size_h = size_h + size_h * factor / refactored
end
if size_h > 0 then
size_h = size_h * sx
@@ -419,7 +421,7 @@ local flush_character do
local dp = packet[4] or 0
if wd > 0 and ht ~= 0 and dp ~= 0 then
if factor ~= 0 then
- wd = wd + wd * factor / 1000
+ wd = wd + wd * factor / refactored
end
if wd > 0 then
wd = wd * sx
@@ -599,10 +601,10 @@ end
local hlist_out, vlist_out do
local function applyanchor(orientation,x,y,width,height,depth,woffset,hoffset,doffset,xoffset,yoffset)
- local ot = (orientation>> 0) & x0F
- local ay = (orientation>> 4) & x0F
- local ax = (orientation>> 8) & x0F
- local of = (orientation>>12) & x0F
+ local ot = (orientation>> 0) & 0x0F
+ local ay = (orientation>> 4) & 0x0F
+ local ax = (orientation>> 8) & 0x0F
+ local of = (orientation>>12) & 0x0F
if ot == 4 then
ot, ay = 0, 1
elseif ot == 5 then
@@ -975,7 +977,7 @@ local hlist_out, vlist_out do
setlink(current,replace)
setreplace(current)
end
- -- elseif id == par_code and start_of_par(current) then
+ -- elseif id == par_code and startofpar(current) then
-- local pardir = getdirection(current) or lefttoright_code
-- if pardir == righttoleft_code then
-- end
@@ -1375,7 +1377,7 @@ do
----- tonut = nodes.tonut
local properties = nodes.properties.data
local flush = texio.write
- local flushline = texio.write_nl
+ local flushline = texio.writenl
local periods = utilities.strings.newrepeater(".")
@@ -1431,4 +1433,10 @@ do
end
end)
+ local names = attributes.names
+
+ callback.register("get_attribute",function(k,v)
+ return attributes.names[k], nil -- we show the name and number
+ end)
+
end
diff --git a/tex/context/base/mkxl/font-chk.lmt b/tex/context/base/mkxl/font-chk.lmt
index fa1167b1c..eb1be3f1b 100644
--- a/tex/context/base/mkxl/font-chk.lmt
+++ b/tex/context/base/mkxl/font-chk.lmt
@@ -64,7 +64,7 @@ local implement = interfaces.implement
local glyph_code = nodes.nodecodes.glyph
-local hpack_node = node.hpack
+local hpack_node = nodes.hpack
local nuts = nodes.nuts
local tonut = nuts.tonut
@@ -75,8 +75,8 @@ local setchar = nuts.setchar
local nextglyph = nuts.traversers.glyph
local remove_node = nuts.remove
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
local copy_node = nuts.copy
local actions = false
@@ -208,7 +208,7 @@ function checkers.missing(head)
onetimemessage(font,char,"missing (decomposed)")
setchar(n,s[l])
for i=l-1,2,-1 do
- head, o = insert_node_before(head,o,copy_node(n))
+ head, o = insertnodebefore(head,o,copy_node(n))
setchar(o,s[i])
end
goto DONE
diff --git a/tex/context/base/mkxl/font-col.lmt b/tex/context/base/mkxl/font-col.lmt
index d60efb216..12603a0dd 100644
--- a/tex/context/base/mkxl/font-col.lmt
+++ b/tex/context/base/mkxl/font-col.lmt
@@ -22,7 +22,6 @@ local nuts = nodes.nuts
local setfont = nuts.setfont
------ traverse_char = nuts.traverse_char
local nextchar = nuts.traversers.char
local getscales = nuts.getscales
local setscales = nuts.setscales
diff --git a/tex/context/base/mkxl/font-ota.lmt b/tex/context/base/mkxl/font-ota.lmt
index 6475c57e6..157270ef1 100644
--- a/tex/context/base/mkxl/font-ota.lmt
+++ b/tex/context/base/mkxl/font-ota.lmt
@@ -42,7 +42,7 @@ local ischar = nuts.ischar
local isnextchar = nuts.isnextchar
----- isprevchar = nuts.isprevchar
-local end_of_math = nuts.end_of_math
+local endofmath = nuts.endofmath
local nodecodes = nodes.nodecodes
local disc_code = nodecodes.disc
@@ -216,8 +216,8 @@ function analyzers.setstate(head,font) -- latin
end
first = false
if id == math_code then
- -- current = end_of_math(current)
- nxt = getnext(end_of_math(current))
+ -- current = endofmath(current)
+ nxt = getnext(endofmath(current))
end
elseif id == disc_code then
-- always in the middle .. it doesn't make much sense to assign a property
@@ -231,7 +231,7 @@ function analyzers.setstate(head,font) -- latin
end
first = false
if id == math_code then
- current = end_of_math(current)
+ current = endofmath(current)
end
end
::NEXT::
@@ -430,8 +430,8 @@ function methods.arab(head,font,attr)
first = nil
end
if id == math_code then -- a bit duplicate as we test for glyphs twice
- -- current = end_of_math(current)
- nxt = getnext(end_of_math(current))
+ -- current = endofmath(current)
+ nxt = getnext(endofmath(current))
end
end
-- current = getnext(current)
@@ -560,8 +560,8 @@ do
wrapup()
end
if id == math_code then -- a bit duplicate as we test for glyphs twice
- -- current = end_of_math(current)
- nxt = getnext(end_of_math(current))
+ -- current = endofmath(current)
+ nxt = getnext(endofmath(current))
end
end
-- current = getnext(current)
diff --git a/tex/context/base/mkxl/font-otj.lmt b/tex/context/base/mkxl/font-otj.lmt
index adbce23e1..800628934 100644
--- a/tex/context/base/mkxl/font-otj.lmt
+++ b/tex/context/base/mkxl/font-otj.lmt
@@ -116,8 +116,8 @@ local setattrlist = nuts.setattrlist
local nextchar = nuts.traversers.char
local nextglue = nuts.traversers.glue
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local properties = nodes.properties.data
@@ -665,12 +665,12 @@ end
-- addmargins(current,-leftkern)
-- elseif prev and getid(prev) == glue_code then
-- if useitalickerns then
--- head = insert_node_before(head,current,italickern(leftkern))
+-- head = insertnodebefore(head,current,italickern(leftkern))
-- else
-- setwidth(prev, getwidth(prev) + leftkern)
-- end
-- else
--- head = insert_node_before(head,current,fontkern(leftkern))
+-- head = insertnodebefore(head,current,fontkern(leftkern))
-- end
-- end
-- end
@@ -748,7 +748,7 @@ end
-- if useadvance then
-- addmargins(n,-leftkern)
-- else
--- pre = insert_node_before(pre,n,fontkern(leftkern))
+-- pre = insertnodebefore(pre,n,fontkern(leftkern))
-- done = true
-- end
-- end
@@ -769,7 +769,7 @@ end
-- if useadvance then
-- addmargins(n,-leftkern)
-- else
--- post = insert_node_before(post,n,fontkern(leftkern))
+-- post = insertnodebefore(post,n,fontkern(leftkern))
-- done = true
-- end
-- end
@@ -790,7 +790,7 @@ end
-- if useadvance then
-- addmargins(n,-leftkern)
-- else
--- replace = insert_node_before(replace,n,fontkern(leftkern))
+-- replace = insertnodebefore(replace,n,fontkern(leftkern))
-- done = true
-- end
-- end
@@ -848,12 +848,12 @@ local function inject_kerns_only_kerns(head,where)
leftkern = xscaled(current,leftkern)
if prev and getid(prev) == glue_code then
if useitalickerns then
- head = insert_node_before(head,current,italickern(leftkern))
+ head = insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev,getwidth(prev) + leftkern)
end
else
- head = insert_node_before(head,current,somekern(fontkern,leftkern,current))
+ head = insertnodebefore(head,current,somekern(fontkern,leftkern,current))
end
end
end
@@ -912,7 +912,7 @@ local function inject_kerns_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
+ pre = insertnodebefore(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
end
@@ -928,7 +928,7 @@ local function inject_kerns_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,somekern(fontkern,xscaled(n,leftkern),n))
+ post = insertnodebefore(post,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
end
@@ -944,7 +944,7 @@ local function inject_kerns_only_kerns(head,where)
if i then
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
+ replace = insertnodebefore(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
end
@@ -1141,23 +1141,23 @@ end
-- rightkern = 0
-- elseif prev and getid(prev) == glue_code then
-- if useitalickerns then
--- head = insert_node_before(head,current,italickern(leftkern))
+-- head = insertnodebefore(head,current,italickern(leftkern))
-- else
-- setwidth(prev,getwidth(prev)+leftkern)
-- end
-- else
--- head = insert_node_before(head,current,fontkern(leftkern))
+-- head = insertnodebefore(head,current,fontkern(leftkern))
-- end
-- end
-- if rightkern ~= 0 then
-- if next and getid(next) == glue_code then
-- if useitalickerns then
--- insert_node_after(head,current,italickern(rightkern))
+-- insertnodeafter(head,current,italickern(rightkern))
-- else
-- setwidth(next, getwidth(next)+rightkern)
-- end
-- else
--- insert_node_after(head,current,fontkern(rightkern))
+-- insertnodeafter(head,current,fontkern(rightkern))
-- end
-- end
-- end
@@ -1260,11 +1260,11 @@ end
-- end
-- else
-- if leftkern ~= 0 then
--- pre = insert_node_before(pre,n,fontkern(leftkern))
+-- pre = insertnodebefore(pre,n,fontkern(leftkern))
-- done = true
-- end
-- if rightkern ~= 0 then
--- insert_node_after(pre,n,fontkern(rightkern))
+-- insertnodeafter(pre,n,fontkern(rightkern))
-- done = true
-- end
-- end
@@ -1298,11 +1298,11 @@ end
-- end
-- else
-- if leftkern ~= 0 then
--- post = insert_node_before(post,n,fontkern(leftkern))
+-- post = insertnodebefore(post,n,fontkern(leftkern))
-- done = true
-- end
-- if rightkern ~= 0 then
--- insert_node_after(post,n,fontkern(rightkern))
+-- insertnodeafter(post,n,fontkern(rightkern))
-- done = true
-- end
-- end
@@ -1336,11 +1336,11 @@ end
-- end
-- else
-- if leftkern ~= 0 then
--- replace = insert_node_before(replace,n,fontkern(leftkern))
+-- replace = insertnodebefore(replace,n,fontkern(leftkern))
-- done = true
-- end
-- if rightkern ~= 0 then
--- insert_node_after(replace,n,fontkern(rightkern))
+-- insertnodeafter(replace,n,fontkern(rightkern))
-- done = true
-- end
-- end
@@ -1361,7 +1361,7 @@ end
-- if useadvance then
-- addmargins(pre,-rightkern)
-- else
--- pre = insert_node_before(pre,pre,fontkern(rightkern))
+-- pre = insertnodebefore(pre,pre,fontkern(rightkern))
-- done = true
-- end
-- end
@@ -1380,7 +1380,7 @@ end
-- if useadvance then
-- addmargins(replace,-rightkern)
-- else
--- replace = insert_node_before(replace,replace,fontkern(rightkern))
+-- replace = insertnodebefore(replace,replace,fontkern(rightkern))
-- done = true
-- end
-- end
@@ -1454,23 +1454,23 @@ local function inject_positions_only_kerns(head,where)
rightkern = 0
elseif prev and getid(prev) == glue_code then
if useitalickerns then
- head = insert_node_before(head,current,italickern(leftkern))
+ head = insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev,getwidth(prev)+leftkern)
end
else
- head = insert_node_before(head,current,somekern(fontkern,leftkern,current))
+ head = insertnodebefore(head,current,somekern(fontkern,leftkern,current))
end
end
if rightkern ~= 0 then
if next and getid(next) == glue_code then
if useitalickerns then
- insert_node_after(head,current,italickern(rightkern))
+ insertnodeafter(head,current,italickern(rightkern))
else
setwidth(next, getwidth(next)+rightkern)
end
else
- insert_node_after(head,current,somekern(fontkern,rightkern,current))
+ insertnodeafter(head,current,somekern(fontkern,rightkern,current))
end
end
else
@@ -1549,11 +1549,11 @@ local function inject_positions_only_kerns(head,where)
addyoffset(n,yscaled(n,yoffset))
end
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
+ pre = insertnodebefore(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
if rightkern and rightkern ~= 0 then
- insert_node_after(pre,n,somekern(fontkern,xscaled(n,rightkern),n))
+ insertnodeafter(pre,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
end
@@ -1574,11 +1574,11 @@ local function inject_positions_only_kerns(head,where)
addyoffset(n,yscaled(n,yoffset))
end
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,somekern(fontkern,xscaled(n,leftkern),n))
+ post = insertnodebefore(post,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
if rightkern and rightkern ~= 0 then
- insert_node_after(post,n,somekern(fontkern,xscaled(n,rightkern),n))
+ insertnodeafter(post,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
end
@@ -1599,11 +1599,11 @@ local function inject_positions_only_kerns(head,where)
addyoffset(n,yscaled(n,yoffset))
end
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
+ replace = insertnodebefore(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
if rightkern and rightkern ~= 0 then
- insert_node_after(replace,n,somekern(fontkern,xscaled(n,rightkern),n))
+ insertnodeafter(replace,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
end
@@ -1620,7 +1620,7 @@ local function inject_positions_only_kerns(head,where)
-- glyph|pre glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- pre = insert_node_before(pre,pre,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
+ pre = insertnodebefore(pre,pre,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
done = true
end
end
@@ -1634,7 +1634,7 @@ local function inject_positions_only_kerns(head,where)
-- glyph|replace glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- replace = insert_node_before(replace,replace,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
+ replace = insertnodebefore(replace,replace,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
done = true
end
end
@@ -1923,8 +1923,8 @@ local function processmark(p,n,pn) -- p = basenode
--
-- todo: head and check for prev / next kern
--
- insert_node_before(n,n,somekern(fontkern,-wn,n))
- insert_node_after(n,n,somekern(fontkern,-wn,n))
+ insertnodebefore(n,n,somekern(fontkern,-wn,n))
+ insertnodeafter(n,n,somekern(fontkern,-wn,n))
end
end
end
@@ -2046,24 +2046,24 @@ local function inject_everything(head,where)
rightkern = 0
elseif prev and getid(prev) == glue_code then
if useitalickerns then
- head = insert_node_before(head,current,italickern(leftkern))
+ head = insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev, getwidth(prev) + leftkern)
end
else
- head = insert_node_before(head,current,somekern(fontkern,leftkern,current))
+ head = insertnodebefore(head,current,somekern(fontkern,leftkern,current))
end
end
if rightkern and rightkern ~= 0 then
rightkern = xscaled(current,rightkern)
if next and getid(next) == glue_code then
if useitalickerns then
- insert_node_after(head,current,italickern(rightkern))
+ insertnodeafter(head,current,italickern(rightkern))
else
setwidth(next, getwidth(next) + rightkern)
end
else
- insert_node_after(head,current,somekern(fontkern,rightkern,current))
+ insertnodeafter(head,current,somekern(fontkern,rightkern,current))
end
end
end
@@ -2157,12 +2157,12 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- pre = insert_node_before(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
+ pre = insertnodebefore(pre,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(pre,n,somekern(fontkern,xscaled(n,rightkern),n))
+ insertnodeafter(pre,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
if hasmarks then
@@ -2188,13 +2188,13 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- post = insert_node_before(post,n,somekern(fontkern,xscaled(n,leftkern),n))
+ post = insertnodebefore(post,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
done = true
- insert_node_after(post,n,somekern(fontkern,xscaled(n,rightkern),n))
+ insertnodeafter(post,n,somekern(fontkern,xscaled(n,rightkern),n))
end
if hasmarks then
local pm = i.markbasenode
@@ -2219,12 +2219,12 @@ local function inject_everything(head,where)
end
local leftkern = i.leftkern
if leftkern and leftkern ~= 0 then
- replace = insert_node_before(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
+ replace = insertnodebefore(replace,n,somekern(fontkern,xscaled(n,leftkern),n))
done = true
end
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- insert_node_after(replace,n,somekern(fontkern,xscaled(n,rightkern),n))
+ insertnodeafter(replace,n,somekern(fontkern,xscaled(n,rightkern),n))
done = true
end
if hasmarks then
@@ -2246,7 +2246,7 @@ local function inject_everything(head,where)
-- glyph|pre glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- pre = insert_node_before(pre,pre,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
+ pre = insertnodebefore(pre,pre,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
done = true
end
end
@@ -2260,7 +2260,7 @@ local function inject_everything(head,where)
-- glyph|replace glyphs
local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
- replace = insert_node_before(replace,replace,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
+ replace = insertnodebefore(replace,replace,somekern(fontkern,xscaled(prevglyph,rightkern),prevglyph))
done = true
end
end
@@ -2446,8 +2446,8 @@ local function injectspaces(head)
end
lnew = lnew * xscale
rnew = rnew * xscale
- head = insert_node_before(head,n,italickern(lnew))
- insert_node_after(head,n,italickern(rnew))
+ head = insertnodebefore(head,n,italickern(lnew))
+ insertnodeafter(head,n,italickern(rnew))
else
local new = old + (leftkern + rightkern) * factor
if trace_spaces then
@@ -2463,7 +2463,7 @@ local function injectspaces(head)
report_spaces("%C [%p + %p]",prevchar,old,new)
end
new = new * xscale
- insert_node_after(head,n,italickern(new)) -- tricky with traverse but ok
+ insertnodeafter(head,n,italickern(new)) -- tricky with traverse but ok
else
local new = old + leftkern * factor * xscale
if trace_spaces then
@@ -2482,7 +2482,7 @@ local function injectspaces(head)
if trace_spaces then
report_spaces("[%p + %p] %C",old,new,nextchar)
end
- insert_node_after(head,n,italickern(new))
+ insertnodeafter(head,n,italickern(new))
else
new = old + new
if trace_spaces then
diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt
index 84ca14488..def09684a 100644
--- a/tex/context/base/mkxl/font-ots.lmt
+++ b/tex/context/base/mkxl/font-ots.lmt
@@ -213,29 +213,31 @@ local getscales = nuts.getscales
-- their positions because some complex ligatures might need that. For the moment we
-- use an x_ prefix because for now generic follows the other approach.
-local copy_no_components = nuts.copy_no_components
-local copy_only_glyphs = nuts.copy_only_glyphs
-local count_components = nuts.count_components
-local set_components = nuts.set_components
-local get_components = nuts.get_components
-local flush_components = nuts.flush_components
+local components = nuts.components
+local copynocomponents = components.copynocomponents
+local copyonlyglyphs = components.copyonlyglyphs
+local countcomponents = components.count
+local setcomponents = components.set
+local getcomponents = components.get
+local flushcomponents = components.flush
---------------------------------------------------------------------------------------
local ischar = nuts.ischar
local isnextchar = nuts.isnextchar -- only makes sense when we know we need next
local isprevchar = nuts.isprevchar -- only makes sense when we know we need prev
-local usesfont = nuts.uses_font
-
-local insert_node_after = nuts.insert_after
-local copy_node = nuts.copy
-local copy_node_list = nuts.copy_list
-local remove_node = nuts.remove
-local find_node_tail = nuts.tail
-local flush_node_list = nuts.flush_list
-local flush_node = nuts.flush_node
-local end_of_math = nuts.end_of_math
-local start_of_par = nuts.start_of_par
+local usesfont = nuts.usesfont
+
+local insertnodeafter = nuts.insertafter
+local copynode = nuts.copy
+local copynodelist = nuts.copylist
+local removenode = nuts.remove
+local findnodetail = nuts.tail
+local flushnodelist = nuts.flushlist
+local flushnode = nuts.flushnode
+local endofmath = nuts.endofmath
+
+local startofpar = nuts.startofpar
local setmetatable = setmetatable
local setmetatableindex = table.setmetatableindex
@@ -320,13 +322,6 @@ local checkstep = (tracers and tracers.steppers.check) or function()
local registerstep = (tracers and tracers.steppers.register) or function() end
local registermessage = (tracers and tracers.steppers.message) or function() end
--- local function checkdisccontent(d)
--- local pre, post, replace = getdisc(d)
--- if pre then for n in traverse_id(glue_code,pre) do report("pre: %s",nodes.idstostring(pre)) break end end
--- if post then for n in traverse_id(glue_code,post) do report("pos: %s",nodes.idstostring(post)) break end end
--- if replace then for n in traverse_id(glue_code,replace) do report("rep: %s",nodes.idstostring(replace)) break end end
--- end
-
local function logprocess(...)
if trace_steps then
registermessage(...)
@@ -426,12 +421,12 @@ local function flattendisk(head,disc)
local prev, next = getboth(disc)
local ishead = head == disc
setdisc(disc)
- flush_node(disc)
+ flushnode(disc)
if pre then
- flush_node_list(pre)
+ flushnodelist(pre)
end
if post then
- flush_node_list(post)
+ flushnodelist(post)
end
if ishead then
if replace then
@@ -461,7 +456,7 @@ end
local function appenddisc(disc,list)
local pre, post, replace, pretail, posttail, replacetail = getdisc(disc,true)
local posthead = list
- local replacehead = copy_node_list(list)
+ local replacehead = copynodelist(list)
if post then
setlink(posttail,posthead)
else
@@ -483,16 +478,16 @@ local function markstoligature(head,start,stop,char)
local next = getnext(stop)
setprev(start)
setnext(stop)
- local base = copy_no_components(start,copyinjection)
+ local base = copynocomponents(start,copyinjection)
if head == start then
head = base
end
resetinjection(base)
setchar(base,char)
setsubtype(base,ligatureglyph_code)
- set_components(base,start)
+ setcomponents(base,start)
setlink(prev,base,next)
- flush_components(start)
+ flushcomponents(start)
return head, base
end
end
@@ -514,7 +509,7 @@ local no_right_ligature_code = glyphoptioncodes.norightligature
local no_left_kern_code = glyphoptioncodes.noleftkern
local no_right_kern_code = glyphoptioncodes.norightkern
-local has_glyph_option = nuts.has_glyph_option
+local hasglyphoption = nuts.hasglyphoption
-- in lmtx we need to check the components and can be slightly more clever
@@ -522,18 +517,18 @@ local function inhibited(start,stop)
for n in nextnode, start do
-- we asume glyph nodes
if n == start then
- if has_glyph_option(n,no_right_ligature_code) then
+ if hasglyphoption(n,no_right_ligature_code) then
return true
end
elseif n == stop then
- if has_glyph_option(n,no_left_ligature_code) then
+ if hasglyphoption(n,no_left_ligature_code) then
return true
else
return false
end
- elseif has_glyph_option(n,no_left_ligature_code) then
+ elseif hasglyphoption(n,no_left_ligature_code) then
return true
- elseif has_glyph_option(n,no_right_ligature_code) then
+ elseif hasglyphoption(n,no_right_ligature_code) then
return true
end
end
@@ -554,7 +549,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
local comp = start
setprev(start)
setnext(stop)
- local base = copy_no_components(start,copyinjection)
+ local base = copynocomponents(start,copyinjection)
if start == head then
head = base
end
@@ -562,7 +557,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
setchar(base,char)
setoptions(base,getoptions(start) | getoptions(stop)) -- maybe only lig options
setsubtype(base,ligatureglyph_code)
- set_components(base,comp)
+ setcomponents(base,comp)
setlink(prev,base,next)
if not discfound then
local deletemarks = not skiphash or hasmarks
@@ -576,7 +571,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
local char = getchar(start)
if not marks[char] then
baseindex = baseindex + componentindex
- componentindex = count_components(start,marks)
+ componentindex = countcomponents(start,marks)
-- we can be more clever here: "not deletemarks or (skiphash and not skiphash[char])"
-- and such:
elseif not deletemarks then
@@ -585,9 +580,9 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
if trace_marks then
logwarning("%s: keep ligature mark %s, gets index %s",pref(dataset,sequence),gref(char),getligaindex(start))
end
- local n = copy_node(start)
+ local n = copynode(start)
copyinjection(n,start) -- is this ok ? we position later anyway
- head, current = insert_node_after(head,current,n) -- unlikely that mark has components
+ head, current = insertnodeafter(head,current,n) -- unlikely that mark has components
elseif trace_marks then
logwarning("%s: delete ligature mark %s",pref(dataset,sequence),gref(char))
end
@@ -612,7 +607,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
break
end
end
- flush_components(components)
+ flushcomponents(components)
else
-- discfound ... forget about marks .. probably no scripts that hyphenate and have marks
local discprev, discnext = getboth(discfound)
@@ -624,8 +619,8 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
if not replace then
-- looks like we never come here as it's not okay
local prev = getprev(base)
- -- local comp = get_components(base) -- already set
- local copied = copy_only_glyphs(comp)
+ -- local comp = getcomponents(base) -- already set
+ local copied = copyonlyglyphs(comp)
if pre then
setlink(discprev,pre)
else
@@ -642,7 +637,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
setlink(prev,discfound,next)
setboth(base)
-- here components have a pointer so we can't free it!
- set_components(base,copied)
+ setcomponents(base,copied)
replace = base
if forcediscretionaries then
setdisc(discfound,pre,post,replace,discretionarydisc_code)
@@ -669,10 +664,10 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what t
-- while ignoremarks and marks[getchar(sn)] then
-- local sn = getnext(sn)
-- end
- local n = copy_node(start) -- ignore components
+ local n = copynode(start) -- ignore components
resetinjection(n)
setchar(n,multiple[k])
- insert_node_after(head,start,n)
+ insertnodeafter(head,start,n)
start = n
end
if what == true then
@@ -680,10 +675,10 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what t
elseif what > 1 then
local m = multiple[nofmultiples]
for i=2,what do
- local n = copy_node(start) -- ignore components
+ local n = copynode(start) -- ignore components
resetinjection(n)
setchar(n,m)
- insert_node_after(head,start,n)
+ insertnodeafter(head,start,n)
start = n
end
end
@@ -782,7 +777,7 @@ end
-- Blocking is nasty: (ff\zwj l) vs (ff\zwj l) vs (ffl) vs (f\zwj fl}
function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skiphash)
- if start and has_glyph_option(start,no_right_ligature_code) then
+ if start and hasglyphoption(start,no_right_ligature_code) then
return head, start, false, nil
end
local current = getnext(start)
@@ -794,7 +789,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
if skiphash and skiphash[startchar] then
while current do
local nxt, char = isnextchar(current,currentfont,currentdynamic,currentscale,currentxscale,currentyscale)
- if char and not has_glyph_option(current,no_left_ligature_code) then
+ if char and not hasglyphoption(current,no_left_ligature_code) then
local lg = ligature[char]
if lg then
stop = current
@@ -830,7 +825,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
if char then
if skiphash and skiphash[char] then
current = nxt
- elseif has_glyph_option(current,no_left_ligature_code) then
+ elseif hasglyphoption(current,no_left_ligature_code) then
break
else
local lg = ligature[char]
@@ -868,13 +863,13 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
local match
if replace then
local nxt, char = isnextchar(replace,currentfont,currentdynamic,currentscale,currentxscale,currentyscale)
- if char and ligature[char] and not has_glyph_option(replace,no_left_ligature_code) then
+ if char and ligature[char] and not hasglyphoption(replace,no_left_ligature_code) then
match = true
end
end
if not match and pre then
local nxt, char = isnextchar(pre,currentfont,currentdynamic,currentscale,currentxscale,currentyscale)
- if char and ligature[char] and not has_glyph_option(pre,no_left_ligature_code) then
+ if char and ligature[char] and not hasglyphoption(pre,no_left_ligature_code) then
match = true
end
end
@@ -882,7 +877,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
if not match and not pre or not replace then
local ndf = getnext(discfound)
local nxt, char = isnextchar(ndf,currentfont,currentdynamic,currentscale,currentxscale,currentyscale)
- if char and ligature[char] and not has_glyph_option(ndf,no_left_ligature_code) then
+ if char and ligature[char] and not hasglyphoption(ndf,no_left_ligature_code) then
match = true
end
end
@@ -892,9 +887,9 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
local prev = getprev(start)
if stop then
setnext(stop)
- local copy = copy_node_list(start)
+ local copy = copynodelist(start)
local tail = stop -- was: getprev(stop) -- Kai: needs checking on your samples
- local liat = find_node_tail(copy)
+ local liat = findnodetail(copy)
if pre then
setlink(liat,pre)
end
@@ -905,7 +900,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
replace = start
else
setnext(start)
- local copy = copy_node(start)
+ local copy = copynode(start)
if pre then
setlink(copy,pre)
end
@@ -957,7 +952,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
end
function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection)
- if has_glyph_option(start,no_right_kern_code) then
+ if hasglyphoption(start,no_right_kern_code) then
return head, start, false
else
local startchar = getchar(start)
@@ -978,7 +973,7 @@ function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash,
end
function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection)
- if has_glyph_option(start,no_right_kern_code) then
+ if hasglyphoption(start,no_right_kern_code) then
return head, start, false
else
local snext = getnext(start)
@@ -1357,7 +1352,7 @@ function chainprocs.gsub_remove(head,start,stop,dataset,sequence,currentlookup,r
if trace_chains then
logprocess("%s: removing character %s",cref(dataset,sequence,chainindex),gref(getchar(start)))
end
- head, start = remove_node(head,start,true)
+ head, start = removenode(head,start,true)
return head, getprev(start), true
end
@@ -1486,7 +1481,7 @@ assume rather stupid ligatures (no complex disc nodes).
-- compare to handlers.gsub_ligature which is more complex ... why
function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
- if start and has_glyph_option(start,no_right_ligature_code) then
+ if start and hasglyphoption(start,no_right_ligature_code) then
return head, start, false, 0, false
end
local mapping = currentlookup.mapping
@@ -1509,7 +1504,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
while current do
local nxt, schar, id = isnextchar(current,currentfont,currentdynamic,currentscale,currentxscale,currentyscale)
if schar then
-if current and has_glyph_option(current,no_left_ligature_code) then
+if current and hasglyphoption(current,no_left_ligature_code) then
break
end
if skiphash and skiphash[schar] then -- marks
@@ -1577,7 +1572,7 @@ end
function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
-- we actually should check no_left_kern_code with next
- if not has_glyph_option(start,no_right_kern_code) then
+ if not hasglyphoption(start,no_right_kern_code) then
local mapping = currentlookup.mapping
if mapping == nil then
mapping = getmapping(dataset,sequence,currentlookup)
@@ -1607,7 +1602,7 @@ end
function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) -- todo: injections ?
-- we actually should check no_left_kern_code with next
- if not has_glyph_option(start,no_right_kern_code) then
+ if not hasglyphoption(start,no_right_kern_code) then
local mapping = currentlookup.mapping
if mapping == nil then
mapping = getmapping(dataset,sequence,currentlookup)
@@ -1959,7 +1954,7 @@ do if not userkern then -- generic
local setkern = nuts.setkern -- not injections.setkern
userkern = function(k)
- local n = copy_node(thekern)
+ local n = copynode(thekern)
setkern(n,k)
return n
end
@@ -1976,13 +1971,13 @@ local function checked(head)
if next then
setlink(kern,next)
end
- flush_node(current)
+ flushnode(current)
head = kern
current = next
else
local prev, next = getboth(current)
setlink(prev,kern,next)
- flush_node(current)
+ flushnode(current)
current = next
end
else
@@ -2216,7 +2211,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
tail = prev
setprev(current,sweepnode)
else
- tail = find_node_tail(head)
+ tail = findnodetail(head)
end
setnext(sweepnode,current)
setprev(head)
@@ -2334,13 +2329,13 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
head = lookaheaddisc
end
local pre, post, replace = getdisc(lookaheaddisc)
- local new = copy_node_list(cf) -- br, how often does that happen
+ local new = copynodelist(cf) -- br, how often does that happen
local cnew = new
if pre then
- setlink(find_node_tail(cf),pre)
+ setlink(findnodetail(cf),pre)
end
if replace then
- local tail = find_node_tail(new)
+ local tail = findnodetail(new)
setlink(tail,replace)
end
for i=1,insertedmarks do
@@ -2396,8 +2391,8 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
setprev(cf)
setnext(cl)
local pre, post, replace, pretail, posttail, replacetail = getdisc(backtrackdisc,true)
- local new = copy_node_list(cf)
- local cnew = find_node_tail(new)
+ local new = copynodelist(cf)
+ local cnew = findnodetail(new)
for i=1,insertedmarks do
cnew = getprev(cnew)
end
@@ -3297,7 +3292,7 @@ local function testrun(disc,t_run,c_run,...)
next = getnext(tail)
setnext(tail)
setprev(head)
- local new = copy_node_list(head)
+ local new = copynodelist(head)
if posttail then
setlink(posttail,head)
else
@@ -3794,7 +3789,7 @@ do
local initialrl = 0
- if getid(head) == par_code and start_of_par(head) then
+ if getid(head) == par_code and startofpar(head) then
initialrl = pardirstate(head)
elseif direction == righttoleft_code then
initialrl = -1
@@ -3839,7 +3834,7 @@ do
-- the before and after lists in the loader. But first I need to see a font that uses multiple
-- matches.
--
- local start = find_node_tail(head)
+ local start = findnodetail(head)
local rlmode = 0 -- how important is this .. do we need to check for dir?
local merged = steps.merged
while start do
@@ -3917,11 +3912,11 @@ do
start = nxt
end
elseif id == math_code then
- start = getnext(end_of_math(start))
+ start = getnext(endofmath(start))
elseif id == dir_code then
topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode)
start = nxt
- -- elseif id == par_code and start_of_par(start) then
+ -- elseif id == par_code and startofpar(start) then
-- rlparmode, rlmode = pardirstate(start)
-- start = nxt
else
@@ -3984,11 +3979,11 @@ do
start = nxt
end
elseif id == math_code then
- start = getnext(end_of_math(start))
+ start = getnext(endofmath(start))
elseif id == dir_code then
topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode)
start = nxt
- -- elseif id == par_code and start_of_par(start) then
+ -- elseif id == par_code and startofpar(start) then
-- rlparmode, rlmode = pardirstate(start)
-- start = nxt
else
@@ -4103,11 +4098,11 @@ do
-- a different font|state or glue (happens often)
start = nxt
elseif id == math_code then
- start = getnext(end_of_math(start))
+ start = getnext(endofmath(start))
elseif id == dir_code then
topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode)
start = nxt
- -- elseif id == par_code and start_of_par(start) then
+ -- elseif id == par_code and startofpar(start) then
-- rlparmode, rlmode = pardirstate(start)
-- start = nxt
else
diff --git a/tex/context/base/mkxl/font-phb.lmt b/tex/context/base/mkxl/font-phb.lmt
index 43edfd33f..67b068885 100644
--- a/tex/context/base/mkxl/font-phb.lmt
+++ b/tex/context/base/mkxl/font-phb.lmt
@@ -388,7 +388,7 @@ local function harfbuzz(head,font,dynamic,rlmode,start,stop,text,leading,trailin
if trace_colors then
resetcolor(g)
end
- setlink(current,g,getnext(current)) -- insert_before
+ setlink(current,g,getnext(current))
current = g
copied = true
else
diff --git a/tex/context/base/mkxl/font-txt.lmt b/tex/context/base/mkxl/font-txt.lmt
index bc2f15464..29d3ca240 100644
--- a/tex/context/base/mkxl/font-txt.lmt
+++ b/tex/context/base/mkxl/font-txt.lmt
@@ -103,15 +103,15 @@ local getwidth = nuts.getwidth
local ischar = nuts.ischar
local isnextchar = nuts.isnextchar
local isglyph = nuts.isglyph
-local traverse_id = nuts.traverse_id
-local usesfont = nuts.uses_font
+local usesfont = nuts.usesfont
-local copy_node_list = nuts.copy_list
+local copy_node_list = nuts.copylist
local find_node_tail = nuts.tail
-local flush_list = nuts.flush_list
-local free_node = nuts.free
-local end_of_math = nuts.end_of_math
-local start_of_par = nuts.start_of_par
+local flushlist = nuts.flushlist
+local freenode = nuts.free
+local endofmath = nuts.endofmath
+
+local startofpar = nuts.startofpar
local nodecodes = nodes.nodecodes
@@ -140,10 +140,10 @@ local function deletedisc(head)
local pre, post, replace, pre_tail, post_tail, replace_tail = getdisc(current,true)
setdisc(current)
if pre then
- flush_list(pre)
+ flushlist(pre)
end
if post then
- flush_list(post)
+ flushlist(post)
end
local p, n = getboth(current)
if replace then
@@ -160,7 +160,7 @@ local function deletedisc(head)
else
setlink(p,n)
end
- free_node(current)
+ freenode(current)
end
current = next
end
@@ -264,7 +264,7 @@ do
stopspacing = false
end
- if getid(head) == par_code and start_of_par(head) then
+ if getid(head) == par_code and startofpar(head) then
rlmode = pardirstate(head)
elseif rlmode == righttoleft_code then
rlmode = -1
@@ -448,7 +448,7 @@ do
else
setnext(getprev(cpostnew))
end
- flush_list(cpostnew)
+ flushlist(cpostnew)
if creplacenew == current_replace then
current_replace = nil
else
@@ -481,7 +481,7 @@ do
setprev(current_pre)
end
setnext(cprenew)
- flush_list(cpre)
+ flushlist(cpre)
creplace = current_replace
current_replace = getnext(creplacenew)
if current_replace then
@@ -502,12 +502,12 @@ do
startspacing = false
stopspacing = false
if id == math_code then
- current = getnext(end_of_math(current))
+ current = getnext(endofmath(current))
elseif id == dir_code then
startspacing = false
topstack, rlmode = txtdirstate(current,dirstack,topstack,rlparmode)
current = getnext(current)
- -- elseif id == par_code and start_of_par(current) then
+ -- elseif id == par_code and startofpar(current) then
-- startspacing = false
-- rlparmode, rlmode = pardirstate(current)
-- current = getnext(current)
diff --git a/tex/context/base/mkxl/good-mth.lmt b/tex/context/base/mkxl/good-mth.lmt
index 578ea8555..c78fdbf71 100644
--- a/tex/context/base/mkxl/good-mth.lmt
+++ b/tex/context/base/mkxl/good-mth.lmt
@@ -36,7 +36,7 @@ local new_glyph = nodepool.glyph
local new_hlist = nodepool.hlist
local new_vlist = nodepool.vlist
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
local helpers = fonts.helpers
local upcommand = helpers.commands.up
@@ -367,7 +367,7 @@ local function mathradicalaction(n,h,v,font,mchar,echar)
local kern = new_kern(height-v)
list = setlink(kern,list)
local list = new_vlist(kern)
- insert_node_after(n,n,list)
+ insertnodeafter(n,n,list)
end
local function mathhruleaction(n,h,v,font,bchar,mchar,echar)
@@ -403,7 +403,7 @@ local function mathhruleaction(n,h,v,font,bchar,mchar,echar)
local kern = new_kern(height-v)
list = setlink(kern,list)
local list = new_vlist(kern)
- insert_node_after(n,n,list)
+ insertnodeafter(n,n,list)
end
local function initialize(tfmdata)
diff --git a/tex/context/base/mkxl/grph-inc.lmt b/tex/context/base/mkxl/grph-inc.lmt
index f644e9b5b..4ac980682 100644
--- a/tex/context/base/mkxl/grph-inc.lmt
+++ b/tex/context/base/mkxl/grph-inc.lmt
@@ -78,9 +78,10 @@ local resolveprefix = resolvers.resolve
local texgetbox = tex.getbox
local texsetbox = tex.setbox
-local hpack = node.hpack
+local hpack = nodes.hpack
local new_latelua = nodes.pool.latelua
+local new_hlist = nodes.pool.hlist
local context = context
@@ -1392,7 +1393,7 @@ end
function figures.dummy(data)
data = data or callstack[#callstack] or lastfiguredata
local dr, du, nr = data.request, data.used, figures.boxnumber
- local box = hpack(node.new("hlist")) -- we need to set the dir (luatex 0.60 buglet)
+ local box = hpack(new_hlist()) -- we need to set the dir (luatex 0.60 buglet)
du.width = du.width or figures.defaultwidth
du.height = du.height or figures.defaultheight
du.depth = du.depth or figures.defaultdepth
diff --git a/tex/context/base/mkxl/lang-dis.lmt b/tex/context/base/mkxl/lang-dis.lmt
index 263225691..1236ba749 100644
--- a/tex/context/base/mkxl/lang-dis.lmt
+++ b/tex/context/base/mkxl/lang-dis.lmt
@@ -36,8 +36,7 @@ local isglyph = nuts.isglyph
local copy_node = nuts.copy
local remove_node = nuts.remove
-local flush_list = nuts.flush_list
-local flush_node = nuts.flush_node
+----- flushnode = nuts.flushnode
local nextdisc = nuts.traversers.disc
@@ -124,12 +123,12 @@ end
local wiped = 0
-local flatten_discretionaries = nuts.flatten_discretionaries -- todo in nodes
+local flattendiscretionaries = nuts.flattendiscretionaries -- todo in nodes
--- if flatten_discretionaries then
+-- if flattendiscretionaries then
function languages.flatten(head)
- local h, n = flatten_discretionaries(head)
+ local h, n = flattendiscretionaries(head)
wiped = wiped + n
return h, n > 0
end
@@ -152,7 +151,7 @@ local flatten_discretionaries = nuts.flatten_discretionaries -- todo in nodes
-- head = h
-- end
-- wiped = wiped + 1
--- flush_node(delayed)
+-- flushnode(delayed)
-- return head
-- end
--
diff --git a/tex/context/base/mkxl/lang-hyp.lmt b/tex/context/base/mkxl/lang-hyp.lmt
index d75af4f46..590528495 100644
--- a/tex/context/base/mkxl/lang-hyp.lmt
+++ b/tex/context/base/mkxl/lang-hyp.lmt
@@ -656,12 +656,12 @@ if context then
local setprev = nuts.setprev
local setnext = nuts.setnext
- local insert_before = nuts.insert_before
- local insert_after = nuts.insert_after
+ local insertbefore = nuts.insertbefore
+ local insertafter = nuts.insertafter
local copy_node = nuts.copy
- local copy_list = nuts.copy_list
+ local copylist = nuts.copylist
local remove_node = nuts.remove
- local end_of_math = nuts.end_of_math
+ local endofmath = nuts.endofmath
local node_tail = nuts.tail
local nexthlist = nuts.traversers.hlist
@@ -1087,7 +1087,7 @@ featureset.hyphenonly = hyphenonly == v_yes
nuts.setvisual(p,"penalty")
end
last = getprev(last)
- first, last = insert_after(first,last,p)
+ first, last = insertafter(first,last,p)
end
local function synchronizefeatureset(a)
@@ -1245,7 +1245,7 @@ featureset.hyphenonly = hyphenonly == v_yes
local glyph = copy_node(stop)
setchar(glyph,characters[replacement])
if head then
- insert_after(current,current,glyph)
+ insertafter(current,current,glyph)
else
head = glyph
end
@@ -1256,7 +1256,7 @@ featureset.hyphenonly = hyphenonly == v_yes
local glyph = copy_node(stop)
setchar(glyph,characters[list[i]])
if head then
- insert_after(current,current,glyph)
+ insertafter(current,current,glyph)
else
head = glyph
end
@@ -1265,7 +1265,7 @@ featureset.hyphenonly = hyphenonly == v_yes
end
if rightchar then
local glyph = copy_node(stop)
- insert_after(current,current,glyph)
+ insertafter(current,current,glyph)
setchar(glyph,rightchar)
end
return head
@@ -1291,7 +1291,7 @@ featureset.hyphenonly = hyphenonly == v_yes
setattrlist(disc,attrnode)
end
-- could be a replace as well
- insert_before(first,current,disc)
+ insertbefore(first,current,disc)
elseif type(r) == "table" then
local disc = new_disc()
local pre = r[1]
@@ -1325,7 +1325,7 @@ featureset.hyphenonly = hyphenonly == v_yes
if attrnode then
setattrlist(disc,attrnode)
end
- insert_before(first,current,disc)
+ insertbefore(first,current,disc)
else
setchar(current,characters[r])
if i < rsize then
@@ -1347,7 +1347,7 @@ featureset.hyphenonly = hyphenonly == v_yes
if first ~= current then
local disc = new_disc()
first, current, glyph = remove_node(first,current)
- first, current = insert_before(first,current,disc)
+ first, current = insertbefore(first,current,disc)
if trace_visualize then
setcolor(glyph,"darkred") -- these get checked
setcolor(disc,"darkgreen") -- in the colorizer
@@ -1372,7 +1372,7 @@ featureset.hyphenonly = hyphenonly == v_yes
local function injectseries(current,last,next,attrnode)
local disc = new_disc()
local start = current
- first, current = insert_before(first,current,disc)
+ first, current = insertbefore(first,current,disc)
setprev(start)
setnext(last)
if next then
@@ -1380,7 +1380,7 @@ featureset.hyphenonly = hyphenonly == v_yes
else
setnext(current)
end
- local pre = copy_list(start)
+ local pre = copylist(start)
local post = nil
local replace = start
setdisc(disc,pre,post,replace,automaticdisc_code,hyphenpenalty) -- ex ?
@@ -1547,10 +1547,10 @@ featureset.hyphenonly = hyphenonly == v_yes
skipping = true
end
-- elseif strict and strict[id] then
- -- current = id == math_code and getnext(end_of_math(current)) or getnext(current)
+ -- current = id == math_code and getnext(endofmath(current)) or getnext(current)
-- size = 0
else
- current = id == math_code and getnext(end_of_math(current)) or getnext(current)
+ current = id == math_code and getnext(endofmath(current)) or getnext(current)
end
if size > 0 then
if dictionary and size > charmin and leftmin + rightmin <= size then
diff --git a/tex/context/base/mkxl/lang-ini.lmt b/tex/context/base/mkxl/lang-ini.lmt
index c80c57a73..5bfc9e1bb 100644
--- a/tex/context/base/mkxl/lang-ini.lmt
+++ b/tex/context/base/mkxl/lang-ini.lmt
@@ -15,8 +15,6 @@ if not modules then modules = { } end modules ['lang-ini'] = {
-- 2011 : nonbreakable hyphen
-- 2013 : endash (compound hyphen)
---~ language:hyphenation(string) string = language:hyphenation() language:clear_hyphenation()
-
-- todo: no foo:bar but foo(bar,...)
-- https://wortschatz.uni-leipzig.de/de/download/German : lots of lists
@@ -363,8 +361,8 @@ local function loaddefinitions(tag,specification)
if trace_patterns then
report_initialization("clearing patterns for language %a",tag)
end
- instance:clear_patterns()
- instance:clear_hyphenation()
+ instance:clearpatterns()
+ instance:clearhyphenation()
ploaded = { }
eloaded = { }
elseif not dataused[definition] then
@@ -405,12 +403,12 @@ local function loaddefinitions(tag,specification)
end
if #ploaded > 0 then
-- why not always clear
- instance:clear_patterns()
+ instance:clearpatterns()
instance:patterns(unique(tag,requested,ploaded))
end
if #eloaded > 0 then
-- why not always clear
- instance:clear_hyphenation()
+ instance:clearhyphenation()
instance:hyphenation(concat(eloaded," "))
end
if type(shared) == "string" then
@@ -623,7 +621,7 @@ do
local new_disc = nuts.pool.disc
local new_glyph = nuts.pool.glyph
local copy_node = nuts.copy
- local flush_list = nuts.flush_list
+ local flushlist = nuts.flushlist
local glyphoptioncodes = tex.glyphoptioncodes
@@ -720,7 +718,7 @@ do
local before = getprev(first)
setnext(last)
setlink(before,after)
- flush_list(first)
+ flushlist(first)
end
else
local i = 0
diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt
index 928aea7cf..bfbbf118d 100644
--- a/tex/context/base/mkxl/lpdf-emb.lmt
+++ b/tex/context/base/mkxl/lpdf-emb.lmt
@@ -1514,7 +1514,7 @@ do
local f_image_w = formatters["%.6N 0 d0 %s"]
local f_image_d = formatters["%.6N 0 d0 1 0 0 1 0 %.6N cm /%s Do"]
local f_stream = formatters["%.6N 0 d0 %s"]
- local f_stream_c = formatters["%.6N 0 0 0 0 0 d1 %s"]
+ local f_stream_c = formatters["%.6N 0 0 0 0 0 d1 %s"] -- last four bbox
local f_stream_d = formatters["%.6N 0 d0 1 0 0 1 0 %.6N cm %s"]
-- local f_stream_s = formatters["%.6N 0 0 %.6N 0 0 cm /%s Do"]
@@ -1534,7 +1534,7 @@ do
-- pk inclusion (not really tested but not really used either)
function methods.pk(filename)
- local pkfullname = resolvers.findpk(basedfontname,resolution)
+ local pkfullname = resolvers.findpk(filename,resolution)
if not pkfullname or pkfullname == "" then
return
end
@@ -1845,7 +1845,7 @@ do
if not method then
return
end
- local glyphs, scalefactor, glyphtopdf, reset, getresources = method(basedfontname,details)
+ local glyphs, scalefactor, glyphtopdf, reset, getresources = method(basefontname,details)
if not glyphs then
return
end
diff --git a/tex/context/base/mkxl/lpdf-fld.lmt b/tex/context/base/mkxl/lpdf-fld.lmt
index eacbb085d..4c17a47fe 100644
--- a/tex/context/base/mkxl/lpdf-fld.lmt
+++ b/tex/context/base/mkxl/lpdf-fld.lmt
@@ -107,7 +107,7 @@ local pdfcolor = lpdf.color
local pdfcolorvalues = lpdf.colorvalues
local pdflayerreference = lpdf.layerreference
-local hpack_node = node.hpack
+local hpack_node = nodes.hpack
local submitoutputformat = 0 -- 0=unknown 1=HTML 2=FDF 3=XML => not yet used, needs to be checked
diff --git a/tex/context/base/mkxl/lpdf-img.lmt b/tex/context/base/mkxl/lpdf-img.lmt
index e1b822210..6914b2b29 100644
--- a/tex/context/base/mkxl/lpdf-img.lmt
+++ b/tex/context/base/mkxl/lpdf-img.lmt
@@ -18,6 +18,15 @@ if not modules then modules = { } end modules ['lpdf-img'] = {
-- wanted but best gain a little. The idea is that we collect striped (in stages) so
-- that we can play with substitutions. We keep this variant commented but not
-- embedding it saves some 14K bytecode in the format.
+--
+-- We keep the \LUA\ code commented because it is what I started with from the \PNG\
+-- specification. It was one fo the first things needed for dropping the backend so
+-- actually this was part of the first \LUA\ based \PDF\ backend, the one that for a
+-- while was part of \MKIV. That bit of development was not widely advertized and
+-- just for me to make the transition and prove that it could be done. At some point
+-- I decided to not provide a generic backend so that cdoe went away. Reminder:
+-- there ended up some code here that was needed for font related png too (and I'd
+-- already forgotten about: I need to document that).
local type = type
local concat, move = table.concat, table.move
@@ -198,6 +207,7 @@ do
local pnginterlace = pngdecode.interlace
local pngexpand = pngdecode.expand
local pngtocmyk = pngdecode.tocmyk
+ local pngtomask = pngdecode.tomask
local filtermask, decodemask, decodestrip, transpose, expand, tocmyk
@@ -206,7 +216,7 @@ do
local function newoutput(size)
if newindex then
- return newindex(size,0)
+ return newindex(size,char(0))
end
local t = newtable and newtable(size,0) or { }
for i=1,size do
@@ -806,52 +816,65 @@ do
-- end
-- end
+ -- We had this for a while (the reference now):
+ --
+ -- local function createmask_c(content,palette,transparent,xsize,ysize,colordepth,colorspace)
+ -- if palette then
+ -- local r = expandvector(transparent)
+ -- local size = xsize*ysize
+ -- local len = ceil(xsize*colordepth/8)
+ -- local o = newoutput(size)
+ -- content = zlibdecompress(content)
+ -- content = pngapplyfilter(content,len,ysize,1) -- nostrip (saves copy)
+ -- content = openstring(content)
+ -- for i=0,ysize-1 do
+ -- local t = readbytetable(content,len)
+ -- local k = i * xsize
+ -- if colordepth == 8 then
+ -- for j=1,len do
+ -- local v = t[j]
+ -- k = k + 1 ; o[k] = r[v]
+ -- end
+ -- elseif colordepth == 4 then
+ -- for j=1,len do
+ -- local v = t[j]
+ -- k = k + 1 ; o[k] = r[(v >> 4) & 0x0F] -- r[extract4(v,4)]
+ -- k = k + 1 ; o[k] = r[(v >> 0) & 0x0F] -- r[extract4(v,0)]
+ -- end
+ -- elseif colordepth == 2 then
+ -- for j=1,len do
+ -- local v = t[j]
+ -- k = k + 1 ; o[k] = r[(v >> 6) & 0x03] -- r[extract2(v,6)]
+ -- k = k + 1 ; o[k] = r[(v >> 4) & 0x03] -- r[extract2(v,4)]
+ -- k = k + 1 ; o[k] = r[(v >> 2) & 0x03] -- r[extract2(v,2)]
+ -- k = k + 1 ; o[k] = r[(v >> 0) & 0x03] -- r[extract2(v,0)]
+ -- end
+ -- else
+ -- for j=1,len do
+ -- local v = t[j]
+ -- k = k + 1 ; o[k] = r[(v >> 7) & 0x01] -- r[extract1(v,7)]
+ -- k = k + 1 ; o[k] = r[(v >> 6) & 0x01] -- r[extract1(v,6)]
+ -- k = k + 1 ; o[k] = r[(v >> 5) & 0x01] -- r[extract1(v,5)]
+ -- k = k + 1 ; o[k] = r[(v >> 4) & 0x01] -- r[extract1(v,4)]
+ -- k = k + 1 ; o[k] = r[(v >> 3) & 0x01] -- r[extract1(v,3)]
+ -- k = k + 1 ; o[k] = r[(v >> 2) & 0x01] -- r[extract1(v,2)]
+ -- k = k + 1 ; o[k] = r[(v >> 1) & 0x01] -- r[extract1(v,1)]
+ -- k = k + 1 ; o[k] = r[(v >> 0) & 0x01] -- r[extract1(v,0)]
+ -- end
+ -- end
+ -- end
+ -- return concat(o,"",1,size)
+ -- end
+ -- end
+ --
+ -- But this is nicer for memory usage:
+
local function createmask_c(content,palette,transparent,xsize,ysize,colordepth,colorspace)
if palette then
- local r = expandvector(transparent)
- local size = xsize*ysize
- local len = ceil(xsize*colordepth/8)
- local o = newoutput(size)
- content = zlibdecompress(content)
- content = pngapplyfilter(content,len,ysize,1) -- nostrip (saves copy)
- content = openstring(content)
- for i=0,ysize-1 do
- local t = readbytetable(content,len)
- local k = i * xsize
- if colordepth == 8 then
- for j=1,len do
- local v = t[j]
- k = k + 1 ; o[k] = r[v]
- end
- elseif colordepth == 4 then
- for j=1,len do
- local v = t[j]
- k = k + 1 ; o[k] = r[(v >> 4) & 0x0F] -- r[extract4(v,4)]
- k = k + 1 ; o[k] = r[(v >> 0) & 0x0F] -- r[extract4(v,0)]
- end
- elseif colordepth == 2 then
- for j=1,len do
- local v = t[j]
- k = k + 1 ; o[k] = r[(v >> 6) & 0x03] -- r[extract2(v,6)]
- k = k + 1 ; o[k] = r[(v >> 4) & 0x03] -- r[extract2(v,4)]
- k = k + 1 ; o[k] = r[(v >> 2) & 0x03] -- r[extract2(v,2)]
- k = k + 1 ; o[k] = r[(v >> 0) & 0x03] -- r[extract2(v,0)]
- end
- else
- for j=1,len do
- local v = t[j]
- k = k + 1 ; o[k] = r[(v >> 7) & 0x01] -- r[extract1(v,7)]
- k = k + 1 ; o[k] = r[(v >> 6) & 0x01] -- r[extract1(v,6)]
- k = k + 1 ; o[k] = r[(v >> 5) & 0x01] -- r[extract1(v,5)]
- k = k + 1 ; o[k] = r[(v >> 4) & 0x01] -- r[extract1(v,4)]
- k = k + 1 ; o[k] = r[(v >> 3) & 0x01] -- r[extract1(v,3)]
- k = k + 1 ; o[k] = r[(v >> 2) & 0x01] -- r[extract1(v,2)]
- k = k + 1 ; o[k] = r[(v >> 1) & 0x01] -- r[extract1(v,1)]
- k = k + 1 ; o[k] = r[(v >> 0) & 0x01] -- r[extract1(v,0)]
- end
- end
- end
- return concat(o,"",1,size)
+ local len = ceil(xsize*colordepth/8)
+ content = zlibdecompress(content)
+ content = pngapplyfilter(content,len,ysize,1) -- nostrip (saves copy)
+ return pngtomask(content,transparent,xsize,ysize,colordepth)
end
end
diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt
index 6e6d7c4c9..036c64da9 100644
--- a/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -602,12 +602,12 @@ do
local move = calc_pdfpos(pos_h,pos_v)
-if trace_threshold then
+ if trace_threshold then
report(
- "before: font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
- font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw
- )
-end
+ "before: font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
+ font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw
+ )
+ end
if move or need_tm then
if not need_tm then
@@ -647,12 +647,13 @@ end
end
end
-if trace_threshold then
+ if trace_threshold then
report(
"after : font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw
)
-end
+ end
+
if mode == "chararray" then
begin_charmode()
end
@@ -971,7 +972,7 @@ local flushimage do
local getprop = nuts.getprop
local getwhd = nuts.getwhd
- local flushlist = nuts.flush_list
+ local flushlist = nuts.flushlist
local getdata = nuts.getdata
local normalrule_code = rulecodes.normal
diff --git a/tex/context/base/mkxl/lpdf-mov.lmt b/tex/context/base/mkxl/lpdf-mov.lmt
index 42ba6fb00..a0f82b25b 100644
--- a/tex/context/base/mkxl/lpdf-mov.lmt
+++ b/tex/context/base/mkxl/lpdf-mov.lmt
@@ -16,7 +16,6 @@ local pdfconstant = lpdf.constant
local pdfdictionary = lpdf.dictionary
local pdfarray = lpdf.array
local pdfborder = lpdf.border
-local write_node = node.write
function nodeinjections.insertmovie(specification)
-- managed in figure inclusion: width, height, factor, repeat, controls, preview, label, foundname
@@ -41,7 +40,7 @@ function nodeinjections.insertmovie(specification)
Movie = moviedict,
A = controldict,
}
- write_node(nodeinjections.annotation(width,height,0,action())) -- test: context(...)
+ context(nodeinjections.annotation(width,height,0,action())) -- test: context(...)
end
function nodeinjections.insertsound(specification)
@@ -63,6 +62,6 @@ function nodeinjections.insertsound(specification)
Movie = sounddict,
A = controldict,
}
- write_node(nodeinjections.annotation(0,0,0,action())) -- test: context(...)
+ context(nodeinjections.annotation(0,0,0,action())) -- test: context(...)
end
end
diff --git a/tex/context/base/mkxl/lpdf-wid.lmt b/tex/context/base/mkxl/lpdf-wid.lmt
index 53ba32812..8c0aa74af 100644
--- a/tex/context/base/mkxl/lpdf-wid.lmt
+++ b/tex/context/base/mkxl/lpdf-wid.lmt
@@ -43,6 +43,8 @@ local context = context
local texgetcount = tex.getcount
+local hpacknode = nodes.hpack
+
local nodeinjections = backends.pdf.nodeinjections
local codeinjections = backends.pdf.codeinjections
local registrations = backends.pdf.registrations
@@ -86,10 +88,6 @@ updaters.register("backend.update.lpdf",function()
pdfshareobjectreference = lpdf.shareobjectreference
end)
-
-local hpack_node = node.hpack
-local write_node = node.write -- test context(...) instead
-
-- symbols
local presets = { } -- xforms
@@ -464,7 +462,7 @@ function nodeinjections.attachfile(specification)
local width = specification.width or 0
local height = specification.height or 0
local depth = specification.depth or 0
- local box = hpack_node(nodeinjections.annotation(width,height,depth,d()))
+ local box = hpacknode(nodeinjections.annotation(width,height,depth,d()))
box.width = width
box.height = height
box.depth = depth
@@ -565,12 +563,12 @@ function nodeinjections.comment(specification) -- brrr: seems to be done twice
Parent = pdfreference(nd),
}
d.Popup = pdfreference(nc)
- box = hpack_node(
+ box = hpacknode(
nodeinjections.annotation(0,0,0,d(),nd),
nodeinjections.annotation(width,height,depth,c(),nc)
)
else
- box = hpack_node(nodeinjections.annotation(width,height,depth,d()))
+ box = hpacknode(nodeinjections.annotation(width,height,depth,d()))
end
box.width = width -- redundant
box.height = height -- redundant
@@ -663,7 +661,7 @@ local function insertrenderingwindow(specification)
if height == 0 or width == 0 then
-- todo: sound needs no window
end
- write_node(nodeinjections.annotation(width,height,0,d(),r)) -- save ref
+ context(nodeinjections.annotation(width,height,0,d(),r)) -- save ref
return pdfreference(r)
end
diff --git a/tex/context/base/mkxl/luat-cod.lmt b/tex/context/base/mkxl/luat-cod.lmt
index 9a74e4238..64c5e71f3 100644
--- a/tex/context/base/mkxl/luat-cod.lmt
+++ b/tex/context/base/mkxl/luat-cod.lmt
@@ -91,7 +91,7 @@ function lua.registercode(filename,options)
lua.lastbytecode = n
end
elseif environment.initex then
- texio.write_nl(format("\nerror loading file: %s (aborting)",filename))
+ texio.writenl(format("\nerror loading file: %s (aborting)",filename))
os.exit()
end
end
@@ -298,7 +298,7 @@ callback.register("trace_memory", function(what,success)
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 '%s' memory %s",
+ texio.writenl(format("bumping tex '%s' memory %s",
what,success))
end
-- os.exit()
diff --git a/tex/context/base/mkxl/luat-fio.lmt b/tex/context/base/mkxl/luat-fio.lmt
index c70ed54e4..228b346bc 100644
--- a/tex/context/base/mkxl/luat-fio.lmt
+++ b/tex/context/base/mkxl/luat-fio.lmt
@@ -32,7 +32,7 @@ if not resolvers.initialized() then
local ioflush = io.flush
local ioread = io.read
- local writenl = texio.write_nl
+ local writenl = texio.writenl
local function terminal()
writenl("\ntex console > ")
diff --git a/tex/context/base/mkxl/luat-log.lmt b/tex/context/base/mkxl/luat-log.lmt
index 522f4ac4f..fe55368f3 100644
--- a/tex/context/base/mkxl/luat-log.lmt
+++ b/tex/context/base/mkxl/luat-log.lmt
@@ -24,8 +24,8 @@ local utfchar = utf.char
local datetime = os.date
local openfile = io.open
-local write_nl = texio.write_nl
-local write = texio.write
+local writenl = texio.writeselectornl
+local write = texio.writeselector
local setmetatableindex = table.setmetatableindex
local formatters = string.formatters
@@ -120,13 +120,20 @@ do
status_nop = formatters["%-15s :\n"],
},
targets = setmetatableindex( {
- logfile = "logfile",
- log = "logfile",
- file = "logfile",
- console = "terminal",
- terminal = "terminal",
- both = "terminal_and_logfile",
- }, function(t,k) t[k] = "terminal_and_logfile" end),
+-- logfile = "logfile",
+-- log = "logfile",
+-- file = "logfile",
+-- console = "terminal",
+-- terminal = "terminal",
+-- both = "terminal_and_logfile",
+ logfile = 2,
+ log = 2,
+ file = 2,
+ console = 1,
+ terminal = 1,
+ both = 3,
+-- }, function(t,k) local v = "terminal_and_logfile" t[k] = v return v end),
+ }, function(t,k) local v = 3 t[k] = v return v end),
},
ansi = {
formats = {
@@ -145,10 +152,14 @@ do
logfile = false,
log = false,
file = false,
- console = "terminal",
- terminal = "terminal",
- both = "terminal",
- }, function(t,k) t[k] = "terminal" end),
+-- console = "terminal",
+-- terminal = "terminal",
+-- both = "terminal",
+ console = 1,
+ terminal = 1,
+ both = 1,
+-- }, function(t,k) local v = "terminal" t[k] = v return v end),
+ }, function(t,k) local v = 1 t[k] = v return v end),
}
}
@@ -161,13 +172,13 @@ do
writer = function(...)
if target then
- write_nl(target,...)
+ writenl(target,...)
end
end
newline = function()
if target then
- write_nl(target,"\n")
+ writenl(target)
end
end
@@ -175,13 +186,13 @@ do
if not target then
-- ignore
elseif c ~= nil then
- write_nl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
+ writenl(target,report_yes(translations[a],formatters[formats[b]](c,...)))
elseif b then
- write_nl(target,report_yes(translations[a],formats[b]))
+ writenl(target,report_yes(translations[a],formats[b]))
elseif a then
- write_nl(target,report_nop(translations[a]))
+ writenl(target,report_nop(translations[a]))
else
- write_nl(target,"\n")
+ writenl(target)
end
end
@@ -203,13 +214,13 @@ do
if not target then
-- ignore
elseif c ~= nil then
- write_nl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
+ writenl(target,subreport_yes(translations[a],translations[s],formatters[formats[b]](c,...)))
elseif b then
- write_nl(target,subreport_yes(translations[a],translations[s],formats[b]))
+ writenl(target,subreport_yes(translations[a],translations[s],formats[b]))
elseif a then
- write_nl(target,subreport_nop(translations[a],translations[s]))
+ writenl(target,subreport_nop(translations[a],translations[s]))
else
- write_nl(target,"\n")
+ writenl(target)
end
end
@@ -231,13 +242,13 @@ do
if not target then
-- ignore
elseif c ~= nil then
- write_nl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
+ writenl(target,status_yes(translations[a],formatters[formats[b]](c,...)))
elseif b then
- write_nl(target,status_yes(translations[a],formats[b]))
+ writenl(target,status_yes(translations[a],formats[b]))
elseif a then
- write_nl(target,status_nop(translations[a]))
+ writenl(target,status_nop(translations[a]))
else
- write_nl(target,"\n")
+ writenl(target)
end
end
@@ -277,8 +288,8 @@ do
end
setprocessor = function(f)
- local writeline = write_nl
- write_nl = function(target,...)
+ local writeline = writenl
+ writenl = function(target,...)
if target then
writeline(target,f(...))
end
diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl
index 46d1871a2..33e52ebbf 100644
--- a/tex/context/base/mkxl/math-ini.mkxl
+++ b/tex/context/base/mkxl/math-ini.mkxl
@@ -102,12 +102,6 @@
\permanent\def\Umathtopaccent{\Umathaccent \s!top }
\permanent\def\Umathaccents {\Umathaccent \s!both } % strange highlighting
-\ifdefined\Umathcharclass \else
- \permanent\def\Umathcharclass{\numexpr\cldcontext{tex.getmathcode(token.scan_int())[1]}\relax}
- \permanent\def\Umathcharfam {\numexpr\cldcontext{tex.getmathcode(token.scan_int())[2]}\relax}
- \permanent\def\Umathcharslot {\numexpr\cldcontext{tex.getmathcode(token.scan_int())[3]}\relax}
-\fi
-
%D The attributes that we will use (todo: pack some into one but uglier code):
\definesystemattribute[mathalphabet] [public]
diff --git a/tex/context/base/mkxl/math-noa.lmt b/tex/context/base/mkxl/math-noa.lmt
index fd30db573..0b9b132e1 100644
--- a/tex/context/base/mkxl/math-noa.lmt
+++ b/tex/context/base/mkxl/math-noa.lmt
@@ -135,12 +135,12 @@ local setsup = nuts.setsup
local setsubpre = nuts.setsubpre
local setsuppre = nuts.setsuppre
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local copy_node = nuts.copy
local slide_nodes = nuts.slide
local set_visual = nuts.setvisual
-local mlist_to_hlist = nuts.mlist_to_hlist
+local mlisttohlist = nuts.mlisttohlist
local new_kern = nodepool.kern
local new_submlist = nodepool.submlist
@@ -897,7 +897,7 @@ do
end
setchar(d,chr)
setfam(d,fam)
- flush_node(sym)
+ flushnode(sym)
end
setattrlist(d,char)
setattrlist(f,char)
@@ -943,7 +943,7 @@ do
if midl then
local fence = makefence(middlefence_code,current)
setnucleus(current)
- flush_node(current)
+ flushnode(current)
middle[current] = nil
-- replace_node
setlink(prev,fence,next)
@@ -969,7 +969,7 @@ do
local f_c = makefence(rightfence_code,close)
makelist(middle,open,f_o,o_next,c_prev,f_c)
setnucleus(close)
- flush_node(close)
+ flushnode(close)
-- open is now a list
setlink(open,c_next)
return open
@@ -1894,7 +1894,7 @@ do
end
while c ~= l do
local n = getnext(c)
- flush_node(c)
+ flushnode(c)
c = n
end
setlink(parent,l)
@@ -2108,7 +2108,7 @@ do
end
setprev(next,pointer)
setnext(parent,getnext(next))
- flush_node(next)
+ flushnode(next)
end
end
end
@@ -2361,12 +2361,12 @@ do
-- force_penalties = v
-- end)
- function builders.kernel.mlist_to_hlist(head,style,penalties)
- return mlist_to_hlist(head,style,force_penalties or penalties)
+ function builders.kernel.mlisttohlist(head,style,penalties)
+ return mlisttohlist(head,style,force_penalties or penalties)
end
- -- function builders.kernel.mlist_to_hlist(head,style,penalties)
- -- local h = mlist_to_hlist(head,style,force_penalties or penalties)
+ -- function builders.kernel.mlisttohlist(head,style,penalties)
+ -- local h = mlisttohlist(head,style,force_penalties or penalties)
-- inspect(nodes.totree(h,true,true,true))
-- return h
-- end
@@ -2385,14 +2385,14 @@ local actions = tasks.actions("math") -- head, style, penalties
local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming
-function processors.mlist_to_hlist(head,style,penalties)
+function processors.mlisttohlist(head,style,penalties)
starttiming(noads)
head = actions(head,style,penalties)
stoptiming(noads)
return head
end
-callbacks.register('mlist_to_hlist',processors.mlist_to_hlist,"preprocessing math list")
+callbacks.register('mlisttohlist',processors.mlisttohlist,"preprocessing math list")
-- tracing
diff --git a/tex/context/base/mkxl/math-tag.lmt b/tex/context/base/mkxl/math-tag.lmt
index 0d02d271c..a602870c9 100644
--- a/tex/context/base/mkxl/math-tag.lmt
+++ b/tex/context/base/mkxl/math-tag.lmt
@@ -37,7 +37,7 @@ local getnucleus = nuts.getnucleus
local getsub = nuts.getsub
local getsup = nuts.getsup
-local set_attributes = nuts.setattributes
+local setattributes = nuts.setattributes
local nextnode = nuts.traversers.node
@@ -285,7 +285,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer
-- empty list
elseif not attr then
-- box comes from strange place
- set_attributes(list,a_tagged,text) -- only the first node ?
+ setattributes(list,a_tagged,text) -- only the first node ?
else
-- Beware, the first node in list is the actual list so we definitely
-- need to nest. This approach is a hack, maybe I'll make a proper
diff --git a/tex/context/base/mkxl/mlib-lua.lmt b/tex/context/base/mkxl/mlib-lua.lmt
index e5737be8c..479dbcae1 100644
--- a/tex/context/base/mkxl/mlib-lua.lmt
+++ b/tex/context/base/mkxl/mlib-lua.lmt
@@ -35,44 +35,44 @@ local stack = { }
local function reports(s) report("%a scan %s", tostring(currentmpx),s) end -- temporary, till we're okay
local function reporti(s) report("%a inject %s",tostring(currentmpx),s) end -- temporary, till we're okay
-local scan_next = mplib.scan_next
-local scan_expression = mplib.scan_expression
-local scan_token = mplib.scan_token
-local scan_symbol = mplib.scan_symbol
-local scan_property = mplib.scan_property
-local scan_numeric = mplib.scan_numeric
-local scan_integer = mplib.scan_integer
-local scan_boolean = mplib.scan_boolean
-local scan_string = mplib.scan_string
-local scan_pair = mplib.scan_pair
-local scan_color = mplib.scan_color
-local scan_cmykcolor = mplib.scan_cmykcolor
-local scan_transform = mplib.scan_transform
-local scan_path = mplib.scan_path
-local scan_pen = mplib.scan_pen
-
-local skip_token = mplib.skip_token
-
-local get_hashentry = mplib.gethashentry
-
-scan.next = function(k) if trace then reporti("next") end return scan_next (currentmpx,k) end
-scan.expression = function(k) if trace then reporti("expression") end return scan_expression(currentmpx,k) end
-scan.token = function(k) if trace then reporti("token") end return scan_token (currentmpx,k) end
-scan.symbol = function(k,e) if trace then reporti("symbol") end return scan_symbol (currentmpx,k,e) end
-scan.property = function(k) if trace then reporti("property") end return scan_property (currentmpx,k) end
-scan.numeric = function() if trace then reporti("numeric") end return scan_numeric (currentmpx) end
-scan.integer = function() if trace then reporti("integer") end return scan_integer (currentmpx) end
-scan.boolean = function() if trace then reporti("boolean") end return scan_boolean (currentmpx) end
-scan.string = function() if trace then reporti("string") end return scan_string (currentmpx) end
-scan.pair = function(t) if trace then reporti("pair") end return scan_pair (currentmpx,t) end
-scan.color = function(t) if trace then reporti("color") end return scan_color (currentmpx,t) end
-scan.cmykcolor = function(t) if trace then reporti("cmykcolor") end return scan_cmykcolor (currentmpx,t) end
-scan.transform = function(t) if trace then reporti("transform") end return scan_transform (currentmpx,t) end
-scan.path = function(t) if trace then reporti("path") end return scan_path (currentmpx,t) end
-scan.pen = function(t) if trace then reporti("pen") end return scan_pen (currentmpx,t) end
-
-skip.token = function(t) return skip_token (currentmpx,t) end
-get.hashentry = function(n) return get_hashentry(currentmpx,n) end
+local scannext = mplib.scannext
+local scanexpression = mplib.scanexpression
+local scantoken = mplib.scantoken
+local scansymbol = mplib.scansymbol
+local scanproperty = mplib.scanproperty
+local scannumeric = mplib.scannumeric
+local scaninteger = mplib.scaninteger
+local scanboolean = mplib.scanboolean
+local scanstring = mplib.scanstring
+local scanpair = mplib.scanpair
+local scancolor = mplib.scancolor
+local scancmykcolor = mplib.scancmykcolor
+local scantransform = mplib.scantransform
+local scanpath = mplib.scanpath
+local scanpen = mplib.scanpen
+
+local skiptoken = mplib.skiptoken
+
+local gethashentry = mplib.gethashentry
+
+scan.next = function(k) if trace then reporti("next") end return scannext (currentmpx,k) end
+scan.expression = function(k) if trace then reporti("expression") end return scanexpression(currentmpx,k) end
+scan.token = function(k) if trace then reporti("token") end return scantoken (currentmpx,k) end
+scan.symbol = function(k,e) if trace then reporti("symbol") end return scansymbol (currentmpx,k,e) end
+scan.property = function(k) if trace then reporti("property") end return scanproperty (currentmpx,k) end
+scan.numeric = function() if trace then reporti("numeric") end return scannumeric (currentmpx) end
+scan.integer = function() if trace then reporti("integer") end return scaninteger (currentmpx) end
+scan.boolean = function() if trace then reporti("boolean") end return scanboolean (currentmpx) end
+scan.string = function() if trace then reporti("string") end return scanstring (currentmpx) end
+scan.pair = function(t) if trace then reporti("pair") end return scanpair (currentmpx,t) end
+scan.color = function(t) if trace then reporti("color") end return scancolor (currentmpx,t) end
+scan.cmykcolor = function(t) if trace then reporti("cmykcolor") end return scancmykcolor (currentmpx,t) end
+scan.transform = function(t) if trace then reporti("transform") end return scantransform (currentmpx,t) end
+scan.path = function(t) if trace then reporti("path") end return scanpath (currentmpx,t) end
+scan.pen = function(t) if trace then reporti("pen") end return scanpen (currentmpx,t) end
+
+skip.token = function(t) return skiptoken (currentmpx,t) end
+get.hashentry = function(n) return gethashentry(currentmpx,n) end
local solvepath = mplib.solvepath
local getstatus = mplib.getstatus
@@ -81,27 +81,27 @@ local expandtex = mplib.expandtex
mp.solve = function(...) return solvepath(currentmpx,...) end
mp.expandtex = function(...) expandtex(currentmpx,...) end
-local inject_path = mplib.inject_path
-local inject_numeric = mplib.inject_numeric
-local inject_pair = mplib.inject_pair
-local inject_boolean = mplib.inject_boolean
-local inject_integer = mplib.inject_integer
-local inject_string = mplib.inject_string
-local inject_color = mplib.inject_color
-local inject_cmykcolor = mplib.inject_cmykcolor
-local inject_transform = mplib.inject_transform
-local inject_whatever = mplib.inject_whatever
-
-------.path = function(t,cycle,curled) if trace then reporti("path") end return inject_path (currentmpx,t,cycle,curled) end
-inject.numeric = function(n) if trace then reporti("numeric") end return inject_numeric (currentmpx,n) end
-inject.pair = function(x,y) if trace then reporti("pair") end return inject_pair (currentmpx,x,y) end
-inject.boolean = function(b) if trace then reporti("boolean") end return inject_boolean (currentmpx,b) end
-inject.integer = function(i) if trace then reporti("integer") end return inject_integer (currentmpx,i) end
-inject.string = function(s) if trace then reporti("string") end return inject_string (currentmpx,s) end
-inject.color = function(r,g,b) if trace then reporti("color") end return inject_color (currentmpx,r,g,b) end
-inject.cmykcolor = function(c,m,y,k) if trace then reporti("cmykcolor") end return inject_cmykcolor(currentmpx,c,m,y,k) end
-inject.transform = function(x,y,xx,xy,yx,yy) if trace then reporti("transform") end return inject_transform(currentmpx,x,y,xx,xy,yx,yy) end
-inject.whatever = function(...) if trace then reporti("whatever") end return inject_whatever (currentmpx,...) end
+local injectpath = mplib.injectpath
+local injectnumeric = mplib.injectnumeric
+local injectpair = mplib.injectpair
+local injectboolean = mplib.injectboolean
+local injectinteger = mplib.injectinteger
+local injectstring = mplib.injectstring
+local injectcolor = mplib.injectcolor
+local injectcmykcolor = mplib.injectcmykcolor
+local injecttransform = mplib.injecttransform
+local injectwhatever = mplib.injectwhatever
+
+------.path = function(t,cycle,curled) if trace then reporti("path") end return injectpath (currentmpx,t,cycle,curled) end
+inject.numeric = function(n) if trace then reporti("numeric") end return injectnumeric (currentmpx,n) end
+inject.pair = function(x,y) if trace then reporti("pair") end return injectpair (currentmpx,x,y) end
+inject.boolean = function(b) if trace then reporti("boolean") end return injectboolean (currentmpx,b) end
+inject.integer = function(i) if trace then reporti("integer") end return injectinteger (currentmpx,i) end
+inject.string = function(s) if trace then reporti("string") end return injectstring (currentmpx,s) end
+inject.color = function(r,g,b) if trace then reporti("color") end return injectcolor (currentmpx,r,g,b) end
+inject.cmykcolor = function(c,m,y,k) if trace then reporti("cmykcolor") end return injectcmykcolor(currentmpx,c,m,y,k) end
+inject.transform = function(x,y,xx,xy,yx,yy) if trace then reporti("transform") end return injecttransform(currentmpx,x,y,xx,xy,yx,yy) end
+inject.whatever = function(...) if trace then reporti("whatever") end return injectwhatever (currentmpx,...) end
inject.triplet = inject.color
inject.quadruplet = inject.cmykcolor
@@ -145,7 +145,7 @@ function inject.path(p,close,connector)
end
end
if trace then reporti("path") end
- return inject_path(currentmpx,p,close,curled)
+ return injectpath(currentmpx,p,close,curled)
end
-- bonus:
@@ -154,7 +154,7 @@ scan .number = scan .numeric
inject.number = inject.numeric
table.setmetatablecall(inject,function(t,...)
- inject_whatever(currentmpx,...)
+ injectwhatever(currentmpx,...)
end)
-- experiment
@@ -164,20 +164,20 @@ function mp.autoinject(m)
if t == "table" then
local n = #t
if n == 2 then
- inject_pair(currentmpx,m)
+ injectpair(currentmpx,m)
elseif n == 3 then
- inject_color(currentmpx,m)
+ injectcolor(currentmpx,m)
elseif n == 4 then
- inject_cmykcolor(currentmpx,m)
+ injectcmykcolor(currentmpx,m)
elseif n == 6 then
- inject_transform(currentmpx,m)
+ injecttransform(currentmpx,m)
end
elseif t == "number" then
- inject_numeric(currentmpx,m)
+ injectnumeric(currentmpx,m)
elseif t == "string" then
- inject_string(currentmpx,m)
+ injectstring(currentmpx,m)
elseif t == "boolean" then
- inject_boolean(currentmpx,m)
+ injectboolean(currentmpx,m)
end
end
diff --git a/tex/context/base/mkxl/mlib-pdf.lmt b/tex/context/base/mkxl/mlib-pdf.lmt
index 0373c22f8..ac84e4f3e 100644
--- a/tex/context/base/mkxl/mlib-pdf.lmt
+++ b/tex/context/base/mkxl/mlib-pdf.lmt
@@ -23,10 +23,7 @@ local context = context
local allocate = utilities.storage.allocate
-local copy_node = node.copy
-local write_node = node.write
-
-local pen_info = mplib.pen_info
+local peninfo = mplib.peninfo
local getfields = mplib.getfields or mplib.fields -- todo: in lmtx get them once and then use gettype
local save_table = false
@@ -114,7 +111,7 @@ end
local rx, sx, sy, ry, tx, ty, divider = 1, 0, 0, 1, 0, 0, 1
local function pen_characteristics(object)
- local t = pen_info(object)
+ local t = peninfo(object)
rx, ry, sx, sy, tx, ty = t.rx, t.ry, t.sx, t.sy, t.tx, t.ty
divider = sx*sy - rx*ry
return not (sx == 1 and rx == 0 and ry == 0 and sy == 1 and tx == 0 and ty == 0), t.width
@@ -359,7 +356,7 @@ local function pushproperties(figure)
width = figure:width(),
height = figure:height(),
depth = figure:depth(),
- italic = figure:italcorr(), -- figure:italic() in lmtx
+ italic = figure:italic(),
number = slot,
}
insert(stack,properties)
diff --git a/tex/context/base/mkxl/mlib-pps.lmt b/tex/context/base/mkxl/mlib-pps.lmt
index 0d6beee00..1ed98bdf3 100644
--- a/tex/context/base/mkxl/mlib-pps.lmt
+++ b/tex/context/base/mkxl/mlib-pps.lmt
@@ -36,8 +36,8 @@ local setmacro = interfaces.setmacro
local texsetbox = tex.setbox
local textakebox = tex.takebox -- or: nodes.takebox
local texrunlocal = tex.runlocal
-local copy_list = node.copy_list
-local flush_list = node.flush_list
+local copylist = nodes.copylist
+local flushlist = nodes.flushlist
local setmetatableindex = table.setmetatableindex
local sortedhash = table.sortedhash
@@ -283,7 +283,7 @@ local function stopjob()
if top then
for slot, content in next, top.textexts do
if content then
- flush_list(content)
+ flushlist(content)
if trace_textexts then
report_textexts("freeing text %s",slot)
end
@@ -1051,7 +1051,7 @@ local tx_reset, tx_process do
local donebox = fasttrack and top.textexts[mp_index]
if mp_hash == "no" then
if donebox then
- box = copy_list(donebox)
+ box = copylist(donebox)
else
texrunlocal("mptexttoks")
box = textakebox("mptextbox")
@@ -1085,10 +1085,10 @@ end
end
box = cache[mp_hash]
if box then
- box = copy_list(box)
+ box = copylist(box)
else
if donebox then
- box = copy_list(donebox)
+ box = copylist(donebox)
else
texrunlocal("mptexttoks")
box = textakebox("mptextbox")
diff --git a/tex/context/base/mkxl/mlib-scn.lmt b/tex/context/base/mkxl/mlib-scn.lmt
index 0a0e96105..217a57ae4 100644
--- a/tex/context/base/mkxl/mlib-scn.lmt
+++ b/tex/context/base/mkxl/mlib-scn.lmt
@@ -137,11 +137,6 @@ scanset = function() -- can be optimized, we now read twice
end
end
-local function scan_pair () return scanpair (true) end
-local function scan_color () return scancolor (true) end
-local function scan_cmykcolor() return scancmykcolor(true) end
-local function scan_transform() return scantransform(true) end
-
tokenscanners = {
[leftbrace_code] = scanset,
[numeric_code] = scannumeric,
@@ -154,10 +149,10 @@ typescanners = {
[types.numeric] = scannumeric,
[types.string] = scanstring,
[types.boolean] = scanboolean,
- [types.pair] = scan_pair,
- [types.color] = scan_color,
- [types.cmykcolor] = scan_cmykcolor,
- [types.transform] = scan_transform,
+ [types.pair] = function() return scanpair (true) end,
+ [types.color] = function() return scancolor (true) end,
+ [types.cmykcolor] = function() return scancmykcolor(true) end,
+ [types.transform] = function() return scantransform(true) end,
[types.path] = scanpath,
[types.pen] = scanpen,
}
diff --git a/tex/context/base/mkxl/node-acc.lmt b/tex/context/base/mkxl/node-acc.lmt
index 2c3302a3e..328074428 100644
--- a/tex/context/base/mkxl/node-acc.lmt
+++ b/tex/context/base/mkxl/node-acc.lmt
@@ -34,7 +34,6 @@ local nextglyph = nuts.traversers.glyph
local nextnode = nuts.traversers.node
local copy_node = nuts.copy
-local insert_after = nuts.insert_after
local nodecodes = nodes.nodecodes
local gluecodes = nodes.gluecodes
diff --git a/tex/context/base/mkxl/node-aux.lmt b/tex/context/base/mkxl/node-aux.lmt
index 27f248c58..1aeae3b45 100644
--- a/tex/context/base/mkxl/node-aux.lmt
+++ b/tex/context/base/mkxl/node-aux.lmt
@@ -53,12 +53,12 @@ local traversers = nuts.traversers
local nextnode = traversers.node
local nextglyph = traversers.glyph
-local flush_node = nuts.flush
-local flush_list = nuts.flush_list
+local flushnode = nuts.flush
+local flushlist = nuts.flushlist
local hpack_nodes = nuts.hpack
local vpack_nodes = nuts.vpack
-local unset_attribute = nuts.unset_attribute
-local first_glyph = nuts.first_glyph
+local unsetattribute = nuts.unsetattribute
+local firstglyph = nuts.firstglyph
local copy_node = nuts.copy
local find_tail = nuts.tail
local getbox = nuts.getbox
@@ -112,7 +112,7 @@ end
function nuts.takelist(n)
local l = getlist(n)
setlist(n)
- flush_node(n)
+ flushnode(n)
return l
end
@@ -125,7 +125,7 @@ local function repackhlist(list,...)
local temp, b = hpack_nodes(list,...)
list = getlist(temp)
setlist(temp)
- flush_node(temp)
+ flushnode(temp)
return list, b
end
@@ -136,50 +136,38 @@ function nodes.repackhlist(list,...)
return tonode(list), b
end
-local function set_attributes(head,attr,value)
+local function setattributes(head,attr,value)
for n, id in nextnode, head do
setattr(n,attr,value)
if id == hlist_node or id == vlist_node then
- set_attributes(getlist(n),attr,value)
+ setattributes(getlist(n),attr,value)
end
end
end
-local function set_unset_attributes(head,attr,value)
+local function setunsetattributes(head,attr,value)
for n, id in nextnode, head do
if not getattr(n,attr) then
setattr(n,attr,value)
end
if id == hlist_code or id == vlist_code then
- set_unset_attributes(getlist(n),attr,value)
+ setunsetattributes(getlist(n),attr,value)
end
end
end
-local function unset_attributes(head,attr)
+local function unsetattributes(head,attr)
for n, id in nextnode, head do
setattr(n,attr,unsetvalue)
if id == hlist_code or id == vlist_code then
- unset_attributes(getlist(n),attr)
+ unsetattributes(getlist(n),attr)
end
end
end
--- for old times sake
-
-nuts.setattribute = nuts.setattr nodes.setattribute = nodes.setattr
-nuts.getattribute = nuts.getattr nodes.getattribute = nodes.getattr
-nuts.unsetattribute = nuts.unset_attribute nodes.unsetattribute = nodes.unset_attribute
-nuts.has_attribute = nuts.has_attribute nodes.has_attribute = nodes.has_attribute
-nuts.firstglyph = nuts.first_glyph nodes.firstglyph = nodes.first_glyph
-
-nuts.setattributes = set_attributes nodes.setattributes = vianuts(set_attributes)
-nuts.setunsetattributes = set_unset_attributes nodes.setunsetattributes = vianuts(set_unset_attributes)
-nuts.unsetattributes = unset_attributes nodes.unsetattributes = vianuts(unset_attributes)
-
function nuts.firstcharacter(n,untagged) -- tagged == subtype > 255
if untagged then
- return first_glyph(n)
+ return firstglyph(n)
else
for g in nextglyph ,n do
return g
@@ -353,7 +341,7 @@ local function rehpack(n,width)
local set, order, sign = getboxglue(temp)
setboxglue(n,set,order,sign)
setlist(temp)
- flush_node(temp)
+ flushnode(temp)
return n
end
@@ -387,11 +375,10 @@ do
end
end
- local getsubtype = nodes.getsubtype
+ local startofpar = nuts.startofpar
- function nodes.start_of_par(n)
- local s = getsubtype(n)
- return s == hmodepar_code or s == vmodepar_code
+ function nodes.startofpar(n)
+ return startofpar(tonut(n))
end
end
diff --git a/tex/context/base/mkxl/node-bck.lmt b/tex/context/base/mkxl/node-bck.lmt
index a814b329d..ba0e508b6 100644
--- a/tex/context/base/mkxl/node-bck.lmt
+++ b/tex/context/base/mkxl/node-bck.lmt
@@ -51,7 +51,7 @@ local nextnode = nuts.traversers.node
local nexthlist = nuts.traversers.hlist
local nextlist = nuts.traversers.list
-local flush_node_list = nuts.flush_list
+local flushnodelist = nuts.flushlist
local new_rule = nodepool.rule
local new_kern = nodepool.kern
@@ -159,7 +159,7 @@ local function add_alignbackgrounds(head,list)
local template = getprop(head,"alignmentchecked")
if template then
list = colored_b(head,list,template[1],hlist_code,template[2])
- flush_node_list(template)
+ flushnodelist(template)
templates[currentrow] = false
return list
end
diff --git a/tex/context/base/mkxl/node-bwc.lmt b/tex/context/base/mkxl/node-bwc.lmt
new file mode 100644
index 000000000..a2e9d566d
--- /dev/null
+++ b/tex/context/base/mkxl/node-bwc.lmt
@@ -0,0 +1,168 @@
+if not modules then modules = { } end modules ['node-bwc'] = {
+ 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"
+}
+
+-- This is a backward compatinility list. Eventually it will go away although a few
+-- might stay around. We start with some real low level ones. But ... users are
+-- supposed to use nodes and nuts.
+
+local node = node
+local direct = node.direct
+
+node .copy_list = node .copylist
+node .current_attributes = node .currentattributes
+node .effective_glue = node .effectiveglue
+node .end_of_math = node .endofmath
+node .first_glyph = node .firstglyph
+node .flush_list = node .flushlist
+node .flush_node = node .flushnode
+node .get_attribute = node .getattribute
+node .get_attributes = node .getattributes
+------.get_properties_table = node .getpropertiestable
+node .has_attribute = node .hasattribute
+node .has_field = node .hasfield
+node .has_glyph = node .hasglyph
+node .insert_after = node .insertafter
+node .insert_before = node .insertbefore
+node .is_node = node .isnode or node.is_node
+node .is_zero_glue = node .iszeroglue
+node .last_node = node .lastnode
+node .mlist_to_hlist = node .mlisttohlist
+node .protect_glyph = node .protectglyph
+node .protect_glyphs = node .protectglyphs
+---- .protrusion_skippable = node .protrusionskippable
+node .set_attribute = node .setattribute
+node .set_attributes = node .setattributes
+node .traverse_id = node .traverseid or node.traverse_id
+node .unprotect_glyph = node .unprotectglyph
+node .unprotect_glyphs = node .unprotectglyphs
+node .unset_attribute = node .unsetattribute
+node .unset_attributes = node .unsetattributes
+
+direct.copy_list = direct.copylist
+direct.current_attributes = direct.currentattributes
+direct.effective_glue = direct.effectiveglue
+direct.end_of_math = direct.endofmath
+direct.find_node = direct.findnode
+direct.first_glyph = direct.firstglyph
+direct.flush_list = direct.flushlist
+direct.flush_node = direct.flushnode
+direct.get_attribute = direct.getattribute
+direct.get_attributes = direct.getattributes
+------.get_properties_table = direct.getpropertiestable
+direct.has_attribute = direct.hasattribute
+direct.hasdimensions = direct.hasdimensions
+direct.has_field = direct.hasfield
+direct.has_glyph = direct.hasglyph
+direct.insert_after = direct.insertafter
+direct.insert_before = direct.insertbefore
+direct.is_char = direct.ischar
+direct.is_direct = direct.isdirect
+direct.is_glyph = direct.isglyph
+direct.is_node = direct.isnode
+direct.is_valid = direct.isvalid
+direct.is_zero_glue = direct.iszeroglue
+direct.last_node = direct.lastnode
+direct.mlist_to_hlist = direct.mlisttohlist
+direct.protect_glyph = direct.protectglyph
+direct.protect_glyphs = direct.protectglyphs
+------.protrusion_skippable = direct.protrusionskippable
+direct.set_attribute = direct.setattribute
+direct.set_attributes = direct.setattributes
+direct.start_of_par = direct.startofpar
+direct.traverse_char = direct.traversechar or direct.traverse_char
+direct.traverse_content = direct.traversecontent or direct.traverse_content
+direct.traverse_glyph = direct.traverseglyph or direct.traverse_glyph
+direct.traverse_id = direct.traverseid or direct.traverse_id
+direct.traverse_list = direct.traverselist or direct.traverse_list
+direct.unprotect_glyph = direct.unprotectglyph
+direct.unprotect_glyphs = direct.unprotectglyphs
+direct.unset_attribute = direct.unsetattribute
+direct.unset_attributes = direct.unsetattributes
+direct.uses_font = direct.usesfont
+
+-- Now come the nodes and nuts.
+
+local nodes = nodes
+local nuts = nodes.nuts
+
+-----.check_discretionaries = nuts .checkdiscretionaries
+nuts .copy_list = nuts .copylist
+nuts .copy_node = nuts .copynode
+nuts .copy_only = nuts .copyonly
+nuts .current_attr = nuts .currentattributes
+nuts .effective_glue = nuts .effectiveglue
+nuts .end_of_math = nuts .endofmath
+nuts .find_attribute = nuts .findattribute
+nuts .first_glyph = nuts .firstglyph
+-----.flatten_discretionaries = nuts .flattendiscretionaries
+nuts .flush_list = nuts .flushlist
+nuts .flush_node = nuts .flushnode
+nuts .get_attribute = nuts .getattribute
+nuts .get_synctex_fields = nuts .getsynctexfields
+nuts .has_attribute = nuts .hasattribute
+nuts .has_dimensions = nuts .hasdimensions
+nuts .has_field = nuts .hasfield
+nuts .has_glyph = nuts .hasglyph
+nuts .insert_after = nuts .insertafter
+nuts .insert_before = nuts .insertbefore
+nuts .is_direct = nuts .isdirect
+nuts .is_node = nuts .isnode
+nuts .is_nut = nuts .isnut
+nuts .is_zero_glue = nuts .iszeroglue
+nuts .mlist_to_hlist = nuts .mlisttohlist
+nuts .protect_glyph = nuts .protectglyph
+nuts .protect_glyphs = nuts .protectglyphs
+-----.protrusion_skippable = nuts .protrusionskippable
+nuts .set_attribute = nuts .setattribute
+-----.set_synctex_fields = nuts .setsynctexfields
+nuts .start_of_par = nuts .startofpar
+nuts .traverse_id = nuts .traverseid
+nuts .traverse_char = nuts .traversechar
+nuts .traverse_glyph = nuts .traverseglyph
+nuts .traverse_id = nuts .traverseid
+nuts .traverse_list = nuts .traverselist
+nuts .unprotect_glyph = nuts .unprotectglyph
+nuts .unprotect_glyphs = nuts .unprotectglyphs
+nuts .unset_attribute = nuts .unsetattribute
+nuts .uses_font = nuts .usesfont
+
+-----.check_discretionaries = nodes.check_discretionaries
+nodes.copy_list = nodes.copylist
+nodes.copy_node = nodes.copynode
+nodes.current_attributes = nodes.currentattributes
+nodes.effective_glue = nodes.effectiveglue
+nodes.end_of_math = nodes.endofmath
+nodes.find_attribute = nodes.findattribute
+nodes.first_glyph = nodes.firstglyph
+-----.flatten_discretionaries = nodes.flattendiscretionaries
+nodes.flush_list = nodes.flushlist
+nodes.flush_node = nodes.flushnode
+nodes.has_attribute = nodes.hasattribute
+nodes.has_field = nodes.hasfield
+nodes.has_glyph = nodes.hasglyph
+nodes.insert_after = nodes.insertafter
+nodes.insert_before = nodes.insertbefore
+nodes.is_direct = nodes.isdirect
+nodes.is_node = nodes.isnode
+nodes.is_nut = nodes.isnut
+nodes.is_zero_glue = nodes.iszeroglue
+nodes.last_node = nodes.lastnode
+nodes.mlist_to_hlist = nodes.mlisttohlist
+nodes.protect_glyph = nodes.protectglyph
+nodes.protect_glyphs = nodes.protectglyphs
+-----.protrusion_skippable = nodes.protrusionskippable
+nodes.set_attribute = nodes.setattribute
+nodes.traverse_id = nodes.traverseid
+nodes.traverse_char = nodes.traversechar
+nodes.traverse_glyph = nodes.traverseglyph
+nodes.traverse_id = nodes.traverseid
+nodes.traverse_list = nodes.traverselist
+nodes.unprotect_glyph = nodes.unprotectglyph
+nodes.unprotect_glyphs = nodes.unprotectglyphs
+nodes.unset_attribute = nodes.unsetattribute
+nodes.uses_font = nodes.usesfont
diff --git a/tex/context/base/mkxl/node-cmp.lmt b/tex/context/base/mkxl/node-cmp.lmt
index 21fd700f0..8f805abd9 100644
--- a/tex/context/base/mkxl/node-cmp.lmt
+++ b/tex/context/base/mkxl/node-cmp.lmt
@@ -75,47 +75,42 @@ function node.kerning(first,last)
end
end
-local protect_glyph = direct.protect_glyph
-local unprotect_glyph = direct.unprotect_glyph
-local protect_glyphs = direct.protect_glyphs
-local unprotect_glyphs = direct.unprotect_glyphs
+local protectglyph = direct.protectglyph
+local unprotectglyph = direct.unprotectglyph
+local protectglyphs = direct.protectglyphs
+local unprotectglyphs = direct.unprotectglyphs
-function node.protect_glyphs(first,last)
- protect_glyphs(todirect(first), last and todirect(last) or nil)
+function node.protectglyphs(first,last)
+ protectglyphs(todirect(first), last and todirect(last) or nil)
end
-function node.unprotect_glyphs(first,last)
- unprotect_glyphs(todirect(first), last and todirect(last) or nil)
+function node.unprotectglyphs(first,last)
+ unprotectglyphs(todirect(first), last and todirect(last) or nil)
end
-function node.protect_glyph(first)
- protect_glyph(todirect(first))
+function node.protectglyph(first)
+ protectglyph(todirect(first))
end
-function node.unprotect_glyph(first)
- unprotect_glyph(todirect(first))
+function node.unprotectglyph(first)
+ unprotectglyph(todirect(first))
end
-local flatten_discretionaries = direct.flatten_discretionaries
-local check_discretionaries = direct.check_discretionaries
-local check_discretionary = direct.check_discretionary
+local flattendiscretionaries = direct.flattendiscretionaries
+local checkdiscretionaries = direct.checkdiscretionaries
+local checkdiscretionary = direct.checkdiscretionary
-function node.flatten_discretionaries(first)
- local h, count = flatten_discretionaries(todirect(first))
+function node.flattendiscretionaries(first)
+ local h, count = flattendiscretionaries(todirect(first))
return tonode(h), count
end
-function node.check_discretionaries(n)
- check_discretionaries(todirect(n))
-end
-
-function node.check_discretionary(n)
- check_discretionary(todirect(n))
-end
+function node.checkdiscretionaries(n) checkdiscretionaries(todirect(n)) end
+function node.checkdiscretionary (n) checkdiscretionary (todirect(n)) end
-local hpack = direct.hpack
-local vpack = direct.vpack
-local list_to_hlist = direct.mlist_to_hlist
+local hpack = direct.hpack
+local vpack = direct.vpack
+local mlisttohlist = direct.mlisttohlist
function node.hpack(head,...)
local h, badness = hpack(head and todirect(head) or nil,...)
@@ -127,17 +122,17 @@ function node.vpack(head,...)
return tonode(h), badness
end
-function node.mlist_to_hlist(head,...)
- return tonode(mlist_to_hlist(head and todirect(head) or nil,...))
+function node.mlisttohlist(head,...)
+ return tonode(mlisttohlist(head and todirect(head) or nil,...))
end
-local end_of_math = direct.end_of_math
-local find_attribute = direct.find_attribute
-local first_glyph = direct.first_glyph
+local endofmath = direct.endofmath
+local findattribute = direct.findattribute
+local firstglyph = direct.firstglyph
-function node.end_of_math(n)
+function node.endofmath(n)
if n then
- n = end_of_math(todirect(n))
+ n = endofmath(todirect(n))
if n then
return tonode(n)
end
@@ -145,9 +140,9 @@ function node.end_of_math(n)
return nil
end
-function node.find_attribute(n,a)
+function node.findattribute(n,a)
if n then
- local v, n = find_attribute(todirect(n),a)
+ local v, n = findattribute(todirect(n),a)
if n then
return v, tonode(n)
end
@@ -155,14 +150,14 @@ function node.find_attribute(n,a)
return nil
end
-function node.first_glyph(first,last)
- local n = first_glyph(todirect(first), last and todirect(last) or nil)
+function node.firstglyph(first,last)
+ local n = firstglyph(todirect(first), last and todirect(last) or nil)
return n and tonode(n) or nil
end
local dimensions = direct.dimensions
local rangedimensions = direct.rangedimensions
-local effective_glue = direct.effective_glue
+local effectiveglue = direct.effectiveglue
function node.dimensions(a,b,c,d,e)
if type(a) == "userdata" then
@@ -185,53 +180,34 @@ function node.rangedimensions(parent,first,last)
return rangedimenensions(todirect(parent),todirect(first),last and todirect(last))
end
-function node.effective_glue(list,parent)
- return effective_glue(list and todirect(list) or nil,parent and todirect(parent) or nil)
-end
-
-local uses_font = direct.uses_font
-local has_glyph = direct.has_glyph
-local protrusion_skippable = direct.protrusion_skippable
-local make_extensible = direct.make_extensible
-
-function node.uses_font(n,f)
- return uses_font(todirect(n),f)
-end
-
-function node.has_glyph(n)
- return has_glyph(todirect(n))
+function node.effectiveglue(list,parent)
+ return effectiveglue(list and todirect(list) or nil,parent and todirect(parent) or nil)
end
-function node.protrusion_skippable(n)
- return protrusion_skippable(todirect(n))
-end
+local usesfont = direct.usesfont
+local hasglyph = direct.hasglyph
+local protrusionskippable = direct.protrusionskippable
-function node.make_extensible(...)
- local n = make_extensible(...)
- return n and tonode(n) or nil
-end
+function node.usesfont (n,f) return usesfont(todirect(n),f) end
+function node.hasglyph (n) return hasglyph(todirect(n)) end
+function node.protrusionskippable(n) return protrusionskippable(todirect(n)) end
-local last_node = direct.last_node
+local makeextensible = direct.make_extensible
+local lastnode = direct.lastnode
-function node.last_node()
- local n = last_node()
- return n and tonode(n) or nil
-end
+function node.makeextensible(...) local n = makeextensible(...) return n and tonode(n) or nil end
+function node.lastnode () local n = lastnode() return n and tonode(n) or nil end
-local is_zero_glue = direct.is_zero_glue
-local getglue = direct.getglue
-local setglue = direct.setglue
+local iszeroglue = direct.iszeroglue
+local getglue = direct.getglue
+local setglue = direct.setglue
-function node.is_zero_glue(n)
- return is_zero_glue(todirect(n))
-end
+function node.iszeroglue(n) return iszeroglue(todirect(n)) end
+function node.getglue (n) return getglue (todirect(n)) end
+function node.setglue (n) return setglue (todirect(n)) end
-function node.get_glue(n)
- return get_glue(todirect(n))
-end
+node.family_font = tex.getfontoffamily
-function node.set_glue(n)
- return set_glue(todirect(n))
-end
+-- node.get_glue = node.getglue
+-- node.set_glue = node.setglue
-node.family_font = tex.getfontoffamily
diff --git a/tex/context/base/mkxl/node-dir.lmt b/tex/context/base/mkxl/node-dir.lmt
index c959fef07..246bf34e4 100644
--- a/tex/context/base/mkxl/node-dir.lmt
+++ b/tex/context/base/mkxl/node-dir.lmt
@@ -28,8 +28,8 @@ local nextdir = nuts.traversers.dir
local nextlist = nuts.traversers.list
local rangedimensions = nuts.rangedimensions
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local new_rule = nuts.pool.rule
local new_kern = nuts.pool.kern
@@ -61,8 +61,8 @@ local function colorit(list,current,dir,w,h,d)
local color = dir == lefttoright_code and "trace:s" or "trace:o"
setcolor(rule,color)
settransparency(rule,color)
- list, current = insert_before(list,current,kern)
- list, current = insert_before(list,current,rule)
+ list, current = insertbefore(list,current,kern)
+ list, current = insertbefore(list,current,rule)
return list, current
end
diff --git a/tex/context/base/mkxl/node-ext.lmt b/tex/context/base/mkxl/node-ext.lmt
index 2f909cd3d..9068cd976 100644
--- a/tex/context/base/mkxl/node-ext.lmt
+++ b/tex/context/base/mkxl/node-ext.lmt
@@ -18,7 +18,8 @@ local allocate = utilities.storage.allocate
local formatters = string.formatters
-local get = token.get_index -- getters
+local get = tokens.accessors.index
+
local scanners = tokens.scanners
local scaninteger = scanners.integer
local scanstring = scanners.string
diff --git a/tex/context/base/mkxl/node-fin.lmt b/tex/context/base/mkxl/node-fin.lmt
index 2ca7491a1..464f17f83 100644
--- a/tex/context/base/mkxl/node-fin.lmt
+++ b/tex/context/base/mkxl/node-fin.lmt
@@ -17,62 +17,62 @@ local setmetatableindex = table.setmetatableindex
local attributes, nodes, node = attributes, nodes, node
-local nuts = nodes.nuts
-local tonut = nodes.tonut
-
-local getnext = nuts.getnext
-local getid = nuts.getid
-local getlist = nuts.getlist
-local getleader = nuts.getleader
-local getattr = nuts.getattr
-local getattrs = nuts.getattrs
-local getwidth = nuts.getwidth
-local getwhd = nuts.getwhd
-local getorientation = nuts.getorientation
-local has_dimensions = nuts.has_dimensions
-local getbox = nuts.getbox
-
-local setlist = nuts.setlist
-local setleader = nuts.setleader
-
-local copy_node = nuts.copy
-local find_tail = nuts.tail
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
-
-local nextnode = nuts.traversers.node
-local nextcontent = nuts.traversers.content
-
-local nodecodes = nodes.nodecodes
-local rulecodes = nodes.rulecodes
-
-local boxrule_code = rulecodes.box
-local imagerule_code = rulecodes.image
-local emptyrule_code = rulecodes.empty
-
-local container_code = nodes.listcodes.container
-
-local glyph_code = nodecodes.glyph
-local disc_code = nodecodes.disc
-local glue_code = nodecodes.glue
-local rule_code = nodecodes.rule
-local hlist_code = nodecodes.hlist
-local vlist_code = nodecodes.vlist
-
-local texlists = tex.lists
-local texgetnest = tex.getnest
-
-local states = attributes.states
-local numbers = attributes.numbers
-local a_trigger = attributes.private('trigger')
-local triggering = false
-
-local implement = interfaces.implement
-
-local starttiming = statistics.starttiming
-local stoptiming = statistics.stoptiming
-local loadstripped = utilities.lua.loadstripped
-local unsetvalue = attributes.unsetvalue
+local nuts = nodes.nuts
+local tonut = nodes.tonut
+
+local getnext = nuts.getnext
+local getid = nuts.getid
+local getlist = nuts.getlist
+local getleader = nuts.getleader
+local getattr = nuts.getattr
+local getattrs = nuts.getattrs
+local getwidth = nuts.getwidth
+local getwhd = nuts.getwhd
+local getorientation = nuts.getorientation
+local hasdimensions = nuts.hasdimensions
+local getbox = nuts.getbox
+
+local setlist = nuts.setlist
+local setleader = nuts.setleader
+
+local copy_node = nuts.copy
+local find_tail = nuts.tail
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
+
+local nextnode = nuts.traversers.node
+local nextcontent = nuts.traversers.content
+
+local nodecodes = nodes.nodecodes
+local rulecodes = nodes.rulecodes
+
+local boxrule_code = rulecodes.box
+local imagerule_code = rulecodes.image
+local emptyrule_code = rulecodes.empty
+
+local container_code = nodes.listcodes.container
+
+local glyph_code = nodecodes.glyph
+local disc_code = nodecodes.disc
+local glue_code = nodecodes.glue
+local rule_code = nodecodes.rule
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+
+local texlists = tex.lists
+local texgetnest = tex.getnest
+
+local states = attributes.states
+local numbers = attributes.numbers
+local a_trigger = attributes.private('trigger')
+local triggering = false
+
+local implement = interfaces.implement
+
+local starttiming = statistics.starttiming
+local stoptiming = statistics.stoptiming
+local loadstripped = utilities.lua.loadstripped
+local unsetvalue = attributes.unsetvalue
-- these two will be like trackers
@@ -168,15 +168,15 @@ function states.finalize(namespace,attribute,head) -- is this one ok?
if id == hlist_code or id == vlist_code then
local content = getlist(head)
if content then
--- local list = insert_node_before(content,content,copy_node(nsnone)) -- two return values
- local list = insert_node_after(content,find_tail(content),copy_node(nsnone)) -- two return values
+-- local list = insertnodebefore(content,content,copy_node(nsnone)) -- two return values
+ local list = insertnodeafter(content,find_tail(content),copy_node(nsnone)) -- two return values
if list ~= content then
setlist(head,list)
end
end
else
--- head = insert_node_before(head,head,copy_node(nsnone))
- head = insert_node_after(find_tail(head),head,copy_node(nsnone))
+-- head = insertnodebefore(head,head,copy_node(nsnone))
+ head = insertnodeafter(find_tail(head),head,copy_node(nsnone))
end
return head, true
end
@@ -206,20 +206,20 @@ current = 0
if outer then
if default and outer == inheritance then
if current ~= default then
- head = insert_node_before(head,stack,copy_node(nsdata[default]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[default]))
current = default
end
elseif current ~= outer then
- head = insert_node_before(head,stack,copy_node(nsdata[c]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[c]))
current = outer
end
elseif default and inheritance then
if current ~= default then
- head = insert_node_before(head,stack,copy_node(nsdata[default]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[default]))
current = default
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current = 0
end
end
@@ -242,7 +242,7 @@ current = 0
end
-- end nested --
elseif id == rule_code then
- check = has_dimensions(stack)
+ check = hasdimensions(stack)
end
-- much faster this way than using a check() and nested() function
if check then
@@ -250,11 +250,11 @@ current = 0
if c then
if default and c == inheritance then
if current ~= default then
- head = insert_node_before(head,stack,copy_node(nsdata[default]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[default]))
current = default
end
elseif current ~= c then
- head = insert_node_before(head,stack,copy_node(nsdata[c]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[c]))
current = c
end
if leader then
@@ -287,11 +287,11 @@ current = 0
end
elseif default and inheritance then
if current ~= default then
- head = insert_node_before(head,stack,copy_node(nsdata[default]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[default]))
current = default
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current = 0
end
check = false
@@ -323,13 +323,13 @@ current = 0
if outer then
if current ~= outer then
if current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
end
- head = insert_node_before(head,stack,copy_node(nsdata[c]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[c]))
current = outer
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current = 0
end
end
@@ -338,16 +338,16 @@ current = 0
setlist(stack,list)
end
elseif id == rule_code then
- check = has_dimensions(stack)
+ check = hasdimensions(stack)
end
if check then
local c = getattr(stack,attribute)
if c then
if current ~= c then
if current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
end
- head = insert_node_before(head,stack,copy_node(nsdata[c]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[c]))
current = c
end
if leader then
@@ -364,7 +364,7 @@ current = 0
leader = false
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current = 0
end
check = false
@@ -405,7 +405,7 @@ end
-- if default and outer == inheritance then
-- if current ~= default then
-- local data = nsdata[default]
--- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
+-- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
-- current = default
-- end
-- else
@@ -413,7 +413,7 @@ end
-- -- local s = nsforced or getattr(stack,nsselector)
-- if current ~= outer or current_selector ~= s then
-- local data = nsdata[outer]
--- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+-- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
-- current = outer
-- current_selector = s
-- end
@@ -421,11 +421,11 @@ end
-- elseif default and inheritance then
-- if current ~= default then
-- local data = nsdata[default]
--- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
+-- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
-- current = default
-- end
-- elseif current > 0 then
--- head = insert_node_before(head,stack,copy_node(nsnone))
+-- head = insertnodebefore(head,stack,copy_node(nsnone))
-- current, current_selector = 0, 0
-- end
-- end
@@ -452,7 +452,7 @@ end
-- -- so no redundant color stuff (only here, layers for instance should obey)
-- check = false
-- else
--- check = has_dimensions(stack)
+-- check = hasdimensions(stack)
-- end
-- end
-- if check then
@@ -461,7 +461,7 @@ end
-- if default and c == inheritance then
-- if current ~= default then
-- local data = nsdata[default]
--- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
+-- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
-- current = default
-- end
-- else
@@ -469,7 +469,7 @@ end
-- -- local s = nsforced or getattr(stack,nsselector)
-- if current ~= c or current_selector ~= s then
-- local data = nsdata[c]
--- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+-- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
-- current = c
-- current_selector = s
-- end
@@ -496,11 +496,11 @@ end
-- elseif default and inheritance then
-- if current ~= default then
-- local data = nsdata[default]
--- head = insert_node_before(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
+-- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
-- current = default
-- end
-- elseif current > 0 then
--- head = insert_node_before(head,stack,copy_node(nsnone))
+-- head = insertnodebefore(head,stack,copy_node(nsnone))
-- current, current_selector = 0, 0
-- end
-- check = false
@@ -531,23 +531,23 @@ current = 0
if default and outer == inheritance then
if current ~= default then
local data = nsdata[default]
- head = insert_node_before(head,stack,copy_node(data[nsforced or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or nsselector]))
current = default
end
elseif current ~= outer or current_selector ~= s then
local data = nsdata[outer]
- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
current = outer
current_selector = s
end
elseif default and inheritance then
if current ~= default then
local data = nsdata[default]
- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
current = default
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current, current_selector = 0, 0
end
end
@@ -574,7 +574,7 @@ current = 0
-- so no redundant color stuff (only here, layers for instance should obey)
check = false
else
- check = has_dimensions(stack)
+ check = hasdimensions(stack)
end
end
if check then
@@ -583,12 +583,12 @@ current = 0
if default and c == inheritance then
if current ~= default then
local data = nsdata[default]
- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
current = default
end
elseif current ~= c or current_selector ~= s then
local data = nsdata[c]
- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
current = c
current_selector = s
end
@@ -614,11 +614,11 @@ current = 0
elseif default and inheritance then
if current ~= default then
local data = nsdata[default]
- head = insert_node_before(head,stack,copy_node(data[nsforced or s or nsselector]))
+ head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
current = default
end
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
current, current_selector = 0, 0
end
check = false
@@ -669,9 +669,9 @@ current = 0
if a and current ~= a and nslistwise[a] then -- viewerlayer / needs checking, see below
local p = current
current = a
- head = insert_node_before(head,stack,copy_node(nsdata[a]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[a]))
list = stacked(attribute,content,current) -- two return values
- head, stack = insert_node_after(head,stack,copy_node(nsnone))
+ head, stack = insertnodeafter(head,stack,copy_node(nsnone))
current = p
else
list = stacked(attribute,content,current)
@@ -684,13 +684,13 @@ current = 0
end
end
elseif id == rule_code then
- check = has_dimensions(stack)
+ check = hasdimensions(stack)
end
if check then
local a = getattr(stack,attribute)
if a then
if current ~= a then
- head = insert_node_before(head,stack,copy_node(nsdata[a]))
+ head = insertnodebefore(head,stack,copy_node(nsdata[a]))
depth = depth + 1
current = a
end
@@ -707,7 +707,7 @@ current = 0
elseif default > 0 then
--
elseif current > 0 then
- head = insert_node_before(head,stack,copy_node(nsnone))
+ head = insertnodebefore(head,stack,copy_node(nsnone))
depth = depth - 1
current = 0
end
@@ -716,7 +716,7 @@ current = 0
stack = getnext(stack)
end
while depth > 0 do
- head = insert_node_after(head,stack,copy_node(nsnone))
+ head = insertnodeafter(head,stack,copy_node(nsnone))
depth = depth - 1
end
return head
@@ -759,12 +759,12 @@ end
-- if nslistwise then
-- local a = getattr(current,attribute)
-- if a and attrib ~= a and nslistwise[a] then -- viewerlayer
--- head = insert_node_before(head,current,copy_node(nsdata[a]))
+-- head = insertnodebefore(head,current,copy_node(nsdata[a]))
-- list = stacker(attribute,content,a)
-- if list ~= content then
-- setlist(current,list)
-- end
--- head, current = insert_node_after(head,current,copy_node(nsnone))
+-- head, current = insertnodeafter(head,current,copy_node(nsnone))
-- else
-- list = stacker(attribute,content,attrib)
-- if list ~= content then
@@ -779,7 +779,7 @@ end
-- end
-- end
-- elseif id == rule_code then
--- check = has_dimensions(current)
+-- check = hasdimensions(current)
-- end
--
-- if check then
@@ -791,7 +791,7 @@ end
-- end
-- local n = nsstep(a)
-- if n then
--- head = insert_node_before(head,current,n) -- a
+-- head = insertnodebefore(head,current,n) -- a
-- end
-- attrib = a
-- if leader then
@@ -820,7 +820,7 @@ end
-- if stacked then
-- local n = nsend()
-- while n do
--- head = insert_node_after(head,previous,n)
+-- head = insertnodeafter(head,previous,n)
-- n = nsend()
-- end
-- end
@@ -854,12 +854,12 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
if nslistwise then
local a = getattr(current,attribute)
if a and attrib ~= a and nslistwise[a] then -- viewerlayer
- head = insert_node_before(head,current,copy_node(nsdata[a]))
+ head = insertnodebefore(head,current,copy_node(nsdata[a]))
list = stacker(attribute,content,a)
if list ~= content then
setlist(current,list)
end
- head, current = insert_node_after(head,current,copy_node(nsnone))
+ head, current = insertnodeafter(head,current,copy_node(nsnone))
else
list = stacker(attribute,content,attrib)
if list ~= content then
@@ -877,7 +877,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
-- so no redundant color stuff (only here, layers for instance should obey)
check = false
else
- check = has_dimensions(current)
+ check = hasdimensions(current)
end
end
@@ -890,7 +890,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
end
local n = nsstep(a)
if n then
- head = insert_node_before(head,current,n) -- a
+ head = insertnodebefore(head,current,n) -- a
end
attrib = a
if leader then
@@ -918,7 +918,7 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
if stacked then
local n = nsend()
while n do
- head = insert_node_after(head,previous,n)
+ head = insertnodeafter(head,previous,n)
n = nsend()
end
end
diff --git a/tex/context/base/mkxl/node-fnt.lmt b/tex/context/base/mkxl/node-fnt.lmt
index c96bdde3d..f3e8c212f 100644
--- a/tex/context/base/mkxl/node-fnt.lmt
+++ b/tex/context/base/mkxl/node-fnt.lmt
@@ -64,15 +64,15 @@ local nextboundary = nuts.traversers.boundary
local nextdisc = nuts.traversers.disc
local nextchar = nuts.traversers.char
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local disc_code = nodecodes.disc
local boundary_code = nodecodes.boundary
local wordboundary_code = boundarycodes.word
-local protect_glyphs = nuts.protect_glyphs
-local unprotect_glyphs = nuts.unprotect_glyphs
+local protectglyphs = nuts.protectglyphs
+local unprotectglyphs = nuts.unprotectglyphs
local setmetatableindex = table.setmetatableindex
@@ -186,7 +186,7 @@ do
local d, u, b, r
local function protectnone()
- protect_glyphs(firstnone,lastnone)
+ protectglyphs(firstnone,lastnone)
firstnone = nil
end
@@ -399,7 +399,7 @@ do
end
end
end
- flush_node(r)
+ flushnode(r)
end
end
@@ -546,5 +546,5 @@ do
end
-handlers.protectglyphs = protect_glyphs
-handlers.unprotectglyphs = unprotect_glyphs
+handlers.protectglyphs = protectglyphs
+handlers.unprotectglyphs = unprotectglyphs
diff --git a/tex/context/base/mkxl/node-gcm.lmt b/tex/context/base/mkxl/node-gcm.lmt
index 7f2a7bded..03a4acda8 100644
--- a/tex/context/base/mkxl/node-gcm.lmt
+++ b/tex/context/base/mkxl/node-gcm.lmt
@@ -14,8 +14,8 @@ local nuts = nodes.nuts
local getnext = nuts.getnext
local getsubtype = nuts.getsubtype
-local copy_node = nuts.copy
-local flush_list = nuts.flush_list
+local copynode = nuts.copy
+local flushlist = nuts.flushlist
local count = nuts.count
local isglyph = nuts.isglyph
local getprop = nuts.getprop
@@ -25,7 +25,7 @@ local fastcopy = table.fastcopy
local report_error = logs.reporter("node-aux:error")
-local function set_components(base,list)
+local function setcomponents(base,list)
local t = { }
local n = 0
local l = list
@@ -39,35 +39,35 @@ local function set_components(base,list)
end
-- not yet as we need them
--
- -- flush_list(l)
+ -- flushlist(l)
--
setprop(base,"components",n > 0 and t or false)
end
-local function get_components(base)
+local function getcomponents(base)
return getprop(base,"components")
end
-local function copy_no_components(base)
- local copy = copy_node(base)
+local function copynocomponents(base)
+ local copy = copynode(base)
setprop(copy,"components",false) -- no metatable lookup!
return copy
end
-local function copy_only_glyphs(base)
+local function copyonlyglyphs(base)
local t = getprop(base,"components") -- also metatable
if t then
return fastcopy(t)
end
end
-local function do_count(t,marks)
+local function docount(t,marks)
local n = 0
if t then
for i=1,#t do
local c = t[i]
if type(c) == "table" then
- n = n + do_count(t,marks)
+ n = n + docount(t,marks)
elseif not marks[c] then
n = n + 1
else
@@ -82,19 +82,19 @@ end
local done = false
-local function count_components(base,marks)
+local function countcomponents(base,marks)
local char = isglyph(base)
if char then
if getsubtype(base) == ligature_code then
if not done then
logs.report("fonts","!")
- logs.report("fonts","! check count_components with mkiv !")
+ logs.report("fonts","! check countcomponents with mkiv !")
logs.report("fonts","!")
done = true
end
local t = getprop(base,"components")
if t then
- return do_count(t,marks)
+ return docount(t,marks)
end
elseif not marks[char] then
return 1
@@ -103,12 +103,14 @@ local function count_components(base,marks)
return 0
end
-nuts.set_components = set_components
-nuts.get_components = get_components
-nuts.copy_only_glyphs = copy_only_glyphs
-nuts.copy_no_components = copy_no_components
-nuts.count_components = count_components
-nuts.flush_components = flush_list
+nuts.components = {
+ set = setcomponents,
+ get = getcomponents,
+ copyonlyglyphs = copyonlyglyphs,
+ copynocomponents = copynocomponents,
+ count = countcomponents,
+ flush = flushlist,
+}
nuts.setcomponents = function() report_error("unsupported: %a","setcomponents") end
nuts.getcomponents = function() report_error("unsupported: %a","getcomponents") end
diff --git a/tex/context/base/mkxl/node-ini.mkxl b/tex/context/base/mkxl/node-ini.mkxl
index 438e6ff01..09ac085c4 100644
--- a/tex/context/base/mkxl/node-ini.mkxl
+++ b/tex/context/base/mkxl/node-ini.mkxl
@@ -39,6 +39,7 @@
\registerctxluafile{node-scn}{autosuffix}
\registerctxluafile{node-syn}{autosuffix}
\registerctxluafile{node-par}{autosuffix}
+\registerctxluafile{node-bwc}{autosuffix} % for a while
%D This might go away (needs checking anyway, very old code):
diff --git a/tex/context/base/mkxl/node-met.lmt b/tex/context/base/mkxl/node-met.lmt
index 0186f2860..f24200e97 100644
--- a/tex/context/base/mkxl/node-met.lmt
+++ b/tex/context/base/mkxl/node-met.lmt
@@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['node-MET'] = {
-- the regular code is proven stable. No support otherwise.
-- luatex: todo: copylist should return h, t
--- todo: see if using insert_before and insert_after makes sense here
+-- todo: see if using insertbefore and insertafter makes sense here
-- This file is a side effect of the \LUATEX\ speed optimization project of Luigi
-- Scarso and me. As \CONTEXT\ spends over half its time in \LUA, we though that
@@ -65,39 +65,41 @@ end
-- We start with some helpers and provide all relevant basic functions in the
-- node namespace as well.
-nodes = nodes or { }
-local nodes = nodes
-
-local nodecodes = nodes.nodecodes
-
-nodes.copy = node.copy
-nodes.copy_list = node.copy_list
-nodes.copy_node = node.copy
-nodes.current_attributes = node.current_attributes
-nodes.remove = node.remove
-nodes.fields = node.fields
-nodes.flush = node.flush_node
-nodes.flush_list = node.flush_list
-nodes.flush_node = node.flush_node
-nodes.get_attribute = node.get_attribute
-nodes.has_attribute = node.has_attribute
-nodes.has_field = node.has_field
-nodes.insert_after = node.insert_after
-nodes.insert_before = node.insert_before
-nodes.is_node = node.is_node
-nodes.new = node.new
-nodes.set_attribute = node.set_attribute
-nodes.tail = node.tail
-nodes.tostring = node.tostring or tostring
-nodes.traverse = node.traverse
-nodes.traverse_id = node.traverse_id
-nodes.unset_attribute = node.unset_attribute
-nodes.write = node.write
-nodes.usedlist = node.usedlist
-
-nodes.get_properties_table = node.get_properties_table
-nodes.getproperty = node.getproperty
-nodes.setproperty = node.setproperty
+nodes = nodes or { }
+local nodes = nodes
+
+local nodecodes = nodes.nodecodes
+
+nodes.copy = node.copy
+nodes.copylist = node.copylist
+nodes.copy_node = node.copy
+nodes.currentattributes = node.currentattributes
+nodes.remove = node.remove
+nodes.fields = node.fields
+nodes.flush = node.flushnode
+nodes.flushlist = node.flushlist
+nodes.flushnode = node.flushnode
+nodes.getattribute = node.getattribute
+nodes.hasattribute = node.hasattribute
+nodes.hasfield = node.hasfield
+nodes.insertafter = node.insertafter
+nodes.insertbefore = node.insertbefore
+nodes.isnode = node.isnode
+nodes.isdirect = node.isdirect
+nodes.isnut = node.isdirect
+nodes.new = node.new
+nodes.setattribute = node.setattribute
+nodes.tail = node.tail
+nodes.tostring = node.tostring or tostring
+nodes.traverse = node.traverse
+nodes.traverseid = node.traverseid
+nodes.unsetattribute = node.unsetattribute
+nodes.write = node.write
+nodes.usedlist = node.usedlist
+
+nodes.getpropertiestable = node.get_properties_table
+nodes.getproperty = node.getproperty
+nodes.setproperty = node.setproperty
-- nodes.usedlist",
-- nodes.inuse",
@@ -118,7 +120,7 @@ nodes.setproperty = node.setproperty
-- Fot now I keep them in \LMTX\ but they will go away!
local n_getfield = node.getfield
-local n_getattr = node.get_attribute
+local n_getattr = node.getattribute
local n_setfield = node.setfield
local n_setattr = n_setfield
@@ -127,7 +129,7 @@ nodes.getfield = n_getfield
nodes.setfield = n_setfield
nodes.getattr = n_getattr
nodes.setattr = n_setattr
-nodes.takeattr = nodes.unset_attribute
+nodes.takeattr = nodes.unsetattribute
local function n_getid (n) return n_getfield(n,"id") end
local function n_getsubtype(n) return n_getfield(n,"subtype") end
@@ -191,12 +193,12 @@ nodes.setlink = n_setlink
nodes.getbox = node.getbox or tex.getbox
nodes.setbox = node.setbox or tex.setbox
-local n_flush_node = nodes.flush
+local n_flushnode = nodes.flushnode
local n_copy_node = nodes.copy
-local n_copy_list = nodes.copy_list
+local n_copy_list = nodes.copylist
local n_find_tail = nodes.tail
-local n_insert_after = nodes.insert_after
-local n_insert_before = nodes.insert_before
+local n_insertafter = nodes.insertafter
+local n_insertbefore = nodes.insertbefore
local n_slide = nodes.slide
local n_remove_node = node.remove -- not yet nodes.remove
@@ -207,7 +209,7 @@ local function remove(head,current,free_too)
if not t then
-- forget about it
elseif free_too then
- n_flush_node(t)
+ n_flushnode(t)
t = nil
else
n_setboth(t)
@@ -244,10 +246,10 @@ function nodes.replace(head,current,new) -- no head returned if false
if head == current then
head = new
end
- n_flush_node(current)
+ n_flushnode(current)
return head, new
else
- n_flush_node(current)
+ n_flushnode(current)
return new
end
end
@@ -256,14 +258,14 @@ end
function nodes.append(head,current,...)
for i=1,select("#",...) do
- head, current = n_insert_after(head,current,(select(i,...)))
+ head, current = n_insertafter(head,current,(select(i,...)))
end
return head, current
end
function nodes.prepend(head,current,...)
for i=1,select("#",...) do
- head, current = n_insert_before(head,current,(select(i,...)))
+ head, current = n_insertbefore(head,current,(select(i,...)))
end
return head, current
end
@@ -408,7 +410,7 @@ metatable.__sub = function(first,second)
local tail = n_find_tail(first)
for i=1,second do
local prev = n_getprev(tail)
- n_flush_node(tail) -- can become flushlist/flushnode
+ n_flushnode(tail) -- can become flushlist/flushnode
if prev then
tail = prev
else
@@ -443,7 +445,7 @@ metatable.__add = function(first,second)
local head = second
for i=1,first do
local second = n_getnext(head)
- n_flush_node(head) -- can become flushlist/flushnode
+ n_flushnode(head) -- can become flushlist/flushnode
if second then
head = second
else
diff --git a/tex/context/base/mkxl/node-mig.lmt b/tex/context/base/mkxl/node-mig.lmt
index c19913509..cc0e4c981 100644
--- a/tex/context/base/mkxl/node-mig.lmt
+++ b/tex/context/base/mkxl/node-mig.lmt
@@ -6,8 +6,6 @@ if not modules then modules = { } end modules ['node-mig'] = {
license = "see context related readme files"
}
--- todo: insert_after
-
local format = string.format
local trace_migrations = false trackers.register("nodes.migrations", function(v) trace_migrations = v end)
diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt
index 9bd7b1889..d8dfbdb9e 100644
--- a/tex/context/base/mkxl/node-nut.lmt
+++ b/tex/context/base/mkxl/node-nut.lmt
@@ -26,52 +26,57 @@ local glyph_code = nodecodes.glyph
local tonode = direct.tonode
local tonut = direct.todirect
-local is_node = direct.is_node
-local is_nut = direct.is_direct
+local isnode = direct.isnode
+local isnut = direct.isdirect
+local isdirect = direct.isdirect
local d_remove_node = direct.remove
-local d_flush_node = direct.flush_node
+local d_flushnode = direct.flushnode
local d_getnext = direct.getnext
local d_getprev = direct.getprev
local d_getid = direct.getid
local d_getlist = direct.getlist
local d_find_tail = direct.tail
-local d_insert_after = direct.insert_after
-local d_insert_before = direct.insert_before
+local d_insertafter = direct.insertafter
+local d_insertbefore = direct.insertbefore
local d_slide = direct.slide
local d_traverse = direct.traverse
local d_setlink = direct.setlink
local d_getboth = direct.getboth
local nuts = {
- check_discretionaries = direct.check_discretionaries,
+ addmargins = direct.addmargins,
+ addxoffset = direct.addxoffset,
+ addxymargins = direct.addxymargins,
+ addyoffset = direct.addyoffset,
+ append = direct.append,
+ checkdiscretionaries = direct.checkdiscretionaries,
collapsing = direct.collapsing,
copy = direct.copy,
- copy_list = direct.copy_list,
- copy_node = direct.copy,
- copy_only = direct.copy_only or direct.copy,
+ copynode = direct.copy,
+ copylist = direct.copylist,
+ copyonly = direct.copyonly,
count = direct.count,
- current_attributes = direct.current_attributes,
+ currentattributes = direct.currentattributes,
delete = direct.delete,
dimensions = direct.dimensions,
- naturalhsize = direct.naturalhsize,
- naturalwidth = direct.naturalwidth,
- effective_glue = direct.effective_glue,
- end_of_math = direct.end_of_math,
+ effectiveglue = direct.effectiveglue,
+ endofmath = direct.endofmath,
exchange = direct.exchange,
- find_attribute = direct.find_attribute,
- first_glyph = direct.first_glyph,
- flatten_discretionaries = direct.flatten_discretionaries,
- flush = d_flush_node,
- flush_components = direct.flush_components,
- flush_list = direct.flush_list,
- flush_node = direct.flush_node,
+ findattribute = direct.findattribute,
+ findnode = direct.findnode,
+ firstglyph = direct.firstglyph,
+ flattendiscretionaries = direct.flattendiscretionaries,
+ flush = d_flushnode,
+ flushlist = direct.flushlist,
+ flushnode = d_flushnode,
free = direct.free,
- getsynctexfields = direct.get_synctex_fields,
- getattr = direct.get_attribute,
- getattrs = direct.get_attributes,
+ getattr = direct.getattribute,
+ getattribute = direct.getattribute,
getattributelist = direct.getattributelist,
+ getattributes = direct.getattributes,
getattrlist = direct.getattributelist,
+ getattrs = direct.getattributes,
getboth = d_getboth,
getbox = direct.getbox,
getboxglue = direct.getglue,
@@ -83,17 +88,19 @@ local nuts = {
getdir = direct.getdir,
getdirection = direct.getdirection,
getdisc = direct.getdisc,
- getdiscretionary = direct.getdisc,
getdiscpart = direct.getdiscpart,
+ getdiscretionary = direct.getdisc,
getexpansion = direct.getexpansion,
getfam = direct.getfam,
getfield = direct.getfield,
getfont = direct.getfont,
getglue = direct.getglue,
getglyphdata = direct.getglyphdata,
+ getglyphdimensions = direct.getglyphdimensions,
getheight = direct.getheight,
getid = d_getid,
getkern = direct.getkern,
+ getkerndimension = direct.getkerndimension,
getlang = direct.getlanguage,-- will become obsolete
getlanguage = direct.getlanguage,
getleader = direct.getleader,
@@ -102,22 +109,16 @@ local nuts = {
getnormalizedline = direct.getnormalizedline,
getnucleus = direct.getnucleus,
getoffsets = direct.getoffsets,
- -- getxyoffsets = direct.getxyoffsets,
- getscale = direct.getscale,
- getscales = direct.getscales,
- getxscale = direct.getxscale,
- getyscale = direct.getyscale,
- xscaled = direct.xscaled,
- yscaled = direct.yscaled,
- getxyscales = direct.getxyscales,
- getorientation = direct.getorientation,
getoptions = direct.getoptions,
+ getorientation = direct.getorientation,
getpenalty = direct.getpenalty,
getpost = direct.getpost,
getpre = direct.getpre,
getprev = d_getprev,
getreplace = direct.getreplace,
getruledata = direct.getdata, -- obsolete when we have the split
+ getscale = direct.getscale,
+ getscales = direct.getscales,
getscript = direct.setscript,
getshift = direct.getshift,
getstate = direct.getstate,
@@ -127,50 +128,56 @@ local nuts = {
getsup = direct.getsup,
getsuppre = direct.getsuppre,
getsurround = direct.getkern,
+ getsynctexfields = direct.getsynctexfields,
gettotal = direct.gettotal,
getvalue = direct.getdata, -- obsolete
getwhd = direct.getwhd,
getwidth = direct.getwidth,
- has_attribute = direct.has_attribute,
- has_dimensions = direct.has_dimensions,
- has_field = direct.has_field,
- has_glyph = direct.has_glyph or direct.first_glyph,
+ getxscale = direct.getxscale,
+ getxyscales = direct.getxyscales,
+ getyscale = direct.getyscale,
+ hasattribute = direct.hasattribute,
+ hasdimensions = direct.hasdimensions,
+ hasfield = direct.hasfield,
+ hasglyph = direct.hasglyph,
+ hasglyphoption = direct.hasglyphoption,
hpack = direct.hpack,
hyphenating = direct.hyphenating,
- insert_after = d_insert_after,
- insert_before = d_insert_before,
- is_direct = is_direct,
- is_node = is_node,
- is_nut = direct.is_direct,
- is_zero_glue = direct.is_zero_glue,
- ischar = direct.is_char,
- isprevchar = direct.is_prev_char,
- isnextchar = direct.is_next_char,
- isprevglyph = direct.is_prev_glyph,
- isnextglyph = direct.is_next_glyph,
- isglyph = direct.is_glyph,
+ ignoremathskip = direct.ignoremathskip,
+ insertafter = d_insertafter,
+ insertbefore = d_insertbefore,
+ isdirect = isdirect,
+ isnode = isnode,
+ isnut = isdirect,
+ ischar = direct.ischar,
+ isglyph = direct.isglyph,
+ isnextchar = direct.isnextchar,
+ isnextglyph = direct.isnextglyph,
+ isprevchar = direct.isprevchar,
+ isprevglyph = direct.isprevglyph,
+ iszeroglue = direct.iszeroglue,
kerning = direct.kerning,
- last_node = direct.last_node,
+ lastnode = direct.lastnode,
length = direct.length,
ligaturing = direct.ligaturing,
+ makextensible = direct.makextensible,
migrate = direct.migrate,
- mlist_to_hlist = direct.mlist_to_hlist,
+ mlisttohlist = direct.mlisttohlist,
+ naturalhsize = direct.naturalhsize,
+ naturalwidth = direct.naturalwidth,
new = direct.new,
- protect_glyph = direct.protect_glyph,
- protect_glyphs = direct.protect_glyphs,
- protrusion_skippable = direct.protrusion_skippable,
+ protectglyph = direct.protectglyph,
+ protectglyphs = direct.protectglyphs,
+ protrusionskippable = direct.protrusionskippable,
rangedimensions = direct.rangedimensions,
- getglyphdimensions = direct.getglyphdimensions,
- getkerndimension = direct.getkerndimension,
remove = d_remove_node,
reverse = direct.reverse,
- set_attribute = direct.set_attribute,
- addmargins = direct.addmargins,
- addxymargins = direct.addxymargins,
- setattr = direct.set_attribute,
- setattrs = direct.set_attributes,
+ setattr = direct.setattribute,
+ setattr = direct.setattribute,
+ setattribute = direct.setattribute,
setattributelist = direct.setattributelist,
setattrlist = direct.setattributelist,
+ setattrs = direct.setattributes,
setboth = direct.setboth,
setbox = direct.setbox,
setboxglue = direct.setglue,
@@ -181,8 +188,8 @@ local nuts = {
setdir = direct.setdir,
setdirection = direct.setdirection,
setdisc = direct.setdisc,
- setdiscretionary = direct.setdisc,
setdiscpart = direct.setdiscpart,
+ setdiscretionary = direct.setdisc,
setexpansion = direct.setexpansion,
setfam = direct.setfam,
setfield = direct.setfield,
@@ -198,19 +205,17 @@ local nuts = {
setlist = direct.setlist,
setnext = direct.setnext,
setnucleus = direct.setnucleus,
- setscale = direct.setscale or direct.setscales,
- setscales = direct.setscales,
setoffsets = direct.setoffsets,
- addxoffset = direct.addxoffset,
- addyoffset = direct.addyoffset,
- setorientation = direct.setorientation,
setoptions = direct.setoptions,
+ setorientation = direct.setorientation,
setpenalty = direct.setpenalty,
setpost = direct.setpost,
setpre = direct.setpre,
setprev = direct.setprev,
setreplace = direct.setreplace,
setruledata = direct.setdata, -- obsolete when we have the split
+ setscale = direct.setscale or direct.setscales,
+ setscales = direct.setscales,
setscript = direct.getscript,
setshift = direct.setshift,
setsplit = direct.setsplit,
@@ -221,44 +226,46 @@ local nuts = {
setsup = direct.setsup,
setsuppre = direct.setsuppre,
setsurround = direct.setkern,
- setsynctexfields = direct.set_synctex_fields,
+ setsynctexfields = direct.setsynctexfields,
setvalue = direct.setdata, -- obsolete
setwhd = direct.setwhd,
setwidth = direct.setwidth,
+ show = direct.show,
slide = d_slide,
- start_of_par = direct.start_of_par,
+ startofpar = direct.startofpar,
tail = d_find_tail,
- takeattr = direct.unset_attribute, -- ?
+ takeattr = direct.unsetattribute, -- ?
tonode = tonode,
tonut = tonut,
tostring = direct.tostring,
traverse = d_traverse,
- traverse_char = direct.traverse_char,
- traverse_glyph = direct.traverse_glyph,
- traverse_id = direct.traverse_id,
- traverse_list = direct.traverse_list,
- traverse_content = direct.traverse_content,
- unprotect_glyph = direct.unprotect_glyph,
- unprotect_glyphs = direct.unprotect_glyphs,
- unset_attribute = direct.unset_attribute,
- unset_attributes = direct.unset_attributes,
+ traversechar = direct.traversechar,
+ traversecontent = direct.traversecontent,
+ traverseglyph = direct.traverseglyph,
+ traverseid = direct.traverseid,
+ traverselist = direct.traverselist,
+ unprotectglyph = direct.unprotectglyph,
+ unprotectglyphs = direct.unprotectglyphs,
+ unsetattribute = direct.unsetattribute,
+ unsetattributes = direct.unsetattributes,
usedlist = direct.usedlist,
- uses_font = direct.uses_font,
+ usesfont = direct.usesfont,
+ verticalbreak = direct.verticalbreak,
vpack = direct.vpack,
write = direct.write,
- append = direct.append,
- has_glyph_option = direct.has_glyph_option,
- show = direct.show,
+ xscaled = direct.xscaled,
+ yscaled = direct.yscaled,
+ -- getxyoffsets = direct.getxyoffsets,
}
-nodes.nuts = nuts
+nodes.nuts = nuts
-nodes.is_node = is_node
-nodes.is_direct = is_nut
-nodes.is_nut = is_nut
+nodes.isnode = isnode
+nodes.isdirect = isnut
+nodes.isnut = isnut
-nodes.tonode = tonode
-nodes.tonut = tonut
+nodes.tonode = tonode
+nodes.tonut = tonut
function nuts.delete(head,current)
return d_remove_node(head,current,true)
@@ -276,10 +283,10 @@ function nuts.replace(head,current,new) -- no head returned if false
if head == current then
head = new
end
- d_flush_node(current)
+ d_flushnode(current)
return head, new
else
- d_flush_node(current)
+ d_flushnode(current)
return new
end
end
@@ -311,14 +318,14 @@ end
function nuts.append(head,current,...)
for i=1,select("#",...) do
- head, current = d_insert_after(head,current,(select(i,...)))
+ head, current = d_insertafter(head,current,(select(i,...)))
end
return head, current
end
function nuts.prepend(head,current,...)
for i=1,select("#",...) do
- head, current = d_insert_before(head,current,(select(i,...)))
+ head, current = d_insertbefore(head,current,(select(i,...)))
end
return head, current
end
@@ -365,7 +372,7 @@ function nuts.vianodes(f) return function(n,...) return tonut (f(tonode(n),...))
nodes.vianuts = nuts.vianuts
nodes.vianodes = nuts.vianodes
-function nodes.insert_list_after(h,c,n)
+function nodes.insertlistafter(h,c,n)
local t = n_tail(n)
if c then
local cn = n_getnext(c)
@@ -383,7 +390,7 @@ function nodes.insert_list_after(h,c,n)
return n, t
end
-function nuts.insert_list_after(h,c,n)
+function nuts.insertlistafter(h,c,n)
local t = d_tail(n)
if c then
local cn = d_getnext(c)
@@ -509,7 +516,7 @@ nuts.nestedtracedslide = nestedtracedslide
-- this might move
-local propertydata = direct.get_properties_table(true)
+local propertydata = direct.getpropertiestable(true)
local getattr = nuts.getattr
local setattr = nuts.setattr
diff --git a/tex/context/base/mkxl/node-pro.lmt b/tex/context/base/mkxl/node-pro.lmt
index e736f2b76..e84730b87 100644
--- a/tex/context/base/mkxl/node-pro.lmt
+++ b/tex/context/base/mkxl/node-pro.lmt
@@ -69,7 +69,6 @@ processors.enabled = true -- this will become a proper state (like trackers)
do
- -- local has_glyph = nodes.has_glyph
local count_nodes = nodes.countall
local texget = tex.get
@@ -79,7 +78,7 @@ do
-- We've set \hlistcallbackmode=1 so glyph checking happens at the other end!
local function pre_linebreak_filter(head,groupcode)
- -- local found = force_processors or has_glyph(head)
+ -- local found = force_processors or hasglyph(head)
-- if found then
if trace_callbacks then
local before = count_nodes(head,true)
@@ -97,7 +96,7 @@ do
end
local function hpack_filter(head,groupcode,size,packtype,direction,attributes)
- -- local found = force_processors or has_glyph(head)
+ -- local found = force_processors or hasglyph(head)
-- if found then
--
-- yes or no or maybe an option
@@ -150,7 +149,7 @@ do
end
do
- -- Beware, these are packaged boxes so no first_glyph test needed. Maybe some day I'll add a hash
+ -- Beware, these are packaged boxes so no firstglyph test needed. Maybe some day I'll add a hash
-- with valid groupcodes. Watch out, much can pass twice, for instance vadjust passes two times,
local actions = tasks.actions("finalizers") -- head, where
diff --git a/tex/context/base/mkxl/node-ref.lmt b/tex/context/base/mkxl/node-ref.lmt
index c02a37dd1..78ff824c9 100644
--- a/tex/context/base/mkxl/node-ref.lmt
+++ b/tex/context/base/mkxl/node-ref.lmt
@@ -80,7 +80,8 @@ local getdimensions = nuts.dimensions
local getrangedimensions = nuts.rangedimensions
local traverse = nuts.traverse
local find_node_tail = nuts.tail
-local start_of_par = nuts.start_of_par
+
+local startofpar = nuts.startofpar
local nodecodes = nodes.nodecodes
local gluecodes = nodes.gluecodes
@@ -109,7 +110,7 @@ local new_rule = nodepool.rule
local new_kern = nodepool.kern
local new_hlist = nodepool.hlist
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local tosequence = nodes.tosequence
@@ -147,7 +148,7 @@ local inject_areas do
local v = vpack_list(start) -- use helper but happens seldom anyway so ...
local w, h, d = getwhd(v)
setlist(v) -- not needed
- flush_node(v)
+ flushnode(v)
if temp then
setnext(stop,temp)
end
@@ -352,7 +353,7 @@ local inject_areas do
txtdir = not pop and direction -- we might need a stack
goto NEXT
elseif id == par_code then
- if start_of_par(current) then
+ if startofpar(current) then
pardir = getdirection(current)
end
goto NEXT
diff --git a/tex/context/base/mkxl/node-res.lmt b/tex/context/base/mkxl/node-res.lmt
index 9c291fcbf..fbf52ae3b 100644
--- a/tex/context/base/mkxl/node-res.lmt
+++ b/tex/context/base/mkxl/node-res.lmt
@@ -78,7 +78,7 @@ local setdata = nuts.setdata
local setruledata = nuts.setruledata
local setvalue = nuts.setvalue
-local copy_nut = nuts.copy_only or nuts.copy
+local copy_nut = nuts.copyonly
local new_nut = nuts.new
local flush_nut = nuts.flush
@@ -542,22 +542,22 @@ lua.registerfinalizer(cleanup, "cleanup reserved nodes")
do
- local glyph = glyph
- local traverse_id = nuts.traverse_id
+ local glyph = glyph
+ local traverseid = nuts.traverseid
- local traversers = table.setmetatableindex(function(t,k)
- local v = traverse_id(type(k) == "number" and k or nodecodes[k],glyph)
+ local traversers = table.setmetatableindex(function(t,k)
+ local v = traverseid(type(k) == "number" and k or nodecodes[k],glyph)
t[k] = v
return v
end)
-- these are special:
- traversers.node = nuts.traverse (glyph)
- traversers.char = nuts.traverse_char (glyph)
- traversers.glyph = nuts.traverse_glyph (glyph)
- traversers.list = nuts.traverse_list (glyph)
- traversers.content = nuts.traverse_content(glyph)
+ traversers.node = nuts.traverse (glyph)
+ traversers.char = nuts.traversechar (glyph)
+ traversers.glyph = nuts.traverseglyph (glyph)
+ traversers.list = nuts.traverselist (glyph)
+ traversers.content = nuts.traversecontent(glyph)
nuts.traversers = traversers
diff --git a/tex/context/base/mkxl/node-rul.lmt b/tex/context/base/mkxl/node-rul.lmt
index a95c5272d..a1857bd6e 100644
--- a/tex/context/base/mkxl/node-rul.lmt
+++ b/tex/context/base/mkxl/node-rul.lmt
@@ -55,15 +55,15 @@ local getruledata = nuts.getruledata
local isglyph = nuts.isglyph
-local flushlist = nuts.flush_list
-local effective_glue = nuts.effective_glue
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
+local flushlist = nuts.flushlist
+local effectiveglue = nuts.effectiveglue
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
local find_tail = nuts.tail
local setglue = nuts.setglue
local getrangedimensions = nuts.rangedimensions
local hpack_nodes = nuts.hpack
-local copy_list = nuts.copy_list
+local copylist = nuts.copylist
local nextlist = nuts.traversers.list
local nextglue = nuts.traversers.glue
@@ -312,7 +312,7 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
setattr(r,a_viewerlayer,layer)
end
if empty then
- head = insert_node_before(head,f,r)
+ head = insertnodebefore(head,f,r)
setlink(r,getnext(l))
setprev(f)
setnext(l)
@@ -320,12 +320,12 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
else
local k = new_kern(-wd)
if foreground then
- insert_node_after(head,l,k)
- insert_node_after(head,k,r)
+ insertnodeafter(head,l,k)
+ insertnodeafter(head,k,r)
l = r
else
- head = insert_node_before(head,f,r)
- insert_node_after(head,r,k)
+ head = insertnodebefore(head,f,r)
+ insertnodeafter(head,r,k)
end
end
if trace_ruled then
@@ -352,7 +352,7 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
else
local tx = d.text
if tx then
- local l = copy_list(tx)
+ local l = copylist(tx)
if d["repeat"] == v_yes then
l = new_leader(wd,l)
setattrlist(l,tx)
@@ -560,7 +560,7 @@ function linefillers.handler(head)
if location == v_left or location == v_both then
local indentation = is and getwidth(is) or 0
local leftfixed = ls and getwidth(ls) or 0
- local lefttotal = ls and effective_glue(ls,current) or 0
+ local lefttotal = ls and effectiveglue(ls,current) or 0
local width = lefttotal - (leftlocal and leftfixed or 0) + indentation - distance
if width > threshold then
if is then
@@ -568,17 +568,17 @@ function linefillers.handler(head)
end
setglue(ls,leftlocal and getwidth(ls) or nil)
if distance > 0 then
- insert_node_after(list,ls,new_kern(distance))
+ insertnodeafter(list,ls,new_kern(distance))
end
- insert_node_after(list,ls,linefiller(current,data,width,"left"))
+ insertnodeafter(list,ls,linefiller(current,data,width,"left"))
end
end
--
if location == v_right or location == v_both then
local rightfixed = rs and getwidth(rs) or 0
- local righttotal = rs and effective_glue(rs,current) or 0
+ local righttotal = rs and effectiveglue(rs,current) or 0
local parfixed = pr and getwidth(pr) or 0
- local partotal = pr and effective_glue(pr,current) or 0
+ local partotal = pr and effectiveglue(pr,current) or 0
local width = righttotal - (rightlocal and rightfixed or 0) + partotal - distance
if width > threshold then
if pr then
@@ -586,9 +586,9 @@ function linefillers.handler(head)
end
setglue(rs,rightlocal and getwidth(rs) or nil)
if distance > 0 then
- insert_node_before(list,rs,new_kern(distance))
+ insertnodebefore(list,rs,new_kern(distance))
end
- insert_node_before(list,rs,linefiller(current,data,width,"right"))
+ insertnodebefore(list,rs,linefiller(current,data,width,"right"))
end
end
else
diff --git a/tex/context/base/mkxl/node-scn.lmt b/tex/context/base/mkxl/node-scn.lmt
index 3c1dd2d88..55f39a74b 100644
--- a/tex/context/base/mkxl/node-scn.lmt
+++ b/tex/context/base/mkxl/node-scn.lmt
@@ -21,8 +21,6 @@ local getsubtype = nuts.getsubtype
local getlist = nuts.getlist
local setlist = nuts.setlist
-local end_of_math = nuts.end_of_math
-
local nodecodes = nodes.nodecodes
local gluecodes = nodes.gluecodes
local kerncodes = nodes.kerncodes
diff --git a/tex/context/base/mkxl/node-ser.lmt b/tex/context/base/mkxl/node-ser.lmt
index 8fcbb31e4..c14a3826f 100644
--- a/tex/context/base/mkxl/node-ser.lmt
+++ b/tex/context/base/mkxl/node-ser.lmt
@@ -14,15 +14,11 @@ local allocate = utilities.storage.allocate
local context = context
local nodes = nodes
-local node = node
-
-local getfields = node.fields
-
-local is_node = nodes.is_node
+local getfields = nodes.fields
+local isnode = nodes.isnode
local nodecodes = nodes.nodecodes
local subtypes = nodes.subtypes
-
local tonode = nodes.tonode
local tonut = nodes.tonut
@@ -109,7 +105,7 @@ end
nodes.astable = astable
-setinspector("node",function(v) if is_node(v) then printtable(astable(v),tostring(v)) return true end end)
+setinspector("node",function(v) if isnode(v) then printtable(astable(v),tostring(v)) return true end end)
local function to_table(n,flat,verbose,noattributes,done)
local d = tonut(n)
diff --git a/tex/context/base/mkxl/node-shp.lmt b/tex/context/base/mkxl/node-shp.lmt
index 64508ecc7..8a0a26510 100644
--- a/tex/context/base/mkxl/node-shp.lmt
+++ b/tex/context/base/mkxl/node-shp.lmt
@@ -34,7 +34,7 @@ function handlers.finalizebox(box)
actions(getbox(box)) -- nut
end
-handlers.cleanuppage = nuts.flatten_discretionaries
+handlers.cleanuppage = nuts.flattendiscretionaries
-- interface
diff --git a/tex/context/base/mkxl/node-syn.lmt b/tex/context/base/mkxl/node-syn.lmt
index ce5f0d2dd..5b0a92a38 100644
--- a/tex/context/base/mkxl/node-syn.lmt
+++ b/tex/context/base/mkxl/node-syn.lmt
@@ -162,8 +162,8 @@ local fontkern_code = kerncodes.fontkern
local cancel_code = nodes.dircodes.cancel
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local nodepool = nuts.pool
local new_latelua = nodepool.latelua
@@ -173,7 +173,7 @@ local new_kern = nodepool.kern
local getdimensions = nuts.dimensions
local getrangedimensions = nuts.rangedimensions
-local getsynctexfields = nuts.getsynctexfields or nuts.get_synctex_fields
+local getsynctexfields = nuts.getsynctexfields
local forcesynctextag = tex.forcesynctextag or tex.force_synctex_tag
local forcesynctexline = tex.forcesynctexline or tex.force_synctex_line
local getsynctexline = tex.getsynctexline or tex.get_synctex_line
@@ -396,7 +396,7 @@ local x_hlist do
x_hlist = function(head,current,t,l,w,h,d)
if filehandle then
- return insert_before(head,current,new_latelua(function() doaction(t,l,w,h,d) end))
+ return insertbefore(head,current,new_latelua(function() doaction(t,l,w,h,d) end))
else
return head
end
@@ -432,8 +432,8 @@ local function inject(head,first,last,tag,line)
d = depth
end
if trace then
- head = insert_before(head,first,new_rule(w,fulltrace and h or traceheight,fulltrace and d or tracedepth))
- head = insert_before(head,first,new_kern(-w))
+ head = insertbefore(head,first,new_rule(w,fulltrace and h or traceheight,fulltrace and d or tracedepth))
+ head = insertbefore(head,first,new_kern(-w))
end
head = x_hlist(head,first,tag,line,w,h,d)
return head
@@ -499,8 +499,8 @@ local function inject(parent,head,first,last,tag,line)
d = depth
end
if trace then
- head = insert_before(head,first,new_rule(w,fulltrace and h or traceheight,fulltrace and d or tracedepth))
- head = insert_before(head,first,new_kern(-w))
+ head = insertbefore(head,first,new_rule(w,fulltrace and h or traceheight,fulltrace and d or tracedepth))
+ head = insertbefore(head,first,new_kern(-w))
end
head = x_hlist(head,first,tag,line,w,h,d)
return head
diff --git a/tex/context/base/mkxl/node-tra.lmt b/tex/context/base/mkxl/node-tra.lmt
index 6060522be..8ed14b305 100644
--- a/tex/context/base/mkxl/node-tra.lmt
+++ b/tex/context/base/mkxl/node-tra.lmt
@@ -52,7 +52,6 @@ local isglyph = nuts.isglyph
local getdirection = nuts.getdirection
local getwidth = nuts.getwidth
-local flush_list = nuts.flush_list
local count_nodes = nuts.countall
local used_nodes = nuts.usedlist
@@ -86,7 +85,7 @@ local whatsit_code = nodecodes.whatsit
local dimenfactors = number.dimenfactors
local formatters = string.formatters
-local start_of_par = nuts.start_of_par
+local startofpar = nuts.startofpar
-- this will be reorganized:
@@ -157,7 +156,7 @@ local function tosequence(start,stop,compact)
elseif id == dir_code then
local d, p = getdirection(start)
n = n + 1 ; t[n] = "[<" .. (p and "-" or "+") .. d .. ">]" -- todo l2r etc
- elseif id == par_code and start_of_par(current) then
+ elseif id == par_code and startofpar(current) then
n = n + 1 ; t[n] = "[<" .. getdirection(start) .. ">]" -- todo l2r etc
elseif compact then
n = n + 1 ; t[n] = "[]"
diff --git a/tex/context/base/mkxl/pack-rul.lmt b/tex/context/base/mkxl/pack-rul.lmt
index 62f305cba..bac21e91c 100644
--- a/tex/context/base/mkxl/pack-rul.lmt
+++ b/tex/context/base/mkxl/pack-rul.lmt
@@ -60,7 +60,7 @@ local getboxglue = nuts.getglue
local hpack = nuts.hpack
local getdimensions = nuts.dimensions
local naturalhsize = nuts.naturalhsize
-local flush_node = nuts.flush
+local flushnode = nuts.flush
local traversers = nuts.traversers
local nexthlist = traversers.hlist
@@ -143,7 +143,7 @@ local function doreshapeframedbox(n)
local set, order, sign = getboxglue(p)
setboxglue(h,set,order,sign)
setlist(p)
- flush_node(p)
+ flushnode(p)
elseif checkformath and subtype == equationlist_code then
-- display formulas use a shift
if nofnonzero == 1 then
@@ -177,7 +177,7 @@ local function doreshapeframedbox(n)
texsetdimen("global","framedaveragewidth",averagewidth)
end
-local function doanalyzeframedbox(n) -- traverse_list
+local function doanalyzeframedbox(n)
local box = getbox(n)
local noflines = 0
local firstheight = nil
diff --git a/tex/context/base/mkxl/page-ini.lmt b/tex/context/base/mkxl/page-ini.lmt
new file mode 100644
index 000000000..bb5ea2b5d
--- /dev/null
+++ b/tex/context/base/mkxl/page-ini.lmt
@@ -0,0 +1,356 @@
+if not modules then modules = { } end modules ['page-ini'] = {
+ version = 1.001,
+ comment = "companion to page-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- Some day I need to make this more efficient.
+
+local tonumber, rawget, rawset, type, next = tonumber, rawget, rawset, type, next
+local match = string.match
+local sort, tohash, insert, remove, sortedkeys = table.sort, table.tohash, table.insert, table.remove, table.sortedkeys
+local settings_to_array, settings_to_hash = utilities.parsers.settings_to_array, utilities.parsers.settings_to_hash
+
+local texgetcount = tex.getcount
+
+local tonut = nodes.tonut
+local nextlist = nodes.nuts.traversers.list
+local texlists = tex.lists
+
+local context = context
+local ctx_doif = commands.doif
+local ctx_doifelse = commands.doifelse
+
+local implement = interfaces.implement
+
+local data = table.setmetatableindex("table")
+local last = 0
+local pages = structures.pages
+local autolist = { }
+local report = logs.reporter("pages","mark")
+local active = false
+
+local trace = false trackers.register("pages.mark",function(v) trace = v end)
+
+function pages.mark(name,list,settings)
+ active = true
+ --
+ local realpage = texgetcount("realpageno")
+ if type(settings) == "string" then
+ settings = settings_to_hash(settings)
+ end
+ if not list or list == "" then
+ if trace then
+ report("marking current page %i as %a",realpage,name)
+ end
+ data[realpage][name] = settings or true
+ return
+ end
+ if type(list) == "string" then
+ list = settings_to_array(list)
+ end
+ if type(list) == "table" then
+ for i=1,#list do
+ local page = list[i]
+ local sign = false
+ if type(page) == "string" then
+ local f, t = match(page,"(%d+)[:%-](%d+)")
+ if f and t then
+ f, t = tonumber(f), tonumber(t)
+ if f and t and f <= t then
+ if trace then
+ report("marking page %i upto %i as %a",f,t,name)
+ end
+ for page=f,t do
+ data[page][name] = settings or true
+ end
+ end
+ page = false
+ else
+ local s, p = match(page,"([%+%-])(%d+)")
+ if s then
+ sign, page = s, p
+ end
+ end
+ end
+ if page then
+ page = tonumber(page)
+ if page then
+ if sign == "+" then
+ page = realpage + page
+ end
+ if sign == "-" then
+ report("negative page numbers are not supported")
+ else
+ if trace then
+ report("marking page %i as %a",page,name)
+ end
+ data[page][name] = settings or true
+ end
+ end
+ end
+ end
+ else
+ if trace then
+ report("marking current page %i as %a",realpage,name)
+ end
+ data[realpage][name] = settings or true
+ end
+end
+
+local tobemarked = { }
+
+function pages.markedlist(realpage)
+ if active and realpage then
+ local m = rawget(tobemarked,realpage) or rawget(data,realpage)
+ return m and next(m) and sortedkeys(m)
+ end
+end
+
+local function marked(name)
+ if active then
+ local realpage = texgetcount("realpageno")
+ if last ~= 0 then
+ for i=last,realpage-1 do
+ -- print(last)
+ local di = data[i]
+ if di then
+ tobemarked[i] = di
+ rawset(data,i,nil)
+ end
+ end
+ last = 0 -- needs checking
+ end
+ local pagedata = rawget(data,realpage)
+ return pagedata and pagedata[name] and true or false
+ else
+ return false
+ end
+end
+
+local function markedparameter(name,key)
+ if active then
+ local pagedata = rawget(data,texgetcount("realpageno"))
+ if pagedata then
+ pagedata = pagedata[name]
+ if pagedata then
+ pagedata = pagedata[key]
+ end
+ end
+ return pagedata
+ end
+end
+
+local function toranges(marked)
+ local list = { }
+ local size = #marked
+ if size > 0 then
+ local first = marked[1]
+ local last = first
+ for i=2,size do
+ local page = marked[i]
+ if page > last + 1 then
+ list[#list+1] = { first, last }
+ first = page
+ end
+ last = page
+ end
+ list[#list+1] = { first, last }
+ --
+ active = true
+ end
+ return list
+end
+
+local function allmarked(list)
+ if active and list then
+ local collected = pages.collected
+ if collected then
+ if type(list) == "string" then
+ list = settings_to_hash(list)
+ elseif type(list) == "table" and #list > 0 then
+ list = tohash(list)
+ end
+ if type(list) == "table" then
+ local found = { }
+ for name in next, list do
+ for page, list in next, data do
+ if list[name] and collected[page] then
+ found[#found+1] = page
+ end
+ end
+ end
+ if #found > 0 then
+ sort(found)
+ if trace then
+ local ranges = toranges(found)
+ for i=1,#ranges do
+ local range = ranges[i]
+ local first = range[1]
+ local last = range[2]
+ if first == last then
+ report("marked page : %i",first)
+ else
+ report("marked range: %i upto %i",first,last)
+ end
+ end
+ end
+ return found
+ end
+ end
+ end
+ end
+end
+
+pages.marked = marked
+pages.toranges = toranges
+pages.allmarked = allmarked
+
+-- An alternative is to use an attribute and identify the state by parsing the node
+-- list but that's a bit overkill for a hardly used feature like this.
+
+-- Page actions are bound to a real page. When we set one, we need to bind to the
+-- current page unless we just flushed. So we also need to check the current page.
+
+-- \page ... \start : sync realpage
+-- \page \start : sync realpage
+-- \page \stop : reset synced because no content yet
+-- \page ... \stop : keep sync
+
+local function autopageaction()
+ if active then
+ local nofauto = #autolist
+ if nofauto > 0 then
+ local realpage = texgetcount("realpageno")
+ for i=1,nofauto do
+ local entry = autolist[i]
+ local names = entry[1]
+ local settings = entry[2]
+ for j=1,#names do
+ local name = names[j]
+ local list = data[realpage]
+ if not list[name] then
+ if trace then
+ report("automatically marking page %i as %a",realpage,name)
+ end
+ list[name] = settings or true
+ end
+ end
+ end
+ end
+ end
+end
+
+local function startmarked(name,settings)
+ active = true
+ --
+ insert(autolist, { settings_to_array(name), settings_to_hash(settings) })
+ autopageaction(true)
+end
+
+local function stopmarked()
+ local nofauto = #autolist
+ if nofauto > 0 then
+ if not texlists.pagehead then
+ local realpage = texgetcount("realpageno")
+ for i=1,nofauto do
+ local entry = autolist[i]
+ local names = entry[1]
+ for j=1,#names do
+ local name = names[j]
+ local list = data[realpage]
+ if list[name] then
+ if trace then
+ report("automatically unmarking page %i as %a",realpage,name)
+ end
+ list[name] = nil
+ end
+ end
+ end
+ end
+ remove(autolist)
+ end
+end
+
+implement {
+ name = "checkmarkedpages",
+ protected = true,
+ public = true,
+ actions = autopageaction,
+}
+
+implement {
+ name = "markpage",
+ arguments = "3 strings",
+ actions = pages.mark
+}
+
+implement {
+ name = "doifelsemarkedpage",
+ arguments = "argument",
+ protected = true,
+ public = true,
+ actions = { marked, ctx_doifelse }
+}
+
+implement {
+ name = "doifmarkedpage",
+ arguments = "argument",
+ protected = true,
+ public = true,
+ actions = { marked, ctx_doif }
+}
+
+implement {
+ name = "markedpageparameter",
+ arguments = "2 arguments",
+ public = true,
+ actions = function(name,key)
+ local value = markedparameter(name,key)
+ if value then
+ context(value)
+ end
+ end
+}
+
+implement {
+ name = "markedpages",
+ arguments = "string",
+ actions = function(name)
+ local t = allmarked(name)
+ if t then
+ context("%,t",t)
+ end
+ end
+}
+
+implement {
+ name = "startmarkpages",
+ arguments = "2 strings",
+ actions = startmarked,
+}
+
+implement {
+ name = "stopmarkpages",
+ protected = true,
+ public = true,
+ actions = stopmarked,
+}
+
+implement {
+ name = "doifelsependingpagecontent",
+ actions = function()
+ local h = texlists.contrib_head
+ -- local t = texlists.contrib_tail
+ local p = false
+ if h then
+ for n in nextlist, tonut(h) do
+ p = true
+ break
+ end
+ end
+ ctx_doifelse(p)
+ end,
+}
diff --git a/tex/context/base/mkxl/page-ini.mkxl b/tex/context/base/mkxl/page-ini.mkxl
index 0a0993d44..fe07f9fb5 100644
--- a/tex/context/base/mkxl/page-ini.mkxl
+++ b/tex/context/base/mkxl/page-ini.mkxl
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Page Macros / Initializations}
-\registerctxluafile{page-ini}{}
+\registerctxluafile{page-ini}{autosuffix}
%D The \type {\processpage} command has become obsolete. It's original
%D purpose was to flush only parts of a document but nowadays we have
@@ -336,11 +336,18 @@
% todo: just define at the lua end ... less hassle
-\permanent\tolerant\protected\def\markpage [#1]#*[#2]{\clf_markpage {#1}{#2}}
-\permanent \def\markedpages [#1]{\clf_markedpages {#1}} % expandable
-\permanent\protected \def\doifelsemarkedpage#1{\clf_doifelsemarkedpage{#1}}
-\permanent\protected \def\startmarkpages [#1]{\clf_startmarkpages {#1}}
-\permanent\protected \def\stopmarkpages {\clf_stopmarkpages }
+\permanent\tolerant\protected\def\markpage [#1]#*[#2]#*[#3]{\clf_markpage{#1}{#2}{#3}}
+\permanent\tolerant\protected\def\startmarkpages [#1]#*[#2]{\clf_startmarkpages{#1}{#2}}
+%permanent \protected\def\stopmarkpages {\clf_stopmarkpages}
+\permanent \def\markedpages [#1]{\clf_markedpages{#1}} % expandable
+%permanent \protected\def\doifmarkedpage #1{\clf_doifmarkedpage{#1}}
+%permanent \protected\def\doifelsemarkedpage #1{\clf_doifelsemarkedpage{#1}}
+% \def\markedpageparameter #1#2{\clf_markedpageparameter{#1}{#2}}
+%permanent \protected\def\checkmarkedpages {\clf_checkmarkedpages}
+
+\appendtoks
+ \checkmarkedpages % defined at lua end
+\to \everyaftershipout
%D Experimental:
diff --git a/tex/context/base/mkxl/page-mix.mkxl b/tex/context/base/mkxl/page-mix.mkxl
index 86abaca2f..daafa4843 100644
--- a/tex/context/base/mkxl/page-mix.mkxl
+++ b/tex/context/base/mkxl/page-mix.mkxl
@@ -31,10 +31,6 @@
% offsets (inner ones, so we change the hsize ... needed with backgrounds
% when no content we currently loose the page
-% luatex buglet:
-%
-% \ctxlua{tex.setbox("global",0,node.hpack(nodes.pool.glyph("a",font.current())))}\box0
-
\registerctxluafile{page-mix}{}
\unprotect
diff --git a/tex/context/base/mkxl/page-one.mkxl b/tex/context/base/mkxl/page-one.mkxl
index a6890c8a6..4b4416fe1 100644
--- a/tex/context/base/mkxl/page-one.mkxl
+++ b/tex/context/base/mkxl/page-one.mkxl
@@ -111,6 +111,103 @@
%
% we can also have bottom notes on top of bottom insertions
+% \protected\def\page_one_command_package_contents#1#2% \box \unvbox % this one will be redone (checked)
+% {\bgroup
+% \strc_notes_check_if_bottom_present
+% \d_page_one_natural_depth\dp#2\relax
+% % we need to set the height as otherwise the shrink will not kick in so the following
+% % no longer applies:
+% %
+% % \setbox\b_page_one_contents\vbox \ifconditional\c_notes_bottom_present to \textheight \fi
+% %
+% \setbox\b_page_one_contents\vbox to \textheight % probably no pack
+% {\page_otr_command_flush_top_insertions
+% % this is messy ... we will provide a more tight area (no big deal as we can
+% % do that at the lua end)
+% % \parfillskip\zeropoint
+% \page_one_registered_text_area_a#1#2% \unvbox
+% %
+% \ifgridsnapping
+% \unskip % new per 2019-06-18, otherwise weird bottom floats
+% \vkern\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax
+% \prevdepth\openstrutdepth
+% \page_otr_command_flush_bottom_insertions
+% \vfil
+% \orelse\ifcase\bottomraggednessmode
+% % ragged (default)
+% \unskip % new per 2019-06-18, otherwise weird bottom floats
+% \vkern\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax
+% \prevdepth\openstrutdepth
+% % these have whitespace before but we can have some more options
+% % like a \vfill or so
+% \page_otr_command_flush_bottom_insertions
+% \vfil
+% \or
+% % align (normal)
+% \page_otr_command_flush_bottom_insertions
+% \or
+% % baseline
+% \unskip % new per 2019-06-18, otherwise weird bottom floats
+% \vkern\dimexpr\maxdepth-\d_page_one_natural_depth\relax
+% \page_otr_command_flush_bottom_insertions
+% \fi
+% \fakepagenotes}%
+% \page_one_command_package_show_state
+% \ifconditional\c_notes_bottom_present
+% \ifgridsnapping
+% \ifcase\layoutlines
+% \getrawnoflines\textheight
+% \else
+% \noflines\layoutlines
+% \fi
+% \scratchoffset\dimexpr\numexpr\noflines-\plusone\relax\lineheight+\topskip\relax
+% \else
+% \scratchoffset\ht\b_page_one_contents
+% \fi
+% \setbox\b_page_one_bottom_notes\hpack
+% {\lower\scratchoffset\vbox{\placebottomnotes\par\kern\zeropoint}}% kerns makes notes sit on bottom % pack ?
+% \smashbox\b_page_one_bottom_notes
+% \ht\b_page_one_contents\zeropoint
+% \page_one_registered_text_area_b
+% {\vpack to \textheight
+% {\box\b_page_one_contents
+% \box\b_page_one_bottom_notes}}%
+% \else
+% \ht\b_page_one_contents\textheight
+% \page_one_registered_text_area_b
+% {\box\b_page_one_contents}%
+% \fi
+% \egroup}
+
+%D \starttyping
+%D \setuplayout[height=middle] \showframe
+%D
+%D % \markpages[stretch][lines=2] % current page
+%D
+%D \starttext
+%D \brokenpenalty 10000 \clubpenalty 20000 \widowpenalty 20000
+%D \dorecurse{10}{\samplefile{tufte}\par} \page
+%D \startmarkpages[stretch][lines=2]
+%D \dorecurse{10}{\samplefile{tufte}\par} \page
+%D \stopmarkpages
+%D \dorecurse{10}{\samplefile{tufte}\par} \page
+%D \stoptext
+%D \stoptyping
+
+\newcount\c_page_one_stretch % we use marked pages which actually slow down a little
+
+\def\page_one_check_stretch_contents
+ {\ifdim\dimexpr\textheight-\ht\b_page_one_contents\relax<\c_page_one_stretch\lineheight
+ \setbox\b_page_one_contents\vpack\bgroup
+ % no need to speed up low level
+ \scale[\c!height=\textheight,\c!width=\textwidth]{\box\b_page_one_contents}%
+ \egroup
+ \fi}
+
+\def\page_one_check_stretch_lines
+ {\edef\m_lines{\markedpageparameter\v!stretch\v!lines}%
+ \ifempty\m_lines\else\c_page_one_stretch\m_lines\fi}
+
\protected\def\page_one_command_package_contents#1#2% \box \unvbox % this one will be redone (checked)
{\bgroup
\strc_notes_check_if_bottom_present
@@ -120,11 +217,14 @@
%
% \setbox\b_page_one_contents\vbox \ifconditional\c_notes_bottom_present to \textheight \fi
%
- \setbox\b_page_one_contents\vbox to \textheight % probably no pack
+ \ifconditional\c_notes_bottom_present\else
+ \doifmarkedpage\v!stretch\page_one_check_stretch_lines
+ \fi
+ \setbox\b_page_one_contents\vbox \ifcase\c_page_one_stretch to \textheight\fi % probably no pack
{\page_otr_command_flush_top_insertions
% this is messy ... we will provide a more tight area (no big deal as we can
% do that at the lua end)
-% \parfillskip\zeropoint
+ % \parfillskip\zeropoint
\page_one_registered_text_area_a#1#2% \unvbox
%
\ifgridsnapping
@@ -173,6 +273,9 @@
{\box\b_page_one_contents
\box\b_page_one_bottom_notes}}%
\else
+ \ifcase\c_page_one_stretch\else
+ \page_one_check_stretch_contents
+ \fi
\ht\b_page_one_contents\textheight
\page_one_registered_text_area_b
{\box\b_page_one_contents}%
diff --git a/tex/context/base/mkxl/page-smp.mkxl b/tex/context/base/mkxl/page-smp.mkxl
index ccb0e989e..d560843e0 100644
--- a/tex/context/base/mkxl/page-smp.mkxl
+++ b/tex/context/base/mkxl/page-smp.mkxl
@@ -30,6 +30,7 @@
{\bgroup
\setsimplecolumnshsize[#1]%
\nopenalties
+ \enforced\permanent\protected\def\column{\vfill\break}% quick hack
\setbox\scratchbox\vbox\bgroup
\forgetall} % \blank[\v!disable]
diff --git a/tex/context/base/mkxl/page-txt.mklx b/tex/context/base/mkxl/page-txt.mklx
index f8db27f38..b03d704c8 100644
--- a/tex/context/base/mkxl/page-txt.mklx
+++ b/tex/context/base/mkxl/page-txt.mklx
@@ -884,10 +884,6 @@
\smashbox\b_page_layouts_element
\box\b_page_layouts_element}
-% \ifdefined\page_prepare_backgrounds\else
-% \let\page_prepare_backgrounds\gobbleoneargument
-% \fi
-
% only for very special controlled cases or experiments:
\let\page_scale_text_box\gobbleoneargument
@@ -900,7 +896,6 @@
\page_layouts_swap_margins
\vkern\dimexpr\headerheight+\headerdistance+\textdistance\relax
\dontleavehmode
- %\page_prepare_backgrounds{#2}%
\hpack to \makeupwidth
{\begingroup
\page_layouts_swap_margins
diff --git a/tex/context/base/mkxl/scrp-ini.lmt b/tex/context/base/mkxl/scrp-ini.lmt
new file mode 100644
index 000000000..60ea15f08
--- /dev/null
+++ b/tex/context/base/mkxl/scrp-ini.lmt
@@ -0,0 +1,1051 @@
+if not modules then modules = { } end modules ['scrp-ini'] = {
+ version = 1.001,
+ comment = "companion to scrp-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- We need to rewrite this a bit ... rather old code ... will be done when japanese
+-- is finished.
+
+local tonumber, next = tonumber, next
+local setmetatableindex = table.setmetatableindex
+local utfbyte, utfsplit = utf.byte, utf.split
+local gmatch = string.gmatch
+
+local trace_analyzing = false trackers.register("scripts.analyzing", function(v) trace_analyzing = v end)
+local trace_injections = false trackers.register("scripts.injections", function(v) trace_injections = v end)
+local trace_splitting = false trackers.register("scripts.splitting", function(v) trace_splitting = v end)
+local trace_splitdetails = false trackers.register("scripts.splitting.details", function(v) trace_splitdetails = v end)
+
+local report_preprocessing = logs.reporter("scripts","preprocessing")
+local report_splitting = logs.reporter("scripts","splitting")
+
+local attributes = attributes
+local nodes = nodes
+local context = context
+
+local nodecodes = nodes.nodecodes
+
+local implement = interfaces.implement
+
+local glyph_code = nodecodes.glyph
+local glue_code = nodecodes.glue
+
+local emwidths = fonts.hashes.emwidths
+local exheights = fonts.hashes.exheights
+
+local a_script = attributes.private('script')
+
+local fontdata = fonts.hashes.identifiers
+local allocate = utilities.storage.allocate
+local setnodecolor = nodes.tracers.colors.set
+
+local enableaction = nodes.tasks.enableaction
+local disableaction = nodes.tasks.disableaction
+
+local nuts = nodes.nuts
+
+local getnext = nuts.getnext
+local getchar = nuts.getchar
+local getfont = nuts.getfont
+local getscript = nuts.getscript
+local getid = nuts.getid
+local getglyphdata = nuts.getglyphdata
+local setglyphdata = nuts.setglyphdata
+
+local isglyph = nuts.isglyph
+
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
+
+local firstglyph = nuts.firstglyph
+
+local nextglyph = nuts.traversers.glyph
+local nextchar = nuts.traversers.char
+
+local texsetglyphscript = tex.setglyphscript
+
+local nodepool = nuts.pool
+
+local new_glue = nodepool.glue
+local new_rule = nodepool.rule
+local new_penalty = nodepool.penalty
+
+scripts = scripts or { }
+local scripts = scripts
+
+scripts.hash = scripts.hash or { }
+local hash = scripts.hash
+
+local handlers = allocate()
+scripts.handlers = handlers
+
+local injectors = allocate()
+scripts.injectors = handlers
+
+local splitters = allocate()
+scripts.splitters = splitters
+
+local hash = { -- we could put these presets in char-def.lua
+ --
+ -- half width opening parenthesis
+ --
+ [0x0028] = "half_width_open",
+ [0x005B] = "half_width_open",
+ [0x007B] = "half_width_open",
+ [0x2018] = "half_width_open", -- ‘
+ [0x201C] = "half_width_open", -- “
+ --
+ -- full width opening parenthesis
+ --
+ [0x3008] = "full_width_open", -- 〈 Left book quote
+ [0x300A] = "full_width_open", -- 《 Left double book quote
+ [0x300C] = "full_width_open", -- 「 left quote
+ [0x300E] = "full_width_open", -- 『 left double quote
+ [0x3010] = "full_width_open", -- 【 left double book quote
+ [0x3014] = "full_width_open", -- 〔 left book quote
+ [0x3016] = "full_width_open", --〖 left double book quote
+ [0x3018] = "full_width_open", -- left tortoise bracket
+ [0x301A] = "full_width_open", -- left square bracket
+ [0x301D] = "full_width_open", -- reverse double prime qm
+ [0xFF08] = "full_width_open", -- ( left parenthesis
+ [0xFF3B] = "full_width_open", -- [ left square brackets
+ [0xFF5B] = "full_width_open", -- { left curve bracket
+ --
+ -- half width closing parenthesis
+ --
+ [0x0029] = "half_width_close",
+ [0x005D] = "half_width_close",
+ [0x007D] = "half_width_close",
+ [0x2019] = "half_width_close", -- ’ right quote, right
+ [0x201D] = "half_width_close", -- ” right double quote
+ --
+ -- full width closing parenthesis
+ --
+ [0x3009] = "full_width_close", -- 〉 book quote
+ [0x300B] = "full_width_close", -- 》 double book quote
+ [0x300D] = "full_width_close", -- 」 right quote, right
+ [0x300F] = "full_width_close", -- 』 right double quote
+ [0x3011] = "full_width_close", -- 】 right double book quote
+ [0x3015] = "full_width_close", -- 〕 right book quote
+ [0x3017] = "full_width_close", -- 〗 right double book quote
+ [0x3019] = "full_width_close", -- right tortoise bracket
+ [0x301B] = "full_width_close", -- right square bracket
+ [0x301E] = "full_width_close", -- double prime qm
+ [0x301F] = "full_width_close", -- low double prime qm
+ [0xFF09] = "full_width_close", -- ) right parenthesis
+ [0xFF3D] = "full_width_close", -- ] right square brackets
+ [0xFF5D] = "full_width_close", -- } right curve brackets
+ --
+ [0xFF62] = "half_width_open", -- left corner bracket
+ [0xFF63] = "half_width_close", -- right corner bracket
+ --
+ -- vertical opening vertical
+ --
+ -- 0xFE35, 0xFE37, 0xFE39, 0xFE3B, 0xFE3D, 0xFE3F, 0xFE41, 0xFE43, 0xFE47,
+ --
+ -- vertical closing
+ --
+ -- 0xFE36, 0xFE38, 0xFE3A, 0xFE3C, 0xFE3E, 0xFE40, 0xFE42, 0xFE44, 0xFE48,
+ --
+ -- half width opening punctuation
+ --
+ --
+ --
+ -- full width opening punctuation
+ --
+ -- 0x2236, -- ∶
+ -- 0xFF0C, -- ,
+ --
+ -- half width closing punctuation_hw
+ --
+ [0x0021] = "half_width_close", -- !
+ [0x002C] = "half_width_close", -- ,
+ [0x002E] = "half_width_close", -- .
+ [0x003A] = "half_width_close", -- :
+ [0x003B] = "half_width_close", -- ;
+ [0x003F] = "half_width_close", -- ?
+ [0xFF61] = "half_width_close", -- hw full stop
+ --
+ -- full width closing punctuation
+ --
+ [0x3001] = "full_width_close", -- 、
+ [0x3002] = "full_width_close", -- 。
+ [0xFF0C] = "full_width_close", -- ,
+ [0xFF0E] = "full_width_close", --
+ --
+ -- depends on font
+ --
+ [0xFF01] = "full_width_close", -- !
+ [0xFF1F] = "full_width_close", -- ?
+ --
+ [0xFF1A] = "full_width_punct", -- :
+ [0xFF1B] = "full_width_punct", -- ;
+ --
+ -- non starter
+ --
+ [0x3005] = "non_starter", [0x3041] = "non_starter", [0x3043] = "non_starter", [0x3045] = "non_starter", [0x3047] = "non_starter",
+ [0x3049] = "non_starter", [0x3063] = "non_starter", [0x3083] = "non_starter", [0x3085] = "non_starter", [0x3087] = "non_starter",
+ [0x308E] = "non_starter", [0x3095] = "non_starter", [0x3096] = "non_starter", [0x309B] = "non_starter", [0x309C] = "non_starter",
+ [0x309D] = "non_starter", [0x309E] = "non_starter", [0x30A0] = "non_starter", [0x30A1] = "non_starter", [0x30A3] = "non_starter",
+ [0x30A5] = "non_starter", [0x30A7] = "non_starter", [0x30A9] = "non_starter", [0x30C3] = "non_starter", [0x30E3] = "non_starter",
+ [0x30E5] = "non_starter", [0x30E7] = "non_starter", [0x30EE] = "non_starter", [0x30F5] = "non_starter", [0x30F6] = "non_starter",
+ [0x30FC] = "non_starter", [0x30FD] = "non_starter", [0x30FE] = "non_starter", [0x31F0] = "non_starter", [0x31F1] = "non_starter",
+ [0x31F2] = "non_starter", [0x31F3] = "non_starter", [0x31F4] = "non_starter", [0x31F5] = "non_starter", [0x31F6] = "non_starter",
+ [0x31F7] = "non_starter", [0x31F8] = "non_starter", [0x31F9] = "non_starter", [0x31FA] = "non_starter", [0x31FB] = "non_starter",
+ [0x31FC] = "non_starter", [0x31FD] = "non_starter", [0x31FE] = "non_starter", [0x31FF] = "non_starter",
+ --
+ [0x301C] = "non_starter", [0x303B] = "non_starter", [0x303C] = "non_starter", [0x309B] = "non_starter", [0x30FB] = "non_starter",
+ [0x30FE] = "non_starter",
+ -- hyphenation
+ --
+ [0x2026] = "hyphen", -- … ellipsis
+ [0x2014] = "hyphen", -- — hyphen
+ --
+ [0x1361] = "ethiopic_word",
+ [0x1362] = "ethiopic_sentence",
+ --
+ -- tibetan:
+ --
+ [0x0F0B] = "breaking_tsheg",
+ [0x0F0C] = "nonbreaking_tsheg",
+
+}
+
+local function provide(t,k)
+ local v
+ if not tonumber(k) then v = false
+ elseif (k >= 0x03040 and k <= 0x030FF)
+ or (k >= 0x031F0 and k <= 0x031FF)
+ or (k >= 0x032D0 and k <= 0x032FE)
+ or (k >= 0x0FF00 and k <= 0x0FFEF) then v = "katakana"
+ elseif (k >= 0x03400 and k <= 0x04DFF)
+ or (k >= 0x04E00 and k <= 0x09FFF)
+ or (k >= 0x0F900 and k <= 0x0FAFF)
+ or (k >= 0x20000 and k <= 0x2A6DF)
+ or (k >= 0x2F800 and k <= 0x2FA1F) then v = "chinese"
+ elseif (k >= 0x0AC00 and k <= 0x0D7A3) then v = "korean"
+ elseif (k >= 0x01100 and k <= 0x0115F) then v = "jamo_initial"
+ elseif (k >= 0x01160 and k <= 0x011A7) then v = "jamo_medial"
+ elseif (k >= 0x011A8 and k <= 0x011FF) then v = "jamo_final"
+ elseif (k >= 0x01200 and k <= 0x0139F) then v = "ethiopic_syllable"
+ elseif (k >= 0x00F00 and k <= 0x00FFF) then v = "tibetan"
+ else v = false
+ end
+ t[k] = v
+ return v
+end
+
+setmetatableindex(hash,provide) -- should come from char-def
+
+scripts.hash = hash
+
+local numbertodataset = allocate()
+local numbertohandler = allocate()
+
+--~ storage.register("scripts/hash", hash, "scripts.hash")
+
+scripts.numbertodataset = numbertodataset
+scripts.numbertohandler = numbertohandler
+
+local defaults = {
+ inter_char_shrink_factor = 0,
+ inter_char_shrink_factor = 0,
+ inter_char_stretch_factor = 0,
+ inter_char_half_shrink_factor = 0,
+ inter_char_half_stretch_factor = 0,
+ inter_char_quarter_shrink_factor = 0,
+ inter_char_quarter_stretch_factor = 0,
+ inter_char_hangul_penalty = 0,
+
+ inter_word_stretch_factor = 0,
+}
+
+scripts.defaults = defaults -- so we can add more
+
+-- todo: copy more efficient than metatable
+
+function scripts.installmethod(handler)
+ local name = handler.name
+ handlers[name] = handler
+ local attributes = { }
+ local datasets = handler.datasets
+ if not datasets or not datasets.default then
+ report_preprocessing("missing (default) dataset in script %a",name)
+ datasets.default = { } -- slower but an error anyway
+ end
+
+ for k, v in next, datasets do
+ setmetatableindex(v,defaults)
+ end
+ setmetatableindex(attributes, function(t,k)
+ local v = datasets[k] or datasets.default
+ local a = 0
+ if v then
+ v.name = name -- for tracing
+ a = #numbertodataset + 1
+ numbertodataset[a] = v
+ numbertohandler[a] = handler
+ end
+ t[k] = a
+ return a
+ end)
+ handler.attributes = attributes
+end
+
+function scripts.installdataset(specification) -- global overload
+ local method = specification.method
+ local name = specification.name
+ local dataset = specification.dataset
+ if method and name and dataset then
+ local parent = specification.parent or ""
+ local handler = handlers[method]
+ if handler then
+ local datasets = handler.datasets
+ if datasets then
+ local defaultset = datasets.default
+ if defaultset then
+ if parent ~= "" then
+ local p = datasets[parent]
+ if p then
+ defaultset = p
+ else
+ report_preprocessing("dataset, unknown parent %a for method %a",parent,method)
+ end
+ end
+ setmetatable(dataset,defaultset)
+ local existing = datasets[name]
+ if existing then
+ for k, v in next, existing do
+ existing[k] = dataset
+ end
+ else
+ datasets[name] = dataset
+ end
+ else
+ report_preprocessing("dataset, no default for method %a",method)
+ end
+ else
+ report_preprocessing("dataset, no datasets for method %a",method)
+ end
+ else
+ report_preprocessing("dataset, no method %a",method)
+ end
+ else
+ report_preprocessing("dataset, invalid specification") -- maybe report table
+ end
+end
+
+local injectorenabled = false
+local splitterenabled = false
+
+local function getscriptdata(n)
+ local s = getscript(n)
+ if s then
+ return s and numbertodataset[s]
+ end
+end
+
+local function getinjector(n)
+ local s = getscript(n)
+ if s then
+ s = numbertohandler[s]
+ return s and s.injector
+ end
+end
+
+local function getsplitter(n)
+ local s = getscript(n)
+ if s then
+ s = numbertodataset[s]
+ return s and s.splitter
+ end
+end
+
+scripts.getdata = getscriptdata
+scripts.getinjector = getinjector
+scripts.getsplitter = getsplitter
+
+function scripts.set(name,method,preset)
+ local handler = handlers[method]
+ if handler then
+ local index = handler.attributes[preset]
+ if handler.injector then
+ if not injectorenabled then
+ enableaction("processors","scripts.injectors.handler")
+ injectorenabled = true
+ end
+ end
+ if handler.splitter then
+ if not splitterenabled then
+ enableaction("processors","scripts.splitters.handler")
+ splitterenabled = true
+ end
+ end
+ if handler.initializer then
+ handler.initializer(handler)
+ handler.initializer = nil
+ end
+ texsetglyphscript(index)
+ else
+ texsetglyphscript()
+ end
+end
+
+function scripts.reset()
+ texsetglyphscript()
+end
+
+-- 0=gray 1=red 2=green 3=blue 4=yellow 5=magenta 6=cyan 7=x-yellow 8=x-magenta 9=x-cyan
+
+-- local categories = allocate { -- rather bound to cjk ... will be generalized
+-- "korean",
+-- "chinese",
+-- "katakana",
+-- "hiragana",
+-- "full_width_open",
+-- "full_width_close",
+-- "half_width_open",
+-- "half_width_close",
+-- "full_width_punct",
+-- "hyphen",
+-- "non_starter",
+-- "jamo_initial",
+-- "jamo_medial",
+-- "jamo_final",
+-- "ethiopic_syllable",
+-- "ethiopic_word",
+-- "ethiopic_sentence",
+-- "breaking_tsheg",
+-- "nonbreaking_tsheg",
+-- }
+--
+-- scripts.categories = categories
+
+local scriptcolors = allocate {
+ -- todo: just named colors
+ hyphen = "trace:5",
+}
+
+scripts.colors = scriptcolors
+
+-- this can become setprop ...
+
+local propertydata = nodes.properties.data
+
+local function setscriptstatus(n,s)
+ local p = propertydata[n]
+ if p then
+ p.scriptstatus = s
+ else
+ propertydata[n] = { scriptstatus = s }
+ end
+end
+
+function getscriptstatus(n)
+ local p = propertydata[n]
+ if p then
+ return p.scriptstatus
+ end
+end
+
+scripts.setstatus = setscriptstatus
+scripts.getstatus = getscriptstatus
+
+--
+
+local function colorize(start,stop)
+ for n in nextglyph, start do
+ local kind = getscriptstatus(n)
+ if kind then
+ local ac = scriptcolors[kind]
+ if ac then
+ setnodecolor(n,ac)
+ end
+ end
+ if n == stop then
+ break
+ end
+ end
+end
+
+local function traced_process(head,first,last,process,a)
+ if start ~= last then
+ local f, l = first, last
+ local name = numbertodataset[a]
+ name = name and name.name or "?"
+ report_preprocessing("before %s: %s",name,nodes.tosequence(f,l))
+ process(head,first,last)
+ report_preprocessing("after %s: %s", name,nodes.tosequence(f,l))
+ end
+end
+
+function scripts.injectors.handler(head)
+ local start = firstglyph(head) -- we already have glyphs here (subtype 1)
+ if not start then
+ return head
+ else
+ local last_a, normal_process, lastfont, originals, first, last
+ local ok = false
+ while start do
+ local char, id = isglyph(start)
+ if char then
+ -- local a = getinjector(start)
+ local a = getscript(start)
+ if a then
+ if a ~= last_a then
+ if first then
+ if ok then
+ if trace_analyzing then
+ colorize(first,last)
+ end
+ if trace_injections then
+ traced_process(head,first,last,normal_process,last_a)
+ else
+ normal_process(head,first,last)
+ end
+ ok = false
+ end
+ first, last = nil, nil
+ end
+ last_a = a
+ -- normal_process = a
+ normal_process = getinjector(start)
+ end
+ if normal_process then
+ -- id == font
+ if id ~= lastfont then
+ originals = fontdata[id].resources
+ if resources then
+ originals = resources.originals
+ else
+ originals = nil -- can't happen
+ end
+ lastfont = id
+ end
+ if originals and type(originals) == "number" then
+ char = originals[char] or char
+ end
+ local h = hash[char]
+ if h then
+ setscriptstatus(start,h)
+ if not first then
+ first, last = start, start
+ else
+ last = start
+ end
+ -- if cjk == "chinese" or cjk == "korean" then -- we need to prevent too much ( ) processing
+ ok = true
+ -- end
+ elseif first then
+ if ok then
+ if trace_analyzing then
+ colorize(first,last)
+ end
+ if trace_injections then
+ traced_process(head,first,last,normal_process,last_a)
+ else
+ normal_process(head,first,last)
+ end
+ ok = false
+ end
+ first, last = nil, nil
+ end
+ end
+ elseif first then
+ if ok then
+ if trace_analyzing then
+ colorize(first,last)
+ end
+ if trace_injections then
+ traced_process(head,first,last,normal_process,last_a)
+ else
+ normal_process(head,first,last)
+ end
+ ok = false
+ end
+ first, last = nil, nil
+ end
+ elseif id == glue_code then
+ if ok then
+ -- continue
+ elseif first then
+ -- no chinese or korean
+ first, last = nil, nil
+ end
+ elseif first then
+ if ok then
+ -- some chinese or korean
+ if trace_analyzing then
+ colorize(first,last)
+ end
+ if trace_injections then
+ traced_process(head,first,last,normal_process,last_a)
+ else
+ normal_process(head,first,last)
+ end
+ first, last, ok = nil, nil, false
+ elseif first then
+ first, last = nil, nil
+ end
+ end
+ start = getnext(start)
+ end
+ if ok then
+ if trace_analyzing then
+ colorize(first,last)
+ end
+ if trace_injections then
+ traced_process(head,first,last,normal_process,last_a)
+ else
+ normal_process(head,first,last)
+ end
+ end
+ return head
+ end
+end
+
+-- kind of experimental .. might move to it's own module
+
+-- function scripts.splitters.handler(head)
+-- return head
+-- end
+
+local function addwords(tree,data)
+ if not tree then
+ tree = { }
+ end
+ for word in gmatch(data,"%S+") do
+ local root = tree
+ local list = utfsplit(word,true)
+ for i=1,#list do
+ local l = utfbyte(list[i])
+ local r = root[l]
+ if not r then
+ r = { }
+ root[l] = r
+ end
+ if i == #list then
+ r.final = word -- true -- could be something else, like word in case of tracing
+ else
+ root = r
+ end
+ end
+ end
+ return tree
+end
+
+local loaded = { }
+
+function splitters.load(handler,files)
+ local files = handler.files
+ local tree = handler.tree or { }
+ handler.tree = tree
+ if not files then
+ return
+ elseif type(files) == "string" then
+ files = { files }
+ handler.files = files
+ end
+ if trace_splitting then
+ report_splitting("loading splitter data for language/script %a",handler.name)
+ end
+ loaded[handler.name or "unknown"] = (loaded[handler.name or "unknown"] or 0) + 1
+ statistics.starttiming(loaded)
+ for i=1,#files do
+ local filename = files[i]
+ local fullname = resolvers.findfile(filename)
+ if fullname == "" then
+ fullname = resolvers.findfile(filename .. ".gz")
+ end
+ if fullname ~= "" then
+ if trace_splitting then
+ report_splitting("loading file %a",fullname)
+ end
+ local suffix, gzipped = gzip.suffix(fullname)
+ if suffix == "lua" then
+ local specification = table.load(fullname,gzipped and gzip.load)
+ if specification then
+ local lists = specification.lists
+ if lists then
+ for i=1,#lists do
+ local entry = lists[i]
+ local data = entry.data
+ if data then
+ if entry.compression == "zlib" then
+ data = zlib.decompress(data)
+ if entry.length and entry.length ~= #data then
+ report_splitting("compression error in file %a",fullname)
+ end
+ end
+ if data then
+ addwords(tree,data)
+ end
+ end
+ end
+ end
+ end
+ else
+ local data = gzipped and io.loadgzip(fullname) or io.loaddata(fullname)
+ if data then
+ addwords(tree,data)
+ end
+ end
+ else
+ report_splitting("unknown file %a",filename)
+ end
+ end
+ statistics.stoptiming(loaded)
+ return tree
+end
+
+statistics.register("loaded split lists", function()
+ if next(loaded) then
+ return string.format("%s, load time: %s",table.sequenced(loaded),statistics.elapsedtime(loaded))
+ end
+end)
+
+-- function splitters.addlist(name,filename)
+-- local handler = scripts.handlers[name]
+-- if handler and filename then
+-- local files = handler.files
+-- if not files then
+-- files = { }
+-- elseif type(files) == "string" then
+-- files = { files }
+-- end
+-- handler.files = files
+-- if type(filename) == "string" then
+-- filename = utilities.parsers.settings_to_array(filename)
+-- end
+-- if type(filename) == "table" then
+-- for i=1,#filename do
+-- files[#files+1] = filenames[i]
+-- end
+-- end
+-- end
+-- end
+--
+-- commands.setscriptsplitterlist = splitters.addlist
+
+local categories = characters.categories or { }
+
+local function hit(root,head)
+ local current = getnext(head)
+ local lastrun = false
+ local lastfinal = false
+ while current do
+ local char = isglyph(current)
+ if char then
+ local newroot = root[char]
+ if newroot then
+ local final = newroot.final
+ if final then
+ lastrun = current
+ lastfinal = final
+ end
+ root = newroot
+ elseif categories[char] == "mn" then
+ -- continue
+ else
+ return lastrun, lastfinal
+ end
+ else
+ break
+ end
+ end
+ if lastrun then
+ return lastrun, lastfinal
+ end
+end
+
+local tree, attr, proc
+
+function splitters.handler(head) -- todo: also firstglyph test
+ local current = head
+ while current do
+ if getid(current) == glyph_code then
+ local a = getsplitter(current)
+ if a then
+ if a ~= attr then
+ local handler = numbertohandler[a]
+ tree = handler.tree or { }
+ attr = a
+ proc = a
+ end
+ if proc then
+ local root = tree[getchar(current)]
+ if root then
+ -- we don't check for attributes in the hitter (yet)
+ local last, final = hit(root,current)
+ if last then
+ local next = getnext(last)
+ if next then
+ local nextchar = isglyph(next)
+ if not nextchar then
+ -- we're done
+ elseif tree[nextchar] then
+ if trace_splitdetails then
+ if type(final) == "string" then
+ report_splitting("advance %s processing between <%s> and <%c>","with",final,nextchar)
+ else
+ report_splitting("advance %s processing between <%c> and <%c>","with",char,nextchar)
+ end
+ end
+ head, current = proc(handler,head,current,last,1)
+ else
+ if trace_splitdetails then
+ -- could be punctuation
+ if type(final) == "string" then
+ report_splitting("advance %s processing between <%s> and <%c>","without",final,nextchar)
+ else
+ report_splitting("advance %s processing between <%c> and <%c>","without",char,nextchar)
+ end
+ end
+ head, current = proc(handler,head,current,last,2)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ current = getnext(current)
+ end
+ return head
+end
+
+local function marker(head,current,font,color) -- could become: nodes.tracers.marker
+ local ex = exheights[font]
+ local em = emwidths [font]
+ head, current = insertnodeafter(head,current,new_penalty(10000))
+ head, current = insertnodeafter(head,current,new_glue(-0.05*em))
+ head, current = insertnodeafter(head,current,new_rule(0.05*em,1.5*ex,0.5*ex))
+ setnodecolor(current,color)
+ return head, current
+end
+
+local last_a, last_f, last_s, last_q
+
+function splitters.insertafter(handler,head,first,last,detail)
+ local a = getscriptdata(first)
+ local f = getfont(first)
+ if a and a ~= last_a or f ~= last_f then
+ last_s = emwidths[f] * data.inter_word_stretch_factor
+ last_a = a
+ last_f = f
+ end
+ if trace_splitting then
+ head, last = marker(head,last,f,detail == 2 and "trace:r" or "trace:g")
+ end
+ if ignore then
+ return head, last
+ else
+ return insertnodeafter(head,last,new_glue(0,last_s))
+ end
+end
+
+-- word-xx.lua:
+--
+-- return {
+-- comment = "test",
+-- copyright = "not relevant",
+-- language = "en",
+-- timestamp = "2013-05-20 14:15:21",
+-- version = "1.00",
+-- lists = {
+-- {
+-- -- data = "we thrive information in thick worlds because of our marvelous and everyday capacity to select edit single out structure highlight group pair merge harmonize synthesize focus organize condense reduce boil down choose categorize catalog classify list abstract scan look into idealize isolate discriminate distinguish screen pigeonhole pick over sort integrate blend inspect filter lump skip smooth chunk average approximate cluster aggregate outline summarize itemize review dip into flip through browse glance into leaf through skim refine enumerate glean synopsize winnow the wheat from the chaff and separate the sheep from the goats",
+-- data = "abstract aggregate and approximate average because blend boil browse capacity catalog categorize chaff choose chunk classify cluster condense dip discriminate distinguish down edit enumerate everyday filter flip focus from glance glean goats group harmonize highlight idealize in information inspect integrate into isolate itemize leaf list look lump marvelous merge of organize our out outline over pair pick pigeonhole reduce refine review scan screen select separate sheep single skim skip smooth sort structure summarize synopsize synthesize the thick thrive through to we wheat winnow worlds",
+-- },
+-- },
+-- }
+
+scripts.installmethod {
+ name = "test",
+ splitter = splitters.insertafter,
+ initializer = splitters.load,
+ files = {
+ -- "scrp-imp-word-test.lua",
+ "word-xx.lua",
+ },
+ datasets = {
+ default = {
+ inter_word_stretch_factor = 0.25, -- of quad
+ },
+ },
+}
+
+-- new plugin:
+
+local registercontext = fonts.specifiers.registercontext
+local mergecontext = fonts.specifiers.mergecontext
+
+local otfscripts = characters.otfscripts
+
+local report_scripts = logs.reporter("scripts","auto feature")
+local trace_scripts = false trackers.register("scripts.autofeature",function(v) trace_scripts = v end)
+
+local autofontfeature = scripts.autofontfeature or { }
+scripts.autofontfeature = autofontfeature
+
+local cache_yes = { }
+local cache_nop = { }
+
+setmetatableindex(cache_yes,function(t,k) local v = { } t[k] = v return v end)
+setmetatableindex(cache_nop,function(t,k) local v = { } t[k] = v return v end)
+
+-- beware: we need to tag a done (otherwise too many extra instances ... but how
+-- often unpack? wait till we have a bitmap
+--
+-- we can consider merging this in handlers.characters(head) at some point as there
+-- already check for the dynamic attribute so it saves a pass, however, then we also
+-- need to check for a_scriptinjection there which nils the benefit
+--
+-- we can consider cheating: set all glyphs in a word as the first one but it's not
+-- playing nice
+
+function autofontfeature.handler(head)
+ for n, char, font in nextchar, head do
+ -- if getscript(n) then
+ -- -- already tagged by script feature, maybe some day adapt
+ -- else
+ local script = otfscripts[char]
+ if script then
+ local dynamic = getglyphdata(n) or 0
+ if dynamic > 0 then
+ local slot = cache_yes[font]
+ local attr = slot[script]
+ if not attr then
+ attr = mergecontext(dynamic,name,2)
+ slot[script] = attr
+ if trace_scripts then
+ report_scripts("script: %s, trigger %C, dynamic: %a, variant: %a",script,char,attr,"extended")
+ end
+ end
+ if attr ~= 0 then
+ n[0] = attr
+ -- maybe set scriptinjection when associated
+ end
+ else
+ local slot = cache_nop[font]
+ local attr = slot[script]
+ if not attr then
+ attr = registercontext(font,script,2)
+ slot[script] = attr
+ if trace_scripts then
+ report_scripts("script: %s, trigger %C, dynamic: %s, variant: %a",script,char,attr,"normal")
+ end
+ end
+ if attr ~= 0 then
+ setglyphdata(n,attr)
+ -- maybe set scriptinjection when associated
+ end
+ end
+ end
+ -- end
+ end
+ return head
+end
+
+function autofontfeature.enable()
+ report_scripts("globally enabled")
+ enableaction("processors","scripts.autofontfeature.handler")
+end
+
+function autofontfeature.disable()
+ report_scripts("globally disabled")
+ disableaction("processors","scripts.autofontfeature.handler")
+end
+
+implement {
+ name = "enableautofontscript",
+ actions = autofontfeature.enable
+}
+
+implement {
+ name = "disableautofontscript",
+ actions = autofontfeature.disable }
+
+implement {
+ name = "setscript",
+ actions = scripts.set,
+ arguments = "3 strings",
+}
+
+implement {
+ name = "resetscript",
+ actions = scripts.reset
+}
+
+-- some common helpers
+
+do
+
+ local parameters = fonts.hashes.parameters
+
+ local space, stretch, shrink, lastfont
+
+ local inter_character_space_factor = 1
+ local inter_character_stretch_factor = 1
+ local inter_character_shrink_factor = 1
+
+ local function space_glue(current)
+ -- local data = numbertodataset[getattr(current,a_scriptinjection)]
+ local data = getscriptdata(current)
+ if data then
+ inter_character_space_factor = data.inter_character_space_factor or 1
+ inter_character_stretch_factor = data.inter_character_stretch_factor or 1
+ inter_character_shrink_factor = data.inter_character_shrink_factor or 1
+ end
+ local font = getfont(current)
+ if lastfont ~= font then
+ local pf = parameters[font]
+ space = pf.space
+ stretch = pf.space_stretch
+ shrink = pf.space_shrink
+ lastfont = font
+ end
+ return new_glue(
+ inter_character_space_factor * space,
+ inter_character_stretch_factor * stretch,
+ inter_character_shrink_factor * shrink
+ )
+ end
+
+ scripts.inserters = {
+
+ space_before = function(head,current)
+ return insertnodebefore(head,current,space_glue(current))
+ end,
+ space_after = function(head,current)
+ return insertnodeafter(head,current,space_glue(current))
+ end,
+
+ zerowidthspace_before = function(head,current)
+ return insertnodebefore(head,current,new_glue(0))
+ end,
+ zerowidthspace_after = function(head,current)
+ return insertnodeafter(head,current,new_glue(0))
+ end,
+
+ nobreakspace_before = function(head,current)
+ local g = space_glue(current)
+ local p = new_penalty(10000)
+ head, current = insertnodebefore(head,current,p)
+ return insertnodebefore(head,current,g)
+ end,
+ nobreakspace_after = function(head,current)
+ local g = space_glue(current)
+ local p = new_penalty(10000)
+ head, current = insertnodeafter(head,current,g)
+ return insertnodeafter(head,current,p)
+ end,
+
+ }
+
+end
+
+-- end of helpers
diff --git a/tex/context/base/mkxl/scrp-ini.mkxl b/tex/context/base/mkxl/scrp-ini.mkxl
index 77412738b..99f064acc 100644
--- a/tex/context/base/mkxl/scrp-ini.mkxl
+++ b/tex/context/base/mkxl/scrp-ini.mkxl
@@ -36,7 +36,7 @@
%D Todo: as in bidi mode we need a way to globally keep the setting.
-\registerctxluafile{scrp-ini}{}
+\registerctxluafile{scrp-ini}{autosuffix}
\registerctxluafile{scrp-cjk}{}
\registerctxluafile{scrp-eth}{}
\registerctxluafile{scrp-tha}{}
diff --git a/tex/context/base/mkxl/spac-ali.lmt b/tex/context/base/mkxl/spac-ali.lmt
index 5c434fcdf..02aaf9efd 100644
--- a/tex/context/base/mkxl/spac-ali.lmt
+++ b/tex/context/base/mkxl/spac-ali.lmt
@@ -51,7 +51,7 @@ local nofrealigned = 0
-- raggedright 0 0 fil
-- raggedcenter 0 + 0 + -
-local function handler(head,leftpage,realpageno) -- traverse_list
+local function handler(head,leftpage,realpageno)
for current, id, subtype, list in nextlist, head do
if subtype == linelist_code then
local a = takeattr(current,a_realign)
diff --git a/tex/context/base/mkxl/spac-chr.lmt b/tex/context/base/mkxl/spac-chr.lmt
index 52d8a7de1..e38f2a30e 100644
--- a/tex/context/base/mkxl/spac-chr.lmt
+++ b/tex/context/base/mkxl/spac-chr.lmt
@@ -42,11 +42,9 @@ local isglyph = nuts.isglyph
local setcolor = nodes.tracers.colors.set
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
------ traverse_id = nuts.traverse_id
------ traverse_char = nuts.traverse_char
local nextchar = nuts.traversers.char
local nextglyph = nuts.traversers.glyph
@@ -95,7 +93,7 @@ local function inject_quad_space(unicode,head,current,fraction)
setattrlist(glue,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode)
- return insert_node_after(head,current,glue)
+ return insertnodeafter(head,current,glue)
end
local function inject_char_space(unicode,head,current,parent)
@@ -105,7 +103,7 @@ local function inject_char_space(unicode,head,current,parent)
setattrlist(glue,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode)
- return insert_node_after(head,current,glue)
+ return insertnodeafter(head,current,glue)
end
local function inject_nobreak_space(unicode,head,current,space,spacestretch,spaceshrink)
@@ -114,17 +112,17 @@ local function inject_nobreak_space(unicode,head,current,space,spacestretch,spac
setattrlist(glue,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode) -- bombs
- head, current = insert_node_after(head,current,penalty)
+ head, current = insertnodeafter(head,current,penalty)
if trace_nbsp then
local rule = new_rule(space)
local kern = new_kern(-space)
local penalty = new_penalty(10000)
setcolor(rule,"orange")
- head, current = insert_node_after(head,current,rule)
- head, current = insert_node_after(head,current,kern)
- head, current = insert_node_after(head,current,penalty)
+ head, current = insertnodeafter(head,current,rule)
+ head, current = insertnodeafter(head,current,kern)
+ head, current = insertnodeafter(head,current,penalty)
end
- return insert_node_after(head,current,glue)
+ return insertnodeafter(head,current,glue)
end
local function nbsp(head,current)
@@ -148,7 +146,7 @@ end
function characters.replacenbspaces(head)
local wipe = false
- for current, char, font in nextglyph, head do -- can be anytime so no traverse_char
+ for current, char, font in nextglyph, head do -- can be anytime so no traversechar
if char == 0x00A0 then
if wipe then
head = remove_node(h,current,true)
@@ -192,7 +190,7 @@ local methods = {
head, current = remove_node(head,current,true)
if not is_punctuation[char] then
local p = fontparameters[font]
- head, current = insert_node_before(head,current,new_glue(p.space,p.space_stretch,p.space_shrink))
+ head, current = insertnodebefore(head,current,new_glue(p.space,p.space_stretch,p.space_shrink))
end
end
end
@@ -226,7 +224,7 @@ local methods = {
end,
[0x00AD] = function(head,current) -- softhyphen
- return insert_node_after(head,current,languages.explicithyphen(current))
+ return insertnodeafter(head,current,languages.explicithyphen(current))
end,
[0x2000] = function(head,current) -- enquad
@@ -295,7 +293,7 @@ local methods = {
characters.methods = methods
--- function characters.handler(head) -- todo: use traverse_id
+-- function characters.handler(head) -- todo: use traverseid
-- local current = head
-- while current do
-- local char, id = isglyph(current)
diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt
index 3e606552a..76d1ce9db 100644
--- a/tex/context/base/mkxl/spac-ver.lmt
+++ b/tex/context/base/mkxl/spac-ver.lmt
@@ -149,12 +149,13 @@ local getdepth = nuts.getdepth
local setnext = nuts.setnext
local find_node_tail = nuts.tail
-local flush_node = nuts.flush_node
+local flushnode = nuts.flushnode
local remove_node = nuts.remove
local count_nodes = nuts.countall
local hpack_node = nuts.hpack
local vpack_node = nuts.vpack
-local start_of_par = nuts.start_of_par
+
+local startofpar = nuts.startofpar
local write_node = nuts.write
@@ -289,7 +290,7 @@ end
local function validvbox(parentid,list)
if parentid == hlist_code then
local id = getid(list)
- if id == par_code and start_of_par(list) then
+ if id == par_code and startofpar(list) then
list = getnext(list)
if not next then
return nil
@@ -323,7 +324,7 @@ local function already_done(parentid,list,a_snapmethod) -- todo: done when only
-- problem: any snapped vbox ends up in a line
if list and parentid == hlist_code then
local id = getid(list)
- if id == par_code and start_of_par(list) then
+ if id == par_code and startofpar(list) then
list = getnext(list)
if not list then
return false
@@ -765,7 +766,7 @@ do
end
end
- local expandmacro = token.expand_macro
+ local expandmacro = token.expandmacro -- todo
-- local runlocal = tex.runlocal
-- local setmacro = tokens.setters.macro
-- local settoks = tex.settoks
@@ -1018,8 +1019,8 @@ end
do
- local insert_node_after = nuts.insert_after
- local insert_node_before = nuts.insert_before
+ local insertnodeafter = nuts.insertafter
+ local insertnodebefore = nuts.insertbefore
local abovedisplayskip_code = gluecodes.abovedisplayskip
local belowdisplayskip_code = gluecodes.belowdisplayskip
@@ -1116,14 +1117,14 @@ do
if width == 0 then
-- do nothing
elseif where == "after" then
- head, current = insert_node_after(head,current,new_rule(w,h,d))
- head, current = insert_node_after(head,current,new_kern(width))
- head, current = insert_node_after(head,current,new_rule(w,h,d))
+ head, current = insertnodeafter(head,current,new_rule(w,h,d))
+ head, current = insertnodeafter(head,current,new_kern(width))
+ head, current = insertnodeafter(head,current,new_rule(w,h,d))
else
local c = current
- head, current = insert_node_before(head,current,new_rule(w,h,d))
- head, current = insert_node_before(head,current,new_kern(width))
- head, current = insert_node_before(head,current,new_rule(w,h,d))
+ head, current = insertnodebefore(head,current,new_rule(w,h,d))
+ head, current = insertnodebefore(head,current,new_kern(width))
+ head, current = insertnodebefore(head,current,new_rule(w,h,d))
current = c
end
if trace then
@@ -1304,10 +1305,10 @@ do
texsetdimen("global","d_spac_overlay",-delta) -- for tracing
-- we should adapt pagetotal ! (need a hook for that) .. now we have the wrong pagebreak
local k = new_kern(-delta)
- head = insert_node_before(head,n,k)
+ head = insertnodebefore(head,n,k)
if n_ht > p_ht then
local k = new_kern(n_ht-p_ht)
- head = insert_node_before(head,p,k)
+ head = insertnodebefore(head,p,k)
end
if trace_vspacing then
report_vspacing("overlaying, prev height: %p, prev depth: %p, next height: %p, skips: %p, move up: %p",p_ht,p_dp,n_ht,skips,delta)
@@ -1477,12 +1478,12 @@ do
local prev = getprev(current)
if getid(prev) == glue_code then -- maybe go back more, or maybe even push back before any glue
-- tricky case: spacing/grid-007.tex: glue penalty glue
- head = insert_node_before(head,prev,p)
+ head = insertnodebefore(head,prev,p)
else
- head = insert_node_before(head,current,p)
+ head = insertnodebefore(head,current,p)
end
else
- head = insert_node_before(head,current,p)
+ head = insertnodebefore(head,current,p)
end
-- if penalty_data > special_penalty_min and penalty_data < special_penalty_max then
local props = properties[p]
@@ -1501,22 +1502,22 @@ do
trace_done("flushed due to forced " .. why,glue_data)
end
head = forced_skip(head,current,getwidth(glue_data,width),"before",trace)
- flush_node(glue_data)
+ flushnode(glue_data)
else
local width, stretch, shrink = getglue(glue_data)
if width ~= 0 then
if trace then
trace_done("flushed due to non zero " .. why,glue_data)
end
- head = insert_node_before(head,current,glue_data)
+ head = insertnodebefore(head,current,glue_data)
elseif stretch ~= 0 or shrink ~= 0 then
if trace then
trace_done("flushed due to stretch/shrink in" .. why,glue_data)
end
- head = insert_node_before(head,current,glue_data)
+ head = insertnodebefore(head,current,glue_data)
else
-- report_vspacing("needs checking (%s): %p",gluecodes[getsubtype(glue_data)],w)
- flush_node(glue_data)
+ flushnode(glue_data)
end
end
end
@@ -1647,7 +1648,7 @@ do
if trace then
trace_done("flush",glue_data)
end
- head = insert_node_before(head,current,glue_data)
+ head = insertnodebefore(head,current,glue_data)
if trace then
trace_natural("natural",current)
end
@@ -1737,7 +1738,7 @@ do
trace_skip("force",sc,so,sp,current)
end
glue_order = so
- flush_node(glue_data)
+ flushnode(glue_data)
head, current, glue_data = remove_node(head,current)
elseif glue_order == so then
-- is now exclusive, maybe support goback as combi, else why a set
@@ -1748,7 +1749,7 @@ do
if trace then
trace_skip("largest",sc,so,sp,current)
end
- flush_node(glue_data)
+ flushnode(glue_data)
head, current, glue_data = remove_node(head,current)
else
if trace then
@@ -1760,7 +1761,7 @@ do
if trace then
trace_skip("goback",sc,so,sp,current)
end
- flush_node(glue_data)
+ flushnode(glue_data)
head, current, glue_data = remove_node(head,current)
elseif sc == force then
-- last one counts, some day we can provide an accumulator and largest etc
@@ -1768,13 +1769,13 @@ do
if trace then
trace_skip("force",sc,so,sp,current)
end
- flush_node(glue_data)
+ flushnode(glue_data)
head, current, glue_data = remove_node(head,current)
elseif sc == penalty then
if trace then
trace_skip("penalty",sc,so,sp,current)
end
- flush_node(glue_data)
+ flushnode(glue_data)
glue_data = nil
head, current = remove_node(head,current,true)
elseif sc == add then
@@ -1855,7 +1856,7 @@ do
elseif glue_data then
local w = getwidth(current)
if w ~= 0 and w > getwidth(glue_data) then
-flush_node(glue_data)
+ flushnode(glue_data)
glue_data = current
if trace then
trace_natural("taking parskip",current)
@@ -1985,7 +1986,7 @@ flush_node(glue_data)
end
if force_glue then
head, tail = forced_skip(head,tail,getwidth(glue_data),"after",trace)
- flush_node(glue_data)
+ flushnode(glue_data)
glue_data = nil
elseif tail then
setlink(tail,glue_data)
diff --git a/tex/context/base/mkxl/supp-box.lmt b/tex/context/base/mkxl/supp-box.lmt
index 657e3addb..24b0f3afb 100644
--- a/tex/context/base/mkxl/supp-box.lmt
+++ b/tex/context/base/mkxl/supp-box.lmt
@@ -7,8 +7,6 @@ if not modules then modules = { } end modules ['supp-box'] = {
license = "see context related readme files"
}
--- this is preliminary code, use insert_before etc
-
local report_hyphenation = logs.reporter("languages","hyphenation")
local tonumber, next, type = tonumber, next, type
@@ -71,20 +69,20 @@ local setattrlist = nuts.setattrlist
local setwhd = nuts.setwhd
local setglue = nuts.setglue
-local flush_node = nuts.flush_node
-local flush_list = nuts.flush_list
+local flushnode = nuts.flushnode
+local flushlist = nuts.flushlist
local copy_node = nuts.copy
-local copy_list = nuts.copy_list
+local copylist = nuts.copylist
local find_tail = nuts.tail
local getdimensions = nuts.dimensions
local hpack = nuts.hpack
local vpack = nuts.vpack
-local traverse_id = nuts.traverse_id
+local traverseid = nuts.traverseid
local traverse = nuts.traverse
local free = nuts.free
local findtail = nuts.tail
local reverse = nuts.reverse
-local effective_glue= nuts.effective_glue
+local effectiveglue = nuts.effectiveglue
local nextdisc = nuts.traversers.disc
local nextdir = nuts.traversers.dir
@@ -122,7 +120,7 @@ local function hyphenatedlist(head,usecolor)
setlistcolor(post,"darkyellow")
end
if replace then
- flush_list(replace)
+ flushlist(replace)
end
setdisc(current)
if pre then
@@ -191,7 +189,7 @@ local function applytowords(current,doaction,noaction,nested)
local id = getid(current)
if id == glue_code then
if start then
- doaction(tonode(copy_list(start,current)))
+ doaction(tonode(copylist(start,current)))
start = nil
end
noaction(tonode(copy_node(current)))
@@ -205,7 +203,7 @@ local function applytowords(current,doaction,noaction,nested)
current = getnext(current)
end
if start then
- doaction(tonode(copy_list(start)))
+ doaction(tonode(copylist(start)))
end
end
@@ -351,7 +349,7 @@ implement {
else
tail = prev
end
- flush_node(temp)
+ flushnode(temp)
end
-- done
setnext(tail)
@@ -434,7 +432,7 @@ local function setboxtonaturalwd(n)
local old = takebox(n)
local new = hpack(getlist(old))
setlist(old,nil)
- flush_node(old)
+ flushnode(old)
setbox(n,new)
end
@@ -488,8 +486,8 @@ do
local tonut = nodes.tonut
local takebox = nuts.takebox
- local flush_list = nuts.flush_list
- local copy_list = nuts.copy_list
+ local flushlist = nuts.flushlist
+ local copylist = nuts.copylist
local getwhd = nuts.getwhd
local setbox = nuts.setbox
local new_hlist = nuts.pool.hlist
@@ -534,7 +532,7 @@ do
if not b then
-- do nothing, maybe trace
elseif copy then
- b = copy_list(b)
+ b = copylist(b)
else
c[name] = false
end
@@ -551,13 +549,13 @@ do
local c = cache[category]
local b = takebox(box)
if b then
- flush_list(b)
+ flushlist(b)
end
local b = c[name]
if not b then
-- do nothing, maybe trace
elseif copy then
- b = copy_list(b)
+ b = copylist(b)
else
c[name] = false
end
@@ -585,7 +583,7 @@ do
if name and name ~= "" then
local b = c[name]
if b then
- flush_list(b)
+ flushlist(b)
c[name] = false
end
if trace then
@@ -594,7 +592,7 @@ do
else
for k, b in next, c do
if b then
- flush_list(b)
+ flushlist(b)
end
end
cache[category] = { }
@@ -772,7 +770,7 @@ local function stripglue(list)
if first and first ~= list then
-- we have discardables
setsplit(getprev(first),first)
- flush_list(list)
+ flushlist(list)
list = first
done = true
end
@@ -789,7 +787,7 @@ local function stripglue(list)
end
if last ~= tail then
-- we have discardables
- flush_list(getnext(last))
+ flushlist(getnext(last))
setnext(last)
done = true
end
@@ -843,7 +841,7 @@ local function limitate(t) -- don't pack the result !
else
maxleft = maxleft - swidth
end
- for n in traverse_id(glue_code,list) do
+ for n in traverseid(glue_code,list) do
local width = getdimensions(list,n)
if width > maxleft then
if not last then
@@ -855,7 +853,7 @@ local function limitate(t) -- don't pack the result !
end
end
if last and maxright > 0 then
- for n in traverse_id(glue_code,last) do
+ for n in traverseid(glue_code,last) do
local width = getdimensions(n)
if width < maxright then
first = n
@@ -884,7 +882,7 @@ local function limitate(t) -- don't pack the result !
end
setlink(last,sentinel)
setprev(rest)
- flush_list(rest)
+ flushlist(rest)
end
end
end
@@ -893,11 +891,11 @@ local function limitate(t) -- don't pack the result !
if t.freeze then
local l = hpack(list,total,"exactly")
- for n in traverse_id(glue_code,list) do
- setglue(n,(effective_glue(n,l)))
+ for n in traverseid(glue_code,list) do
+ setglue(n,(effectiveglue(n,l)))
end
setlist(l)
- flush_node(l)
+ flushnode(l)
end
return tonode(list)
@@ -1178,7 +1176,7 @@ do
else
setlink(p,temp,n)
end
- flush_node(found)
+ flushnode(found)
getprop(box,"boxlines")[line] = temp
end
end
@@ -1319,7 +1317,7 @@ do
local getbox = tex.getbox
local setfield = nodes.setfield
local getfield = nodes.getfield
- local flush = nodes.flush
+ local flush = nodes.flushnode
local copynode = nodes.copy
local function get(n,field,copy)
diff --git a/tex/context/base/mkxl/syst-lua.lmt b/tex/context/base/mkxl/syst-lua.lmt
index a89cea852..44d2fd2e9 100644
--- a/tex/context/base/mkxl/syst-lua.lmt
+++ b/tex/context/base/mkxl/syst-lua.lmt
@@ -15,13 +15,10 @@ local S, C, P, lpegmatch, lpegtsplitat = lpeg.S, lpeg.C, lpeg.P, lpeg.match, lpe
local xmath = xmath or math
local xcomplex = xcomplex or { }
-local scan_next = token.scan_next or token.get_next
-local scan_cmdchr = token.scan_cmdchr_expanded
-local scan_token = token.scan_token
-
-local get_csname = token.get_csname
------ get_macro = token.get_macro
------ put_next = token.put_next
+local scannext = token.scannext
+local scancmdchr = token.scancmdchrexpanded
+local scantoken = token.scantoken
+local getcsname = token.getcsname
local cmd = tokens.commands
local letter_code = cmd.letter
@@ -224,7 +221,7 @@ do
local w = 0
local r = 1
while true do
- local n, i = scan_cmdchr()
+ local n, i = scancmdchr()
if n == letter_code then
w = w + 1 ; word[w] = utfchar(i)
else
@@ -262,7 +259,7 @@ do
elseif n == char_given_code or n == math_given_code or n == xmath_given_code then
r = r + 1 ; result[r] = i
elseif n == some_item_code then
- local n = get_csname(t)
+ local n = getcsname(t)
if n then
local s = gettex(n)
if s then
@@ -274,7 +271,7 @@ do
unexpected(c)
end
-- elseif n == call_code then
- -- local n = get_csname(t)
+ -- local n = getcsname(t)
-- if n then
-- local s = get_macro(n)
-- if s then
@@ -287,7 +284,7 @@ do
-- end
-- elseif n == the_code or n == convert_code or n == lua_expandable_call_code then
-- put_next(t)
- -- scan_token() -- expands
+ -- scantoken() -- expands
else
unexpected(c)
end
diff --git a/tex/context/base/mkxl/syst-mac.lmt b/tex/context/base/mkxl/syst-mac.lmt
index 410a49f8b..74502f4ee 100644
--- a/tex/context/base/mkxl/syst-mac.lmt
+++ b/tex/context/base/mkxl/syst-mac.lmt
@@ -17,21 +17,21 @@ if not modules then modules = { } end modules ['syst-mac'] = {
local insert, remove = table.insert, table.remove
-local push_macro = token.push_macro
-local pop_macro = token.pop_macro
-local scan_csname = token.scan_csname
-local create_token = token.create
-local gobble_token = token.gobble
+local pushmacrotoken = token.pushmacro
+local popmacrotoken = token.popmacro
+local scancsname = token.scancsname
+local createtoken = token.create
+local gobbletoken = token.gobble
-local context = context
-local implement = interfaces.implement
+local context = context
+local implement = interfaces.implement
-local report = logs.reporter("system","macrostack")
+local report = logs.reporter("system","macrostack")
-local stack = table.setmetatableindex("table")
+local stack = table.setmetatableindex("table")
local function pushmacro(name,global)
- local s = push_macro(name,global)
+ local s = pushmacrotoken(name,global)
if s then
insert(stack[name],s)
else
@@ -43,7 +43,7 @@ end
local function popmacro(name)
local s = remove(stack[name])
if s then
- pop_macro(s)
+ popmacrotoken(s)
else
report("no macro %a to pop",name)
end
@@ -57,7 +57,7 @@ implement {
public = true,
protected = true,
actions = function()
- pushmacro(scan_csname())
+ pushmacro(scancsname())
end
}
@@ -66,7 +66,7 @@ implement {
public = true,
protected = true,
actions = function()
- pushmacro(scan_csname(),true)
+ pushmacro(scancsname(),true)
end
}
@@ -75,7 +75,7 @@ implement {
public = true,
protected = true,
actions = function()
- popmacro(scan_csname())
+ popmacro(scancsname())
end
}
@@ -84,7 +84,7 @@ implement {
public = true,
protected = true,
actions = function()
- popmacro(scan_csname())
+ popmacro(scancsname())
end
}
@@ -93,7 +93,7 @@ implement {
public = true,
protected = true,
actions = function()
- local n = scan_csname()
+ local n = scancsname()
local s = stack[n]
local m = #s
report("%s : %i stack slots used",n,m)
@@ -109,7 +109,7 @@ implement {
protected = true,
arguments = "3 strings",
actions = function(start,stop,command)
- gobble_token(create_token(start),create_token(stop))
+ gobbletoken(createtoken(start),createtoken(stop))
if command then
context[command]()
end
diff --git a/tex/context/base/mkxl/task-ini.lmt b/tex/context/base/mkxl/task-ini.lmt
index 933bc948d..571d31013 100644
--- a/tex/context/base/mkxl/task-ini.lmt
+++ b/tex/context/base/mkxl/task-ini.lmt
@@ -116,7 +116,7 @@ appendaction("math", "normalizers", "noads.handlers.italics",
appendaction("math", "normalizers", "noads.handlers.kernpairs", nil, "nonut", "disabled" )
appendaction("math", "normalizers", "noads.handlers.classes", nil, "nonut", "disabled" )
-appendaction("math", "builders", "builders.kernel.mlist_to_hlist", nil, "nut", "enabled" ) -- mandate
+appendaction("math", "builders", "builders.kernel.mlisttohlist", nil, "nut", "enabled" ) -- mandate
appendaction("math", "builders", "typesetters.directions.processmath", nil, "nut", "disabled" )
appendaction("math", "builders", "noads.handlers.makeup", nil, "nonut", "disabled" )
appendaction("math", "builders", "noads.handlers.align", nil, "nonut", "enabled" )
diff --git a/tex/context/base/mkxl/toks-aux.lmt b/tex/context/base/mkxl/toks-aux.lmt
index 46d42dfdc..a8bdae5e8 100644
--- a/tex/context/base/mkxl/toks-aux.lmt
+++ b/tex/context/base/mkxl/toks-aux.lmt
@@ -10,6 +10,8 @@ local max = math.max
local formatters, gsub, char = string.formatters, string.gsub, string.char
local concat = table.concat
+-- todo : locals from scanners
+
local function flags(t)
if type(t) == "string" then
t = token.create(t)
@@ -37,27 +39,27 @@ interfaces.implement {
local f0 = formatters["%s: %s"]
local nl = logs.newline
local wr = logs.writer
- local t = token.peek_next() -- local t = token.scan_next() token.put_back(t)
+ local t = token.peeknext() -- local t = token.scannext() token.putback(t)
local n = ""
local w = ""
local c = t.cmdname
if c == "left_brace" then
w = "given token list"
- t = token.scan_toks(false)
+ t = token.scantoks(false)
elseif c == "register_toks" then
- token.scan_next()
+ token.scannext()
w = "token register"
n = t.csname or t.index
t = tex.gettoks(n,true)
elseif c == "internal_toks" then
- token.scan_next()
+ token.scannext()
w = "internal token variable"
n = t.csname or t.index
t = tex.gettoks(n,true)
else
- n = token.scan_csname()
+ n = token.scancsname()
local r = flags(t)
- local m = token.get_meaning(n,true)
+ local m = token.getmeaning(n,true)
r[#r+1] = "control sequence"
if type(m) == "table" then
t = m
diff --git a/tex/context/base/mkxl/toks-ini.lmt b/tex/context/base/mkxl/toks-ini.lmt
index 4b2d1facc..3e9ff362b 100644
--- a/tex/context/base/mkxl/toks-ini.lmt
+++ b/tex/context/base/mkxl/toks-ini.lmt
@@ -25,58 +25,59 @@ values.count = values.integer
tokens.values = utilities.storage.allocate(table.swapped(values, values))
tokens.commands = utilities.storage.allocate(table.swapped(commands,commands))
-local scan_toks = token.scan_toks
-local scan_string = token.scan_string
-local scan_argument = token.scan_argument
-local scan_delimited = token.scan_delimited
-local scan_tokenlist = token.scan_tokenlist or scan_string
-local scan_integer = token.scan_integer or token.scan_int
-local scan_cardinal = token.scan_cardinal
-local scan_code = token.scan_code
-local scan_token_code = token.scan_token_code
-local scan_dimen = token.scan_dimen
-local scan_glue = token.scan_glue
-local scan_skip = token.scan_skip
-local scan_keyword = token.scan_keyword
-local scan_keyword_cs = token.scan_keyword_cs or scan_keyword
-local scan_token = token.scan_token
-local scan_box = token.scan_box
-local scan_word = token.scan_word
-local scan_letters = token.scan_letters or scan_word -- lmtx
-local scan_key = token.scan_key
-local scan_value = token.scan_value
-local scan_char = token.scan_char
-local scan_number = token.scan_number -- not defined
-local scan_csname = token.scan_csname
-local scan_real = token.scan_real
-local scan_float = token.scan_float
-local scan_luanumber = token.scan_luanumber or scan_float -- only lmtx
-local scan_luainteger = token.scan_luainteger or scan_integer -- only lmtx
-local scan_luacardinal = token.scan_luacardinal or scan_cardinal -- only lmtx
-
-local scan_integer_argument = token.scan_integer_argument
-local scan_dimen_argument = token.scan_dimen_argument
-
--- todo: gobble_integer -- might go away
--- todo: gobble_dimension -- might go away
-
-local set_macro = token.set_macro
-local set_char = token.set_char
-local set_lua = token.set_lua
-
-local create_token = token.create
-local new_token = token.new
-local is_defined = token.is_defined
-local is_token = token.is_token
-
-tokens.new = new_token
-tokens.create = create_token
-tokens.istoken = is_token
-tokens.isdefined = is_defined
-tokens.defined = is_defined
-
-tokens.getinteger = token.get_integer
-tokens.setinteger = token.set_integer
+local scantoks = token.scantoks
+local scanstring = token.scanstring
+local scanargument = token.scanargument
+local scandelimited = token.scandelimited
+local scantokenlist = token.scantokenlist
+local scaninteger = token.scaninteger
+local scancardinal = token.scancardinal
+local scancode = token.scancode
+local scantokencode = token.scantokencode
+local scandimen = token.scandimen
+local scanglue = token.scanglue
+local scanskip = token.scanskip
+local scankeyword = token.scankeyword
+local scankeywordcs = token.scankeywordcs
+local scantoken = token.scantoken
+local scanbox = token.scanbox
+local scanword = token.scanword
+local scanletters = token.scanletters
+local scankey = token.scankey
+local scanvalue = token.scanvalue
+local scanchar = token.scanchar
+local scancsname = token.scancsname
+local scannextchar = token.scannextchar
+local scanreal = token.scanreal
+local scanfloat = token.scanfloat
+local scanluanumber = token.scanluanumber
+local scanluainteger = token.scanluainteger
+local scanluacardinal = token.scanluacardinal
+local scanintegerargument = token.scanintegerargument
+local scandimenargument = token.scandimenargument
+
+local scannumber = token.scannumber
+local scanboolean = token.scanboolean
+
+local setmacro = token.setmacro
+local setchar = token.setchar
+local setlua = token.setlua
+
+local createtoken = token.create
+local newtoken = token.new
+local isdefined = token.isdefined
+local istoken = token.istoken
+
+tokens.new = newtoken
+tokens.create = createtoken
+tokens.istoken = istoken
+tokens.isdefined = isdefined
+tokens.defined = isdefined
+
+tokens.gobble = token.gobble
+
+tokens.getinteger = token.getinteger
+tokens.setinteger = token.setinteger
local bits = {
escape = 0x00000001, -- 2^00
@@ -110,10 +111,10 @@ tokens.bits = bits
-- words are space or \relax terminated and the trailing space is gobbled; a word
-- can contain any non-space letter/other (see archive for implementation in lua)
-if not scan_number then
+if not scannumber then -- we do have float and real .. this is actually scanluanumber
- scan_number = function(base)
- local s = scan_word()
+ scannumber = function(base)
+ local s = scanword()
if not s then
return nil
elseif base then
@@ -125,100 +126,89 @@ if not scan_number then
end
-local function scan_boolean()
- local kw = scan_word()
- if kw == "true" then
- return true
- elseif kw == "false" then
- return false
- else
- return nil
- end
-end
-
-local function scan_verbatim()
- return scan_argument(false)
-end
-
-if not scan_box then
+if not scanboolean then
- local scan_list = token.scan_list
- local put_next = token.put_next
-
- scan_box = function(s)
- if s == "hbox" or s == "vbox" or s == "vtop" then
- put_next(create_token(s))
+ scanboolean = function()
+ local kw = scanword()
+ if kw == "true" then
+ return true
+ elseif kw == "false" then
+ return false
+ else
+ return nil
end
- return scan_list()
end
- token.scan_box = scan_box
+end
+local function scanverbatim() -- check
+ return scanargument(false)
end
tokens.scanners = { -- these expand
- token = scan_token,
- toks = scan_toks,
- tokens = scan_toks,
- box = scan_box,
- hbox = function() return scan_box("hbox") end,
- vbox = function() return scan_box("vbox") end,
- vtop = function() return scan_box("vtop") end,
- dimen = scan_dimen,
- dimension = scan_dimen,
- glue = scan_glue,
- gluevalues = function() return scan_glue(false,false,true) end,
- gluespec = scan_skip,
- integer = scan_integer,
- cardinal = scan_cardinal,
- real = scan_real,
- float = scan_float,
- luanumber = scan_luanumber,
- luainteger = scan_luainteger,
- luacardinal = scan_luacardinal,
- count = scan_integer,
- string = scan_string,
- argument = scan_argument,
- delimited = scan_delimited,
- tokenlist = scan_tokenlist,
- verbatim = scan_verbatim, -- detokenize
- code = scan_code,
- tokencode = scan_token_code,
- word = scan_word,
- letters = scan_letters,
- key = scan_key,
- value = scan_value,
- char = scan_char,
- number = scan_number,
- boolean = scan_boolean,
- keyword = scan_keyword,
- keywordcs = scan_keyword_cs,
- csname = scan_csname,
-
- next = token.scan_next,
- nextexpanded = token.scan_next_expanded,
-
- peek = token.peek_next,
- peekexpanded = token.peek_next_expanded,
- peekchar = token.peek_next_char,
-
- skip = token.skip_next,
- skipexpanded = token.skip_next_expanded,
-
- cmdchr = token.scan_cmdchr,
- cmdchrexpanded = token.scan_cmdchr_expanded,
-
- ischar = token.is_next_char,
-
- integerargument = scan_integer_argument,
- dimenargument = scan_dimen_argument,
+ token = scantoken,
+ toks = scantoks,
+ tokens = scantoks,
+ box = scanbox,
+ hbox = function() return scanbox("hbox") end,
+ vbox = function() return scanbox("vbox") end,
+ vtop = function() return scanbox("vtop") end,
+ dimen = scandimen,
+ dimension = scandimen,
+ glue = scanglue,
+ gluevalues = function() return scanglue(false,false,true) end,
+ gluespec = scanskip,
+ integer = scaninteger,
+ cardinal = scancardinal,
+ real = scanreal,
+ float = scanfloat,
+ luanumber = scanluanumber,
+ luainteger = scanluainteger,
+ luacardinal = scanluacardinal,
+ count = scaninteger,
+ string = scanstring,
+ argument = scanargument,
+ delimited = scandelimited,
+ tokenlist = scantokenlist,
+ verbatim = scanverbatim, -- detokenize
+ code = scancode,
+ tokencode = scantokencode,
+ word = scanword,
+ letters = scanletters,
+ key = scankey,
+ value = scanvalue,
+ char = scanchar,
+ number = scannumber,
+ boolean = scanboolean,
+ keyword = scankeyword,
+ keywordcs = scankeywordcs,
+ csname = scancsname,
+ nextchar = scannextchar,
+
+ next = token.scannext,
+ nextexpanded = token.scannextexpanded,
+
+ peek = token.peeknext,
+ peekexpanded = token.peeknextexpanded,
+ peekchar = token.peeknextchar,
+
+ skip = token.skipnext,
+ skipexpanded = token.skipnextexpanded,
+
+ cmdchr = token.scancmdchr,
+ cmdchrexpanded = token.scancmdchrexpanded,
+
+ ischar = token.isnextchar,
+
+ integerargument = scanintegerargument,
+ dimenargument = scandimenargument,
}
tokens.getters = { -- these don't expand
- meaning = token.get_meaning,
- macro = token.get_macro,
- token = token.scan_next or token.get_next, -- not here, use scanners.next or token
- cstoken = token.get_cstoken,
+ meaning = token.getmeaning,
+ macro = token.getmacro,
+ token = token.scannext,
+ cstoken = token.getcstoken,
count = tex.getcount,
dimen = tex.getdimen,
skip = tex.getglue,
@@ -229,9 +219,9 @@ tokens.getters = { -- these don't expand
}
tokens.setters = {
- macro = set_macro,
- char = set_char,
- lua = set_lua,
+ macro = setmacro,
+ char = setchar,
+ lua = setlua,
count = tex.setcount,
dimen = tex.setdimen,
skip = tex.setglue,
@@ -241,50 +231,29 @@ tokens.setters = {
box = tex.setbox,
}
-token.accessors = {
- command = token.get_command,
- cmd = token.get_command,
- cmdname = token.get_cmdname,
- name = token.get_cmdname,
- csname = token.get_csname,
- index = token.get_index,
- active = token.get_active,
- frozen = token.get_frozen,
- protected = token.get_protected,
- expandable = token.get_protected,
- user = token.get_user,
- cmdchrcs = token.get_cmdchrcs,
- active = token.get_active,
- range = token.get_range,
+tokens.accessors = {
+ command = token.getcommand,
+ cmd = token.getcommand,
+ cmdname = token.getcmdname,
+ name = token.getcmdname,
+ csname = token.getcsname,
+ index = token.getindex,
+ active = token.getactive,
+ frozen = token.getfrozen,
+ protected = token.getprotected,
+ expandable = token.getprotected,
+ user = token.getuser,
+ cmdchrcs = token.getcmdchrcs,
+ active = token.getactive,
+ range = token.getrange,
}
--- static int run_scan_token(lua_State * L)
--- {
--- saved_tex_scanner texstate;
--- save_tex_scanner(texstate);
--- get_x_token();
--- make_new_token(L, cur_cmd, cur_chr, cur_cs);
--- unsave_tex_scanner(texstate);
--- return 1;
--- }
---
--- static int run_get_future(lua_State * L)
--- {
--- /* saved_tex_scanner texstate; */
--- /* save_tex_scanner(texstate); */
--- get_token();
--- make_new_token(L, cur_cmd, cur_chr, cur_cs);
--- back_input();
--- /* unsave_tex_scanner(texstate); */
--- return 1;
--- }
-
-if setinspector then
+if setinspector then -- can best be true
local simple = { letter = "letter", other_char = "other" }
local astable = function(t)
- if t and is_token(t) then
+ if t and istoken(t) then
local cmdname = t.cmdname
local simple = simple[cmdname]
if simple then
@@ -323,10 +292,98 @@ if setinspector then
end
tokens.cache = table.setmetatableindex(function(t,k)
- if not is_defined(k) then
- set_macro(k,"","global")
+ if not isdefined(k) then
+ setmacro(k,"","global")
end
- local v = create_token(k)
+ local v = createtoken(k)
t[k] = v
return v
end)
+
+-- This will go, although ... we use some old names in styles. Check what we
+-- actually use.
+
+token.is_token = token.istoken
+token.is_defined = token.isdefined
+token.scan_next = token.scannext
+token.scan_next_expanded = token.scannextexpanded
+token.scan_next_char = token.scannextchar
+token.skip_next = token.skipnext
+token.skip_next_expanded = token.skipnextexpanded
+token.peek_next = token.peeknext
+token.peek_next_expanded = token.peeknextexpanded
+token.peek_next_char = token.peeknextchar
+token.scan_cmdchr = token.scancmdchr
+token.scan_cmdchr_expanded = token.scancmdchrexpanded
+token.scan_keyword = token.scankeyword
+token.scan_keyword_cs = token.scankeywordcs
+token.scan_integer = token.scaninteger
+token.scan_integer_argument = token.scanintegerargument
+token.scan_dimen_argument = token.scandimenargument
+token.scan_cardinal = token.scancardinal
+token.scan_float = token.scanfloat
+token.scan_real = token.scanreal
+token.scan_luanumber = token.scanluanumber
+token.scan_luainteger = token.scanluainteger
+token.scan_luacardinal = token.scanluacardinal
+token.scan_scale = token.scanscale
+token.scan_dimen = token.scandimen
+token.scan_skip = token.scanskip
+token.scan_glue = token.scanglue
+token.scan_toks = token.scantoks
+token.scan_tokenlist = token.scantokenlist
+token.scan_code = token.scancode
+token.scan_token_code = token.scantokencode
+token.scan_string = token.scanstring
+token.scan_argument = token.scanargument
+token.scan_delimited = token.scandelimited
+token.scan_word = token.scanword
+token.scan_letters = token.scanletters
+token.scan_key = token.scankey
+token.scan_value = token.scanvalue
+token.scan_char = token.scanchar
+token.scan_csname = token.scancsname
+token.scan_token = token.scantoken
+token.scan_box = token.scanbox
+token.is_next_char = token.isnextchar
+token.put_next = token.putnext
+token.put_back = token.putback
+token.get_command = token.getcommand
+token.get_index = token.getindex
+token.get_range = token.getrange
+token.get_cmdname = token.getcmdname
+token.get_csname = token.getcsname
+token.get_id = token.getid
+token.get_tok = token.gettok
+token.get_active = token.getactive
+token.get_expandable = token.getexpandable
+token.get_protected = token.getprotected
+token.get_frozen = token.getfrozen
+token.get_tolerant = token.gettolerant
+token.get_noaligned = token.getnoaligned
+token.get_primitive = token.getprimitive
+token.get_permanent = token.getpermanent
+token.get_immutable = token.getimmutable
+token.get_instance = token.getinstance
+token.get_flags = token.getflags
+token.get_parameters = token.getparameters
+token.get_macro = token.getmacro
+token.get_meaning = token.getmeaning
+token.get_cmdchrcs = token.getcmdchrcs
+token.get_cstoken = token.getcstoken
+token.get_fields = token.getfields
+token.set_macro = token.setmacro
+token.undefine_macro = token.undefinemacro
+token.expand_macro = token.expandmacro
+token.set_char = token.setchar
+token.set_lua = token.setlua
+token.set_integer = token.setinteger
+token.get_integer = token.getinteger
+token.set_dimension = token.setdimension
+token.get_dimension = token.getdimension
+token.gobble_integer = token.gobbleinteger
+token.gobble_dimen = token.gobbledimen
+token.future_expand = token.futureexpand
+token.push_macro = token.pushmacro
+token.pop_macro = token.popmacro
+token.save_lua = token.savelua
diff --git a/tex/context/base/mkxl/trac-deb.lmt b/tex/context/base/mkxl/trac-deb.lmt
index 8ff124105..506a4e9cd 100644
--- a/tex/context/base/mkxl/trac-deb.lmt
+++ b/tex/context/base/mkxl/trac-deb.lmt
@@ -24,7 +24,7 @@ local implement = interfaces.implement
local ioflush = io.flush
local ioread = io.read
-local writenl = texio.write_nl
+local writenl = texio.writenl
local write = texio.write
local runlocal = tex.runlocal
diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt
index 72835165d..d278a40b0 100644
--- a/tex/context/base/mkxl/trac-vis.lmt
+++ b/tex/context/base/mkxl/trac-vis.lmt
@@ -61,12 +61,12 @@ local isglyph = nuts.isglyph
local hpack_nodes = nuts.hpack
local vpack_nodes = nuts.vpack
-local copy_list = nuts.copy_list
-local copy_node = nuts.copy_node
-local flush_node_list = nuts.flush_list
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local copylist = nuts.copylist
+local copy_node = nuts.copy
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local apply_to_nodes = nuts.apply
+local flushnodelist = nuts.flushlist
local hpack_string = nuts.typesetters.tohpack
@@ -462,7 +462,7 @@ local fontkern, italickern, marginkern, mathlistkern do
setattr(info,a_layer,layer)
f_cache[kern] = info
end
- head = insert_node_before(head,current,copy_list(info))
+ head = insertnodebefore(head,current,copylist(info))
return head, current
end
@@ -510,7 +510,7 @@ local glyphexpansion do
setattr(info,a_layer,l_expansion)
f_cache[extra] = info
end
- head = insert_node_before(head,current,copy_list(info))
+ head = insertnodebefore(head,current,copylist(info))
return head, current
end
return head, current
@@ -546,7 +546,7 @@ local kernexpansion do
setattr(info,a_layer,l_expansion)
f_cache[extra] = info
end
- head = insert_node_before(head,current,copy_list(info))
+ head = insertnodebefore(head,current,copylist(info))
return head, current
end
return head, current
@@ -594,7 +594,7 @@ local whatsit do
setattr(info,a_layer,l_whatsit)
w_cache[what] = info
end
- head, current = insert_node_after(head,current,copy_list(info))
+ head, current = insertnodeafter(head,current,copylist(info))
return head, current
end
@@ -669,7 +669,7 @@ local user do
setattr(info,a_layer,l_user)
u_cache[what] = info
end
- head, current = insert_node_after(head,current,copy_list(info))
+ head, current = insertnodeafter(head,current,copylist(info))
return head, current
end
@@ -708,7 +708,7 @@ local math do
setattr(info,a_layer,l_math)
m_cache[tag][skip] = info
end
- head, current = insert_node_after(head,current,copy_list(info))
+ head, current = insertnodeafter(head,current,copylist(info))
return head, current
end
@@ -768,7 +768,7 @@ local ruledbox do
end
-- we need to trigger the right mode (else sometimes no whatits)
local info = setlink(
- this and copy_list(this) or nil,
+ this and copylist(this) or nil,
(force_origin and emptyrule(wd,ht,dp)) -- we accept some overhead
or (dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth))
or userrule {
@@ -791,7 +791,7 @@ local ruledbox do
elseif trace_origin or force_origin then
local size = 2*size
local origin = o_cache[size]
- origin = copy_list(origin)
+ origin = copylist(origin)
if getid(parent) == vlist_code then
setshift(origin,-shift)
info = setlink(current,new_kern(-size),origin,new_kern(-size-dp),info)
@@ -811,7 +811,7 @@ local ruledbox do
elseif trace_origin or force_origin then
local size = 2*size
local origin = o_cache[size]
- origin = copy_list(origin)
+ origin = copylist(origin)
if getid(parent) == vlist_code then
info = setlink(current,new_kern(-wd-size-shift),origin,new_kern(-size+shift),info)
else
@@ -906,7 +906,7 @@ end
local ruledglue, ruledmathglue do
- local effectiveglue = nuts.effective_glue
+ local effectiveglue = nuts.effectiveglue
local gluecodes = nodes.gluecodes
@@ -1001,11 +1001,11 @@ local ruledglue, ruledmathglue do
setattr(info,a_layer,layer)
g_cache_gn[name] = info
end
- return copy_list(info)
+ return copylist(info)
end
ruledmathglue = function(head,current)
- return insert_node_before(head,current,gluename(getfont(current),l_glue,"trace:m"))
+ return insertnodebefore(head,current,gluename(getfont(current),l_glue,"trace:m"))
end
ruledglue = function(head,current,vertical,parent)
@@ -1049,11 +1049,11 @@ local ruledglue, ruledmathglue do
end
(vertical and g_cache_v or g_cache_h)[amount] = info
end
- info = copy_list(info)
+ info = copylist(info)
if vertical then
info = vpack_nodes(info)
end
- head, current = insert_node_before(head,current,info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1077,8 +1077,8 @@ local ruledglue, ruledmathglue do
g_cache_x[width] = info
end
end
- info = copy_list(info)
- head, current = insert_node_before(head,current,info)
+ info = copylist(info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1104,11 +1104,11 @@ local ruledkern do
end
cache[kern] = info
end
- info = copy_list(info)
+ info = copylist(info)
if vertical then
info = vpack_nodes(info)
end
- head, current = insert_node_before(head,current,info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1132,8 +1132,8 @@ local ruleditalic do
end
i_cache[kern] = info
end
- info = copy_list(info)
- head, current = insert_node_before(head,current,info)
+ info = copylist(info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1157,8 +1157,8 @@ local ruledmarginkern do
end
m_cache[kern] = info
end
- info = copy_list(info)
- head, current = insert_node_before(head,current,info)
+ info = copylist(info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1182,8 +1182,8 @@ local ruledmathlistkern do
end
l_cache[kern] = info
end
- info = copy_list(info)
- head, current = insert_node_before(head,current,info)
+ info = copylist(info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1205,7 +1205,7 @@ local ruleddiscretionary do
d = new_hlist(kern)
d_cache[true] = d
end
- insert_node_after(head,current,copy_list(d))
+ insertnodeafter(head,current,copylist(d))
return head, current
end
@@ -1238,13 +1238,13 @@ local ruledpenalty do
end
(vertical and p_cache_v or p_cache_h)[penalty] = info
end
- info = copy_list(info)
+ info = copylist(info)
if vertical then
info = vpack_nodes(info)
elseif raisepenalties then
setshift(info,-65536*4)
end
- head, current = insert_node_before(head,current,info)
+ head, current = insertnodebefore(head,current,info)
return head, getnext(current)
end
@@ -1563,7 +1563,7 @@ do
local function cleanup()
for tag, cache in next, caches do
for k, v in next, cache do
- flush_node_list(v)
+ flushnodelist(v)
end
end
cleanup = function()
diff --git a/tex/context/base/mkxl/typo-bld.lmt b/tex/context/base/mkxl/typo-bld.lmt
index 599106ccd..78bdd8214 100644
--- a/tex/context/base/mkxl/typo-bld.lmt
+++ b/tex/context/base/mkxl/typo-bld.lmt
@@ -46,7 +46,7 @@ local nodeidstostring = nodes.idstostring
local nodepool = nodes.pool
local new_baselineskip = nodepool.baselineskip
local new_lineskip = nodepool.lineskip
-local insert_node_before = nodes.insert_before
+local insertnodebefore = nodes.insertbefore
local hpack_node = nodes.hpack
local nuts = nodes.nuts
@@ -157,9 +157,9 @@ function parbuilders.constructors.methods.oneline(head,followed_by_display)
t.prevdepth = h.depth
t.prevgraf = 1
if d < texget("lineskiplimit") then
- return insert_node_before(h,h,new_lineskip(texget("lineskip",false))) -- no stretch etc
+ return insertnodebefore(h,h,new_lineskip(texget("lineskip",false))) -- no stretch etc
else
- return insert_node_before(h,h,new_baselineskip(d))
+ return insertnodebefore(h,h,new_baselineskip(d))
end
end
diff --git a/tex/context/base/mkxl/typo-brk.lmt b/tex/context/base/mkxl/typo-brk.lmt
index bebd4a149..f9c255608 100644
--- a/tex/context/base/mkxl/typo-brk.lmt
+++ b/tex/context/base/mkxl/typo-brk.lmt
@@ -45,15 +45,15 @@ local setprev = nuts.setprev
local setboth = nuts.setboth
local setsubtype = nuts.setsubtype
-local copy_node = nuts.copy_node
-local copy_node_list = nuts.copy_list
-local flush_node = nuts.flush_node
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local copy_node = nuts.copy
+local copy_node_list = nuts.copylist
+local flushnode = nuts.flushnode
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
-local end_of_math = nuts.end_of_math
-local find_attribute = nuts.find_attribute
-local unset_attributes = nuts.unset_attributes
+local endofmath = nuts.endofmath
+local findattribute = nuts.findattribute
+local unsetattributes = nuts.unsetattributes
local tonodes = nuts.tonodes
@@ -117,15 +117,15 @@ local function insert_break(head,start,stop,before,after,kern)
local g = new_glue()
setattrlist(p,start)
setattrlist(g,start)
- insert_node_before(head,start,p)
- insert_node_before(head,start,g)
+ insertnodebefore(head,start,p)
+ insertnodebefore(head,start,g)
end
local p = new_penalty(after)
local g = new_glue()
setattrlist(p,start)
setattrlist(g,start)
- insert_node_after(head,stop,g)
- insert_node_after(head,stop,p)
+ insertnodeafter(head,stop,g)
+ insertnodeafter(head,stop,p)
end
methods[1] = function(head,start,stop,settings,kern)
@@ -172,7 +172,7 @@ methods[2] = function(head,start) -- ( => (-
local hyphen = copy_node(post)
setchar(hyphen,languages.prehyphenchar(getlanguage(post)))
setlink(post,hyphen)
- head, start = insert_node_before(head,start,new_disc(nil,post,replace))
+ head, start = insertnodebefore(head,start,new_disc(nil,post,replace))
setattrlist(start,replace)
insert_break(head,start,start,10000,10000)
end
@@ -188,7 +188,7 @@ methods[3] = function(head,start) -- ) => -)
local hyphen = copy_node(pre)
setchar(hyphen,languages.prehyphenchar(getlanguage(pre)))
setlink(hyphen,pre)
- head, start = insert_node_before(head,start,new_disc(hyphen,nil,replace)) -- so not pre !
+ head, start = insertnodebefore(head,start,new_disc(hyphen,nil,replace)) -- so not pre !
setattrlist(start,tmp)
insert_break(head,start,start,10000,10000)
end
@@ -200,7 +200,7 @@ methods[4] = function(head,start) -- - => - - -
if p and n then
local tmp
head, start, tmp = remove_node(head,start)
- head, start = insert_node_before(head,start,new_disc())
+ head, start = insertnodebefore(head,start,new_disc())
setattrlist(start,tmp)
setdisc(start,copy_node(tmp),copy_node(tmp),tmp)
insert_break(head,start,start,10000,10000)
@@ -213,7 +213,7 @@ methods[5] = function(head,start,stop,settings) -- x => p q r
if p and n then
local tmp
head, start, tmp = remove_node(head,start)
- head, start = insert_node_before(head,start,new_disc())
+ head, start = insertnodebefore(head,start,new_disc())
local attr = getattrlist(tmp)
local font = getfont(tmp)
local left = settings.left
@@ -230,7 +230,7 @@ methods[5] = function(head,start,stop,settings) -- x => p q r
end
setdisc(start,left,right,middle)
setattrlist(start,attr)
- flush_node(tmp)
+ flushnode(tmp)
insert_break(head,start,start,10000,10000)
end
return head, start
@@ -241,7 +241,7 @@ end
-- do we need to go into disc nodes (or do it as first step but then we need a pre/post font handler)
function breakpoints.handler(head)
- local _, current = find_attribute(head, a_breakpoints)
+ local _, current = findattribute(head, a_breakpoints)
if current then
local done = false
local attr = nil
@@ -304,7 +304,7 @@ function breakpoints.handler(head)
end
elseif id == math_code then
attr = nil
- current = end_of_math(current)
+ current = endofmath(current)
if current then
current = getnext(current)
end
@@ -398,7 +398,7 @@ function breakpoints.handler(head)
end
end
if done then
--- unset_attributes(a_breakpoints, head)
+-- unsetattributes(a_breakpoints, head)
end
end
return head
diff --git a/tex/context/base/mkxl/typo-cap.lmt b/tex/context/base/mkxl/typo-cap.lmt
index 3f53b65e0..03a04a17b 100644
--- a/tex/context/base/mkxl/typo-cap.lmt
+++ b/tex/context/base/mkxl/typo-cap.lmt
@@ -35,10 +35,10 @@ local setfont = nuts.setfont
local setscales = nuts.setscales
local copy_node = nuts.copy
-local end_of_math = nuts.end_of_math
-local insert_after = nuts.insert_after
-local find_attribute = nuts.find_attribute
-local unset_attributes = nuts.unset_attributes
+local endofmath = nuts.endofmath
+local insertafter = nuts.insertafter
+local findattribute = nuts.findattribute
+local unsetattributes = nuts.unsetattributes
local nextglyph = nuts.traversers.glyph
@@ -145,7 +145,7 @@ local function replacer(start,codes)
else
local g = copy_node(start)
setchar(g,chr)
- insert_after(start,start,g)
+ insertafter(start,start,g)
end
end
elseif ifc[dc] then
@@ -301,7 +301,7 @@ register(variables.cap, variables.capital) -- clone
register(variables.Cap, variables.Capital) -- clone
function cases.handler(head)
- local _, start = find_attribute(head, a_cases)
+ local _, start = findattribute(head, a_cases)
if start then
local lastfont = { }
local lastattr = nil
@@ -387,7 +387,7 @@ function cases.handler(head)
end
else
if id == math_code then
- start = end_of_math(start)
+ start = endofmath(start)
end
count = 0
end
@@ -396,7 +396,7 @@ function cases.handler(head)
end
end
if done then
- -- unset_attributes(a_cases,head)
+ -- unsetattributes(a_cases,head)
end
end
return head
diff --git a/tex/context/base/mkxl/typo-chr.lmt b/tex/context/base/mkxl/typo-chr.lmt
index bb11f54a6..745a35a14 100644
--- a/tex/context/base/mkxl/typo-chr.lmt
+++ b/tex/context/base/mkxl/typo-chr.lmt
@@ -27,8 +27,8 @@ local wordboundary_code = boundarycodes.word
local texgetnest = tex.getnest -- to be used
local texsetcount = tex.setcount
-local flush_node = nodes.flush_node
-local flush_list = nodes.flush_list
+local flushnode = nodes.flushnode
+local flushlist = nodes.flushlist
local settexattribute = tex.setattribute
local punctuation = characters.is_punctuation
@@ -68,7 +68,7 @@ local actions = {
remove = function(specification)
local n = pickup()
if n then
- flush_node(n)
+ flushnode(n)
end
end,
push = function(specification)
@@ -103,7 +103,7 @@ local function pickup(head,tail,str)
while true do
local prev = first.prev
if prev and prev[a_marked] == attr then
- if prev.id == par_code then -- and start_of_par(prev)
+ if prev.id == par_code then -- and startofpar(prev)
break
else
first = prev
@@ -140,7 +140,7 @@ local actions = {
list.tail = prev
prev.next = nil
end
- flush_list(first)
+ flushlist(first)
end
end
end,
diff --git a/tex/context/base/mkxl/typo-dig.lmt b/tex/context/base/mkxl/typo-dig.lmt
index 7f6663db9..9e72d25c2 100644
--- a/tex/context/base/mkxl/typo-dig.lmt
+++ b/tex/context/base/mkxl/typo-dig.lmt
@@ -33,12 +33,11 @@ local setlink = nuts.setlink
local setnext = nuts.setnext
local setprev = nuts.setprev
-local hpack_node = nuts.hpack
-local traverse_id = nuts.traverse_id
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
-local find_attribute = nuts.find_attribute
-local unset_attributes = nuts.unset_attributes
+local hpacknode = nuts.hpack
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
+local findattribute = nuts.findattribute
+local unsetattributes = nuts.unsetattributes
local texsetattribute = tex.setattribute
local unsetvalue = attributes.unsetvalue
@@ -75,16 +74,16 @@ local a_digits = attributes.private("digits")
function nodes.aligned(head,start,stop,width,how)
if how == "flushright" or how == "middle" then
- head, start = insert_node_before(head,start,new_glue(0,65536,65536))
+ head, start = insertnodebefore(head,start,new_glue(0,65536,65536))
end
if how == "flushleft" or how == "middle" then
- head, stop = insert_node_after(head,stop,new_glue(0,65536,65536))
+ head, stop = insertnodeafter(head,stop,new_glue(0,65536,65536))
end
local prv = getprev(start)
local nxt = getnext(stop)
setprev(start)
setnext(stop)
- local packed = hpack_node(start,width,"exactly") -- no directional mess here, just lr
+ local packed = hpacknode(start,width,"exactly") -- no directional mess here, just lr
if prv then
setlink(prv,packed)
end
@@ -117,7 +116,7 @@ actions[1] = function(head,start,attr)
end
function digits.handler(head)
- local _, start = find_attribute(head, a_digits)
+ local _, start = findattribute(head, a_digits)
if start then
local current = head
while current do
@@ -138,7 +137,7 @@ function digits.handler(head)
end
end
if done then
- unset_attributes(a_digits, head)
+ unsetattributes(a_digits, head)
end
end
return head
diff --git a/tex/context/base/mkxl/typo-drp.lmt b/tex/context/base/mkxl/typo-drp.lmt
index 2c53cc111..1885ce90d 100644
--- a/tex/context/base/mkxl/typo-drp.lmt
+++ b/tex/context/base/mkxl/typo-drp.lmt
@@ -57,10 +57,11 @@ local nodecodes = nodes.nodecodes
local nodepool = nuts.pool
local new_kern = nodepool.kern
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local remove_node = nuts.remove
-local start_of_par = nuts.start_of_par
+
+local startofpar = nuts.startofpar
local nextnode = nuts.traversers.node
local nextglyph = nuts.traversers.glyph
@@ -314,7 +315,7 @@ actions[v_default] = function(head,setting)
texset("hangindent",hangindent,true)
end
if indent then
- insert_after(first,first,new_kern(-parindent))
+ insertafter(first,first,new_kern(-parindent))
end
end
return head
@@ -323,7 +324,7 @@ end
-- we can count ... when all done, we can disable ...
function initials.handler(head)
- if getid(head) == par_code and start_of_par(head) then
+ if getid(head) == par_code and startofpar(head) then
local settings = getprop(head,a_initial)
if settings then
disableaction("processors","typesetters.initials.handler")
diff --git a/tex/context/base/mkxl/typo-duc.lmt b/tex/context/base/mkxl/typo-duc.lmt
index 07ae140e8..87190a1ab 100644
--- a/tex/context/base/mkxl/typo-duc.lmt
+++ b/tex/context/base/mkxl/typo-duc.lmt
@@ -76,9 +76,10 @@ local setattrlist = nuts.setattrlist
local properties = nodes.properties.data
local remove_node = nuts.remove
-local insert_node_after = nuts.insert_after
-local insert_node_before = nuts.insert_before
-local start_of_par = nuts.start_of_par
+local insertnodeafter = nuts.insertafter
+local insertnodebefore = nuts.insertbefore
+
+local startofpar = nuts.startofpar
local nodepool = nuts.pool
local new_direction = nodepool.direction
@@ -426,7 +427,7 @@ end
local function get_baselevel(head,list,size,direction)
if direction == lefttoright_code or direction == righttoleft_code then
return direction, true
- elseif getid(head) == par_code and start_of_par(head) then
+ elseif getid(head) == par_code and startofpar(head) then
direction = getdirection(head)
if direction == lefttoright_code or direction == righttoleft_code then
return direction, true
@@ -969,18 +970,18 @@ local function apply_to_list(list,size,head,pardir)
c = p
end
-- there is always a par nodes so head will stay
- head = insert_node_before(head,c,new_direction(enddir,true))
+ head = insertnodebefore(head,c,new_direction(enddir,true))
enddir = false
end
elseif begindir then
- if id == par_code and start_of_par(current) then
+ if id == par_code and startofpar(current) then
-- par should always be the 1st node
- head, current = insert_node_after(head,current,new_direction(begindir))
+ head, current = insertnodeafter(head,current,new_direction(begindir))
begindir = nil
end
end
if begindir then
- head = insert_node_before(head,current,new_direction(begindir))
+ head = insertnodebefore(head,current,new_direction(begindir))
end
local skip = entry.skip
if skip and skip > 0 then
@@ -995,7 +996,7 @@ local function apply_to_list(list,size,head,pardir)
end
end
if enddir then
- head, current = insert_node_after(head,current,new_direction(enddir,true))
+ head, current = insertnodeafter(head,current,new_direction(enddir,true))
end
if not entry.remove then
current = getnext(current)
diff --git a/tex/context/base/mkxl/typo-fln.lmt b/tex/context/base/mkxl/typo-fln.lmt
index fa507df4b..8d1553d4c 100644
--- a/tex/context/base/mkxl/typo-fln.lmt
+++ b/tex/context/base/mkxl/typo-fln.lmt
@@ -62,15 +62,15 @@ local spaceskip_code = nodes.gluecodes.spaceskip
local nextglyph = nuts.traversers.glyph
local nextdisc = nuts.traversers.disc
-local flush_node_list = nuts.flush_list
-local flush_node = nuts.flush_node
-local copy_node_list = nuts.copy_list
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local flushnodelist = nuts.flushlist
+local flushnode = nuts.flushnode
+local copy_node_list = nuts.copylist
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
local getdimensions = nuts.dimensions
local hpack_node_list = nuts.hpack
-local start_of_par = nuts.start_of_par
+local startofpar = nuts.startofpar
local setcoloring = nuts.colors.set
@@ -180,7 +180,7 @@ actions[v_line] = function(head,setting)
-- temp = typesetters.kerns.handler(temp) -- maybe when enabled
-- temp = typesetters.cases.handler(temp) -- maybe when enabled
local width = getdimensions(temp)
- flush_node_list(temp)
+ flushnodelist(temp)
return width
end
@@ -228,7 +228,7 @@ actions[v_line] = function(head,setting)
end
end
- flush_node_list(temp)
+ flushnodelist(temp)
local start = head
local n = 0
@@ -288,11 +288,11 @@ actions[v_line] = function(head,setting)
end
end
setdisc(disc,pre,post,replace)
- flush_node(disc)
+ flushnode(disc)
elseif id == glue_code then
n = n + 1
if linebreak ~= n then
- head = insert_node_before(head,start,newpenalty(10000)) -- nobreak
+ head = insertnodebefore(head,start,newpenalty(10000)) -- nobreak
end
end
local next = getnext(start)
@@ -300,11 +300,11 @@ actions[v_line] = function(head,setting)
if start ~= head then
local where = id == glue_code and getprev(start) or start
if trace_firstlines then
- head, where = insert_node_after(head,where,newpenalty(10000)) -- nobreak
- head, where = insert_node_after(head,where,newkern(-65536))
- head, where = insert_node_after(head,where,tracerrule(65536,4*65536,2*65536,"darkblue"))
+ head, where = insertnodeafter(head,where,newpenalty(10000)) -- nobreak
+ head, where = insertnodeafter(head,where,newkern(-65536))
+ head, where = insertnodeafter(head,where,tracerrule(65536,4*65536,2*65536,"darkblue"))
end
- head, where = insert_node_after(head,where,newpenalty(-10000)) -- break
+ head, where = insertnodeafter(head,where,newpenalty(-10000)) -- break
end
start = next
break
@@ -358,7 +358,7 @@ end
actions[v_default] = actions[v_line]
function firstlines.handler(head)
- if getid(head) == par_code and start_of_par(head) then
+ if getid(head) == par_code and startofpar(head) then
local settings = getprop(head,a_firstline)
if settings then
disableaction("processors","typesetters.firstlines.handler")
diff --git a/tex/context/base/mkxl/typo-hid.lmt b/tex/context/base/mkxl/typo-hid.lmt
index e3b7567d9..45dde4979 100644
--- a/tex/context/base/mkxl/typo-hid.lmt
+++ b/tex/context/base/mkxl/typo-hid.lmt
@@ -17,7 +17,7 @@ local getprev = nuts.getprev
local setlist = nuts.setlist
local setlink = nuts.setlink
local nextnode = nuts.traversers.node
-local flushlist = nuts.flush_list
+local flushlist = nuts.flushlist
local dimensions = nuts.rangedimensions
local hpack = nuts.hpack
local setwhd = nuts.setwhd
diff --git a/tex/context/base/mkxl/typo-itc.lmt b/tex/context/base/mkxl/typo-itc.lmt
index 4350053b3..74c47355f 100644
--- a/tex/context/base/mkxl/typo-itc.lmt
+++ b/tex/context/base/mkxl/typo-itc.lmt
@@ -44,9 +44,9 @@ local setkern = nuts.setkern
local getkern = nuts.getkern
local getheight = nuts.getheight
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
-local end_of_math = nuts.end_of_math
+local endofmath = nuts.endofmath
local texgetattribute = tex.getattribute
local texsetattribute = tex.setattribute
@@ -184,7 +184,7 @@ local enablemath = false
local enabletext = false
local function domath(head,current)
- current = end_of_math(current)
+ current = endofmath(current)
local next = getnext(current)
if next then
local char, id = isglyph(next)
@@ -253,7 +253,7 @@ local function domath(head,current)
if trace_italics then
report_italics("%s italic %p between math %C and non punctuation %C","adding",a,getchar(glyph),char)
end
- insert_node_after(head,glyph,correction_kern(a,glyph))
+ insertnodeafter(head,glyph,correction_kern(a,glyph))
end
end
end
@@ -311,7 +311,7 @@ local function texthandler(head)
if font ~= lastfont then
if previtalic ~= 0 then
if okay(data,current,font,prevchar,previtalic,char,"glyph") then
- insert_node_after(prevhead,prev,correction_kern(previtalic,current))
+ insertnodeafter(prevhead,prev,correction_kern(previtalic,current))
end
elseif previnserted and data then
if trace_italics then
@@ -322,7 +322,7 @@ local function texthandler(head)
--
if replaceitalic ~= 0 then
if okay(data,replace,font,replacechar,replaceitalic,char,"replace") then
- insert_node_after(replacehead,replace,correction_kern(replaceitalic,current))
+ insertnodeafter(replacehead,replace,correction_kern(replaceitalic,current))
end
replaceitalic = 0
elseif replaceinserted and data then
@@ -334,7 +334,7 @@ local function texthandler(head)
--
if postitalic ~= 0 then
if okay(data,post,font,postchar,postitalic,char,"post") then
- insert_node_after(posthead,post,correction_kern(postitalic,current))
+ insertnodeafter(posthead,post,correction_kern(postitalic,current))
end
postitalic = 0
elseif postinserted and data then
@@ -486,7 +486,7 @@ local function texthandler(head)
end
previnserted = correction_glue(previtalic,current) -- maybe just add ? else problem with penalties
previtalic = 0
- insert_node_after(prevhead,prev,previnserted)
+ insertnodeafter(prevhead,prev,previnserted)
else
if replaceitalic ~= 0 then
if trace_italics then
@@ -494,7 +494,7 @@ local function texthandler(head)
end
replaceinserted = correction_kern(replaceitalic,current) -- needs to be a kern
replaceitalic = 0
- insert_node_after(replacehead,replace,replaceinserted)
+ insertnodeafter(replacehead,replace,replaceinserted)
end
if postitalic ~= 0 then
if trace_italics then
@@ -502,7 +502,7 @@ local function texthandler(head)
end
postinserted = correction_kern(postitalic,current) -- needs to be a kern
postitalic = 0
- insert_node_after(posthead,post,postinserted)
+ insertnodeafter(posthead,post,postinserted)
end
end
elseif id == math_code then
@@ -516,14 +516,14 @@ local function texthandler(head)
if mathokay then
current = domath(head,current)
else
- current = end_of_math(current)
+ current = endofmath(current)
end
else
if previtalic ~= 0 then
if trace_italics then
report_italics("inserting %p between %s italic %C and whatever",previtalic,"glyph",prevchar)
end
- insert_node_after(prevhead,prev,correction_kern(previtalic,current))
+ insertnodeafter(prevhead,prev,correction_kern(previtalic,current))
previnserted = nil
previtalic = 0
replaceinserted = nil
@@ -535,7 +535,7 @@ local function texthandler(head)
if trace_italics then
report_italics("inserting %p between %s italic %C and whatever",replaceitalic,"replace",replacechar)
end
- insert_node_after(replacehead,replace,correction_kern(replaceitalic,current))
+ insertnodeafter(replacehead,replace,correction_kern(replaceitalic,current))
previnserted = nil
previtalic = 0
replaceinserted = nil
@@ -547,7 +547,7 @@ local function texthandler(head)
if trace_italics then
report_italics("inserting %p between %s italic %C and whatever",postitalic,"post",postchar)
end
- insert_node_after(posthead,post,correction_kern(postitalic,current))
+ insertnodeafter(posthead,post,correction_kern(postitalic,current))
previnserted = nil
previtalic = 0
replaceinserted = nil
@@ -564,19 +564,19 @@ local function texthandler(head)
if trace_italics then
report_italics("inserting %p between %s italic %C and end of list",previtalic,"glyph",prevchar)
end
- insert_node_after(prevhead,prev,correction_kern(previtalic,current))
+ insertnodeafter(prevhead,prev,correction_kern(previtalic,current))
else
if replaceitalic ~= 0 then
if trace_italics then
report_italics("inserting %p between %s italic %C and end of list",replaceitalic,"replace",replacechar)
end
- insert_node_after(replacehead,replace,correction_kern(replaceitalic,current))
+ insertnodeafter(replacehead,replace,correction_kern(replaceitalic,current))
end
if postitalic ~= 0 then
if trace_italics then
report_italics("inserting %p between %s italic %C and end of list",postitalic,"post",postchar)
end
- insert_node_after(posthead,post,correction_kern(postitalic,current))
+ insertnodeafter(posthead,post,correction_kern(postitalic,current))
end
end
end
diff --git a/tex/context/base/mkxl/typo-krn.lmt b/tex/context/base/mkxl/typo-krn.lmt
index a8ccedccf..450194767 100644
--- a/tex/context/base/mkxl/typo-krn.lmt
+++ b/tex/context/base/mkxl/typo-krn.lmt
@@ -24,13 +24,12 @@ local nodepool = nuts.pool
-- check what is used
local find_node_tail = nuts.tail
-local flush_node = nuts.flush_node
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
-local end_of_math = nuts.end_of_math
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
+local endofmath = nuts.endofmath
local copy_node = nuts.copy
-local find_attribute = nuts.find_attribute
-local unset_attributes = nuts.unset_attributes
+local findattribute = nuts.findattribute
+local unsetattributes = nuts.unsetattributes
local getnext = nuts.getnext
local getprev = nuts.getprev
@@ -130,7 +129,7 @@ local factors = kerns.factors
-- make sure it runs after all others
-- there will be a width adaptor field in nodes so this will change
-- todo: interchar kerns / disc nodes / can be made faster
--- todo: use insert_before etc
+-- todo: use insertbefore etc
local gluefactor = 4 -- assumes quad = .5 enspace
@@ -332,7 +331,7 @@ local function process_list(head,keeptogether,krn,font,okay)
-- if kerns then
-- print("it happens indeed, basemode kerns not yet injected")
-- end
- insert_node_before(head,start,new_kern((kerns and kerns[char] or 0) + kern))
+ insertnodebefore(head,start,new_kern((kerns and kerns[char] or 0) + kern))
okay = true
end
end
@@ -366,7 +365,7 @@ local function closest_bound(b,get)
end
function kerns.handler(head)
- local _, start = find_attribute(head, a_kerns)
+ local _, start = findattribute(head, a_kerns)
if start then
local lastfont = nil
local keepligature = kerns.keepligature
@@ -415,7 +414,7 @@ function kerns.handler(head)
setattr(n,a_kerns,attr) -- we took away the attr
end
setchar(n,unicode[i])
- insert_node_after(head,s,n)
+ insertnodeafter(head,s,n)
s = n
end
end
@@ -447,10 +446,10 @@ function kerns.handler(head)
local data = chardata[font][prevchar]
local kerns = data and data.kerns
local kern = (kerns and kerns[char] or 0) + quaddata[font]*krn
- insert_node_before(head,start,kern_injector(fillup,kern))
+ insertnodebefore(head,start,kern_injector(fillup,kern))
end
else
- insert_node_before(head,start,kern_injector(fillup,quaddata[font]*krn))
+ insertnodebefore(head,start,kern_injector(fillup,quaddata[font]*krn))
end
end
prev = start
@@ -560,16 +559,16 @@ function kerns.handler(head)
-- special case
local b, f = closest_bound(start,getprev)
if b then
- insert_node_before(head,start,kern_injector(fillup,quaddata[f]*krn))
+ insertnodebefore(head,start,kern_injector(fillup,quaddata[f]*krn))
end
local b, f = closest_bound(start,getnext)
if b then
- insert_node_after(head,start,kern_injector(fillup,quaddata[f]*krn))
+ insertnodeafter(head,start,kern_injector(fillup,quaddata[f]*krn))
end
end
bound = false
elseif id == math_code then
- start = end_of_math(start)
+ start = endofmath(start)
bound = false
end
if start then
@@ -590,7 +589,7 @@ function kerns.handler(head)
end
end
if done then
- -- unset_attributes(a_kerns, head)
+ -- unsetattributes(a_kerns, head)
end
end
return head
diff --git a/tex/context/base/mkxl/typo-lin.lmt b/tex/context/base/mkxl/typo-lin.lmt
index 86365c3ba..783faeabf 100644
--- a/tex/context/base/mkxl/typo-lin.lmt
+++ b/tex/context/base/mkxl/typo-lin.lmt
@@ -68,8 +68,8 @@ local tonut = nodes.tonut
local tonode = nodes.tonode
local nexthlist = nuts.traversers.hlist
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
local getlist = nuts.getlist
local setlist = nuts.setlist
@@ -89,7 +89,7 @@ local getnormalizedline = nuts.getnormalizedline
local setprop = nuts.setprop
local getprop = nuts.rawprop -- getprop
-local effectiveglue = nuts.effective_glue
+local effectiveglue = nuts.effectiveglue
local nodepool = nuts.pool
local new_kern = nodepool.kern
@@ -127,9 +127,9 @@ local function finalize(prop,key) -- delayed calculations
end
local kern1 = new_kern(delta)
local kern2 = new_kern(-delta)
- head = insert_before(head,head,kern1) -- setlink
- head = insert_before(head,head,pack)
- head = insert_before(head,head,kern2)
+ head = insertbefore(head,head,kern1) -- setlink
+ head = insertbefore(head,head,pack)
+ head = insertbefore(head,head,kern2)
setlist(line,head)
local where = {
pack = pack,
@@ -193,10 +193,10 @@ local function addtoline(n,list,option)
if trace_anchors and not line.traced then
line.traced = true
local rule = new_rule(2*65536,2*65536,1*65536)
- local list = insert_before(rule,rule,new_kern(-1*65536))
+ local list = insertbefore(rule,rule,new_kern(-1*65536))
addtoline(n,list)
local rule = new_rule(2*65536,6*65536,-3*65536)
- local list = insert_before(rule,rule,new_kern(-1*65536))
+ local list = insertbefore(rule,rule,new_kern(-1*65536))
addtoline(n,list,"internal")
else
line.traced = true
@@ -219,14 +219,14 @@ local function addtoline(n,list,option)
-- optimize now .. we can also decide to put each blob in a hlist
local kern = new_kern(delta)
if tail then
- head, tail = insert_after(head,tail,kern)
+ head, tail = insertafter(head,tail,kern)
else
head, tail = kern, kern
setlist(where.pack,head)
end
- head, tail = insert_after(head,tail,blob)
+ head, tail = insertafter(head,tail,blob)
local kern = new_kern(-delta)
- head, tail = insert_after(head,tail,kern)
+ head, tail = insertafter(head,tail,kern)
--
where.head = head
where.tail = tail
@@ -256,7 +256,7 @@ local function addanchortoline(n,anchor)
end
if where.tail then
local head = where.head
- insert_before(head,head,anchor)
+ insertbefore(head,head,anchor)
else
where.tail = anchor
end
diff --git a/tex/context/base/mkxl/typo-mar.lmt b/tex/context/base/mkxl/typo-mar.lmt
index 7e69162a9..f8c135fa7 100644
--- a/tex/context/base/mkxl/typo-mar.lmt
+++ b/tex/context/base/mkxl/typo-mar.lmt
@@ -61,9 +61,9 @@ local v_line = variables.line
local nuts = nodes.nuts
local tonode = nuts.tonode
-local hpack_nodes = nuts.hpack
-local traverse_id = nuts.traverse_id
-local flush_node_list = nuts.flush_list
+local hpacknodes = nuts.hpack
+local traverseid = nuts.traverseid
+local flushnodelist = nuts.flushlist
local getnext = nuts.getnext
local getprev = nuts.getprev
@@ -251,7 +251,7 @@ function margins.save(t)
local si = store[i]
if si.name == name then
local s = remove(store,i)
- flush_node_list(s.box)
+ flushnodelist(s.box)
end
end
else
@@ -259,7 +259,7 @@ function margins.save(t)
local si = store[i]
if si.name == name then
local s = remove(store,i)
- flush_node_list(s.box)
+ flushnodelist(s.box)
end
end
end
@@ -492,9 +492,9 @@ local function markovershoot(current) -- todo: alleen als offset > line
v_anchors = v_anchors + 1
cache[v_anchors] = fastcopy(stacked)
local anchor = setanchor(v_anchors)
- -- local list = hpack_nodes(setlink(anchor,getlist(current))) -- not ok, we need to retain width
+ -- local list = hpacknodes(setlink(anchor,getlist(current))) -- not ok, we need to retain width
-- local list = setlink(anchor,getlist(current)) -- why not this ... better play safe
- local list = hpack_nodes(setlink(anchor,getlist(current)),getwidth(current),"exactly")--
+ local list = hpacknodes(setlink(anchor,getlist(current)),getwidth(current),"exactly")--
if trace_marginstack then
report_margindata("marking anchor %a",v_anchors)
end
@@ -790,7 +790,7 @@ local function flushed(scope,parent) -- current is hlist
if done then
local a = getattr(head,a_linenumber) -- hack .. we need a more decent critical attribute inheritance mechanism
if false then
- local l = hpack_nodes(head,getwidth(parent),"exactly")
+ local l = hpacknodes(head,getwidth(parent),"exactly")
setlist(parent,l)
if a then
setattr(l,a_linenumber,a)
@@ -905,7 +905,7 @@ end
local function finalhandler(head)
if nofdelayed > 0 then
local current = head
- while current and nofdelayed > 0 do -- traverse_list
+ while current and nofdelayed > 0 do
local id = getid(current)
if id == hlist_code then -- only lines?
local a = getprop(current,"margindata")
diff --git a/tex/context/base/mkxl/typo-pag.lmt b/tex/context/base/mkxl/typo-pag.lmt
index 9f8a3a1f4..d9b910e86 100644
--- a/tex/context/base/mkxl/typo-pag.lmt
+++ b/tex/context/base/mkxl/typo-pag.lmt
@@ -39,7 +39,7 @@ local setpenalty = nuts.setpenalty
local getwidth = nuts.getwidth
local getdepth = nuts.getdepth
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
local new_penalty = nuts.pool.penalty
local trace_keeptogether = false
@@ -129,7 +129,7 @@ local function keeptogether(start,a,specification)
if getid(previous) == penalty_code then
setpenalty(previous,10000)
else
- insert_node_after(head,previous,new_penalty(10000))
+ insertnodeafter(head,previous,new_penalty(10000))
end
else
break
@@ -144,7 +144,7 @@ local function keeptogether(start,a,specification)
if getid(previous) == penalty_code then
setpenalty(previous,10000)
else
- insert_node_after(head,previous,new_penalty(10000))
+ insertnodeafter(head,previous,new_penalty(10000))
end
else
break
@@ -158,7 +158,7 @@ local function keeptogether(start,a,specification)
if getid(previous) == penalty_code then
setpenalty(previous,10000)
else
- insert_node_after(head,previous,new_penalty(10000))
+ insertnodeafter(head,previous,new_penalty(10000))
end
else
break
diff --git a/tex/context/base/mkxl/typo-rub.lmt b/tex/context/base/mkxl/typo-rub.lmt
index 82aa3c269..eff522e02 100644
--- a/tex/context/base/mkxl/typo-rub.lmt
+++ b/tex/context/base/mkxl/typo-rub.lmt
@@ -49,7 +49,6 @@ local getwidth = nuts.getwidth
local setwidth = nuts.setwidth
local hpack = nuts.hpack
-local insert_after = nuts.insert_after
local takebox = nuts.takebox
local nextlist = nuts.traversers.list
diff --git a/tex/context/base/mkxl/typo-shp.lmt b/tex/context/base/mkxl/typo-shp.lmt
index 30719c40e..139468a19 100644
--- a/tex/context/base/mkxl/typo-shp.lmt
+++ b/tex/context/base/mkxl/typo-shp.lmt
@@ -14,7 +14,7 @@ local texset = tex.set
local texgetcount = tex.getcount
local texgetglue = tex.getglue
-local expandmacro = token.expand_macro
+local expandmacro = token.expandmacro or token.expand_macro -- todo
local implement = interfaces.implement
@@ -217,6 +217,8 @@ do
a = l + r
goto AGAIN
end
+ elseif key == "inspect" then
+ inspect(t)
else
logs.report("system","bad key %a in paragraphshape",key)
break
diff --git a/tex/context/base/mkxl/typo-shp.mkxl b/tex/context/base/mkxl/typo-shp.mkxl
index b74003068..6201012fe 100644
--- a/tex/context/base/mkxl/typo-shp.mkxl
+++ b/tex/context/base/mkxl/typo-shp.mkxl
@@ -45,6 +45,19 @@
%D But we wrap this in a more abstract interface:
\installcorenamespace {parshapes}
+\installcorenamespace {shapedparagraph}
+
+\installbasicnativeautosetuphandler \??shapedparagraph {shapedparagraph}
+
+\setupshapedparagraph
+ [\c!method=,
+ \c!list=,
+ \c!lines=\zerocount,
+ \c!mp=,
+ \c!repeat=,
+ \c!hoffset=\zeropoint,
+ \c!voffset=\zeropoint,
+ \c!distance=\zeropoint]
\aliased\let\stopparagraphshape\relax
@@ -62,20 +75,103 @@
\def\spac_shapes_calculate#1% called locally in \LUA
{\startMPcalculation \includeMPgraphic{#1} \stopMPcalculation}
-\permanent\protected\tolerant\def\startshapedparagraph[#1]% no grouping
- {\begingroup
- \getdummyparameters[\c!method=,\c!list=,\c!mp=,\c!repeat=,#1]%
- \edef\p_mp {\dummyparameter\c!mp}%
- \edef\p_repeat{\dummyparameter\c!repeat}%
- \setlocalhsize
+% \permanent\protected\tolerant\def\startshapedparagraph[#1]% no grouping
+% {\begingroup
+% \let\currentshapedparagraph\empty
+% \setupshapedparagraph[#1]%
+% \edef\p_mp {\shapedparagraphparameter\c!mp}%
+% \edef\p_repeat{\shapedparagraphparameter\c!repeat}%
+% \setlocalhsize
+% \normalexpanded
+% {\endgroup
+% \ifempty\p_mp
+% \setparagraphshape[\shapedparagraphparameter\c!list]%
+% \else
+% \setparagraphmetashape[\shapedparagraphparameter\c!mp][\ifx\p_repeat\v!yes repeat\fi]%
+% \fi
+% \pushparagraphtweak{\shapedparagraphparameter\c!method}\relax}}
+
+\newbox\b_spac_shapes
+
+\def\spac_shapes_list
+ {\edef\p_mp {\shapedparagraphparameter\c!mp}%
+ \edef\p_repeat{\shapedparagraphparameter\c!repeat}%
\normalexpanded
{\endgroup
\ifempty\p_mp
- \setparagraphshape[\dummyparameter\c!list]%
+ \setparagraphshape[\shapedparagraphparameter\c!list]%
\else
- \setparagraphmetashape[\dummyparameter\c!mp][\ifx\p_repeat\v!yes repeat\fi]%
+ \setparagraphmetashape[\p_mp][\ifx\p_repeat\v!yes repeat\fi]%
\fi
- \pushparagraphtweak{\dummyparameter\c!method}\relax}}
+ \pushparagraphtweak{\shapedparagraphparameter\c!method}\relax}}
+
+\def\spac_shapes_text
+ {\getnoflines{\dimexpr\htdp\b_spac_shapes+\shapedparagraphparameter\c!voffset}%
+ \normalexpanded
+ {\endgroup
+ \clf_setparagraphshape
+ left \the\dimexpr
+ \wd\b_spac_shapes+\shapedparagraphparameter\c!distance
+ +\shapedparagraphparameter\c!hoffset
+ \relax
+ right \zeropoint
+ copy \the\numexpr
+ \noflines
+ +\shapedparagraphparameter\c!lines
+ \relax
+ left \zeropoint
+ right \zeropoint
+ % inspect
+ done
+ \relax
+ \pushparagraphtweak{shift}%
+ \dontleavehmode
+ \vtop
+ xoffset \the\dimexpr
+ -\shapedparagraphparameter\c!distance
+ -\wd\b_spac_shapes
+ \relax
+ yoffset \the\dimexpr
+ \shapedparagraphparameter\c!voffset
+ +\strutht
+ \relax
+ {\smashbox\b_spac_shapes
+ \box\b_spac_shapes}}}
+
+\def\spac_shapes_lines
+ {\normalexpanded
+ {\endgroup
+ \clf_setparagraphshape
+ left \shapedparagraphparameter\c!width
+ right \zeropoint
+ copy \shapedparagraphparameter\c!lines
+ left \zeropoint
+ right \zeropoint
+ % inspect
+ done
+ \relax
+ \pushparagraphtweak{shift}}}
+
+\permanent\protected\tolerant\def\startshapedparagraph[#1]% no grouping
+ {\begingroup
+ \let\currentshapedparagraph\empty
+ \setupshapedparagraph[#1]%
+ \setlocalhsize
+ \doifsomething{\shapedparagraphparameter\c!text}
+ {\global\setbox\b_spac_shapes\vpack\bgroup
+ \forgetall
+ \shapedparagraphparameter\c!text
+ \egroup}%
+ \ifvoid\b_spac_shapes
+ \ifnum\shapedparagraphparameter\c!lines>\zerocount
+ \spac_shapes_lines
+ \else
+ \spac_shapes_list
+ \fi
+ \else
+ \spac_shapes_text
+ \fi
+ \ignorespaces}
\permanent\protected\def\stopshapedparagraph
{\popparagraphtweak}
diff --git a/tex/context/base/mkxl/typo-spa.lmt b/tex/context/base/mkxl/typo-spa.lmt
index f453814fb..88ade876e 100644
--- a/tex/context/base/mkxl/typo-spa.lmt
+++ b/tex/context/base/mkxl/typo-spa.lmt
@@ -29,12 +29,12 @@ local getprev = nuts.getprev
local getattr = nuts.getattr
local isglyph = nuts.isglyph
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local remove_node = nuts.remove
-local end_of_math = nuts.end_of_math
-local unset_attributes = nuts.unset_attributes
-local find_attribute = nuts.find_attribute
+local endofmath = nuts.endofmath
+local unsetattributes = nuts.unsetattributes
+local findattribute = nuts.findattribute
local nodepool = nuts.pool
local new_penalty = nodepool.penalty
@@ -72,7 +72,7 @@ end
-- todo cache lastattr
function spacings.handler(head)
- local _, start = find_attribute(head, a_spacings)
+ local _, start = findattribute(head, a_spacings)
if start then
local done = false
-- head is always begin of par (whatsit), so we have at least two prev nodes
@@ -118,8 +118,8 @@ function spacings.handler(head)
if trace_spacing then
report_spacing("inserting penalty and space before %C (left)",char)
end
- insert_node_before(head,start,new_penalty(10000))
- insert_node_before(head,start,new_glue(left*quad))
+ insertnodebefore(head,start,new_penalty(10000))
+ insertnodebefore(head,start,new_glue(left*quad))
end
end
local next = getnext(start)
@@ -149,8 +149,8 @@ function spacings.handler(head)
if trace_spacing then
report_spacing("inserting penalty and space after %C (right)",char)
end
- insert_node_after(head,start,new_glue(right*quad))
- insert_node_after(head,start,new_penalty(10000))
+ insertnodeafter(head,start,new_glue(right*quad))
+ insertnodeafter(head,start,new_penalty(10000))
end
end
end
@@ -158,14 +158,14 @@ function spacings.handler(head)
done = true
end
elseif id == math_code then
- start = end_of_math(start) -- weird, can return nil .. no math end?
+ start = endofmath(start) -- weird, can return nil .. no math end?
end
if start then
start = getnext(start)
end
end
if done then
- -- unset_attributes(a_spacings,head)
+ -- unsetattributes(a_spacings,head)
end
end
return head
diff --git a/tex/context/base/mkxl/typo-sus.lmt b/tex/context/base/mkxl/typo-sus.lmt
index 2c6d9ea69..b8d0d1cd9 100644
--- a/tex/context/base/mkxl/typo-sus.lmt
+++ b/tex/context/base/mkxl/typo-sus.lmt
@@ -59,9 +59,9 @@ local setattr = nuts.setattr
local setlist = nuts.setlist
local setcolor = nodes.tracers.colors.set
-local insert_before = nuts.insert_before
-local insert_after = nuts.insert_after
-local end_of_math = nuts.end_of_math
+local insertbefore = nuts.insertbefore
+local insertafter = nuts.insertafter
+local endofmath = nuts.endofmath
local nodepool = nuts.pool
@@ -127,22 +127,22 @@ local function mark(head,current,id,color)
local width = getwidth(current)
local rule = new_rule(width)
local kern = new_kern(-width)
- head = insert_before(head,current,rule)
- head = insert_before(head,current,kern)
+ head = insertbefore(head,current,rule)
+ head = insertbefore(head,current,kern)
setcolor(rule,color)
-- elseif id == kern_code then
-- local width = getkern(current)
-- local rule = new_rule(width)
-- local kern = new_kern(-width)
- -- head = insert_before(head,current,rule)
- -- head = insert_before(head,current,kern)
+ -- head = insertbefore(head,current,rule)
+ -- head = insertbefore(head,current,kern)
-- setcolor(rule,color)
else
local width, height, depth = getwhd(current)
local extra = fonts.hashes.xheights[getfont(current)] / 2
local rule = new_rule(width,height+extra,depth+extra)
local hlist = new_hlist(rule)
- head = insert_before(head,current,hlist)
+ head = insertbefore(head,current,hlist)
setcolor(rule,color)
setcolor(current,"white")
end
@@ -230,7 +230,7 @@ function typesetters.marksuspects(head)
end
current = getnext(current)
elseif id == math_code then
- current = getnext(end_of_math(current))
+ current = getnext(endofmath(current))
elseif id == glue_code then
local a = getattr(current,a_characters)
if a then
@@ -273,7 +273,7 @@ local function showsuspects(head)
head, current = mark(head,current,id,colors[a])
end
elseif id == math_code then
- current = end_of_math(current)
+ current = endofmath(current)
elseif id == hlist_code or id == vlist_code then
local list = getlist(current)
if list then
diff --git a/tex/context/base/mkxl/typo-tal.lmt b/tex/context/base/mkxl/typo-tal.lmt
index 5c32e9ef9..e5431cffc 100644
--- a/tex/context/base/mkxl/typo-tal.lmt
+++ b/tex/context/base/mkxl/typo-tal.lmt
@@ -47,8 +47,8 @@ local isglyph = nuts.isglyph
local setattr = nuts.setattr
local setchar = nuts.setchar
-local insert_node_before = nuts.insert_before
-local insert_node_after = nuts.insert_after
+local insertnodebefore = nuts.insertbefore
+local insertnodeafter = nuts.insertafter
local nextglyph = nuts.traversers.glyph
local getdimensions = nuts.dimensions
@@ -393,46 +393,46 @@ function characteralign.handler(head,where)
local new_kern = trace_split and traced_kern or new_kern
if b_start then
if before < maxbefore then
- head = insert_node_before(head,b_start,new_kern(maxbefore-before))
+ head = insertnodebefore(head,b_start,new_kern(maxbefore-before))
end
if not c then
-- print("[before]")
if dataset.hasseparator then
local width = fontcharacters[getfont(b_start)][separator].width
- insert_node_after(head,b_stop,new_kern(maxafter+width))
+ insertnodeafter(head,b_stop,new_kern(maxafter+width))
end
elseif a_start then
-- print("[before] [separator] [after]")
if after < maxafter then
- insert_node_after(head,a_stop,new_kern(maxafter-after))
+ insertnodeafter(head,a_stop,new_kern(maxafter-after))
end
else
-- print("[before] [separator]")
if maxafter > 0 then
- insert_node_after(head,c,new_kern(maxafter))
+ insertnodeafter(head,c,new_kern(maxafter))
end
end
elseif a_start then
if c then
-- print("[separator] [after]")
if maxbefore > 0 then
- head = insert_node_before(head,c,new_kern(maxbefore))
+ head = insertnodebefore(head,c,new_kern(maxbefore))
end
else
-- print("[after]")
local width = fontcharacters[getfont(b_stop)][separator].width
- head = insert_node_before(head,a_start,new_kern(maxbefore+width))
+ head = insertnodebefore(head,a_start,new_kern(maxbefore+width))
end
if after < maxafter then
- insert_node_after(head,a_stop,new_kern(maxafter-after))
+ insertnodeafter(head,a_stop,new_kern(maxafter-after))
end
elseif c then
-- print("[separator]")
if maxbefore > 0 then
- head = insert_node_before(head,c,new_kern(maxbefore))
+ head = insertnodebefore(head,c,new_kern(maxbefore))
end
if maxafter > 0 then
- insert_node_after(head,c,new_kern(maxafter))
+ insertnodeafter(head,c,new_kern(maxafter))
end
end
return head
diff --git a/tex/context/base/mkxl/typo-wrp.mkxl b/tex/context/base/mkxl/typo-wrp.mkxl
index b552c151a..92af2058e 100644
--- a/tex/context/base/mkxl/typo-wrp.mkxl
+++ b/tex/context/base/mkxl/typo-wrp.mkxl
@@ -34,7 +34,7 @@
\ignorespaces}
\protected\def\spac_crlf_placeholder
- {\strut}
+ {\wordboundary\strut} % or \endstrut
\protected\def\spac_crlf_placeholder_show
{\wordboundary
diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml
index 031a715e6..86871d97a 100644
--- a/tex/context/interface/mkii/keys-fr.xml
+++ b/tex/context/interface/mkii/keys-fr.xml
@@ -144,6 +144,7 @@
+
@@ -395,6 +396,7 @@
+
diff --git a/tex/context/modules/common/s-obsolete-tokens.mkiv b/tex/context/modules/common/s-obsolete-tokens.mkiv
index 0d055049c..117282a60 100644
--- a/tex/context/modules/common/s-obsolete-tokens.mkiv
+++ b/tex/context/modules/common/s-obsolete-tokens.mkiv
@@ -56,15 +56,15 @@ local report = logs.reporter("tokens","collectors")
-- flush : print back to tex
-- test : fancy stuff
-local get_next = token.scan_next or token.get_next
-local create_token = token.create
+local get_next_token = tokens.scanners.next
+local create_token = tokens.create
function collectors.install(tag,end_cs)
local data, d = { }, 0
collectordata[tag] = data
end_cs = gsub(end_cs,"^\\","")
while true do
- local t = get_next()
+ local t = get_next_token()
if t.csname == end_cs then
context[end_cs]()
return
@@ -93,20 +93,20 @@ function collectors.show(data)
local ctx_verbatim = context.verbatim
local function show(data)
for i=1,#data do
- local token = data[i]
- if type(token) == "table" then
- show(token)
+ local tok = data[i]
+ if type(tok) == "table" then
+ show(tok)
else
- local cmdname = token.cmdname
+ local cmdname = tok.cmdname
local simple = simple[cmdname]
ctx_NC()
ctx_verbatim(simple or cmdname)
ctx_NC()
- ctx_verbatim(simple and utfchar(token.index) or token.csname)
+ ctx_verbatim(simple and utfchar(tok.index) or tok.csname)
ctx_NC()
- if token.active then context("active ") end
- if token.expandable then context("expandable ") end
- if token.protected then context("protected ") end
+ if tok.active then context("active ") end
+ if tok.expandable then context("expandable ") end
+ if tok.protected then context("protected ") end
ctx_NC()
ctx_NR()
end
diff --git a/tex/context/modules/mkiv/m-catchword.mkiv b/tex/context/modules/mkiv/m-catchword.mkiv
index 86a3a2d55..98f0132fd 100644
--- a/tex/context/modules/mkiv/m-catchword.mkiv
+++ b/tex/context/modules/mkiv/m-catchword.mkiv
@@ -60,19 +60,19 @@ local function set_catchword(t)
end
local page = tex.getbox(t.box)
local head = nodes.copy_list(first,last.next)
- head = nodes.insert_before(head,head,nodes.pool.glue(1,1,1))
+ head = nodes.insertbefore(head,head,nodes.pool.glue(1,1,1))
local line = nodes.hpack(head,page.width,"exactly")
if CONTEXTLMTXMODE > 0 then
line.yoffset = -t.voffset
line.xoffset = t.hoffset
else
line.shift = t.hoffset
- line = nodes.insert_before(line,line,nodes.pool.kern(t.voffset-line.height))
+ line = nodes.insertbefore(line,line,nodes.pool.kern(t.voffset-line.height))
line = nodes.vpack(line)
end
line.height = 0
line.depth = 0
- node.insert_after(page.list,nodes.tail(page.list),line)
+ nodes.insertafter(page.list,nodes.tail(page.list),line)
logs.report("catchword","appending %a on page %i",nodes.toutf(head),tex.getcount("realpageno"))
end
diff --git a/tex/context/modules/mkiv/m-escrito.mkiv b/tex/context/modules/mkiv/m-escrito.mkiv
index 2d69fb218..704108cee 100644
--- a/tex/context/modules/mkiv/m-escrito.mkiv
+++ b/tex/context/modules/mkiv/m-escrito.mkiv
@@ -98,7 +98,7 @@
end
function p.flushpage(result)
- context(newliteral(result))
+ context.(newliteral(result))
end
-- todo
diff --git a/tex/context/modules/mkiv/m-system-readers.mkxl b/tex/context/modules/mkiv/m-system-readers.mkxl
index a077b20a3..0f2d3275e 100644
--- a/tex/context/modules/mkiv/m-system-readers.mkxl
+++ b/tex/context/modules/mkiv/m-system-readers.mkxl
@@ -51,8 +51,8 @@
\startluacode
- local createtoken = token.create
- local gobbletoken = token.gobble
+ local createtoken = tokens.create
+ local gobbletoken = tokens.gobble
local integer_value = tokens.values.integer
local marked = { }
diff --git a/tex/context/modules/mkiv/s-fonts-emoji.mkiv b/tex/context/modules/mkiv/s-fonts-emoji.mkiv
index 59fdda124..1f303d569 100644
--- a/tex/context/modules/mkiv/s-fonts-emoji.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-emoji.mkiv
@@ -20,7 +20,8 @@ local utfvalues = string.utfvalues
local context = context
-local traverse_id = node.traverse_id
+local traverseid = nodes.traverseid
+
local glyph_code = nodes.nodecodes.glyph
local descriptions = fonts.hashes.descriptions
@@ -60,7 +61,7 @@ local function emojiglyphs(name)
if d then
local e = checkedemoji(name)
local s = { }
- for n in traverse_id(glyph_code,e) do
+ for n in traverseid(glyph_code,e) do
local b = n.char
if not (b == 0x200D or (b >= 0x1F3FB and b <= 0x1F3FF)) then
local t = { }
diff --git a/tex/context/modules/mkiv/s-fonts-kerns.mkiv b/tex/context/modules/mkiv/s-fonts-kerns.mkiv
index c3a5637c3..1767ad472 100644
--- a/tex/context/modules/mkiv/s-fonts-kerns.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-kerns.mkiv
@@ -30,31 +30,6 @@
local glyph_code = nodecodes.glyph
local hlist_code = nodecodes.hlist
- -- local function flatten(l)
- -- while l do
- -- local id = l.id
- -- if id == disc_code then
- -- local r = l.replace
- -- if r then
- -- local p = l.prev
- -- local n = l.next
- -- if n and p and n.id == glyph_code and p.id == glyph_code then
- -- local s = node.slide(r)
- -- p.next = r
- -- n.prev = s
- -- r.prev = p
- -- s.next= n
- -- l.replace = nil
- -- node.free(l)
- -- end
- -- end
- -- elseif id == hlist_code then
- -- flatten(l.list)
- -- end
- -- l = l.next
- -- end
- -- end
-
local function mark(l,c)
while l do
local id = l.id
@@ -90,7 +65,7 @@
local id = l.id
if id == kern_code then
i = i + 1
- node.insert_before(x,l,node.copy(m[i]))
+ nodes.insertbefore(x,l,node.copy(m[i]))
elseif id == disc_code then
i = inject(l.pre,m,i)
i = inject(l.post,m,i)
diff --git a/tex/context/modules/mkiv/s-languages-hyphenation.lua b/tex/context/modules/mkiv/s-languages-hyphenation.lua
index 2ba265b53..6cb9fc8a2 100644
--- a/tex/context/modules/mkiv/s-languages-hyphenation.lua
+++ b/tex/context/modules/mkiv/s-languages-hyphenation.lua
@@ -9,47 +9,47 @@ if not modules then modules = { } end modules ['s-languages-hyphenation'] = {
moduledata.languages = moduledata.languages or { }
moduledata.languages.hyphenation = moduledata.languages.hyphenation or { }
-local a_colormodel = attributes.private('colormodel')
+local a_colormodel = attributes.private('colormodel')
-local tex = tex
-local context = context
+local tex = tex
+local context = context
-local nodecodes = nodes.nodecodes
-local nuts = nodes.nuts
-local nodepool = nuts.pool
+local nodecodes = nodes.nodecodes
+local nuts = nodes.nuts
+local nodepool = nuts.pool
-local disc_code = nodecodes.disc
-local glyph_code = nodecodes.glyph
+local disc_code = nodecodes.disc
+local glyph_code = nodecodes.glyph
-local emwidths = fonts.hashes.emwidths
-local exheights = fonts.hashes.exheights
+local emwidths = fonts.hashes.emwidths
+local exheights = fonts.hashes.exheights
-local newkern = nodepool.kern
-local newrule = nodepool.rule
-local newglue = nodepool.glue
+local newkern = nodepool.kern
+local newrule = nodepool.rule
+local newglue = nodepool.glue
-local insert_node_after = nuts.insert_after
+local insertnodeafter = nuts.insertafter
-local nextglyph = nuts.traversers.glyph
+local nextglyph = nuts.traversers.glyph
-local tonut = nodes.tonut
-local tonode = nodes.tonode
-local getid = nuts.getid
-local getnext = nuts.getnext
-local getdisc = nuts.getdisc
-local getattr = nuts.getattr
-local getfont = nuts.getfont
-local getfield = nuts.getfield
-local getlanguage = nuts.getlanguage
-local setlanguage = nuts.setlanguage
-local setlink = nuts.setlink
-local setdisc = nuts.setdisc
-local setfield = nuts.setfield
-local free_node = nuts.free
+local tonut = nodes.tonut
+local tonode = nodes.tonode
+local getid = nuts.getid
+local getnext = nuts.getnext
+local getdisc = nuts.getdisc
+local getattr = nuts.getattr
+local getfont = nuts.getfont
+local getfield = nuts.getfield
+local getlanguage = nuts.getlanguage
+local setlanguage = nuts.setlanguage
+local setlink = nuts.setlink
+local setdisc = nuts.setdisc
+local setfield = nuts.setfield
+local free_node = nuts.free
-local tracers = nodes.tracers
-local colortracers = tracers and tracers.colors
-local setnodecolor = colortracers.set
+local tracers = nodes.tracers
+local colortracers = tracers and tracers.colors
+local setnodecolor = colortracers.set
-- maybe this will become code code
@@ -122,10 +122,10 @@ local function mark(head,marked,w,h,d,how)
local ex = exheights[font]
local width = w*em
local rule = newrule(width,h*ex,d*ex)
- head, current = insert_node_after(head,current,newkern(-width/2))
- head, current = insert_node_after(head,current,rule)
- head, current = insert_node_after(head,current,newkern(-width/2))
- head, current = insert_node_after(head,current,newglue(0))
+ head, current = insertnodeafter(head,current,newkern(-width/2))
+ head, current = insertnodeafter(head,current,rule)
+ head, current = insertnodeafter(head,current,newkern(-width/2))
+ head, current = insertnodeafter(head,current,newglue(0))
setnodecolor(rule,how) -- ,getattr(current,a_colormodel))
end
end
diff --git a/tex/context/modules/mkiv/s-present-weird.mkiv b/tex/context/modules/mkiv/s-present-weird.mkiv
index 641c3d979..1b287e148 100644
--- a/tex/context/modules/mkiv/s-present-weird.mkiv
+++ b/tex/context/modules/mkiv/s-present-weird.mkiv
@@ -297,6 +297,12 @@
\stopmodule
-\continueifinputfile{s-present-balls.mkiv}
+\continueifinputfile{s-present-weird.mkiv}
+
+\pushoverloadmode
+
+\usemodule[present-common]
\inputpresentationfile{examples/present-weird-001.tex}
+
+\popoverloadmode
diff --git a/tex/context/modules/mkiv/s-present-wobbling.mkiv b/tex/context/modules/mkiv/s-present-wobbling.mkiv
index e61b262f4..b296966e2 100644
--- a/tex/context/modules/mkiv/s-present-wobbling.mkiv
+++ b/tex/context/modules/mkiv/s-present-wobbling.mkiv
@@ -11,8 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D This a bit old stuyls and I should adapt it a bit but as it sort of works ok I'll
-%D not do that now.
+%D This a bit old style and I should adapt it a bit but as it sort of works ok I'll
+%D not do that now.
\startmodule[present-wobbling]
diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl
index 4fd723285..605859000 100644
--- a/tex/context/modules/mkiv/s-system-macros.mkxl
+++ b/tex/context/modules/mkiv/s-system-macros.mkxl
@@ -62,7 +62,7 @@
local find = string.find
local gsub = string.gsub
- local create = token.create
+ local create = tokens.create
local crap = "[$>%|%&%#" .. string.char(0xEF) .. "]"
@@ -244,7 +244,7 @@
local find = string.find
local gsub = string.gsub
- local create = token.create
+ local create = tokens.create
context.starttitle { title = "\\METAFUN\\ commands" }
diff --git a/tex/generic/context/luatex/luatex-basics-nod.lua b/tex/generic/context/luatex/luatex-basics-nod.lua
index 25f5473a5..76e36f2aa 100644
--- a/tex/generic/context/luatex/luatex-basics-nod.lua
+++ b/tex/generic/context/luatex/luatex-basics-nod.lua
@@ -71,8 +71,8 @@ nodes.glyphcodes = glyphcodes
nodes.disccodes = disccodes
nodes.dirvalues = { lefttoright = 0, righttoleft = 1 }
-nodes.handlers.protectglyphs = node.protect_glyphs -- beware: nodes!
-nodes.handlers.unprotectglyphs = node.unprotect_glyphs -- beware: nodes!
+nodes.handlers.protectglyphs = node.protectglyphs or node.protect_glyphs -- beware: nodes!
+nodes.handlers.unprotectglyphs = node.unprotectglyphs or node.unprotect_glyphs -- beware: nodes!
-- in generic code, at least for some time, we stay nodes, while in context
-- we can go nuts (e.g. experimental); this split permits us us keep code
@@ -81,84 +81,85 @@ nodes.handlers.unprotectglyphs = node.unprotect_glyphs -- beware: nodes!
-- much of this will go away .. it's part of the context interface and not
-- officially in luatex-*.lua
-local direct = node.direct
-local nuts = { }
-nodes.nuts = nuts
-
-local tonode = direct.tonode
-local tonut = direct.todirect
-
-nodes.tonode = tonode
-nodes.tonut = tonut
-
-nuts.tonode = tonode
-nuts.tonut = tonut
-
-nuts.getattr = direct.get_attribute
-nuts.getboth = direct.getboth
-nuts.getchar = direct.getchar
-nuts.getdirection = direct.getdirection
-nuts.getdisc = direct.getdisc
-nuts.getreplace = direct.getreplace
-nuts.getfield = direct.getfield
-nuts.getfont = direct.getfont
-nuts.getid = direct.getid
-nuts.getkern = direct.getkern
-nuts.getlist = direct.getlist
-nuts.getnext = direct.getnext
-nuts.getoffsets = direct.getoffsets
-nuts.getoptions = direct.getoptions or function() return 0 end
-nuts.getprev = direct.getprev
-nuts.getsubtype = direct.getsubtype
-nuts.getwidth = direct.getwidth
-nuts.setattr = direct.setfield
-nuts.setboth = direct.setboth
-nuts.setchar = direct.setchar
-nuts.setcomponents = direct.setcomponents
-nuts.setdirection = direct.setdirection
-nuts.setdisc = direct.setdisc
-nuts.setreplace = direct.setreplace
-nuts.setfield = setfield
-nuts.setkern = direct.setkern
-nuts.setlink = direct.setlink
-nuts.setlist = direct.setlist
-nuts.setnext = direct.setnext
-nuts.setoffsets = direct.setoffsets
-nuts.setprev = direct.setprev
-nuts.setsplit = direct.setsplit
-nuts.setsubtype = direct.setsubtype
-nuts.setwidth = direct.setwidth
-
-nuts.getglyphdata = nuts.getattr
-nuts.setglyphdata = nuts.setattr
-
-nuts.ischar = direct.is_char
-nuts.isglyph = direct.is_glyph
-
-nuts.copy = direct.copy
-nuts.copy_list = direct.copy_list
-nuts.copy_node = direct.copy
-nuts.end_of_math = direct.end_of_math
-nuts.flush = direct.flush
-nuts.flush_list = direct.flush_list
-nuts.flush_node = direct.flush_node
-nuts.free = direct.free
-nuts.insert_after = direct.insert_after
-nuts.insert_before = direct.insert_before
-nuts.is_node = direct.is_node
-nuts.kerning = direct.kerning
-nuts.ligaturing = direct.ligaturing
-nuts.new = direct.new
-nuts.remove = direct.remove
-nuts.tail = direct.tail
-nuts.traverse = direct.traverse
-nuts.traverse_char = direct.traverse_char
-nuts.traverse_glyph = direct.traverse_glyph
-nuts.traverse_id = direct.traverse_id
+local direct = node.direct
+local nuts = { }
+nodes.nuts = nuts
+
+local tonode = direct.tonode
+local tonut = direct.todirect
+
+nodes.tonode = tonode
+nodes.tonut = tonut
+
+nuts.tonode = tonode
+nuts.tonut = tonut
+
+nuts.getattr = direct.get_attribute
+nuts.getboth = direct.getboth
+nuts.getchar = direct.getchar
+nuts.getdirection = direct.getdirection
+nuts.getdisc = direct.getdisc
+nuts.getreplace = direct.getreplace
+nuts.getfield = direct.getfield
+nuts.getfont = direct.getfont
+nuts.getid = direct.getid
+nuts.getkern = direct.getkern
+nuts.getlist = direct.getlist
+nuts.getnext = direct.getnext
+nuts.getoffsets = direct.getoffsets
+nuts.getoptions = direct.getoptions or function() return 0 end
+nuts.getprev = direct.getprev
+nuts.getsubtype = direct.getsubtype
+nuts.getwidth = direct.getwidth
+nuts.setattr = direct.setfield
+nuts.setboth = direct.setboth
+nuts.setchar = direct.setchar
+nuts.setcomponents = direct.setcomponents
+nuts.setdirection = direct.setdirection
+nuts.setdisc = direct.setdisc
+nuts.setreplace = direct.setreplace
+nuts.setfield = setfield
+nuts.setkern = direct.setkern
+nuts.setlink = direct.setlink
+nuts.setlist = direct.setlist
+nuts.setnext = direct.setnext
+nuts.setoffsets = direct.setoffsets
+nuts.setprev = direct.setprev
+nuts.setsplit = direct.setsplit
+nuts.setsubtype = direct.setsubtype
+nuts.setwidth = direct.setwidth
+
+nuts.getglyphdata = nuts.getattribute or nuts.getattr
+nuts.setglyphdata = nuts.setattribute or nuts.setattr
+
+nuts.ischar = direct.ischar or direct.is_char
+nuts.isglyph = direct.isglyph or direct.is_glyph
+nuts.copy = direct.copy
+nuts.copynode = direct.copy
+nuts.copylist = direct.copylist or direct.copy_list
+nuts.endofmath = direct.endofmath or direct.end_of_math
+nuts.flush = direct.flush
+nuts.flushlist = direct.flushlist or direct.flush_list
+nuts.flushnode = direct.flushnode or direct.flush_node
+nuts.free = direct.free
+nuts.insertafter = direct.insertafter or direct.insert_after
+nuts.insertbefore = direct.insertbefore or direct.insert_before
+nuts.isnode = direct.isnode or direct.is_node
+nuts.isdirect = direct.isdirect or direct.is_direct
+nuts.isnut = direct.isdirect or direct.is_direct
+nuts.kerning = direct.kerning
+nuts.ligaturing = direct.ligaturing
+nuts.new = direct.new
+nuts.remove = direct.remove
+nuts.tail = direct.tail
+nuts.traverse = direct.traverse
+nuts.traversechar = direct.traversechar or direct.traverse_char
+nuts.traverseglyph = direct.traverseglyph or direct.traverse_glyph
+nuts.traverseid = direct.traverseid or direct.traverse_id
-- properties as used in the (new) injector:
-local propertydata = direct.get_properties_table()
+local propertydata = (direct.getpropertiestable or direct.get_properties_table)()
nodes.properties = { data = propertydata }
if direct.set_properties_mode then
@@ -199,10 +200,10 @@ local setfield = nuts.setfield
local getsubtype = nuts.getsubtype
local isglyph = nuts.isglyph
local find_tail = nuts.tail
-local flush_list = nuts.flush_list
-local flush_node = nuts.flush_node
-local traverse_id = nuts.traverse_id
-local copy_node = nuts.copy_node
+local flushlist = nuts.flushlist
+local flushnode = nuts.flushnode
+local traverseid = nuts.traverseid
+local copynode = nuts.copynode
local glyph_code = nodes.nodecodes.glyph
local ligature_code = nodes.glyphcodes.ligature
@@ -222,22 +223,22 @@ end
do
- local get_components = node.direct.getcomponents
- local set_components = node.direct.setcomponents
+ local getcomponents = node.direct.getcomponents
+ local setcomponents = node.direct.setcomponents
- local function copy_no_components(g,copyinjection)
- local components = get_components(g)
+ local function copynocomponents(g,copyinjection)
+ local components = getcomponents(g)
if components then
- set_components(g)
- local n = copy_node(g)
+ setcomponents(g)
+ local n = copynode(g)
if copyinjection then
copyinjection(n,g)
end
- set_components(g,components)
+ setcomponents(g,components)
-- maybe also upgrade the subtype but we don't use it anyway
return n
else
- local n = copy_node(g)
+ local n = copynode(g)
if copyinjection then
copyinjection(n,g)
end
@@ -245,11 +246,11 @@ do
end
end
- local function copy_only_glyphs(current)
+ local function copyonlyglyphs(current)
local head = nil
local previous = nil
- for n in traverse_id(glyph_code,current) do
- n = copy_node(n)
+ for n in traverseid(glyph_code,current) do
+ n = copynode(n)
if head then
setlink(previous,n)
else
@@ -260,14 +261,14 @@ do
return head
end
- local function count_components(start,marks)
+ local function countcomponents(start,marks)
local char = isglyph(start)
if char then
if getsubtype(start) == ligature_code then
local n = 0
- local components = get_components(start)
+ local components = getcomponents(start)
while components do
- n = n + count_components(components,marks)
+ n = n + countcomponents(components,marks)
components = getnext(components)
end
return n
@@ -278,20 +279,22 @@ do
return 0
end
- local function flush_components()
+ local function flushcomponents()
-- this is a no-op in mkiv / generic
end
- nuts.set_components = set_components
- nuts.get_components = get_components
- nuts.copy_only_glyphs = copy_only_glyphs
- nuts.copy_no_components = copy_no_components
- nuts.count_components = count_components
- nuts.flush_components = flush_components
+ nuts.components = {
+ set = setcomponents,
+ get = getcomponents,
+ copyonlyglyphs = copyonlyglyphs,
+ copynocomponents = copynocomponents,
+ count = countcomponents,
+ flush = flushcomponents,
+ }
end
-nuts.uses_font = direct.uses_font
+nuts.usesfont = direct.usesfont or direct.uses_font
do
@@ -301,12 +304,12 @@ do
local dummy = tonut(node.new("glyph"))
nuts.traversers = {
- glyph = nuts.traverse_id(nodecodes.glyph,dummy),
- glue = nuts.traverse_id(nodecodes.glue,dummy),
- disc = nuts.traverse_id(nodecodes.disc,dummy),
- boundary = nuts.traverse_id(nodecodes.boundary,dummy),
+ glyph = nuts.traverseid(nodecodes.glyph,dummy),
+ glue = nuts.traverseid(nodecodes.glue,dummy),
+ disc = nuts.traverseid(nodecodes.disc,dummy),
+ boundary = nuts.traverseid(nodecodes.boundary,dummy),
- char = nuts.traverse_char(dummy),
+ char = nuts.traversechar(dummy),
node = nuts.traverse(dummy),
}
@@ -333,7 +336,7 @@ do
local getsubtype = nuts.getsubtype
- function nuts.start_of_par(n)
+ function nuts.startofpar(n)
local s = getsubtype(n)
return s == 0 or s == 2 -- sorry, hardcoded, won't change anyway
end
diff --git a/tex/generic/context/luatex/luatex-fonts-gbn.lua b/tex/generic/context/luatex/luatex-fonts-gbn.lua
index 53be41c7e..d690ee567 100644
--- a/tex/generic/context/luatex/luatex-fonts-gbn.lua
+++ b/tex/generic/context/luatex/luatex-fonts-gbn.lua
@@ -17,27 +17,27 @@ local next = next
local fonts = fonts
local nodes = nodes
-local nuts = nodes.nuts -- context abstraction of direct nodes
+local nuts = nodes.nuts -- context abstraction of direct nodes
-local traverse_id = nuts.traverse_id
-local flush_node = nuts.flush_node
+local traverseid = nuts.traverseid
+local flushnode = nuts.flushnode
-local glyph_code = nodes.nodecodes.glyph
-local disc_code = nodes.nodecodes.disc
+local glyph_code = nodes.nodecodes.glyph
+local disc_code = nodes.nodecodes.disc
-local tonode = nuts.tonode
-local tonut = nuts.tonut
+local tonode = nuts.tonode
+local tonut = nuts.tonut
-local getfont = nuts.getfont
-local getchar = nuts.getchar
-local getid = nuts.getid
-local getboth = nuts.getboth
-local getprev = nuts.getprev
-local getnext = nuts.getnext
-local getdisc = nuts.getdisc
-local setchar = nuts.setchar
-local setlink = nuts.setlink
-local setprev = nuts.setprev
+local getfont = nuts.getfont
+local getchar = nuts.getchar
+local getid = nuts.getid
+local getboth = nuts.getboth
+local getprev = nuts.getprev
+local getnext = nuts.getnext
+local getdisc = nuts.getdisc
+local setchar = nuts.setchar
+local setlink = nuts.setlink
+local setprev = nuts.setprev
-- from now on we apply ligaturing and kerning here because it might interfere with complex
-- opentype discretionary handling where the base ligature pass expect some weird extra
@@ -99,7 +99,7 @@ local function nodepass(head,groupcode,size,packtype,direction)
local variants = nil
local redundant = nil
local nofused = 0
- for n in traverse_id(glyph_code,head) do
+ for n in traverseid(glyph_code,head) do
local font = getfont(n)
if font ~= prevfont then
if basefont then
@@ -178,13 +178,13 @@ local function nodepass(head,groupcode,size,packtype,direction)
end
end
end
- flush_node(r)
+ flushnode(r)
end
end
- for d in traverse_id(disc_code,head) do
+ for d in traverseid(disc_code,head) do
local _, _, r = getdisc(d)
if r then
- for n in traverse_id(glyph_code,r) do
+ for n in traverseid(glyph_code,r) do
local font = getfont(n)
if font ~= prevfont then
prevfont = font
@@ -254,7 +254,7 @@ local function basepass(head)
return head
end
-local protectpass = node.direct.protect_glyphs
+local protectpass = node.direct.protectglyphs or node.direct.protect_glyphs
local injectpass = nodes.injections.handler
-- This is the only official public interface and this one can be hooked into a callback (chain) and
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 386529b1a..267c8361b 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 : 2021-05-09 17:12
+-- merge date : 2021-05-15 22:41
do -- begin closure to overcome local limits and interference
@@ -4961,8 +4961,8 @@ nodes.nodecodes=nodecodes
nodes.glyphcodes=glyphcodes
nodes.disccodes=disccodes
nodes.dirvalues={ lefttoright=0,righttoleft=1 }
-nodes.handlers.protectglyphs=node.protect_glyphs
-nodes.handlers.unprotectglyphs=node.unprotect_glyphs
+nodes.handlers.protectglyphs=node.protectglyphs or node.protect_glyphs
+nodes.handlers.unprotectglyphs=node.unprotectglyphs or node.unprotect_glyphs
local direct=node.direct
local nuts={}
nodes.nuts=nuts
@@ -5006,31 +5006,33 @@ nuts.setprev=direct.setprev
nuts.setsplit=direct.setsplit
nuts.setsubtype=direct.setsubtype
nuts.setwidth=direct.setwidth
-nuts.getglyphdata=nuts.getattr
-nuts.setglyphdata=nuts.setattr
-nuts.ischar=direct.is_char
-nuts.isglyph=direct.is_glyph
+nuts.getglyphdata=nuts.getattribute or nuts.getattr
+nuts.setglyphdata=nuts.setattribute or nuts.setattr
+nuts.ischar=direct.ischar or direct.is_char
+nuts.isglyph=direct.isglyph or direct.is_glyph
nuts.copy=direct.copy
-nuts.copy_list=direct.copy_list
-nuts.copy_node=direct.copy
-nuts.end_of_math=direct.end_of_math
+nuts.copynode=direct.copy
+nuts.copylist=direct.copylist or direct.copy_list
+nuts.endofmath=direct.endofmath or direct.end_of_math
nuts.flush=direct.flush
-nuts.flush_list=direct.flush_list
-nuts.flush_node=direct.flush_node
+nuts.flushlist=direct.flushlist or direct.flush_list
+nuts.flushnode=direct.flushnode or direct.flush_node
nuts.free=direct.free
-nuts.insert_after=direct.insert_after
-nuts.insert_before=direct.insert_before
-nuts.is_node=direct.is_node
+nuts.insertafter=direct.insertafter or direct.insert_after
+nuts.insertbefore=direct.insertbefore or direct.insert_before
+nuts.isnode=direct.isnode or direct.is_node
+nuts.isdirect=direct.isdirect or direct.is_direct
+nuts.isnut=direct.isdirect or direct.is_direct
nuts.kerning=direct.kerning
nuts.ligaturing=direct.ligaturing
nuts.new=direct.new
nuts.remove=direct.remove
nuts.tail=direct.tail
nuts.traverse=direct.traverse
-nuts.traverse_char=direct.traverse_char
-nuts.traverse_glyph=direct.traverse_glyph
-nuts.traverse_id=direct.traverse_id
-local propertydata=direct.get_properties_table()
+nuts.traversechar=direct.traversechar or direct.traverse_char
+nuts.traverseglyph=direct.traverseglyph or direct.traverse_glyph
+nuts.traverseid=direct.traverseid or direct.traverse_id
+local propertydata=(direct.getpropertiestable or direct.get_properties_table)()
nodes.properties={ data=propertydata }
if direct.set_properties_mode then
direct.set_properties_mode(true,true)
@@ -5063,10 +5065,10 @@ local setfield=nuts.setfield
local getsubtype=nuts.getsubtype
local isglyph=nuts.isglyph
local find_tail=nuts.tail
-local flush_list=nuts.flush_list
-local flush_node=nuts.flush_node
-local traverse_id=nuts.traverse_id
-local copy_node=nuts.copy_node
+local flushlist=nuts.flushlist
+local flushnode=nuts.flushnode
+local traverseid=nuts.traverseid
+local copynode=nuts.copynode
local glyph_code=nodes.nodecodes.glyph
local ligature_code=nodes.glyphcodes.ligature
do
@@ -5079,31 +5081,31 @@ do
end
end
do
- local get_components=node.direct.getcomponents
- local set_components=node.direct.setcomponents
- local function copy_no_components(g,copyinjection)
- local components=get_components(g)
+ local getcomponents=node.direct.getcomponents
+ local setcomponents=node.direct.setcomponents
+ local function copynocomponents(g,copyinjection)
+ local components=getcomponents(g)
if components then
- set_components(g)
- local n=copy_node(g)
+ setcomponents(g)
+ local n=copynode(g)
if copyinjection then
copyinjection(n,g)
end
- set_components(g,components)
+ setcomponents(g,components)
return n
else
- local n=copy_node(g)
+ local n=copynode(g)
if copyinjection then
copyinjection(n,g)
end
return n
end
end
- local function copy_only_glyphs(current)
+ local function copyonlyglyphs(current)
local head=nil
local previous=nil
- for n in traverse_id(glyph_code,current) do
- n=copy_node(n)
+ for n in traverseid(glyph_code,current) do
+ n=copynode(n)
if head then
setlink(previous,n)
else
@@ -5113,14 +5115,14 @@ do
end
return head
end
- local function count_components(start,marks)
+ local function countcomponents(start,marks)
local char=isglyph(start)
if char then
if getsubtype(start)==ligature_code then
local n=0
- local components=get_components(start)
+ local components=getcomponents(start)
while components do
- n=n+count_components(components,marks)
+ n=n+countcomponents(components,marks)
components=getnext(components)
end
return n
@@ -5130,24 +5132,26 @@ do
end
return 0
end
- local function flush_components()
+ local function flushcomponents()
end
- nuts.set_components=set_components
- nuts.get_components=get_components
- nuts.copy_only_glyphs=copy_only_glyphs
- nuts.copy_no_components=copy_no_components
- nuts.count_components=count_components
- nuts.flush_components=flush_components
+ nuts.components={
+ set=setcomponents,
+ get=getcomponents,
+ copyonlyglyphs=copyonlyglyphs,
+ copynocomponents=copynocomponents,
+ count=countcomponents,
+ flush=flushcomponents,
+ }
end
-nuts.uses_font=direct.uses_font
+nuts.usesfont=direct.usesfont or direct.uses_font
do
local dummy=tonut(node.new("glyph"))
nuts.traversers={
- glyph=nuts.traverse_id(nodecodes.glyph,dummy),
- glue=nuts.traverse_id(nodecodes.glue,dummy),
- disc=nuts.traverse_id(nodecodes.disc,dummy),
- boundary=nuts.traverse_id(nodecodes.boundary,dummy),
- char=nuts.traverse_char(dummy),
+ glyph=nuts.traverseid(nodecodes.glyph,dummy),
+ glue=nuts.traverseid(nodecodes.glue,dummy),
+ disc=nuts.traverseid(nodecodes.disc,dummy),
+ boundary=nuts.traverseid(nodecodes.boundary,dummy),
+ char=nuts.traversechar(dummy),
node=nuts.traverse(dummy),
}
end
@@ -5164,7 +5168,7 @@ if not nuts.setreplace then
end
do
local getsubtype=nuts.getsubtype
- function nuts.start_of_par(n)
+ function nuts.startofpar(n)
local s=getsubtype(n)
return s==0 or s==2
end
@@ -11798,8 +11802,6 @@ readers.post=function(f,fontdata,specification)
if length>0 then
glyphs[mapping].name=readstring(f,length)
else
- report("quit post name fetching at %a of %a: %s",i,maxnames,"overflow")
- break
end
end
end
@@ -12899,7 +12901,7 @@ if not modules then modules={} end modules ['font-cff']={
}
local next,type,tonumber,rawget=next,type,tonumber,rawget
local byte,char,gmatch,sub=string.byte,string.char,string.gmatch,string.sub
-local concat,remove,unpack=table.concat,table.remove,table.unpack
+local concat,insert,remove,unpack=table.concat,table.insert,table.remove,table.unpack
local floor,abs,round,ceil,min,max=math.floor,math.abs,math.round,math.ceil,math.min,math.max
local P,C,R,S,C,Cs,Ct=lpeg.P,lpeg.C,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Ct
local lpegmatch=lpeg.match
@@ -14503,8 +14505,34 @@ do
showstate(reverse[t] or "")
end
if top>0 then
- for i=1,top do
- r=r+1;result[r]=encode[stack[i]]
+ if t==8 and top>48 then
+ local n=0
+ for i=1,top do
+ if n==48 then
+ local zero=encode[0]
+ local res3=result[r-3]
+ local res2=result[r-2]
+ local res1=result[r-1]
+ local res0=result[r]
+ result[r-3]=zero
+ result[r-2]=zero
+ r=r+1;result[r]=chars[t]
+ r=r+1;result[r]=zero
+ r=r+1;result[r]=zero
+ r=r+1;result[r]=res3
+ r=r+1;result[r]=res2
+ r=r+1;result[r]=res1
+ r=r+1;result[r]=res0
+ n=1
+ else
+ n=n+1
+ end
+ r=r+1;result[r]=encode[stack[i]]
+ end
+ else
+ for i=1,top do
+ r=r+1;result[r]=encode[stack[i]]
+ end
end
top=0
end
@@ -20830,7 +20858,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_d
local report_otf=logs.reporter("fonts","otf loading")
local fonts=fonts
local otf=fonts.handlers.otf
-otf.version=3.113
+otf.version=3.114
otf.cache=containers.define("fonts","otl",otf.version,true)
otf.svgcache=containers.define("fonts","svg",otf.version,true)
otf.pngcache=containers.define("fonts","png",otf.version,true)
@@ -22030,8 +22058,8 @@ local setwidth=nuts.setwidth
local getwidth=nuts.getwidth
local nextchar=nuts.traversers.char
local nextglue=nuts.traversers.glue
-local insert_node_before=nuts.insert_before
-local insert_node_after=nuts.insert_after
+local insertnodebefore=nuts.insertbefore
+local insertnodeafter=nuts.insertafter
local properties=nodes.properties.data
local fontkern=nuts.pool and nuts.pool.fontkern
local italickern=nuts.pool and nuts.pool.italickern
@@ -22045,7 +22073,7 @@ end)
if not fontkern then
local thekern=nuts.new("kern",0)
local setkern=nuts.setkern
- local copy_node=nuts.copy_node
+ local copy_node=nuts.copy
fontkern=function(k)
local n=copy_node(thekern)
setkern(n,k)
@@ -22055,7 +22083,7 @@ end
if not italickern then
local thekern=nuts.new("kern",3)
local setkern=nuts.setkern
- local copy_node=nuts.copy_node
+ local copy_node=nuts.copy
italickern=function(k)
local n=copy_node(thekern)
setkern(n,k)
@@ -22516,12 +22544,12 @@ local function inject_kerns_only(head,where)
if leftkern and leftkern~=0 then
if prev and getid(prev)==glue_code then
if useitalickerns then
- head=insert_node_before(head,current,italickern(leftkern))
+ head=insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev,getwidth(prev)+leftkern)
end
else
- head=insert_node_before(head,current,fontkern(leftkern))
+ head=insertnodebefore(head,current,fontkern(leftkern))
end
end
end
@@ -22575,7 +22603,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- pre=insert_node_before(pre,n,fontkern(leftkern))
+ pre=insertnodebefore(pre,n,fontkern(leftkern))
done=true
end
end
@@ -22590,7 +22618,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- post=insert_node_before(post,n,fontkern(leftkern))
+ post=insertnodebefore(post,n,fontkern(leftkern))
done=true
end
end
@@ -22605,7 +22633,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- replace=insert_node_before(replace,n,fontkern(leftkern))
+ replace=insertnodebefore(replace,n,fontkern(leftkern))
done=true
end
end
@@ -22667,23 +22695,23 @@ local function inject_positions_only(head,where)
rightkern=0
elseif prev and getid(prev)==glue_code then
if useitalickerns then
- head=insert_node_before(head,current,italickern(leftkern))
+ head=insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev,getwidth(prev)+leftkern)
end
else
- head=insert_node_before(head,current,fontkern(leftkern))
+ head=insertnodebefore(head,current,fontkern(leftkern))
end
end
if rightkern and rightkern~=0 then
if next and getid(next)==glue_code then
if useitalickerns then
- insert_node_after(head,current,italickern(rightkern))
+ insertnodeafter(head,current,italickern(rightkern))
else
setwidth(next,getwidth(next)+rightkern)
end
else
- insert_node_after(head,current,fontkern(rightkern))
+ insertnodeafter(head,current,fontkern(rightkern))
end
end
else
@@ -22757,12 +22785,12 @@ local function inject_positions_only(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- pre=insert_node_before(pre,n,fontkern(leftkern))
+ pre=insertnodebefore(pre,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(pre,n,fontkern(rightkern))
+ insertnodeafter(pre,n,fontkern(rightkern))
done=true
end
end
@@ -22781,12 +22809,12 @@ local function inject_positions_only(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- post=insert_node_before(post,n,fontkern(leftkern))
+ post=insertnodebefore(post,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(post,n,fontkern(rightkern))
+ insertnodeafter(post,n,fontkern(rightkern))
done=true
end
end
@@ -22805,12 +22833,12 @@ local function inject_positions_only(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- replace=insert_node_before(replace,n,fontkern(leftkern))
+ replace=insertnodebefore(replace,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(replace,n,fontkern(rightkern))
+ insertnodeafter(replace,n,fontkern(rightkern))
done=true
end
end
@@ -22825,7 +22853,7 @@ local function inject_positions_only(head,where)
if i then
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- pre=insert_node_before(pre,pre,fontkern(rightkern))
+ pre=insertnodebefore(pre,pre,fontkern(rightkern))
done=true
end
end
@@ -22838,7 +22866,7 @@ local function inject_positions_only(head,where)
if i then
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- replace=insert_node_before(replace,replace,fontkern(rightkern))
+ replace=insertnodebefore(replace,replace,fontkern(rightkern))
done=true
end
end
@@ -22941,8 +22969,8 @@ local function inject_everything(head,where)
if trace_injections then
report_injections("correcting non zero width mark %C",getchar(n))
end
- insert_node_before(n,n,fontkern(-wn))
- insert_node_after(n,n,fontkern(-wn))
+ insertnodebefore(n,n,fontkern(-wn))
+ insertnodeafter(n,n,fontkern(-wn))
end
end
end
@@ -23034,23 +23062,23 @@ local function inject_everything(head,where)
rightkern=0
elseif prev and getid(prev)==glue_code then
if useitalickerns then
- head=insert_node_before(head,current,italickern(leftkern))
+ head=insertnodebefore(head,current,italickern(leftkern))
else
setwidth(prev,getwidth(prev)+leftkern)
end
else
- head=insert_node_before(head,current,fontkern(leftkern))
+ head=insertnodebefore(head,current,fontkern(leftkern))
end
end
if rightkern and rightkern~=0 then
if next and getid(next)==glue_code then
if useitalickerns then
- insert_node_after(head,current,italickern(rightkern))
+ insertnodeafter(head,current,italickern(rightkern))
else
setwidth(next,getwidth(next)+rightkern)
end
else
- insert_node_after(head,current,fontkern(rightkern))
+ insertnodeafter(head,current,fontkern(rightkern))
end
end
end
@@ -23139,12 +23167,12 @@ local function inject_everything(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- pre=insert_node_before(pre,n,fontkern(leftkern))
+ pre=insertnodebefore(pre,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(pre,n,fontkern(rightkern))
+ insertnodeafter(pre,n,fontkern(rightkern))
done=true
end
if hasmarks then
@@ -23169,12 +23197,12 @@ local function inject_everything(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- post=insert_node_before(post,n,fontkern(leftkern))
+ post=insertnodebefore(post,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(post,n,fontkern(rightkern))
+ insertnodeafter(post,n,fontkern(rightkern))
done=true
end
if hasmarks then
@@ -23199,12 +23227,12 @@ local function inject_everything(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- replace=insert_node_before(replace,n,fontkern(leftkern))
+ replace=insertnodebefore(replace,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(replace,n,fontkern(rightkern))
+ insertnodeafter(replace,n,fontkern(rightkern))
done=true
end
if hasmarks then
@@ -23225,7 +23253,7 @@ local function inject_everything(head,where)
if i then
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- pre=insert_node_before(pre,pre,fontkern(rightkern))
+ pre=insertnodebefore(pre,pre,fontkern(rightkern))
done=true
end
end
@@ -23238,7 +23266,7 @@ local function inject_everything(head,where)
if i then
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- replace=insert_node_before(replace,replace,fontkern(rightkern))
+ replace=insertnodebefore(replace,replace,fontkern(rightkern))
done=true
end
end
@@ -23384,8 +23412,8 @@ local function injectspaces(head)
if trace_spaces then
report_spaces("%C [%p + %p + %p] %C",prevchar,lnew,old,rnew,nextchar)
end
- head=insert_node_before(head,n,italickern(lnew))
- insert_node_after(head,n,italickern(rnew))
+ head=insertnodebefore(head,n,italickern(lnew))
+ insertnodeafter(head,n,italickern(rnew))
else
local new=old+(leftkern+rightkern)*factor
if trace_spaces then
@@ -23400,7 +23428,7 @@ local function injectspaces(head)
if trace_spaces then
report_spaces("%C [%p + %p]",prevchar,old,new)
end
- insert_node_after(head,n,italickern(new))
+ insertnodeafter(head,n,italickern(new))
else
local new=old+leftkern*factor
if trace_spaces then
@@ -23419,7 +23447,7 @@ local function injectspaces(head)
if trace_spaces then
report_spaces("[%p + %p] %C",old,new,nextchar)
end
- insert_node_after(head,n,italickern(new))
+ insertnodeafter(head,n,italickern(new))
else
local new=old+rightkern*factor
if trace_spaces then
@@ -26134,7 +26162,7 @@ local setprop=nuts.setprop
local getsubtype=nuts.getsubtype
local getchar=nuts.getchar
local ischar=nuts.ischar
-local end_of_math=nuts.end_of_math
+local endofmath=nuts.endofmath
local nodecodes=nodes.nodecodes
local disc_code=nodecodes.disc
local math_code=nodecodes.math
@@ -26240,7 +26268,7 @@ function analyzers.setstate(head,font)
end
first,last,n=nil,nil,0
if id==math_code then
- current=end_of_math(current)
+ current=endofmath(current)
end
elseif id==disc_code then
setstate(current,s_medi)
@@ -26253,7 +26281,7 @@ function analyzers.setstate(head,font)
end
first,last,n=nil,nil,0
if id==math_code then
- current=end_of_math(current)
+ current=endofmath(current)
end
end
current=getnext(current)
@@ -26469,7 +26497,7 @@ function methods.arab(head,font,attr)
first=nil
end
if id==math_code then
- current=end_of_math(current)
+ current=endofmath(current)
end
end
current=getnext(current)
@@ -26583,7 +26611,7 @@ do
wrapup()
end
if id==math_code then
- current=end_of_math(current)
+ current=endofmath(current)
end
end
current=getnext(current)
@@ -26679,23 +26707,24 @@ local setlink=nuts.setlink
local getwidth=nuts.getwidth
local getattr=nuts.getattr
local getglyphdata=nuts.getglyphdata
-local copy_no_components=nuts.copy_no_components
-local copy_only_glyphs=nuts.copy_only_glyphs
-local count_components=nuts.count_components
-local set_components=nuts.set_components
-local get_components=nuts.get_components
-local flush_components=nuts.flush_components
+local components=nuts.components
+local copynocomponents=components.copynocomponents
+local copyonlyglyphs=components.copyonlyglyphs
+local countcomponents=components.count
+local setcomponents=components.set
+local getcomponents=components.get
+local flushcomponents=components.flush
local ischar=nuts.ischar
-local usesfont=nuts.uses_font
-local insert_node_after=nuts.insert_after
+local usesfont=nuts.usesfont
+local insertnodeafter=nuts.insertafter
local copy_node=nuts.copy
-local copy_node_list=nuts.copy_list
+local copy_node_list=nuts.copylist
local remove_node=nuts.remove
local find_node_tail=nuts.tail
-local flush_node_list=nuts.flush_list
-local flush_node=nuts.flush_node
-local end_of_math=nuts.end_of_math
-local start_of_par=nuts.start_of_par
+local flushnodelist=nuts.flushlist
+local flushnode=nuts.flushnode
+local endofmath=nuts.endofmath
+local startofpar=nuts.startofpar
local setmetatable=setmetatable
local setmetatableindex=table.setmetatableindex
local nextnode=nuts.traversers.node
@@ -26826,12 +26855,12 @@ local function flattendisk(head,disc)
local prev,next=getboth(disc)
local ishead=head==disc
setdisc(disc)
- flush_node(disc)
+ flushnode(disc)
if pre then
- flush_node_list(pre)
+ flushnodelist(pre)
end
if post then
- flush_node_list(post)
+ flushnodelist(post)
end
if ishead then
if replace then
@@ -26880,16 +26909,16 @@ local function markstoligature(head,start,stop,char)
local next=getnext(stop)
setprev(start)
setnext(stop)
- local base=copy_no_components(start,copyinjection)
+ local base=copynocomponents(start,copyinjection)
if head==start then
head=base
end
resetinjection(base)
setchar(base,char)
setsubtype(base,ligatureglyph_code)
- set_components(base,start)
+ setcomponents(base,start)
setlink(prev,base,next)
- flush_components(start)
+ flushcomponents(start)
return head,base
end
end
@@ -26897,7 +26926,7 @@ local no_left_ligature_code=1
local no_right_ligature_code=2
local no_left_kern_code=4
local no_right_kern_code=8
-local has_glyph_option=node.direct.has_glyph_option or function(n,c)
+local hasglyphoption=function(n,c)
if c==no_left_ligature_code or c==no_right_ligature_code then
return getattr(n,a_noligature)==1
else
@@ -26905,7 +26934,7 @@ local has_glyph_option=node.direct.has_glyph_option or function(n,c)
end
end
local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfound,hasmarks)
- if has_glyph_option(start,no_right_ligature_code) then
+ if hasglyphoption(start,no_right_ligature_code) then
return head,start
end
if start==stop and getchar(start)==char then
@@ -26918,14 +26947,14 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
local comp=start
setprev(start)
setnext(stop)
- local base=copy_no_components(start,copyinjection)
+ local base=copynocomponents(start,copyinjection)
if start==head then
head=base
end
resetinjection(base)
setchar(base,char)
setsubtype(base,ligatureglyph_code)
- set_components(base,comp)
+ setcomponents(base,comp)
setlink(prev,base,next)
if not discfound then
local deletemarks=not skiphash or hasmarks
@@ -26938,7 +26967,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
local char=getchar(start)
if not marks[char] then
baseindex=baseindex+componentindex
- componentindex=count_components(start,marks)
+ componentindex=countcomponents(start,marks)
elseif not deletemarks then
setligaindex(start,baseindex+getligaindex(start,componentindex))
if trace_marks then
@@ -26946,7 +26975,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
end
local n=copy_node(start)
copyinjection(n,start)
- head,current=insert_node_after(head,current,n)
+ head,current=insertnodeafter(head,current,n)
elseif trace_marks then
logwarning("%s: delete ligature mark %s",pref(dataset,sequence),gref(char))
end
@@ -26969,14 +26998,14 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
break
end
end
- flush_components(components)
+ flushcomponents(components)
else
local discprev,discnext=getboth(discfound)
if discprev and discnext then
local pre,post,replace,pretail,posttail,replacetail=getdisc(discfound,true)
if not replace then
local prev=getprev(base)
- local copied=copy_only_glyphs(comp)
+ local copied=copyonlyglyphs(comp)
if pre then
setlink(discprev,pre)
else
@@ -26992,7 +27021,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou
end
setlink(prev,discfound,next)
setboth(base)
- set_components(base,copied)
+ setcomponents(base,copied)
replace=base
if forcediscretionaries then
setdisc(discfound,pre,post,replace,discretionarydisc_code)
@@ -27016,7 +27045,7 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop)
local n=copy_node(start)
resetinjection(n)
setchar(n,multiple[k])
- insert_node_after(head,start,n)
+ insertnodeafter(head,start,n)
start=n
end
if what==true then
@@ -27026,7 +27055,7 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop)
local n=copy_node(start)
resetinjection(n)
setchar(n,m)
- insert_node_after(head,start,n)
+ insertnodeafter(head,start,n)
start=n
end
end
@@ -27256,7 +27285,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
return head,start,false,false
end
function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection)
- if has_glyph_option(start,no_right_kern_code) then
+ if hasglyphoption(start,no_right_kern_code) then
return head,start,false
else
local startchar=getchar(start)
@@ -27276,7 +27305,7 @@ function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash,
end
end
function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection)
- if has_glyph_option(start,no_right_kern_code) then
+ if hasglyphoption(start,no_right_kern_code) then
return head,start,false
else
local snext=getnext(start)
@@ -27765,7 +27794,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup
return head,start,false,0,false
end
function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
- if not has_glyph_option(start,no_right_kern_code) then
+ if not hasglyphoption(start,no_right_kern_code) then
local mapping=currentlookup.mapping
if mapping==nil then
mapping=getmapping(dataset,sequence,currentlookup)
@@ -27793,7 +27822,7 @@ function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,r
return head,start,false
end
function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex)
- if not has_glyph_option(start,no_right_kern_code) then
+ if not hasglyphoption(start,no_right_kern_code) then
local mapping=currentlookup.mapping
if mapping==nil then
mapping=getmapping(dataset,sequence,currentlookup)
@@ -28116,13 +28145,13 @@ local function checked(head)
if next then
setlink(kern,next)
end
- flush_node(current)
+ flushnode(current)
head=kern
current=next
else
local prev,next=getboth(current)
setlink(prev,kern,next)
- flush_node(current)
+ flushnode(current)
current=next
end
else
@@ -29673,7 +29702,7 @@ do
checkstep(head)
end
local initialrl=0
- if getid(head)==par_code and start_of_par(head) then
+ if getid(head)==par_code and startofpar(head) then
initialrl=pardirstate(head)
elseif direction==righttoleft_code then
initialrl=-1
@@ -29790,7 +29819,7 @@ do
start=getnext(start)
end
elseif id==math_code then
- start=getnext(end_of_math(start))
+ start=getnext(endofmath(start))
elseif id==dir_code then
topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode)
start=getnext(start)
@@ -29860,7 +29889,7 @@ do
start=getnext(start)
end
elseif id==math_code then
- start=getnext(end_of_math(start))
+ start=getnext(endofmath(start))
elseif id==dir_code then
topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode)
start=getnext(start)
@@ -29938,7 +29967,7 @@ do
elseif char==false or id==glue_code then
start=getnext(start)
elseif id==math_code then
- start=getnext(end_of_math(start))
+ start=getnext(endofmath(start))
elseif id==dir_code then
topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode)
start=getnext(start)
@@ -31026,11 +31055,11 @@ local setprop=nuts.setprop
local getstate=nuts.getstate
local setstate=nuts.setstate
local ischar=nuts.ischar
-local insert_node_after=nuts.insert_after
+local insertnodeafter=nuts.insertafter
local copy_node=nuts.copy
local remove_node=nuts.remove
-local flush_list=nuts.flush_list
-local flush_node=nuts.flush_node
+local flushlist=nuts.flushlist
+local flushnode=nuts.flushnode
local copyinjection=nodes.injections.copy
local unsetvalue=attributes.unsetvalue
local fontdata=fonts.hashes.identifiers
@@ -31655,7 +31684,7 @@ local function inject_syntax_error(head,current,char)
else
setchar(current,dotted_circle)
end
- return insert_node_after(head,current,signal)
+ return insertnodeafter(head,current,signal)
end
local function initialize_one(font,attr)
local tfmdata=fontdata[font]
@@ -31773,7 +31802,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
if current==stop then
stop=getprev(stop)
head=remove_node(head,current)
- flush_node(current)
+ flushnode(current)
return head,stop,nbspaces
else
nbspaces=nbspaces+1
@@ -31803,7 +31832,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
tempcurrent=processcharacters(tempcurrent,font)
setstate(tempcurrent,unsetvalue)
if getchar(next)==getchar(tempcurrent) then
- flush_list(tempcurrent)
+ flushlist(tempcurrent)
if show_syntax_errors then
head,current=inject_syntax_error(head,current,char)
end
@@ -31811,8 +31840,8 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
setchar(current,getchar(tempcurrent))
local freenode=getnext(current)
setlink(current,tmp)
- flush_node(freenode)
- flush_list(tempcurrent)
+ flushnode(freenode)
+ flushlist(tempcurrent)
if changestop then
stop=current
end
@@ -31939,7 +31968,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
ch=tpm[1]
setchar(n,ch)
setchar(extra,tpm[2])
- head=insert_node_after(head,current,extra)
+ head=insertnodeafter(head,current,extra)
tpm=twopart_mark[ch]
end
while c~=stop and dependent_vowel[ch] do
@@ -32113,7 +32142,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
stop=getprev(stop)
end
head=remove_node(head,base)
- flush_node(base)
+ flushnode(base)
end
return head,stop,nbspaces
end
@@ -32373,7 +32402,7 @@ function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replaceme
if head==start then
head=stop
end
- flush_list(start)
+ flushlist(start)
return head,stop,true
end
local function initialize_two(font,attr)
@@ -32518,7 +32547,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
if current==stop then
stop=getprev(stop)
head=remove_node(head,current)
- flush_node(current)
+ flushnode(current)
return head,stop,nbspaces
else
nbspaces=nbspaces+1
@@ -32615,7 +32644,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
char=tpm[1]
setchar(current,char)
setchar(extra,tpm[2])
- head=insert_node_after(head,current,extra)
+ head=insertnodeafter(head,current,extra)
tpm=twopart_mark[char]
end
if not moved[current] and dependent_vowel[char] then
@@ -32765,7 +32794,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces)
end
nbspaces=nbspaces-1
head=remove_node(head,base)
- flush_node(base)
+ flushnode(base)
end
return head,stop,nbspaces
end
@@ -33701,7 +33730,7 @@ end
local nofshapes=#svgshapes
local f_svgfile=formatters["temp-otf-svg-shape-%i.svg"]
local f_pdffile=formatters["temp-otf-svg-shape-%i.pdf"]
- local f_convert=formatters["%s --export-%s=%s\n"]
+ local f_convert=formatters[new and "file-open:%s; export-%s:%s; export-do\n" or "%s --export-%s=%s\n"]
local filterglyph=otfsvg.filterglyph
local nofdone=0
local processed={}
@@ -39451,8 +39480,8 @@ local next=next
local fonts=fonts
local nodes=nodes
local nuts=nodes.nuts
-local traverse_id=nuts.traverse_id
-local flush_node=nuts.flush_node
+local traverseid=nuts.traverseid
+local flushnode=nuts.flushnode
local glyph_code=nodes.nodecodes.glyph
local disc_code=nodes.nodecodes.disc
local tonode=nuts.tonode
@@ -39511,7 +39540,7 @@ local function nodepass(head,groupcode,size,packtype,direction)
local variants=nil
local redundant=nil
local nofused=0
- for n in traverse_id(glyph_code,head) do
+ for n in traverseid(glyph_code,head) do
local font=getfont(n)
if font~=prevfont then
if basefont then
@@ -39589,13 +39618,13 @@ local function nodepass(head,groupcode,size,packtype,direction)
end
end
end
- flush_node(r)
+ flushnode(r)
end
end
- for d in traverse_id(disc_code,head) do
+ for d in traverseid(disc_code,head) do
local _,_,r=getdisc(d)
if r then
- for n in traverse_id(glyph_code,r) do
+ for n in traverseid(glyph_code,r) do
local font=getfont(n)
if font~=prevfont then
prevfont=font
@@ -39663,7 +39692,7 @@ local function basepass(head)
end
return head
end
-local protectpass=node.direct.protect_glyphs
+local protectpass=node.direct.protectglyphs or node.direct.protect_glyphs
local injectpass=nodes.injections.handler
function nodes.handlers.nodepass(head,...)
if head then
--
cgit v1.2.3