From e2cfcd99f00b7ad1c8dc1e66af880dd0662ce22c Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Mon, 21 Dec 2020 10:10:53 +0100
Subject: 2020-12-21 09:35:00

---
 .../followingup/followingup-compilation.tex        |  71 +++++++++++++-
 metapost/context/base/mpxl/mp-base.mpxl            |   6 +-
 metapost/context/base/mpxl/mp-lmtx.mpxl            |   3 +-
 tex/context/base/mkii/cont-new.mkii                |   2 +-
 tex/context/base/mkii/context.mkii                 |   2 +-
 tex/context/base/mkii/mult-ro.mkii                 |   1 +
 tex/context/base/mkiv/cont-new.mkiv                |   2 +-
 tex/context/base/mkiv/context.mkiv                 |   2 +-
 tex/context/base/mkiv/mult-def.lua                 |   3 +
 tex/context/base/mkiv/status-files.pdf             | Bin 26101 -> 26100 bytes
 tex/context/base/mkiv/status-lua.pdf               | Bin 253610 -> 253608 bytes
 tex/context/base/mkiv/strc-doc.lua                 |   1 +
 tex/context/base/mkiv/strc-lst.lua                 |   1 +
 tex/context/base/mkiv/strc-ref.lua                 |   2 +-
 tex/context/base/mkxl/cont-new.mkxl                |   2 +-
 tex/context/base/mkxl/context.mkxl                 |   2 +-
 tex/context/base/mkxl/core-env.mkxl                |   8 +-
 tex/context/base/mkxl/math-ali.mkxl                |  26 ++++--
 tex/context/base/mkxl/strc-con.mklx                |  42 +++++----
 tex/context/base/mkxl/strc-sec.mkxl                |  49 +++++-----
 tex/context/base/mkxl/syst-aux.mkxl                | 104 +++++++--------------
 tex/context/interface/mkii/keys-ro.xml             |   1 +
 tex/generic/context/luatex/luatex-fonts-merged.lua |   2 +-
 23 files changed, 199 insertions(+), 133 deletions(-)

diff --git a/doc/context/sources/general/manuals/followingup/followingup-compilation.tex b/doc/context/sources/general/manuals/followingup/followingup-compilation.tex
index a0e67d4be..9e4b10662 100644
--- a/doc/context/sources/general/manuals/followingup/followingup-compilation.tex
+++ b/doc/context/sources/general/manuals/followingup/followingup-compilation.tex
@@ -4,6 +4,12 @@
 
 \environment followingup-style
 
+\logo[WLS]       {WLS}
+\logo[INTEL]     {Intel}
+\logo[APPLE]     {Apple}
+\logo[UBUNTU]    {Ubuntu}
+\logo[RASPBERRY] {RaspberryPi}
+
 \startchapter[title={Compilation}]
 
 Compiling \LUATEX\ is possible because after all it's what I do on my machine.
@@ -50,7 +56,7 @@ In retrospect I should have done that sooner because in a day I could get all
 relevant platforms working. Flattening the source tree was a next step and so
 there is no way back now. What baffled me (and Alan, who at some point joined in
 testing \OSX) is the speed of compilation. My pretty old laptop needed about half
-a minute to get the job done and even on a raspberry pi with only a flash card
+a minute to get the job done and even on a \RASPBERRY\ with only a flash card
 just a few minutes were needed. At that point, as we could remove more make
 related files, the compressed 11 MB archive (\type {tar.xz}) shrunk to just over
 2~MB. Interesting is that compiling \MPLIB\ takes most time, and when one compiles
@@ -79,6 +85,69 @@ equivalent for zero was made a bit more distinctive as we now have more subtypes
 That is: all the subtypes were collected in enumerations instead of \CCODE\
 defines. Back to the basics.
 
+End of 2020 I noticed that the binary had grown a bit relative to the mid 2020
+versions. This surprised me because some improvements actually made them smaller,
+something you notice when you compile a couple of times when doing these things.
+I also noticed that the platforms on the compile farm had quite a bit of
+variation. In most cases we're still below my 3MB threshold, but when for
+instance cross compiled binaries become a few hundred MB larger one can get
+puzzled. In the \LUAMETAFUN\ manual I have this comment at the top:
+
+\starttyping[style=\ttx]
+------------------------   ------------------------   ------------------------
+2019-12-17  32bit  64bit   2020-01-10  32bit  64bit   2020-11-30  32bit  64bit
+------------------------   ------------------------   ------------------------
+freebsd     2270k  2662k   freebsd     2186k  2558k   freebsd     2108k  2436k
+openbsd6.6  2569k  2824k   openbsd6.6  2472k  2722k   openbsd6.8  2411k  2782k
+linux-armhf 2134k          linux-armhf 2063k          linux-armhf 2138k  2860k
+linux       2927k  2728k   linux       2804k  2613k   linux   (?) 3314k  2762k
+                                                      linux-musl  2532k  2686k
+osx                2821k   osx                2732k   osx                2711k
+ms mingw    2562k  2555k   ms mingw    2481k  2471k   ms mingw    2754k  2760k
+                                                      ms intel           2448k
+                                                      ms arm             3894k
+                                                      ms clang           2159k
+------------------------   ------------------------   ------------------------
+\stoptyping
+
+So why the differences? One possible answer is that the cross compiler now uses
+\GCC9 instead of \GCC8. It is quite likely that inlining code is done more
+aggressively (at least one can find remarks of that kind on the Internet). An
+interesting exception in this overview is the \LINUX\ 32 bit version. The native
+\WINDOWS\ binary is smaller than the \MINGW\ binary but the \CLANG\ variant is
+still smaller. For the native compilation we always enabled link time
+optimization, which makes compiling a bit slower but similar to regular
+compilation in \WLS\ but when for the other compilers we turn on link time
+optimization the linker takes quite some time. I just turn it off when testing
+code because it's no fun to wait these additional minutes with \GCC. Given that
+the native windows binary by now runs nearly as fast as the cross compiled ones,
+it is an indication that the native \WINDOWS\ compiler is quite okay. The numbers
+also show (for \WINDOWS) that using \CLANG\ is not yet an option: the binaries
+are smaller but also much slower and compilation (without link time optimization)
+also takes much longer. But we'll see how that evolves: the compile farm
+generates them all.
+
+So, what effects does link time optimization has? The (current) cross compiled
+binary is is some 60KB smaller and performs a little better. Some tests show
+some 3~percent gain but I'm pretty sure users won't notice that on a normal run.
+So, when we forget to enable it when we release new binaries, it's no big deal.
+
+Another end 2020 adventure was generating \ARM\ binaries for \OSX\ and \WINDOWS.
+This seems to work out well. The \OSX\ binaries were tested, but we don't have
+the proper hardware in the compile farm, so for now users have to use \INTEL\
+binaries on that hardware. Compiling the \LUAMETATEX\ manual on a 2020 M1 is a
+little more that twice as fast than on my 2013 i7 laptop running \WINDOWS. A
+native \ARM\ binary is about three times faster, which is what one expects from a
+more modern (also a bit performance hyped) chipset. On a \RASPBERRY\ with 4MB
+ram, an external \SSD\ on \USB3, running \UBUNTU\ 20, the manual compiles three
+times slower than on my laptop. So, when we limit conclusions to \LUAMETATEX\ it
+looks like \ARM\ is catching up: these modern chipsets (from \APPLE\ and
+\MICROSOFT, although the later was not yet tested) with plenty of cache, lots of
+fast memory, fast graphics and speedy disks are six times faster than a cheap
+media oriented \ARM\ chipset. Being a single core consumer, \LUAMETATEX\ benefits
+more from faster cores than from more cores. But, unless I have these machines
+on my desk these rough estimates have to do.
+
 \stopchapter
 
 \stopcomponent
diff --git a/metapost/context/base/mpxl/mp-base.mpxl b/metapost/context/base/mpxl/mp-base.mpxl
index 2c88ee53a..a111c7337 100644
--- a/metapost/context/base/mpxl/mp-base.mpxl
+++ b/metapost/context/base/mpxl/mp-base.mpxl
@@ -535,7 +535,7 @@ vardef min(expr u)(text t) = % t is a list of numerics, pairs, or strings
     elseif string u :
         string temp_any_u
     fi ;
-    temp_any_u = u
+    temp_any_u := u ;
     for i = t :
         if i < temp_any_u :
             temp_any_u := i ;
@@ -551,7 +551,7 @@ vardef max(expr u)(text t) = % t is a list of numerics, pairs, or strings
     elseif string u :
         string temp_any_u
     fi ;
-    temp_any_u = u
+    temp_any_u := u ;
     for i = t :
         if i > temp_any_u :
             temp_any_u := i ;
@@ -642,7 +642,7 @@ pc := 11.95517 ;
 cc := 12.79213 ;
 in := 72 ;
 
-immutable mm, pt, dd, bp, cm, pc, cc, in ;
+immutable mm, pt, bp, cm, in ; % we don't protect (yet): dd, pc cc (used as locals)
 
 % vardef magstep primary m = % obsolete
 %     mexp(46.67432m)
diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl
index 4b2ed7940..f1bdf4fd5 100644
--- a/metapost/context/base/mpxl/mp-lmtx.mpxl
+++ b/metapost/context/base/mpxl/mp-lmtx.mpxl
@@ -357,9 +357,10 @@ vardef lmt_do_followtext =
         save scale_up   ; string scale_up   ; scale_up   := getparameter "autoscaleup" ;
         save scale_down ; string scale_down ; scale_down := getparameter "autoscaledown" ;
         save followtextalternative   ; followtextalternative   := if getparameter "spread" : 1 else : 0 fi ;
-        save tracingfollowtext       ; tracingfollowtext          := if getparameter "trace"  : 1 else : 0 fi ;
         save autoscaleupfollowtext   ; autoscaleupfollowtext   := if scale_up   = "yes" : 1 elseif scale_up   = "max" : 2 else : 0 fi ;
         save autoscaledownfollowtext ; autoscaledownfollowtext := if scale_down = "yes" : 1 elseif scale_down = "max" : 2 else : 0 fi ;
+      % save tracingfollowtext       ; tracingfollowtext          := if getparameter "trace"  : 1 else : 0 fi ;
+        interim tracingfollowtext := if getparameter "trace" : 1 else : 0 fi ;
         draw followtext (
             if (getparameter "reverse") : reverse fi (getparameter "path"),
                 getparameter "text"
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 146a3ad9c..256006f2f 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2020.12.18 18:28}
+\newcontextversion{2020.12.21 09:32}
 
 %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 b036f7229..e0b7329fd 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
 %D your styles an modules.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2020.12.18 18:28}
+\edef\contextversion{2020.12.21 09:32}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii
index 997c3f4ab..21c69669f 100644
--- a/tex/context/base/mkii/mult-ro.mkii
+++ b/tex/context/base/mkii/mult-ro.mkii
@@ -1131,6 +1131,7 @@
 \setinterfaceconstant{reference}{referinta}
 \setinterfaceconstant{referencemethod}{referencemethod}
 \setinterfaceconstant{referenceprefix}{referenceprefix}
+\setinterfaceconstant{referencetext}{referencetext}
 \setinterfaceconstant{referencing}{referinta}
 \setinterfaceconstant{region}{region}
 \setinterfaceconstant{regionin}{regiuneintrare}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 2e7c722bf..0497d4005 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
 
 % \normalend % uncomment this to get the real base runtime
 
-\newcontextversion{2020.12.18 18:28}
+\newcontextversion{2020.12.21 09:32}
 
 %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 59cc03096..73324b92f 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
 %D {YYYY.MM.DD HH:MM} format.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2020.12.18 18:28}
+\edef\contextversion{2020.12.21 09:32}
 
 %D Kind of special:
 
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index 661a444de..f9f233892 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -11027,6 +11027,9 @@ return {
    ["en"]="referencemethod",
    ["fr"]="methodereference",
   },
+  ["referencetext"]={
+   ["en"]="referencetext",
+  },
   ["referenceprefix"]={
    ["en"]="referenceprefix",
    ["fr"]="prefixereference",
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index b58ba82d8..2c9f519e0 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 069320e47..06cc3bd93 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/strc-doc.lua b/tex/context/base/mkiv/strc-doc.lua
index aadbd8a90..5cb207c38 100644
--- a/tex/context/base/mkiv/strc-doc.lua
+++ b/tex/context/base/mkiv/strc-doc.lua
@@ -1160,6 +1160,7 @@ implement {
                     { "bookmark" },
                     { "marking" },
                     { "list" },
+                    { "reference" },
                 }
             },
             { "numberdata", {
diff --git a/tex/context/base/mkiv/strc-lst.lua b/tex/context/base/mkiv/strc-lst.lua
index fdbb97873..a6799d80f 100644
--- a/tex/context/base/mkiv/strc-lst.lua
+++ b/tex/context/base/mkiv/strc-lst.lua
@@ -1054,6 +1054,7 @@ implement {
                     { "bookmark" },
                     { "marking" },
                     { "list" },
+                    { "reference" },
                 }
             },
             { "prefixdata", {
diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index fb4d22807..4203e6aac 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -2289,7 +2289,7 @@ function genericfilters.title(data)
     if data then
         local titledata = data.titledata or data.useddata
         if titledata then
-            helpers.title(titledata.title or "?",data.metadata)
+            helpers.title(titledata.reference or titledata.title or "?",data.metadata)
         end
     end
 end
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index e93c21f01..448809e0f 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{2020.12.18 18:28}
+\newcontextversion{2020.12.21 09:32}
 
 %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 9f7bc755f..90fe9c913 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{2020.12.18 18:28}
+\immutable\edef\contextversion{2020.12.21 09:32}
 
 %overloadmode 1 % check frozen / warning
 %overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/core-env.mkxl b/tex/context/base/mkxl/core-env.mkxl
index ccb5b665e..c90b92f22 100644
--- a/tex/context/base/mkxl/core-env.mkxl
+++ b/tex/context/base/mkxl/core-env.mkxl
@@ -750,8 +750,6 @@
 \permanent\tolerant\protected\def\defineselector[#1]#*[#2]{\getparameters[\??selector#1][\c!max=\plusone,\c!n=\plusone,#2]}
 \permanent\tolerant\protected\def\setupselector [#1]#*[#2]{\getparameters[\??selector#1][#2]}
 
-\permanent\protected\let\select\directselect % we promote to protected
-
 % \def\directselect#1% expandable
 %   {\filterfromnext % maybe add an \expanded
 %      {\csname\??selector\ifcsname\??selector#1\c!max\endcsname#1\fi\c!max\endcsname}%
@@ -764,7 +762,9 @@
      \csname\??selector\ifcsname\??selector#1\c!max\endcsname#1\fi\c!max\expandafter\endcsname
      \csname\??selector\ifcsname\??selector#1\c!n  \endcsname#1\fi\c!n  \endcsname}
 
-\letvalue{\??selector\c!max}\plusone % \aliased ?
-\letvalue{\??selector\c!n  }\plusone % \aliased ?
+\permanent\protected\let\select\directselect % we promote to protected
+
+\letcsname\??selector\c!max\endcsname\plusone
+\letcsname\??selector\c!n  \endcsname\plusone
 
 \protect \endinput
diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl
index d7d7088c1..a8b0fa113 100644
--- a/tex/context/base/mkxl/math-ali.mkxl
+++ b/tex/context/base/mkxl/math-ali.mkxl
@@ -660,8 +660,8 @@
    \c!right={\right.}]
 
 \appendtoks
-    \frozen\instance\setuevalue{\e!start\currentmathcases}{\math_cases_start[\currentmathcases]}%
-    \frozen\instance\setvalue  {\e!stop \currentmathcases}{\math_cases_stop}%
+    \frozen\instance\protected\edefcsname\e!start\currentmathcases\endcsname{\math_cases_start[\currentmathcases]}%
+    \frozen\instance          \defcsname \e!stop \currentmathcases\endcsname{\math_cases_stop}%
 \to \everydefinemathcases
 
 \permanent\protected\def\math_cases_NC_zero
@@ -812,8 +812,9 @@
    \c!rulethickness=\linewidth]
 
 \appendtoks
-    \frozen\instance\setuevalue{\e!start\currentmathmatrix}{\math_matrix_start[\currentmathmatrix]}%
-    \frozen\instance\setvalue  {\e!stop \currentmathmatrix}{\math_matrix_stop}% no u else lookahead problem
+    \frozen\instance\protected\edefcsname\e!start\currentmathmatrix\endcsname{\math_matrix_start[\currentmathmatrix]}%
+    % \noaligned\protected should work here:
+    \frozen\instance          \defcsname \e!stop \currentmathmatrix\endcsname{\math_matrix_stop}% no u else lookahead problem
 \to \everydefinemathmatrix
 
 \def\math_matrix_start_table
@@ -825,12 +826,23 @@
   {\dostoptagged
    \dostoptagged}
 
+% \def\math_matrix_start_row
+%   {\noalign{\global\c_math_eqalign_column\zerocount}%
+%    \dostarttagged\t!mtablerow\empty}
+%
+% \def\math_matrix_stop_row
+%   {\dostoptagged}
+
 \def\math_matrix_start_row
-  {\noalign{\global\c_math_eqalign_column\zerocount}%
-   \dostarttagged\t!mtablerow\empty}
+  {\beginlocalcontrol
+   \global\c_math_eqalign_column\zerocount
+   \dostarttagged\t!mtablerow\empty
+   \endlocalcontrol}
 
 \def\math_matrix_stop_row
-  {\dostoptagged}
+  {\beginlocalcontrol
+   \dostoptagged
+   \endlocalcontrol}
 
 \protected\def\math_matrix_start_cell
   {\dostarttagged\t!mtablecell\empty
diff --git a/tex/context/base/mkxl/strc-con.mklx b/tex/context/base/mkxl/strc-con.mklx
index ddaa9e570..d64be35f0 100644
--- a/tex/context/base/mkxl/strc-con.mklx
+++ b/tex/context/base/mkxl/strc-con.mklx
@@ -122,6 +122,7 @@
 \mutable\let\currentconstructionmarking        \empty
 \mutable\let\currentconstructionnumber         \empty
 \mutable\let\currentconstructionreference      \empty
+\mutable\let\currentconstructionreferencetext  \empty
 \mutable\let\currentconstructionreferenceprefix\empty
 \mutable\let\currentconstructionsynchronize    \empty
 \mutable\let\currentconstructiontitle          \empty
@@ -157,7 +158,7 @@
 \tolerant\protected\def\strc_constructions_start[#1]#*[#2]#*[#3]%
   {\begingroup
    \strc_constructions_initialize{#1}%
-   \strc_constructions_register[#3][\c!label={\constructionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,#2]%
+   \strc_constructions_register[#3][\c!label={\constructionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,\c!referencetext=,#2]%
    \csname\??constructionstarthandler\currentconstructionhandler\endcsname}
 
 \protected\def\strc_constructions_stop
@@ -1030,6 +1031,7 @@
    \xdef\currentconstructioncatcodes       {\constructionparameter\s!catcodes}%
    \xdef\currentconstructionlabel          {\constructionparameter\c!label}%
    \xdef\currentconstructionreference      {\constructionparameter\c!reference}%
+   \xdef\currentconstructionreferencetext  {\constructionparameter\c!referencetext}%
    \xdef\currentconstructionreferenceprefix{\constructionparameter\c!referenceprefix}%
    %xdef\currentconstructionshownumber     {\constructionparameter\c!number}%
    \xdef\currentconstructionincrementnumber{\constructionparameter\c!incrementnumber}%
@@ -1043,10 +1045,11 @@
    \fi
    \ifx\currentconstructionexpansion\s!xml
      \xmlstartraw
-       \xdef\currentconstructiontitle   {\constructionparameter\c!title}%
-       \xdef\currentconstructionbookmark{\constructionparameter\c!bookmark}%
-       \xdef\currentconstructionmarking {\constructionparameter\c!marking}%
-       \xdef\currentconstructionlist    {\constructionparameter\c!list}%
+       \xdef\currentconstructiontitle        {\constructionparameter\c!title}%
+       \xdef\currentconstructionbookmark     {\constructionparameter\c!bookmark}%
+       \xdef\currentconstructionmarking      {\constructionparameter\c!marking}%
+       \xdef\currentconstructionlist         {\constructionparameter\c!list}%
+       \xdef\currentconstructionreferencetext{\constructionparameter\c!referencetext}%
      \xmlstopraw
      \ifempty\currentconstructionlist
        \glet\currentconstructionlist\currentconstructiontitle
@@ -1054,15 +1057,17 @@
      \glet\currentconstructioncoding\s!xml
    \else
      \ifx\currentconstructionexpansion\v!yes
-       \xdef\currentconstructiontitle   {\constructionparameter\c!title}%
-       \xdef\currentconstructionbookmark{\constructionparameter\c!bookmark}%
-       \xdef\currentconstructionmarking {\constructionparameter\c!marking}%
-       \xdef\currentconstructionlist    {\constructionparameter\c!list}%
+       \xdef\currentconstructiontitle        {\constructionparameter\c!title}%
+       \xdef\currentconstructionbookmark     {\constructionparameter\c!bookmark}%
+       \xdef\currentconstructionmarking      {\constructionparameter\c!marking}%
+       \xdef\currentconstructionlist         {\constructionparameter\c!list}%
+       \xdef\currentconstructionreferencetext{\constructionparameter\c!referencetext}%
      \else
-       \xdef\currentconstructiontitle   {\detokenizedconstructionparameter\c!title}%
-       \xdef\currentconstructionbookmark{\detokenizedconstructionparameter\c!bookmark}%
-       \xdef\currentconstructionmarking {\detokenizedconstructionparameter\c!marking}%
-       \xdef\currentconstructionlist    {\detokenizedconstructionparameter\c!list}%
+       \xdef\currentconstructiontitle        {\detokenizedconstructionparameter\c!title}%
+       \xdef\currentconstructionbookmark     {\detokenizedconstructionparameter\c!bookmark}%
+       \xdef\currentconstructionmarking      {\detokenizedconstructionparameter\c!marking}%
+       \xdef\currentconstructionlist         {\detokenizedconstructionparameter\c!list}%
+       \xdef\currentconstructionreferencetext{\detokenizedconstructionparameter\c!referencetext}%
        \iflocation \ifempty\currentconstructionbookmark
          \begingroup
          \simplifycommands
@@ -1104,13 +1109,16 @@
           % section   structures.sections.currentid(),
         }
         titledata  {
-            label    {\detokenize\expandafter{\currentconstructionlabel}}
-            title    {\detokenize\expandafter{\currentconstructiontitle}}
+            label     {\detokenize\expandafter{\currentconstructionlabel}}
+            title     {\detokenize\expandafter{\currentconstructiontitle}}
         \ifx\currentconstructionbookmark\currentconstructiontitle \else
-            bookmark {\detokenize\expandafter{\currentconstructionbookmark}}
+            bookmark  {\detokenize\expandafter{\currentconstructionbookmark}}
+        \fi
+        \ifx\currentconstructionreferencetext\currentconstructiontitle \else
+            reference {\detokenize\expandafter{\currentconstructionreferencetext}}
         \fi
         \ifx\currentconstructionlist\currentconstructiontitle \else
-            list     {\detokenize\expandafter{\currentconstructionlist}}
+            list      {\detokenize\expandafter{\currentconstructionlist}}
         \fi
         }
     \ifconditional\c_strc_constructions_number_state
diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl
index 9025b9930..81e0248e6 100644
--- a/tex/context/base/mkxl/strc-sec.mkxl
+++ b/tex/context/base/mkxl/strc-sec.mkxl
@@ -29,10 +29,11 @@
    \c!level=,
    \c!name=,
    \c!title=,
-   \c!bookmark=,
-   \c!marking=,
-   \c!list=,
-   \c!label=,
+   \c!bookmark=,      % no real need, default to empty anyway
+   \c!marking=,       % no real need, default to empty anyway
+   \c!list=,          % no real need, default to empty anyway
+   \c!referencetext=, % no real need, default to empty anyway
+   \c!label=,         % no real need, default to empty anyway
    \c!coupling=,
    \c!ownnumber=,
  % \c!interaction=\v!list,
@@ -158,10 +159,11 @@
    \xdef\currentstructureplaceholder    {\structureparameter\c!placeholder}%
    \ifx\currentstructureexpansion\s!xml
      \xmlstartraw
-       \xdef\currentstructuretitle   {\structureparameter\c!title}%
-       \xdef\currentstructurebookmark{\structureparameter\c!bookmark}%
-       \xdef\currentstructuremarking {\structureparameter\c!marking}%
-       \xdef\currentstructurelist    {\structureparameter\c!list}%
+       \xdef\currentstructuretitle        {\structureparameter\c!title}%
+       \xdef\currentstructurebookmark     {\structureparameter\c!bookmark}%
+       \xdef\currentstructuremarking      {\structureparameter\c!marking}%
+       \xdef\currentstructurelist         {\structureparameter\c!list}%
+       \xdef\currentstructurereferencetext{\structureparameter\c!referencetext}%
      \xmlstopraw
      \iflocation \ifempty\currentstructurebookmark \ifconditional\c_strc_bookmarks_preroll
        \strc_sectioning_autobookmark\currentstructuretitle
@@ -172,18 +174,20 @@
      \glet\currentstructurecoding\s!xml
    \else
      \ifx\currentstructureexpansion\v!yes
-       \xdef\currentstructuretitle   {\structureparameter\c!title}%
-       \xdef\currentstructurebookmark{\structureparameter\c!bookmark}%
-       \xdef\currentstructuremarking {\structureparameter\c!marking}%
-       \xdef\currentstructurelist    {\structureparameter\c!list}%
+       \xdef\currentstructuretitle        {\structureparameter\c!title}%
+       \xdef\currentstructurebookmark     {\structureparameter\c!bookmark}%
+       \xdef\currentstructuremarking      {\structureparameter\c!marking}%
+       \xdef\currentstructurelist         {\structureparameter\c!list}%
+       \xdef\currentstructurereferencetext{\structureparameter\c!referencetext}%
        \iflocation \ifempty\currentstructurebookmark \ifconditional\c_strc_bookmarks_preroll
          \strc_sectioning_autobookmark\currentstructuretitle
        \fi \fi \fi
      \else
-       \xdef\currentstructuretitle   {\detokenizedstructureparameter\c!title}%
-       \xdef\currentstructurebookmark{\detokenizedstructureparameter\c!bookmark}%
-       \xdef\currentstructuremarking {\detokenizedstructureparameter\c!marking}%
-       \xdef\currentstructurelist    {\detokenizedstructureparameter\c!list}%
+       \xdef\currentstructuretitle        {\detokenizedstructureparameter\c!title}%
+       \xdef\currentstructurebookmark     {\detokenizedstructureparameter\c!bookmark}%
+       \xdef\currentstructuremarking      {\detokenizedstructureparameter\c!marking}%
+       \xdef\currentstructurelist         {\detokenizedstructureparameter\c!list}%
+       \xdef\currentstructurereferencetext{\detokenizedstructureparameter\c!referencetext}%
        \iflocation \ifempty\currentstructurebookmark
          \ifconditional\c_strc_bookmarks_preroll
            \strc_sectioning_autobookmark{\structureparameter\c!title}%
@@ -233,19 +237,22 @@
         \fi
         }
         titledata {
-            label    {\detokenize\expandafter{\currentstructurelabel}}
-            title    {\detokenize\expandafter{\currentstructuretitle}}
+            label     {\detokenize\expandafter{\currentstructurelabel}}
+            title     {\detokenize\expandafter{\currentstructuretitle}}
         \ifx\currentstructurebookmark\currentstructuretitle \else
-            bookmark {\detokenize\expandafter{\currentstructurebookmark}}
+            bookmark  {\detokenize\expandafter{\currentstructurebookmark}}
         \fi
         \ifx\currentstructuremarking\currentstructuretitle \else
-            marking  {\detokenize\expandafter{\currentstructuremarking}}
+            marking   {\detokenize\expandafter{\currentstructuremarking}}
         \fi
         \ifx\currentstructuresaveinlist\v!no \else
           \ifx\currentstructurelist\currentstructuretitle \else
-            list     {\detokenize\expandafter{\currentstructurelist}}
+            list      {\detokenize\expandafter{\currentstructurelist}}
           \fi
         \fi
+        \ifx\currentstructurereferencetext\currentstructuretitle \else
+            reference {\detokenize\expandafter{\currentstructurereferencetext}}
+        \fi
         }
         numberdata {
           % block         {\currentsectionblock}
diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl
index 7b1b889c3..9dea8e5bb 100644
--- a/tex/context/base/mkxl/syst-aux.mkxl
+++ b/tex/context/base/mkxl/syst-aux.mkxl
@@ -5169,36 +5169,17 @@
 %D \definesomething[alfa,beta,...][variable=...,...]
 %D \stoptyping
 
-%% \let\syst_helpers_with_set_step\relax
-%% \let\m_syst_helpers_with_set_command\empty
-%%
-%% \def\syst_helpers_with_set_double[#1][#2]%
-%%   {\doifsomething{#1}%
-%%      {\def\syst_helpers_with_set_step##1{\m_syst_helpers_with_set_command[##1][#2]}%
-%%       \processcommalist[#1]\syst_helpers_with_set_step}}
-%%
-%% \def\syst_helpers_with_set_triple[#1][#2][#3]%
-%%   {\doifsomething{#1}%
-%%      {\def\syst_helpers_with_set_step##1{\m_syst_helpers_with_set_command[##1][#2][#3]}%
-%%       \processcommalist[#1]\syst_helpers_with_set_step}}
-%%
-%% \def\dodoubleemptywithset   #1{\let\m_syst_helpers_with_set_command#1\dodoubleempty   \syst_helpers_with_set_double} % \command
-%% \def\dodoubleargumentwithset#1{\let\m_syst_helpers_with_set_command#1\dodoubleargument\syst_helpers_with_set_double} % \command
-%%
-%% \def\dotripleemptywithset   #1{\let\m_syst_helpers_with_set_command#1\dotripleempty   \syst_helpers_with_set_triple} % \command
-%% \def\dotripleargumentwithset#1{\let\m_syst_helpers_with_set_command#1\dotripleargument\syst_helpers_with_set_triple} % \command
-
 \let\syst_helpers_with_set_step\relax % maybe push pop
 
 \permanent\tolerant\protected\def\dodoubleemptywithset#1#*[#2]#*[#3]%
   {\doifsomething{#2}%
      {\def\syst_helpers_with_set_step##1{#1[##1][#3]}%
-      \processcommalist[#1]\syst_helpers_with_set_step}}
+      \processcommalist[#2]\syst_helpers_with_set_step}}
 
 \permanent\tolerant\protected\def\dotripleemptywithset#1#*[#2]#*[#3]#*[#4]%
   {\doifsomething{#2}%
      {\def\syst_helpers_with_set_step##1{#1[##1][#3][#4]}%
-      \processcommalist[#1]\syst_helpers_with_set_step}}
+      \processcommalist[#2]\syst_helpers_with_set_step}}
 
 \aliased\let\dodoubleargumentwithset\dodoubleemptywithset
 \aliased\let\dotripleargumentwithset\dotripleemptywithset
@@ -5918,7 +5899,7 @@
 \permanent\def\purenumber#1{\expandafter\firstofoneargument\expandafter{\number#1}}
 
 %D \macros
-%D   {filterfromvalue}
+%D   {filterfromvalue, filterfromnext}
 %D
 %D \starttyping
 %D \setvalue{xx}{{A}{B}{C}}
@@ -5927,59 +5908,40 @@
 %D \filterfromvalue{xx}{3}{2}
 %D \filterfromvalue{xx}{3}{1}
 %D \stoptyping
-%D
-%D An alternative is to store 'max' in the list, say:
-%D
-%D \starttyping
-%D \setvalue{xx}{3{A}{B}{C}}
-%D
-%D \filterfromvalues{3}{xx}{3}
-%D \filterfromvalues{3}{xx}{2}
-%D \filterfromvalues{3}{xx}{1}
-%D \stoptyping
-%D
-%D I'll implement this when I'm in \quotation {writing dirty macros mood}.
-
-\permanent\def\dofilterfromstr#1#2% max n % no need to be fast
-  {\expandafter \expandafter \expandafter \csstring
-   \ifcase#1\or \ifcase#2\or
-     \firstofoneargument     \else
-     \gobbleoneargument      \fi
-   \or \ifcase#2\or
-     \firstoftwoarguments    \or
-     \secondoftwoarguments   \else
-     \gobbletwoarguments     \fi
-   \or \ifcase#2\or
-     \firstofthreearguments  \or
-     \secondofthreearguments \or
-     \thirdofthreearguments  \else
-     \gobblethreearguments   \fi
-   \or \ifcase#2\or
-     \firstoffourarguments   \or
-     \secondoffourarguments  \or
-     \thirdoffourarguments   \or
-     \fourthoffourarguments  \else
-     \gobblefourarguments    \fi
-   \or \ifcase#2\or
-     \firstoffivearguments   \or
-     \secondoffivearguments  \or
-     \thirdoffivearguments   \or
-     \fourthoffivearguments  \or
-     \fifthoffivearguments   \else
-     \gobblefivearguments    \fi
+
+% can be sped up with ignored arguments
+
+\def\syst_filter_from_next_yes#1%
+  {\advance\scratchcounterone\plusone
+   \ifnum\scratchcounterone=\scratchcountertwo
+     \scratchtoks{#1}%
+   \fi
+   \ifnum\scratchcounterone=\scratchcounterthree
+     \expandafter\syst_filter_from_next_nop
+   \else
+     \expandafter\syst_filter_from_next_yes
    \fi}
 
-\permanent\def\filterfromvalue#1#2#3% value max n
-  {\expandafter\doubleexpandafter\csname         % we use the fact that an
-     \expandafter\ifrelax\csname#1\endcsname     % undefined cs has become \relax
-       \csstring\gobbleoneargument               % which we then gobble here
-     \else
-       \dofilterfromstr{#2}{#3}%
-     \fi
-     \endcsname\csname#1\endcsname}
+\def\syst_filter_from_next_nop
+  {\expandafter\endgroup
+   \expandafter\endlocalcontrol
+   \the\scratchtoks}
 
 \permanent\def\filterfromnext#1#2% max n {..}{..}{..}{..}
-  {\csname\dofilterfromstr{#1}{#2}\endcsname}
+  {\beginlocalcontrol
+   \begingroup
+   \scratchcounterone   \zerocount
+   \scratchcountertwo   #2%
+   \scratchcounterthree #1%
+   \syst_filter_from_next_yes}
+
+\permanent\def\filterfromvalue#1#2#3% max n {..}{..}{..}{..}
+  {\beginlocalcontrol
+   \begingroup
+   \scratchcounterone   \zerocount
+   \scratchcountertwo   #3%
+   \scratchcounterthree #2%
+   \expandafter\expandafter\expandafter\syst_filter_from_next_yes\csname#1\endcsname}
 
 %D \macros
 %D   {definemeasure}
diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml
index 6d215d6c3..ef5c385fc 100644
--- a/tex/context/interface/mkii/keys-ro.xml
+++ b/tex/context/interface/mkii/keys-ro.xml
@@ -1137,6 +1137,7 @@
 		<cd:constant name='reference' value='referinta'/>
 		<cd:constant name='referencemethod' value='referencemethod'/>
 		<cd:constant name='referenceprefix' value='referenceprefix'/>
+		<cd:constant name='referencetext' value='referencetext'/>
 		<cd:constant name='referencing' value='referinta'/>
 		<cd:constant name='region' value='region'/>
 		<cd:constant name='regionin' value='regiuneintrare'/>
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 479ac5491..2b9335285 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
 -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
 -- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date  : 2020-12-18 18:28
+-- merge date  : 2020-12-21 09:32
 
 do -- begin closure to overcome local limits and interference
 
-- 
cgit v1.2.3