From cf803ad70f7a6ad2e7779875fcc02dd711706fc6 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 14 Feb 2021 17:26:41 +0100 Subject: 2021-02-14 16:14:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/colo-ini.mkiv | 4 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/data-tex.lua | 6 + tex/context/base/mkiv/lpdf-aux.lua | 3 +- tex/context/base/mkiv/lpdf-ini.lua | 4 +- tex/context/base/mkiv/mult-low.lua | 6 +- tex/context/base/mkiv/spac-ver.mkiv | 14 +- tex/context/base/mkiv/status-files.pdf | Bin 25323 -> 25354 bytes tex/context/base/mkiv/status-lua.pdf | Bin 254423 -> 255883 bytes tex/context/base/mkiv/supp-ran.mkiv | 5 +- tex/context/base/mkxl/anch-tab.mkxl | 2 +- tex/context/base/mkxl/attr-ini.mkxl | 2 +- tex/context/base/mkxl/back-ini.mkxl | 6 - tex/context/base/mkxl/buff-ini.mkxl | 6 +- tex/context/base/mkxl/colo-ini.mkxl | 7 +- tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/core-dat.mkxl | 2 +- tex/context/base/mkxl/core-env.mkxl | 2 + tex/context/base/mkxl/core-sys.mkxl | 2 + tex/context/base/mkxl/font-ini.mklx | 6 +- tex/context/base/mkxl/font-sel.mklx | 2 + tex/context/base/mkxl/font-sty.mklx | 16 +-- tex/context/base/mkxl/lpdf-aux.lmt | 3 +- tex/context/base/mkxl/lpdf-ini.lmt | 4 +- tex/context/base/mkxl/luat-cod.mkxl | 9 +- tex/context/base/mkxl/math-acc.mklx | 2 + tex/context/base/mkxl/math-ali.mkxl | 10 +- tex/context/base/mkxl/math-ini.mkxl | 2 + tex/context/base/mkxl/math-stc.mklx | 2 + tex/context/base/mkxl/meta-ini.mkxl | 41 +++--- tex/context/base/mkxl/mlib-pps.mkxl | 3 + tex/context/base/mkxl/node-fin.mkxl | 5 +- tex/context/base/mkxl/node-nut.lmt | 2 + tex/context/base/mkxl/pack-box.mkxl | 6 +- tex/context/base/mkxl/pack-com.mkxl | 30 +++-- tex/context/base/mkxl/pack-mrl.mkxl | 20 ++- tex/context/base/mkxl/pack-rul.lmt | 11 +- tex/context/base/mkxl/pack-rul.mkxl | 34 ++--- tex/context/base/mkxl/page-bck.mkxl | 2 + tex/context/base/mkxl/page-brk.mkxl | 2 +- tex/context/base/mkxl/page-col.mkxl | 2 + tex/context/base/mkxl/page-cst.mkxl | 2 + tex/context/base/mkxl/page-pcl.mkxl | 16 +-- tex/context/base/mkxl/page-sel.mklx | 3 + tex/context/base/mkxl/page-txt.mklx | 5 +- tex/context/base/mkxl/scrn-bar.mklx | 2 + tex/context/base/mkxl/scrn-but.mklx | 4 + tex/context/base/mkxl/scrn-fld.mklx | 4 +- tex/context/base/mkxl/spac-par.mkxl | 13 +- tex/context/base/mkxl/spac-ver.lmt | 11 -- tex/context/base/mkxl/spac-ver.mkxl | 24 +--- tex/context/base/mkxl/strc-flt.mklx | 3 + tex/context/base/mkxl/strc-itm.mklx | 18 ++- tex/context/base/mkxl/strc-not.mklx | 13 +- tex/context/base/mkxl/strc-reg.mkxl | 2 + tex/context/base/mkxl/strc-syn.mkxl | 2 +- tex/context/base/mkxl/strc-tag.mkxl | 2 +- tex/context/base/mkxl/supp-box.lmt | 2 +- tex/context/base/mkxl/supp-box.mkxl | 10 +- tex/context/base/mkxl/supp-ran.mkxl | 4 +- tex/context/base/mkxl/syst-aux.mkxl | 57 ++++++-- tex/context/base/mkxl/syst-ini.mkxl | 146 ++++++++++++++++++++ tex/context/base/mkxl/syst-lua.lmt | 14 +- tex/context/base/mkxl/tabl-mis.mkxl | 17 ++- tex/context/base/mkxl/tabl-ntb.mkxl | 5 + tex/context/base/mkxl/tabl-tab.mkxl | 2 + tex/context/base/mkxl/type-ini.mklx | 2 +- tex/context/base/mkxl/typo-itm.mkxl | 23 ++-- tex/context/modules/mkiv/m-system-readers.mkxl | 148 +++++++++++++++++++++ tex/context/modules/mkiv/s-system-macros.mkxl | 5 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 75 files changed, 634 insertions(+), 224 deletions(-) create mode 100644 tex/context/modules/mkiv/m-system-readers.mkxl (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 22ce5d100..7a5ef95b4 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.02.12 18:45} +\newcontextversion{2021.02.14 16:11} %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 3f7659e9d..1f5e76b38 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.02.12 18:45} +\edef\contextversion{2021.02.14 16:11} %D For those who want to use this: diff --git a/tex/context/base/mkiv/colo-ini.mkiv b/tex/context/base/mkiv/colo-ini.mkiv index 7faaa5c5a..d031c4bfe 100644 --- a/tex/context/base/mkiv/colo-ini.mkiv +++ b/tex/context/base/mkiv/colo-ini.mkiv @@ -649,10 +649,10 @@ % {\edef#1{\negatedcolorcomponent{#1}}} \unexpanded\def\negatecolorcomponent#1% #1 = \macro - {\edef#1{\clf_negatecolorcomponent{#1}}} + {\edef#1{\clf_negatedcolorcomponent{#1}}} \def\negatedcolorcomponent#1% - {\clf_negatecolorcomponent{#1}} + {\clf_negatedcolorcomponent{#1}} %D \macros %D {MPcolor} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 0aac29de3..a8c68be75 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.02.12 18:45} +\newcontextversion{2021.02.14 16:11} %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 9ef91ed8e..57f0fc064 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.02.12 18:45} +\edef\contextversion{2021.02.14 16:11} %D Kind of special: diff --git a/tex/context/base/mkiv/data-tex.lua b/tex/context/base/mkiv/data-tex.lua index 55383c1fe..2c1a7dbd5 100644 --- a/tex/context/base/mkiv/data-tex.lua +++ b/tex/context/base/mkiv/data-tex.lua @@ -149,6 +149,12 @@ local function textopener(tag,filename,filehandle,coding) filename = filename, noflines = noflines, -- currentline = 0, + gotoline = function(self,n) + currentline = n - 1 + if currentline <= 0 then + currentline = 0 + end + end, endoffile = function() return not lines or currentline >= noflines end, diff --git a/tex/context/base/mkiv/lpdf-aux.lua b/tex/context/base/mkiv/lpdf-aux.lua index 71b018c5f..91636ad04 100644 --- a/tex/context/base/mkiv/lpdf-aux.lua +++ b/tex/context/base/mkiv/lpdf-aux.lua @@ -22,6 +22,7 @@ local cache = table.setmetatableindex(function(t,k) -- can be made weak if v < 0x10000 then v = format("%04x",v) else + v = v - 0x10000 v = format("%04x%04x",rshift(v,10)+0xD800,v%1024+0xDC00) end t[k] = v @@ -71,7 +72,7 @@ local more = 0 local pattern = C(4) / function(s) -- needs checking ! local now = tonumber(s,16) if more > 0 then - now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 more = 0 return utfchar(now) elseif now >= 0xD800 and now <= 0xDBFF then diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua index ccb6e6628..1098ef8fa 100644 --- a/tex/context/base/mkiv/lpdf-ini.lua +++ b/tex/context/base/mkiv/lpdf-ini.lua @@ -298,7 +298,9 @@ do if v < 0x10000 then v = format("%04x",v) else + v = v - 0x10000 v = format("%04x%04x",rshift(v,10)+0xD800,v%1024+0xDC00) + -- v = format("%04x%04x",rshift(v-0x10000,10)+0xD800,v%1024+0xDC00) end t[k] = v return v @@ -319,7 +321,7 @@ do local pattern = C(4) / function(s) -- needs checking ! local now = tonumber(s,16) if more > 0 then - now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 more = 0 return utfchar(now) elseif now >= 0xD800 and now <= 0xDBFF then diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index c4078692d..ca65934ba 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -251,7 +251,7 @@ return { -- "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", -- - "scratchstringone", "scratchstringtwo", "tempstring", + "scratchstring", "scratchstringone", "scratchstringtwo", "tempstring", "scratchcounter", "globalscratchcounter", "privatescratchcounter", "scratchdimen", "globalscratchdimen", "privatescratchdimen", "scratchskip", "globalscratchskip", "privatescratchskip", @@ -551,5 +551,9 @@ return { "pushoverloadmode", "popoverloadmode", -- "suggestedalias", + -- + "newlocalcount", "newlocaldimen", "newlocalskip", "newlocalmuskip", "newlocaltoks", "newlocalbox", + "newlocalwrite", "newlocalread", + "setnewlocalcount", "setnewlocaldimen", "setnewlocalskip", "setnewlocalmuskip", "setnewlocaltoks", "setnewlocalbox", } } diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv index 680ba7a99..3f330a267 100644 --- a/tex/context/base/mkiv/spac-ver.mkiv +++ b/tex/context/base/mkiv/spac-ver.mkiv @@ -166,17 +166,11 @@ \installmacrostack\currentinterlinespace \unexpanded\def\setupinterlinespace - {\dodoubleempty\spac_linespacing_setup} + {\dosingleempty\spac_linespacing_setup} -\ifdefined\setupinterlinespace_double \else - \let\setupinterlinespace_double\setup_interlinespace % for a while -\fi - -\def\spac_linespacing_setup[#1][#2]% +\def\spac_linespacing_setup[#1]% {\settrue\interlinespaceisset % reset has to be done when needed - \ifsecondargument - \setupinterlinespace_double[#1][#2]% - \else\iffirstargument + \iffirstargument \ifcsname\namedinterlinespacehash{#1}\s!parent\endcsname \edef\currentinterlinespace{#1}% \spac_linespacing_setup_specified_interline_space @@ -187,7 +181,7 @@ \else \let\currentinterlinespace\empty \spac_linespacing_synchronize_local - \fi\fi} + \fi} \def\spac_linespacing_setup_specified_or_relative[#1]% {\doifelseassignment{#1}\setupspecifiedinterlinespace\setuprelativeinterlinespace[#1]% diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 53148beec..c4ac7d938 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 8079e1fb2..d91dbaebb 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-ran.mkiv b/tex/context/base/mkiv/supp-ran.mkiv index 4deb6f689..52a45cf9c 100644 --- a/tex/context/base/mkiv/supp-ran.mkiv +++ b/tex/context/base/mkiv/supp-ran.mkiv @@ -44,8 +44,9 @@ \let\freezerandomseed \pushrandomseed \let\defrostrandomseed\poprandomseed -\def\randomnumber #1#2{\clf_getrandomnumber\numexpr#1\relax\numexpr#2\relax} -\let\mprandomnumber \clf_getmprandomnumber +\setnewconstant \mpscaledmax 4095 % for old times sake +\def\randomnumber #1#2{\clf_getrandomnumber\numexpr#1\relax\numexpr#2\relax} +\def\mprandomnumber {\clf_getrandomnumber\zerocount\mpscaledmax} \protect \endinput diff --git a/tex/context/base/mkxl/anch-tab.mkxl b/tex/context/base/mkxl/anch-tab.mkxl index 6783b1314..11e9598d9 100644 --- a/tex/context/base/mkxl/anch-tab.mkxl +++ b/tex/context/base/mkxl/anch-tab.mkxl @@ -372,7 +372,7 @@ \protected\def\anch_framed_handle {\bgroup - \anch_framed_indeed} + \positionframed} \permanent\tolerant\protected\def\positionframed[#1]#*[#2]% {\setbox\scratchbox\hpack diff --git a/tex/context/base/mkxl/attr-ini.mkxl b/tex/context/base/mkxl/attr-ini.mkxl index ae749ff29..e707a478f 100644 --- a/tex/context/base/mkxl/attr-ini.mkxl +++ b/tex/context/base/mkxl/attr-ini.mkxl @@ -80,7 +80,7 @@ {\the\t_attr_list_pickup\relax} \permanent\protected\def\newattribute#1% - {\attr_basics_define_indeed\s!public[\csstring#1][]% + {\attr_basics_define_indeed[\s!public][\csstring#1][]% \expandafter\glet\expandafter#1\csname\??attributeid\csstring#1\endcsname} % expandable so we can \edef them for speed diff --git a/tex/context/base/mkxl/back-ini.mkxl b/tex/context/base/mkxl/back-ini.mkxl index 1bf31413e..fad9c1e70 100644 --- a/tex/context/base/mkxl/back-ini.mkxl +++ b/tex/context/base/mkxl/back-ini.mkxl @@ -50,12 +50,6 @@ \clf_setrealspaces{\backendparameter\c!space}% \to \everysetupbackend -\appendtoks - \ifdefined\clf_resetmapfile - \clf_resetmapfile - \fi -\to \everysetupbackend - %D For the moment this is an experiment (defauls is pdf, but we also %D have lua, json and mps). %D diff --git a/tex/context/base/mkxl/buff-ini.mkxl b/tex/context/base/mkxl/buff-ini.mkxl index bb1468e61..ed62743ad 100644 --- a/tex/context/base/mkxl/buff-ini.mkxl +++ b/tex/context/base/mkxl/buff-ini.mkxl @@ -66,8 +66,8 @@ \def\buff_start_indeed_default#1#2#3#4{\buff_start_indeed\empty{#1}{#2}{#3}} -% \let\buff_finish\relax -% \let\buff_gobble\relax +\let\buff_finish\relax +%let\buff_gobble\relax \protected\def\buff_pickup#1#2#3#4#5#6% name, startsequence, stopsequence, before, after, undent {\begingroup % (1) @@ -222,7 +222,7 @@ % maybe still used elsewhere -\permanent\protected\def\doprocesstexbuffer#1{\buff_process_tex[#1]} % still used? if not ... it will go away +% \aliased\doprocesstexbuffer\mkvibuffer \aliased\let\dostartbuffer\grabbufferdata % for old times sake, this will go away diff --git a/tex/context/base/mkxl/colo-ini.mkxl b/tex/context/base/mkxl/colo-ini.mkxl index 9c291ea9f..c096fe90f 100644 --- a/tex/context/base/mkxl/colo-ini.mkxl +++ b/tex/context/base/mkxl/colo-ini.mkxl @@ -636,11 +636,8 @@ %D %D These speak for themselves. See \type {colo-ext} for usage. -\permanent\protected\def\negatecolorcomponent#1% #1 = \macro - {\edef#1{\clf_negatecolorcomponent{#1}}} - -\permanent\def\negatedcolorcomponent#1% - {\clf_negatecolorcomponent{#1}} +\permanent\protected\def\negatecolorcomponent #1{\edef#1{\clf_negatedcolorcomponent{#1}}} +\permanent \def\negatedcolorcomponent#1{\clf_negatedcolorcomponent{#1}} %D \macros %D {MPcolor} diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 4485f0cf6..a50137486 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.02.12 18:45} +\newcontextversion{2021.02.14 16:11} %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 ddaafb93e..d628aa307 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.02.12 18:45} +\immutable\edef\contextversion{2021.02.14 16:11} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/core-dat.mkxl b/tex/context/base/mkxl/core-dat.mkxl index 7360a4e46..93d0bbb7a 100644 --- a/tex/context/base/mkxl/core-dat.mkxl +++ b/tex/context/base/mkxl/core-dat.mkxl @@ -95,7 +95,7 @@ \endgroup} \permanent\protected\def\autosetpagestate#1% - {\syst_pagestates_set[#1]\relax} + {\setpagestate[#1]\relax} \permanent\def\autopagestatenumber#1{\begincsname\??pagestatecounter#1\endcsname} diff --git a/tex/context/base/mkxl/core-env.mkxl b/tex/context/base/mkxl/core-env.mkxl index 4e040d632..62e4106c5 100644 --- a/tex/context/base/mkxl/core-env.mkxl +++ b/tex/context/base/mkxl/core-env.mkxl @@ -198,6 +198,8 @@ % all +\let\syst_modes_check_all_step\gobbleoneargument + \def\syst_modes_check_all_indeed#1% {\ifcsname\??mode#1\endcsname \ifcase\lastnamedcs diff --git a/tex/context/base/mkxl/core-sys.mkxl b/tex/context/base/mkxl/core-sys.mkxl index 5b23e4eab..c5093588e 100644 --- a/tex/context/base/mkxl/core-sys.mkxl +++ b/tex/context/base/mkxl/core-sys.mkxl @@ -163,6 +163,8 @@ \expandafter\syst_start_yes \fi} +\let\syst_stop_indeed\donothing + \def\syst_start_yes {\ifempty\m_syst_start_stop \let\syst_stop_indeed\donothing diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 1066a5ee6..557ac3c49 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -2604,11 +2604,11 @@ {\ifcsname\??predefinedfont#1\endcsname \lastnamedcs \else - \definedfont[#1]% + \font_basics_predefined{#1}% \fi} \protected\def\font_basics_predefine#1#2% - {\font_basics_defined_font_yes[#2]% + {\definedfont[#2]% \gletcsname#1\expandafter\endcsname\csname\v_font_identifier_basic\endcsname} \protected\def\font_basics_predefined#1% @@ -2616,7 +2616,7 @@ %D Handy helper: -\permanent\protected\def\savedefinedfont[#1]% +\permanent\protected\def\savedefinedfont[#1]% hm, how about scales {\bgroup \definedfont[#1]% \xdef\saveddefinedfontid {\number\fontid\font}% diff --git a/tex/context/base/mkxl/font-sel.mklx b/tex/context/base/mkxl/font-sel.mklx index a1fc8cd7f..a25b7fab7 100644 --- a/tex/context/base/mkxl/font-sel.mklx +++ b/tex/context/base/mkxl/font-sel.mklx @@ -17,6 +17,8 @@ \installcorenamespace {selectfont} \installsimplecommandhandler \??selectfont {selectfont} +\let\selectfont_index\!!zerocount + \protected\def\selectfont_register[#style][#settings]% {\begingroup \edef\currentselectfont{\expandnamespacevalue\??fontshortstyle{#style}\s!rm}% diff --git a/tex/context/base/mkxl/font-sty.mklx b/tex/context/base/mkxl/font-sty.mklx index 866e355c3..503356a4a 100644 --- a/tex/context/base/mkxl/font-sty.mklx +++ b/tex/context/base/mkxl/font-sty.mklx @@ -180,12 +180,11 @@ \setfalse\fontattributeisset -\let\m_font_style_parameter \empty % was \currentstyleparameter -\let\m_font_detokenized_style_parameter\empty % was \currentdetokenizedstyleparameter +\mutable\let\currentdetokenizedstyleparameter\empty \permanent\protected\def\dousestyleparameter#value% - {\edef\m_font_style_parameter{#value}% - \ifempty\m_font_style_parameter\else + {\edef\currentstyleparameter{#value}% + \ifempty\currentstyleparameter\else \expandafter\dousecurrentstyleparameter \fi} @@ -195,14 +194,14 @@ \fi} \permanent\protected\def\dousecurrentstyleparameter % empty check outside here - {\edef\m_font_detokenized_style_parameter{\detokenize\expandafter{\m_font_style_parameter}}% + {\edef\currentdetokenizedstyleparameter{\detokenize\expandafter{\currentstyleparameter}}% \settrue\fontattributeisset % reset is done elsewhere - \ifcsname\??alternativestyle\m_font_detokenized_style_parameter\endcsname + \ifcsname\??alternativestyle\currentdetokenizedstyleparameter\endcsname \lastnamedcs - \orelse\ifcsname\m_font_detokenized_style_parameter\endcsname + \orelse\ifcsname\currentdetokenizedstyleparameter\endcsname \lastnamedcs \else - \m_font_style_parameter + \currentstyleparameter \fi} %D New commands (not yet interfaced): @@ -360,6 +359,7 @@ \font_styles_define_style_collection_a\s!default \fi} +\let\font_styles_define_style_collection \relax \let\font_styles_define_style_collection_a\relax \let\font_styles_define_style_collection_b\relax diff --git a/tex/context/base/mkxl/lpdf-aux.lmt b/tex/context/base/mkxl/lpdf-aux.lmt index 71b018c5f..91636ad04 100644 --- a/tex/context/base/mkxl/lpdf-aux.lmt +++ b/tex/context/base/mkxl/lpdf-aux.lmt @@ -22,6 +22,7 @@ local cache = table.setmetatableindex(function(t,k) -- can be made weak if v < 0x10000 then v = format("%04x",v) else + v = v - 0x10000 v = format("%04x%04x",rshift(v,10)+0xD800,v%1024+0xDC00) end t[k] = v @@ -71,7 +72,7 @@ local more = 0 local pattern = C(4) / function(s) -- needs checking ! local now = tonumber(s,16) if more > 0 then - now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 more = 0 return utfchar(now) elseif now >= 0xD800 and now <= 0xDBFF then diff --git a/tex/context/base/mkxl/lpdf-ini.lmt b/tex/context/base/mkxl/lpdf-ini.lmt index 785242b8a..759f5e33f 100644 --- a/tex/context/base/mkxl/lpdf-ini.lmt +++ b/tex/context/base/mkxl/lpdf-ini.lmt @@ -176,7 +176,9 @@ do if v < 0x10000 then v = format("%04x",v) else + v = v - 0x10000 v = format("%04x%04x",rshift(v,10)+0xD800,v%1024+0xDC00) + -- v = format("%04x%04x",rshift(v-0x10000,10)+0xD800,v%1024+0xDC00) end t[k] = v return v @@ -197,7 +199,7 @@ do local pattern = C(4) / function(s) -- needs checking ! local now = tonumber(s,16) if more > 0 then - now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 more = 0 return utfchar(now) elseif now >= 0xD800 and now <= 0xDBFF then diff --git a/tex/context/base/mkxl/luat-cod.mkxl b/tex/context/base/mkxl/luat-cod.mkxl index fec88aecd..ed4a13981 100644 --- a/tex/context/base/mkxl/luat-cod.mkxl +++ b/tex/context/base/mkxl/luat-cod.mkxl @@ -18,19 +18,16 @@ \newif\ifproductionrun \permanent\let\ctxdirectlua \directlua -\permanent\let\ctxlatelua \latelua \permanent\def\ctxsprint #1{\directlua{tex.sprint(tex.ctxcatcodes,#1)}} % saves tokens \permanent\def\ctxwrite #1{\directlua{tex.write(#1)}} % saves tokens \permanent\def\ctxcommand #1{\directlua{commands.#1}} % saves tokens \permanent\def\ctxdirectcommand#1{\directlua{commands.#1}} % saves tokens -\permanent\def\ctxlatecommand #1{\latelua {commands.#1}} % saves tokens \permanent\def\ctxreport #1{\directlua{logs.writer[[#1]]}} %D Take your choice \unknown \aliased\let\ctxlua \ctxdirectlua \aliased\let\luacode \ctxdirectlua -\aliased\let\lateluacode \ctxlatelua \aliased\let\directluacode\ctxdirectlua %D Reporting the version of \LUA\ that we use is done as follows: @@ -42,4 +39,10 @@ \registerctxluafile{luat-cod.lmt}{autosuffix} +\toksapp \everydump {% + \permanent\let\ctxlatelua \latelua + \permanent\def\ctxlatecommand#1{\latelua{commands.#1}}% + \aliased\let\lateluacode \ctxlatelua +} % no \appendtoks yet + \protect \endinput diff --git a/tex/context/base/mkxl/math-acc.mklx b/tex/context/base/mkxl/math-acc.mklx index b5580fff2..9d8656630 100644 --- a/tex/context/base/mkxl/math-acc.mklx +++ b/tex/context/base/mkxl/math-acc.mklx @@ -87,6 +87,8 @@ \frozen\instance\setuevalue{#1}{\math_accents_make_double\noexpand\currentmathaccents\plusthree{\number#2}{\number#3}}% \fi} +\let\math_accents_color_pop\donothing + \def\math_accents_color_push_yes {\pushcolor[\p_math_accent_color]% \let\math_accents_color_pop\popcolor} diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl index 371c1b9af..2007ed83c 100644 --- a/tex/context/base/mkxl/math-ali.mkxl +++ b/tex/context/base/mkxl/math-ali.mkxl @@ -224,9 +224,11 @@ \installcorenamespace {mathalignlocation} -\setvalue{\??mathalignlocation\v!top }{\let\math_alignment_halign_method\halign\tpack} -\setvalue{\??mathalignlocation\v!bottom}{\let\math_alignment_halign_method\halign\vpack} -\setvalue{\??mathalignlocation\v!center}{\let\math_alignment_halign_method\halign\vcenter} +\defcsname\??mathalignlocation\v!top \endcsname{\let\math_alignment_halign_method\halign\tpack} +\defcsname\??mathalignlocation\v!bottom\endcsname{\let\math_alignment_halign_method\halign\vpack} +\defcsname\??mathalignlocation\v!center\endcsname{\let\math_alignment_halign_method\halign\vcenter} + +\let\math_alignment_halign_method\relax \def\math_both_eqalign_no_aligned#1% {\let\math_alignment_halign_method\math_halign_checked @@ -694,6 +696,8 @@ \installmacrostack\math_cases_NC +\let\math_cases_strut\relax + \permanent\tolerant\protected\def\math_cases_start[#1]#*[#2]% {\begingroup \edef\currentmathcases{#1}% diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 35092ceba..9f541c351 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -2550,6 +2550,8 @@ % this can become an option: +\let\math_display_align_hack_indeed\relax + \protected\def\math_display_align_hack % I don't like the global, maybe we should push and pop {\glet\math_display_align_hack_indeed\math_display_align_hack_remove_skip \math_openup\displayopenupvalue % was \math_openup\jot diff --git a/tex/context/base/mkxl/math-stc.mklx b/tex/context/base/mkxl/math-stc.mklx index 917fd97ba..944185c23 100644 --- a/tex/context/base/mkxl/math-stc.mklx +++ b/tex/context/base/mkxl/math-stc.mklx @@ -538,6 +538,8 @@ % 1 0 name n 0 | 0 1 name n 0 | 1 1 name n n +\let\math_stackers_stop_group\endgroup + \protected\def\math_stackers_start_group#category% {\begingroup \edef\currentmathstackers{#category}% diff --git a/tex/context/base/mkxl/meta-ini.mkxl b/tex/context/base/mkxl/meta-ini.mkxl index 41d39dee4..6b79c39c9 100644 --- a/tex/context/base/mkxl/meta-ini.mkxl +++ b/tex/context/base/mkxl/meta-ini.mkxl @@ -314,6 +314,9 @@ \let\meta_process_graphic_figure_start\relax \let\meta_process_graphic_figure_stop \relax +\let\normal_meta_process_graphic_start\relax +\let\normal_meta_process_graphic_stop \relax + \permanent\protected\def\processMPfigurefile#1% special case: obeys beginfig .. endfig and makes pages {\begingroup \let\normal_meta_process_graphic_start\meta_process_graphic_start @@ -851,7 +854,7 @@ \meta_end_graphic_group} \permanent\tolerant\protected\def\runMPbuffer[#1]% - {\startnointerference\meta_process_buffer[#1]\stopnointerference} + {\startnointerference\processMPbuffer[#1]\stopnointerference} %D \macros %D {startMPenvironment, resetMPenvironment} @@ -1303,24 +1306,24 @@ \setupMPgraphics [\c!color=\v!local] -%D This can save some runtime: rename the mpy file from a first run (when stable) to -%D another file and reuse it. One can also use the original filename, but a copy is -%D often better. -%D -%D \starttyping -%D \setupMPgraphics -%D [mpy=\jobname.mpy] -%D \stoptyping - -\mutable\let\MPdataMPYfile\empty - -\appendtoks - \edef\p_mpy{\directMPgraphicsparameter{mpy}}% - \ifempty\p_mpy \else - \let\MPdataMPYfile\p_mpy - \clf_registermpyfile{\p_mpy}% - \fi -\to \everysetupMPgraphics +% %D This can save some runtime: rename the mpy file from a first run (when stable) to +% %D another file and reuse it. One can also use the original filename, but a copy is +% %D often better. +% %D +% %D \starttyping +% %D \setupMPgraphics +% %D [mpy=\jobname.mpy] +% %D \stoptyping +% +% \mutable\let\MPdataMPYfile\empty +% +% \appendtoks +% \edef\p_mpy{\directMPgraphicsparameter{mpy}}% +% \ifempty\p_mpy \else +% \let\MPdataMPYfile\p_mpy +% \clf_registermpyfile{\p_mpy}% +% \fi +% \to \everysetupMPgraphics %D Some more helpers (see \type {meta-grd.mkiv} for an example of usage): diff --git a/tex/context/base/mkxl/mlib-pps.mkxl b/tex/context/base/mkxl/mlib-pps.mkxl index 61313afa2..11d7e5672 100644 --- a/tex/context/base/mkxl/mlib-pps.mkxl +++ b/tex/context/base/mkxl/mlib-pps.mkxl @@ -80,6 +80,9 @@ {\clf_mpgettext\MPtextbox #1% \vpack to \zeropoint{\vss\hpack to \zeropoint{\scale[\c!sx=#2,\c!sy=#3]{\raise\dp\MPtextbox\box\MPtextbox}\forcecolorhack\hss}}} +\let\mlib_sx\!!zerocount % set at the lua end +\let\mlib_sy\!!zerocount % set at the lua end + \permanent\protected\def\MPLIBfigure#1#2% {\setbox\scratchbox\hpack{\externalfigure[#1][\c!mask=#2]}% \clf_mpsetsxsy\wd\scratchbox\ht\scratchbox\zeropoint diff --git a/tex/context/base/mkxl/node-fin.mkxl b/tex/context/base/mkxl/node-fin.mkxl index fa2a01f82..6840c85ab 100644 --- a/tex/context/base/mkxl/node-fin.mkxl +++ b/tex/context/base/mkxl/node-fin.mkxl @@ -21,9 +21,10 @@ \permanent\protected\def\finalizeobjectbox #1{\clf_finalizebox#1\relax} \permanent\protected\def\finalizeshipoutbox#1{\clf_finalizebox#1\relax} -% Experimental (for Aditya): +% Experimental (for Aditya), not in mkxl, if we need it, it has to be more +% clever. -\permanent\protected\def\cleanupbox#1{\clf_cleanupbox#1\relax} +% \permanent\protected\def\cleanupbox#1{\clf_cleanupbox#1\relax} % Tricky stuff: this might become obsolete. It is about time to check this out % now (after more than a decade)! The few times that we need this we can better diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt index ab44e4d92..5a487eaea 100644 --- a/tex/context/base/mkxl/node-nut.lmt +++ b/tex/context/base/mkxl/node-nut.lmt @@ -53,6 +53,8 @@ local nuts = { current_attributes = direct.current_attributes, delete = direct.delete, dimensions = direct.dimensions, + naturalhsize = direct.naturalhsize, + naturalwidth = direct.naturalwidth, effective_glue = direct.effective_glue, end_of_math = direct.end_of_math, exchange = direct.exchange, diff --git a/tex/context/base/mkxl/pack-box.mkxl b/tex/context/base/mkxl/pack-box.mkxl index 0d56b8175..77b0bbc69 100644 --- a/tex/context/base/mkxl/pack-box.mkxl +++ b/tex/context/base/mkxl/pack-box.mkxl @@ -56,7 +56,9 @@ \permanent\tolerant\protected\def\defineanchor[#1]#*[#2]#*[#3]#*[#4]% name targetlayer layersetting framedsetting {\setvalue{\??anchor#1}{\pack_anchors_process_defined{#2}{#3}{#4}}} -\def\pack_anchors_process_defined#1#2#3% +\let\pack_anchors_process_defined_indeed\gobbletwooptionals + +\def\pack_anchors_process_defined#1#2#3% brrr {\tolerant\def\pack_anchors_process_defined_indeed[##1]##*[##2]% {\ifarguments \def\next{\pack_anchors_process_indeed{#1}{#2}{#3}}% @@ -473,7 +475,7 @@ {\egroup\csname#1\endcsname}} \permanent\tolerant\protected\def\defineornament[#1]#*[#2]#*[#3]% - {\setuvalue{#1}{\pack_ornament_text[#2][#3]}} + {\protected\frozen\instance\defcsname#1\endcsname{\ornamenttext[#2][#3]}} % \defineornament % [affiliation] diff --git a/tex/context/base/mkxl/pack-com.mkxl b/tex/context/base/mkxl/pack-com.mkxl index d2a9af914..44cfc9a4f 100644 --- a/tex/context/base/mkxl/pack-com.mkxl +++ b/tex/context/base/mkxl/pack-com.mkxl @@ -468,6 +468,8 @@ \fi \savebox{\??combinationcaption:\number\c_pack_combinations_nesting}{\number\c_pack_combinations_x}{\box\b_pack_combinations_caption}} +\let\pack_combinations_flush_captions_indeed\relax + \def\pack_combinations_flush_captions {\noalign {\ifdim\d_pack_combinations_ht>\zeropoint @@ -765,24 +767,25 @@ \installcorenamespace{pairedboxnature} \installcorenamespace{pairedboxalign} +\let\pack_pairedboxes_flush \relax \let\pack_pairedboxes_fill_top \relax \let\pack_pairedboxes_fill_bottom\relax -\setvalue{\??pairedboxnature\v!left}% +\defcsname\??pairedboxnature\v!left\endcsname {\settrue\c_pack_pairedboxes_horizontal \let\pack_pairedboxes_flush\pack_pairedboxes_flush_left} -\setvalue{\??pairedboxnature\v!right}% +\defcsname\??pairedboxnature\v!right\endcsname {\settrue\c_pack_pairedboxes_horizontal \let\pack_pairedboxes_flush\pack_pairedboxes_flush_right} -\setvalue{\??pairedboxnature\v!top}% +\defcsname\??pairedboxnature\v!top\endcsname {\setfalse\c_pack_pairedboxes_horizontal \let\pack_pairedboxes_fill_top\relax \let\pack_pairedboxes_fill_bottom\vss \let\pack_pairedboxes_flush\pack_pairedboxes_flush_top} -\setvalue{\??pairedboxnature\v!bottom}% +\defcsname\??pairedboxnature\v!bottom\endcsname {\setfalse\c_pack_pairedboxes_horizontal \let\pack_pairedboxes_fill_top\vss \let\pack_pairedboxes_fill_bottom\relax @@ -812,38 +815,43 @@ \pairedboxparameter\c!inbetween \box\b_pack_pairedboxes_second} -\setvalue{\??pairedboxalign\v!left}% 0 +\let\pack_pairedboxes_align_l\relax +\let\pack_pairedboxes_align_r\relax +\let\pack_pairedboxes_align_t\relax +\let\pack_pairedboxes_align_b\relax + +\defcsname\??pairedboxalign\v!left\endcsname % 0 {\let\pack_pairedboxes_align_l\relax \let\pack_pairedboxes_align_r\hss \let\pack_pairedboxes_align_t\relax \let\pack_pairedboxes_align_b\relax} -\setvalue{\??pairedboxalign\v!right}% 1 +\defcsname\??pairedboxalign\v!right\endcsname % 1 {\let\pack_pairedboxes_align_l\hss \let\pack_pairedboxes_align_r\relax \let\pack_pairedboxes_align_t\relax \let\pack_pairedboxes_align_b\relax} -\setvalue{\??pairedboxalign\v!high}% 2 +\defcsname\??pairedboxalign\v!high\endcsname % 2 {\let\pack_pairedboxes_align_l\relax \let\pack_pairedboxes_align_r\relax \let\pack_pairedboxes_align_t\relax \let\pack_pairedboxes_align_b\vss} -\setvalue{\??pairedboxalign\v!low}% 3 +\defcsname\??pairedboxalign\v!low\endcsname % 3 {\let\pack_pairedboxes_align_l\relax \let\pack_pairedboxes_align_r\relax \let\pack_pairedboxes_align_t\vss \let\pack_pairedboxes_align_b\relax} -\setvalue{\??pairedboxalign\v!middle}% 4 +\defcsname\??pairedboxalign\v!middle\endcsname % 4 {\let\pack_pairedboxes_align_l\hss \let\pack_pairedboxes_align_r\hss \let\pack_pairedboxes_align_t\vss \let\pack_pairedboxes_align_b\vss} -\setvalue{\??pairedboxalign\v!bottom}{\csname\??pairedboxalign\v!low \endcsname} -\setvalue{\??pairedboxalign \v!top}{\csname\??pairedboxalign\v!high\endcsname} +\defcsname\??pairedboxalign\v!bottom\endcsname{\csname\??pairedboxalign\v!low \endcsname} +\defcsname\??pairedboxalign \v!top\endcsname{\csname\??pairedboxalign\v!high\endcsname} \def\pack_pairedbox_valign#1{\setbox#1\vpack to \s_pack_pairedboxes_size{\pack_pairedboxes_align_t\box#1\pack_pairedboxes_align_b}} \def\pack_pairedbox_halign#1{\setbox#1\hpack to \s_pack_pairedboxes_size{\pack_pairedboxes_align_l\box#1\pack_pairedboxes_align_r}} diff --git a/tex/context/base/mkxl/pack-mrl.mkxl b/tex/context/base/mkxl/pack-mrl.mkxl index 7bdbc6b60..678afb68a 100644 --- a/tex/context/base/mkxl/pack-mrl.mkxl +++ b/tex/context/base/mkxl/pack-mrl.mkxl @@ -543,11 +543,8 @@ \def\pack_textrule_nop[#1]% {\doifelsenextbgroupcs\pack_textrule_nop_indeed_yes\pack_textrule_nop_indeed_nop} -\def\pack_textrule_nop_indeed_yes - {\csname\??textrulealternatives\v!top\endcsname} - -\def\pack_textrule_nop_indeed_nop - {\csname\??textrulealternatives\v!bottom\endcsname\empty} +\def\pack_textrule_nop_indeed_yes{\csname\??textrulealternatives\v!top \endcsname} +\def\pack_textrule_nop_indeed_nop{\csname\??textrulealternatives\v!bottom\endcsname\empty} %D\startbuffer %D\showstruts @@ -668,7 +665,8 @@ \permanent\protected\def\starttextrule#1% {\bgroup - \def\pack_textrule_nop_indeed{\csname\??textrulealternatives\v!middle\endcsname}% + \def\pack_textrule_nop_indeed_nop{\csname\??textrulealternatives\v!middle\endcsname}% + %\let\pack_textrule_nop_indeed_yes\pack_textrule_nop_indeed_nop % needs checking \csname\??textrulealternatives\v!top\endcsname{#1}% \bgroup \usebodyfontparameter\directtextrulesparameter} @@ -715,11 +713,12 @@ \c!style=, \c!color=] +\def\pack_fillinrules_rule_indeed{\thinrules} + \permanent\tolerant\protected\def\fillinrules[#1]#:#=#*#=% {\endgraf \begingroup \setupcurrentfillinrules[#1]% - \let\pack_fillinrules_rule\thinrules \directfillinrulesparameter\c!before \setupcurrentthinrules [\c!n=\directfillinrulesparameter\c!n, @@ -748,7 +747,7 @@ \fi \setupwhitespace[\v!big]% \ignorespaces - \pack_fillinrules_rule + \pack_fillinrules_rule_indeed \iftok{#3}\emptytoks\else \kern\scratchdistance \usefillinrulesstyleandcolor\c!style\c!color @@ -770,9 +769,8 @@ \permanent\tolerant\protected\def\fillintext[#1]#:#=#*#=% {\endgraf \begingroup - \setupcurrentfillinrules[#1]% - \def\pack_fillinrules_rule{\unhbox\nextbox\unskip}% - \dowithnextbox{\pack_fillinrules_indeed{#2}{\hfill#3}}% + \def\pack_fillinrules_rule_indeed{\unhbox\nextbox\unskip}% hm, needs checking + \dowithnextbox{\fillinrules[#1]{#2}{\hfill#3}}% \hbox\bgroup\let\par\egroup\ignorespaces} %D \macros diff --git a/tex/context/base/mkxl/pack-rul.lmt b/tex/context/base/mkxl/pack-rul.lmt index e5b2887ba..d99f0a78e 100644 --- a/tex/context/base/mkxl/pack-rul.lmt +++ b/tex/context/base/mkxl/pack-rul.lmt @@ -57,6 +57,7 @@ local getboxglue = nuts.getboxglue local hpack = nuts.hpack local getdimensions = nuts.dimensions +local naturalhsize = nuts.naturalhsize local flush_node = nuts.flush local traversers = nuts.traversers @@ -97,7 +98,15 @@ local function doreshapeframedbox(n) if list then if id == hlist_code then if subtype == boxlist_code or subtype == linelist_code then - lastlinelength = getdimensions(list) + -- the fast one also returns compensation (plus node) + local w, c, n = naturalhsize(list) + if n then + -- can become an option in framed: strict + w = w - c + else + -- print("no compensation found") + end + lastlinelength = w else lastlinelength = width end diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index e89989dfa..b6a22d894 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -520,6 +520,8 @@ \box\b_framed_extra \egroup} +\let\pack_framed_overlay_initialize\relax + \def\pack_framed_process_background_indeed_external {\pack_framed_overlay_initialize \pack_framed_process_background_indeed_internal} @@ -1182,7 +1184,7 @@ \edef\framedheight{\the\ifdim\d_framed_height>\zeropoint \d_framed_height\else\zeropoint\fi}% public \edef\framedoffset{\the\dimexpr\ifconditional\c_framed_has_offset\localoffset \else\zeropoint\fi}% public % for now: i need to think of something better - \bitwiseflip \normalizelinemode -\clipwidthcode + % \bitwiseflip \normalizelinemode -\clipwidthcode % now handled in analyzer % but that's for later \ifempty\p_framed_orientation \let\pack_framed_stop_orientation\relax @@ -1870,26 +1872,20 @@ \newtoks \t_pack_framed_mathframed \appendtoks - \frozen\instance\setuevalue{\currentmathframed}{\pack_framed_mathframed{\currentmathframed}}% + \frozen\protected\instance\edefcsname\currentmathframed\endcsname{\pack_framed_mathframed[\currentmathframed]}% \to \everydefinemathframed -\protected\def\pack_framed_mathframed#1% +\let\pack_framed_mc_one\relax +\let\pack_framed_mc_two\relax + +\tolerant\protected\def\pack_framed_mathframed[#1]#*[#2]#:#3% needs testing ! {\begingroup \edef\currentmathframed{#1}% - \dosingleempty\pack_framed_mathframed_indeed} - -\def\pack_framed_math_pos - {\global\advance\c_pack_framed_mathframed\plusone - \xdef\pack_framed_mc_one{mcf:1:\number\c_pack_framed_mathframed}% - \xdef\pack_framed_mc_two{mcf:2:\number\c_pack_framed_mathframed}% - \xypos\pack_framed_mc_two} - -\def\pack_framed_mathframed_indeed[#1]#2% no fancy nesting supported here - {\setupcurrentmathframed[#1]% + \setupcurrentmathframed[#2]% \c_framed_mstyle\normalmathstyle \edef\m_framed_location{\mathframedparameter\c!location}% \ifx\m_framed_location\v!mathematics - \enforced\let\normalstrut\pack_framed_math_pos + \enforced\let\normalstrut\pack_framed_math_pos % I don't like this overload! \orelse\ifx\m_framed_location\v!low\else \enforced\let\normalstrut\pack_framed_math_strut \fi @@ -1897,11 +1893,17 @@ \Ustartmath \triggermathstyle\c_framed_mstyle \the\t_pack_framed_mathframed - #2% + #3% \Ustopmath \egroup \endgroup} +\def\pack_framed_math_pos + {\global\advance\c_pack_framed_mathframed\plusone + \xdef\pack_framed_mc_one{mcf:1:\number\c_pack_framed_mathframed}% + \xdef\pack_framed_mc_two{mcf:2:\number\c_pack_framed_mathframed}% + \xypos\pack_framed_mc_two} + \appendtoks \mathraggedstatus\plustwo % makes \startalign work \eqalignmode \zerocount % makes \startalign fit @@ -2771,6 +2773,8 @@ %D The simple brace (or group) delimited case is typeset slightly different %D and is not aligned. +\let\pack_framed_strut\relax + \tolerant\protected\def\pack_framed_text_direct[#1]#*[#2]% {\bgroup \edef\currentframedtext{#1}% diff --git a/tex/context/base/mkxl/page-bck.mkxl b/tex/context/base/mkxl/page-bck.mkxl index 334a797b8..5683ba250 100644 --- a/tex/context/base/mkxl/page-bck.mkxl +++ b/tex/context/base/mkxl/page-bck.mkxl @@ -508,6 +508,8 @@ \def\v_page_backgrounds_single_set{\v!text,\v!hidden,\v!paper,\v!page,\v!leftpage,\v!rightpage} \def\v_page_backgrounds_common_set{\v!leftedge,\v!leftmargin,\v!text,\v!rightmargin,\v!rightedge} +\let\page_backgrounds_setup_step_nested\relax + \protected\def\page_backgrounds_setup_double[#1][#2][#3]% if needed we can speed this up {\global\settrue\c_page_backgrounds_some \def\page_backgrounds_setup_step##1% diff --git a/tex/context/base/mkxl/page-brk.mkxl b/tex/context/base/mkxl/page-brk.mkxl index 7256efefa..aca1d097d 100644 --- a/tex/context/base/mkxl/page-brk.mkxl +++ b/tex/context/base/mkxl/page-brk.mkxl @@ -124,7 +124,7 @@ {\enforced\permanent\protected\def\pagebreak[##1]{\goodbreak}} \permanent\protected\def\disablepagebreaks % to be used grouped ! - {\enforced\let\page_breaks_process\gobbleoneoptional} + {\enforced\let\pagebreak\gobbleoneoptional} \installpagebreakmethod \s!dummy {\page_otr_command_flush_all_floats diff --git a/tex/context/base/mkxl/page-col.mkxl b/tex/context/base/mkxl/page-col.mkxl index 5634589fa..43330c9a7 100644 --- a/tex/context/base/mkxl/page-col.mkxl +++ b/tex/context/base/mkxl/page-col.mkxl @@ -105,6 +105,8 @@ %D with \type {\currentcolumnbox}. In case of the mid columns, \type %D {\firstcolumnbox} and \type {\lastcolumnbox} are handled outside these macro's. +\let\page_columns_action\relax + \permanent\protected\def\dohandleallcolumnscs#1{\let\page_columns_action #1\page_columns_all_indeed} \permanent\protected\def\dohandleallcolumns #1{\def\page_columns_action{#1}\page_columns_all_indeed} diff --git a/tex/context/base/mkxl/page-cst.mkxl b/tex/context/base/mkxl/page-cst.mkxl index d0d6f2abd..a6f63a562 100644 --- a/tex/context/base/mkxl/page-cst.mkxl +++ b/tex/context/base/mkxl/page-cst.mkxl @@ -633,6 +633,8 @@ \newdimen\d_page_grd_span_width +\let\page_grd_span_stop\relax + \permanent\tolerant\protected\def\startpagegridspan[#1]#*[#2]#*[#3]% [#3] gobbles space {\endgraf % else rubish output if forgotten \synchronizepagegrid diff --git a/tex/context/base/mkxl/page-pcl.mkxl b/tex/context/base/mkxl/page-pcl.mkxl index 98f69b10d..6d186a4cd 100644 --- a/tex/context/base/mkxl/page-pcl.mkxl +++ b/tex/context/base/mkxl/page-pcl.mkxl @@ -546,17 +546,13 @@ \let\page_col_command_flush_top_insertions \page_one_command_flush_top_insertions \let\page_col_command_flush_bottom_insertions\page_one_command_flush_bottom_insertions -%let\page_col_command_set_top_insertions \page_one_command_set_top_insertions -\let\page_col_command_set_bottom_insertions \page_one_command_set_bottom_insertions +\let\page_col_command_set_bottom_insertions \page_one_command_set_bottom_insertions -%let\page_col_command_set_top_insertions_indeed \page_one_command_set_top_insertions -\let\page_col_command_set_bottom_insertions_indeed \page_one_command_set_botttom_insertions - -\let\page_col_command_flush_float_box \page_one_command_flush_float_box -\let\page_col_command_synchronize_side_floats \page_one_command_synchronize_side_floats -\let\page_col_command_flush_side_floats \page_one_command_flush_side_floats -\let\page_col_command_flush_margin_blocks \page_one_command_flush_margin_blocks -\let\page_col_command_test_page \page_one_command_test_page +\let\page_col_command_flush_float_box \page_one_command_flush_float_box +\let\page_col_command_synchronize_side_floats\page_one_command_synchronize_side_floats +\let\page_col_command_flush_side_floats \page_one_command_flush_side_floats +\let\page_col_command_flush_margin_blocks \page_one_command_flush_margin_blocks +\let\page_col_command_test_page \page_one_command_test_page %D The separator code is more or less the same as mixed columns but we need %D to compensate for the top floats so we comment a bit for now. diff --git a/tex/context/base/mkxl/page-sel.mklx b/tex/context/base/mkxl/page-sel.mklx index 03be048f4..1ec1b40e3 100644 --- a/tex/context/base/mkxl/page-sel.mklx +++ b/tex/context/base/mkxl/page-sel.mklx @@ -77,6 +77,9 @@ {\emptyhbox\page}}% \egroup} +\let\page_selectors_filter_step_indeed\gobbleoneargument +\let\page_selectors_filter_step \gobbleoneargument + \permanent\tolerant\protected\def\filterpages[#filename]#spacer[#selection]#spacer[#settings]% % \noffigurepages not yet supported {\bgroup \dontcomplain diff --git a/tex/context/base/mkxl/page-txt.mklx b/tex/context/base/mkxl/page-txt.mklx index 4a217538e..f8db27f38 100644 --- a/tex/context/base/mkxl/page-txt.mklx +++ b/tex/context/base/mkxl/page-txt.mklx @@ -763,9 +763,10 @@ \def\page_layouts_reset_page_number_location {\ifrelax\m_page_layouts_page_number_location_v\else + % this can be done better now, no meaning hackery needed \edef\currentlayoutelement{\m_page_layouts_page_number_location_v:\m_page_layouts_page_number_location_h}% - \edef\page_layouts_previous_page_number_locator{\detokenizedlayoutelementparameter\m_page_layouts_page_number_location_x}% - \doif{\meaning\page_layouts_previous_page_number_locator}{\meaning\page_layouts_place_page_number} + \edef\tempstring{\detokenizedlayoutelementparameter\m_page_layouts_page_number_location_x}% + \doif{\meaning\tempstring}{\meaning\page_layouts_place_page_number} {\resetlayoutelementparameter\m_page_layouts_page_number_location_x}% \fi} diff --git a/tex/context/base/mkxl/scrn-bar.mklx b/tex/context/base/mkxl/scrn-bar.mklx index f99f7569f..4cfcbde81 100644 --- a/tex/context/base/mkxl/scrn-bar.mklx +++ b/tex/context/base/mkxl/scrn-bar.mklx @@ -253,6 +253,8 @@ \newconstant\c_scrn_bar_mode +\let\scrn_bar_goto_indeed\relax + \protected\def\scrn_bar_goto_x#command% {\doifelse{\interactionbarparameter\c!symbol}\v!yes {\setupsymbolset[\interactionparameter\c!symbolset]% diff --git a/tex/context/base/mkxl/scrn-but.mklx b/tex/context/base/mkxl/scrn-but.mklx index 76694e1d9..9832ffbbb 100644 --- a/tex/context/base/mkxl/scrn-but.mklx +++ b/tex/context/base/mkxl/scrn-but.mklx @@ -521,6 +521,8 @@ %D This calls: % can be \c!command for vertical/horizontal +\let\scrn_menu_packager\relax + \setvalue{\??menupacker\v!vertical}% all menus {\let\scrn_menu_packager\scrn_menu_packager_vertical \setbox\b_scrn_menu\hbox{\scrn_menu_actions\currentinteractionmenulocation}% @@ -631,6 +633,8 @@ % removed: \restorestandardblank (vspacing) ... should happen elsewhere +\let\scrn_menu_between_action_indeed\relax + \def\scrn_menu_package_vertical#content% {\begingroup \global\c_scrn_menu_position\zerocount diff --git a/tex/context/base/mkxl/scrn-fld.mklx b/tex/context/base/mkxl/scrn-fld.mklx index d4f07d5e9..6c134268c 100644 --- a/tex/context/base/mkxl/scrn-fld.mklx +++ b/tex/context/base/mkxl/scrn-fld.mklx @@ -754,7 +754,7 @@ \permanent\tolerant\protected\def\fieldstack[#tag]#spacer[#symbols]#spacer[#settings]% {\ifparameter#symbols\or - \scrn_fieldstack_define[#tag][#symbols][#settings]% + \definefieldstack[#tag][#symbols][#settings]% \fi \csname\??fieldstack#tag\endcsname} @@ -959,6 +959,8 @@ [\c!frame=\v!off, \c!offset=\v!overlay] +\let\scrn_rollbutton_symbol\relax + \def\scrn_rollbutton_symbol_m {\scrn_rollbutton_symbol_indeed \interactionmenuparameter diff --git a/tex/context/base/mkxl/spac-par.mkxl b/tex/context/base/mkxl/spac-par.mkxl index 03b81b25d..808043cb6 100644 --- a/tex/context/base/mkxl/spac-par.mkxl +++ b/tex/context/base/mkxl/spac-par.mkxl @@ -245,14 +245,17 @@ \newconditional\c_spac_paragraphs_intro_next \newconditional\c_spac_paragraphs_intro_each +\let\spac_paragraphs_flush_intro\relax +\let\spac_paragraphs_intro_step \relax + \permanent\protected\tolerant\def\setupparagraphintro[#1]#*[#2]% {\def\spac_paragraphs_intro_step##1% {\csname\??paragraphintro\ifcsname\??paragraphintro##1\endcsname##1\fi\endcsname{#2}}% \processcommacommand[#1]\spac_paragraphs_intro_step} -\letvalue{\??paragraphintro\empty}\gobbleoneargument +\letcsname\??paragraphintro\empty\endcsname\gobbleoneargument -\setvalue{\??paragraphintro\v!reset}#1% +\defcsname\??paragraphintro\v!reset\endcsname#1% {\global\setfalse\c_spac_paragraphs_intro_first \global\setfalse\c_spac_paragraphs_intro_next \global\setfalse\c_spac_paragraphs_intro_each @@ -261,17 +264,17 @@ \global\t_spac_paragraphs_intro_each \emptytoks \glet\spac_paragraphs_flush_intro\relax} -\setvalue{\??paragraphintro\v!first}#1% +\defcsname\??paragraphintro\v!first\endcsname#1% {\global\settrue\c_spac_paragraphs_intro_first \gtoksapp\t_spac_paragraphs_intro_first{#1}% \glet\spac_paragraphs_flush_intro\spac_paragraphs_flush_intro_indeed} -\setvalue{\??paragraphintro\v!next}#1% +\defcsname\??paragraphintro\v!next\endcsname#1% {\global\settrue\c_spac_paragraphs_intro_next \gtoksapp\t_spac_paragraphs_intro_next{#1}% \glet\spac_paragraphs_flush_intro\spac_paragraphs_flush_intro_indeed} -\setvalue{\??paragraphintro\v!each}#1% +\defcsname\??paragraphintro\v!each\endcsname#1% {\global\settrue\c_spac_paragraphs_intro_each \gtoksapp\t_spac_paragraphs_intro_each{#1}% \glet\spac_paragraphs_flush_intro\spac_paragraphs_flush_intro_indeed} diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt index f3fa78ddd..2d4aace24 100644 --- a/tex/context/base/mkxl/spac-ver.lmt +++ b/tex/context/base/mkxl/spac-ver.lmt @@ -2359,17 +2359,6 @@ end do - -- old variant - --- implement { --- name = "vspacing", --- actions = vspacing.analyze, --- scope = "private", --- arguments = "string" --- } - - -- new variant - interfaces.implement { name = "injectvspacing", actions = vspacing.inject, diff --git a/tex/context/base/mkxl/spac-ver.mkxl b/tex/context/base/mkxl/spac-ver.mkxl index 4bbf723bd..6787c7cad 100644 --- a/tex/context/base/mkxl/spac-ver.mkxl +++ b/tex/context/base/mkxl/spac-ver.mkxl @@ -165,11 +165,11 @@ \installmacrostack\currentinterlinespace -\permanent\overloaded\tolerant\protected\def\setupinterlinespace[#1]#*[#2]% +\permanent\overloaded\tolerant\protected\def\setupinterlinespace[#1]% {\ifarguments \settrue\interlinespaceisset \spac_linespacing_synchronize_local - \or + \else \settrue\interlinespaceisset \ifcsname\namedinterlinespacehash{#1}\s!parent\endcsname \edef\currentinterlinespace{#1}% @@ -178,9 +178,6 @@ \else \spac_linespacing_setup_specified_or_relative[#1]% \fi - \or - \settrue\interlinespaceisset - \setup_interlinespace[#1][#2]% \fi} \def\spac_linespacing_setup_specified_or_relative[#1]% @@ -1892,6 +1889,7 @@ % % \ifgridsnapping will go +\installcorenamespace{vspacing} \installcorenamespace{vspacingamount} \permanent\tolerant\protected\def\definevspacingamount[#1]#*[#2]#*[#3]% can be combined @@ -1991,25 +1989,9 @@ \def\spac_vspacing_yes_ignore[#1]{\ifmmode\else\par\fi} \def\spac_vspacing_nop_ignore {\ifmmode\else\par\fi} -\installcorenamespace{vspacing} - \permanent\protected\def\directvspacing#1% {\ifmmode\else\par\ifvmode\clf_injectvspacing\ifgridsnapping\plusone\else\zerocount\fi{\iftok{#1}\emptytoks\currentvspacing\else#1\fi}\fi\fi} -\def\spac_vspacing_dim_preset#1% - {\ifcsname\??vspacing#1\endcsname - \lastnamedcs - \else - \spac_vspacing_yes_preset{#1}% - \fi} - -\def\spac_vspacing_yes_preset#1% - {\xdefcsname\??vspacing#1\endcsname{\clf_vspacing{#1}}% - %\writestatus{}{}% - %\writestatus{#1}{\expandafter\meaning\csname\??vspacing#1\endcsname}% - %\writestatus{}{}% - \csname\??vspacing#1\endcsname} - \permanent\protected\def\directdefaultvspacing {\ifinpagebody % somewhat weird \directvspacing\currentvspacing diff --git a/tex/context/base/mkxl/strc-flt.mklx b/tex/context/base/mkxl/strc-flt.mklx index 846d55d60..8f96701f5 100644 --- a/tex/context/base/mkxl/strc-flt.mklx +++ b/tex/context/base/mkxl/strc-flt.mklx @@ -1581,6 +1581,9 @@ \permanent\def\captionminwidth {\the\d_strc_floats_caption_min_width} \permanent\def\captionovershoot{\the\d_strc_floats_caption_overshoot} +\let\strc_floats_align_content\relax +\let\strc_floats_align_caption\relax + \def\strc_floats_set_caption_criteria % can become parameter (but what name) {\d_strc_floats_caption_min_width15\bodyfontsize \d_strc_floats_caption_overshoot 2\emwidth} diff --git a/tex/context/base/mkxl/strc-itm.mklx b/tex/context/base/mkxl/strc-itm.mklx index 9f0ba35db..efead3d83 100644 --- a/tex/context/base/mkxl/strc-itm.mklx +++ b/tex/context/base/mkxl/strc-itm.mklx @@ -741,25 +741,31 @@ % \strc_itemgroups_insert_reference % \endgroup} +\let\strc_itemgroups_temp_symbol \empty +\let\strc_itemgroups_used_symbol \empty +\let\strc_itemgroups_asked_symbol \empty +\let\strc_itemgroups_margin_symbol\empty +\let\strc_itemgroups_extra_symbol \empty + \def\strc_itemgroups_set_symbol#symbol% - {\edef\strc_itemgroups_tmp_symbol{#symbol}% - \ifempty\strc_itemgroups_tmp_symbol \else - \doifelsesymboldefined\strc_itemgroups_tmp_symbol + {\edef\strc_itemgroups_temp_symbol{#symbol}% + \ifempty\strc_itemgroups_temp_symbol \else + \doifelsesymboldefined\strc_itemgroups_temp_symbol \strc_itemgroups_set_symbol_symbol - {\doifelseconversiondefined\strc_itemgroups_tmp_symbol + {\doifelseconversiondefined\strc_itemgroups_temp_symbol \strc_itemgroups_set_symbol_conversion \donothing}% \fi} \def\strc_itemgroups_set_symbol_symbol - {\let\currentitemgroupsymbol\strc_itemgroups_tmp_symbol + {\let\currentitemgroupsymbol\strc_itemgroups_temp_symbol \strc_itemgroups_store_global_symbol\currentitemgroupsymbol \strc_itemgroups_store_local_symbol\v_strc_itemgroups_unknown_symbol \let\strc_itemgroups_used_symbol\strc_itemgroups_set_symbol_symbol_item \let\strc_itemgroups_asked_symbol\empty} \def\strc_itemgroups_set_symbol_conversion - {\let\currentitemgroupsymbol\strc_itemgroups_tmp_symbol + {\let\currentitemgroupsymbol\strc_itemgroups_temp_symbol \strc_itemgroups_store_global_symbol\currentitemgroupsymbol \strc_itemgroups_store_local_symbol\strc_itemgroups_insert_item_counter \let\strc_itemgroups_used_symbol\strc_itemgroups_set_symbol_conversion_item diff --git a/tex/context/base/mkxl/strc-not.mklx b/tex/context/base/mkxl/strc-not.mklx index b8a44e287..5ac571374 100644 --- a/tex/context/base/mkxl/strc-not.mklx +++ b/tex/context/base/mkxl/strc-not.mklx @@ -297,17 +297,19 @@ \expandafter\strc_notations_start_reference \fi[#2]} +\let\strc_notations_pickup_yes\relax + \protected\def\strc_notations_start_setups[#1]% - {\normalexpanded{\def\noexpand\strc_pickup_yes##/\csname\e!stop\currentconstruction\endcsname{\strc_notations_start_setups_indeed[#1]{##1}}}% - \strc_pickup_yes} + {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/\csname\e!stop\currentconstruction\endcsname{\strc_notations_start_setups_indeed[#1]{##1}}}% + \strc_notations_pickup_yes} \protected\def\strc_notations_start_setups_indeed[#1]#*#2% {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference=,\c!title={#2},\c!bookmark=,\c!list=,\c!referencetext=,#1]% \strc_notations_wrapup} \protected\def\strc_notations_start_reference[#1]% - {\normalexpanded{\def\noexpand\strc_pickup_yes##/\csname\e!stop\currentconstruction\endcsname{\strc_notations_start_reference_indeed[#1]{##1}}}% - \strc_pickup_yes} + {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/\csname\e!stop\currentconstruction\endcsname{\strc_notations_start_reference_indeed[#1]{##1}}}% + \strc_notations_pickup_yes} \protected\def\strc_notations_start_reference_indeed[#1]#*#2% {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title={#2},\c!bookmark=,\c!list=,\c!referencetext=]% @@ -550,6 +552,9 @@ \let\strc_notes_set_reference_attribute_text \donothing \let\strc_notes_set_destination_attribute_text\donothing +\let\strc_notes_set_style_color_inline \relax +\let\strc_notes_set_style_color_display\relax + % inline \let\m_strc_notes_internal\relax diff --git a/tex/context/base/mkxl/strc-reg.mkxl b/tex/context/base/mkxl/strc-reg.mkxl index 841b1e8be..22a6614b7 100644 --- a/tex/context/base/mkxl/strc-reg.mkxl +++ b/tex/context/base/mkxl/strc-reg.mkxl @@ -64,6 +64,8 @@ % maybe we should drop the plural form +\let\strc_registers_setup_step\relax + \permanent\tolerant\protected\overloaded\def\setupregister[#1]#*[#2]#*[#3]% {\ifarguments\or \strc_registers_setup_saved[#1]% diff --git a/tex/context/base/mkxl/strc-syn.mkxl b/tex/context/base/mkxl/strc-syn.mkxl index bcf5895c2..df573a7e9 100644 --- a/tex/context/base/mkxl/strc-syn.mkxl +++ b/tex/context/base/mkxl/strc-syn.mkxl @@ -636,7 +636,7 @@ {\begingroup \edef\currentsimplelist{#1}% \normalexpanded{\startnamedsection[\v!chapter][\c!title={\headtext{\simplelistparameter\s!multi}},\c!reference=#1]}% - \strc_sorting_place_list[#1][#2]% + \placelistofsorts[#1][#2]% \page \stopnamedsection \endgroup} diff --git a/tex/context/base/mkxl/strc-tag.mkxl b/tex/context/base/mkxl/strc-tag.mkxl index 18cb65760..c25970747 100644 --- a/tex/context/base/mkxl/strc-tag.mkxl +++ b/tex/context/base/mkxl/strc-tag.mkxl @@ -340,7 +340,7 @@ {\iftrialtypesetting \expandafter\gobbletwooptionals \else - \expandafterstrc_set_element_user_properties + \expandafter\strc_tags_set_element_user_properties \fi} \protected\def\strc_tags_enable_properties diff --git a/tex/context/base/mkxl/supp-box.lmt b/tex/context/base/mkxl/supp-box.lmt index 9dd85e093..206529bae 100644 --- a/tex/context/base/mkxl/supp-box.lmt +++ b/tex/context/base/mkxl/supp-box.lmt @@ -1330,7 +1330,7 @@ do else setfield(b,field) end - context(p) + context(p) -- todo: proper return end end diff --git a/tex/context/base/mkxl/supp-box.mkxl b/tex/context/base/mkxl/supp-box.mkxl index b8d6e86e4..3f8739c42 100644 --- a/tex/context/base/mkxl/supp-box.mkxl +++ b/tex/context/base/mkxl/supp-box.mkxl @@ -556,6 +556,8 @@ %D In this implementation the \type {\aftergroup} construction is needed because %D \type {\afterassignment} is executed inside the box. +\let\syst_boxes_with_next_box\relax + \permanent\protected\def\dowithnextbox#1% {\def\syst_boxes_with_next_box{#1}% \afterassignment\syst_boxes_with_next_box_indeed @@ -639,6 +641,9 @@ % \let\syst_boxes_with_next_box_two#1% % \afterassignment\syst_boxes_with_next_box_content_indeed % \setbox\nextbox} +% +% \def\syst_boxes_with_next_box_content_indeed +% {\syst_boxes_with_next_box_two\aftergroup\syst_boxes_with_next_box_one} \permanent\protected\def\dowithnextboxcontent#1#2% inside, after {\afterassigned{#1\aftergrouped{#2}}% @@ -648,9 +653,6 @@ {\afterassigned{#1\aftergroup#2}% \setbox\nextbox} -\def\syst_boxes_with_next_box_content_indeed - {\syst_boxes_with_next_box_two\aftergroup\syst_boxes_with_next_box_one} - %D \macros %D {llap, rlap, tlap, blap, clap} %D @@ -1853,6 +1855,8 @@ \newbox\processbox % public : this is the one where \nextbox's end up in +\let\syst_boxes_process_indeed\relax + \permanent\protected\def\processboxes#1% {\bgroup \def\syst_boxes_process_indeed{#1}% #1 can be redefined halfway diff --git a/tex/context/base/mkxl/supp-ran.mkxl b/tex/context/base/mkxl/supp-ran.mkxl index 4762153f7..7d212fdfd 100644 --- a/tex/context/base/mkxl/supp-ran.mkxl +++ b/tex/context/base/mkxl/supp-ran.mkxl @@ -44,7 +44,9 @@ \aliased\let\freezerandomseed \pushrandomseed \aliased\let\defrostrandomseed\poprandomseed +\setnewconstant \mpscaledmax 4095 % for old times sake + \permanent\def\randomnumber #1#2{\clf_getrandomnumber\numexpr#1\relax\numexpr#2\relax} -\permanent\def\mprandomnumber {\clf_getmprandomnumber} +\permanent\def\mprandomnumber {\clf_getrandomnumber\zerocount\mpscaledmax} \protect \endinput diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl index d2e5ce581..e4cecfe58 100644 --- a/tex/context/base/mkxl/syst-aux.mkxl +++ b/tex/context/base/mkxl/syst-aux.mkxl @@ -289,13 +289,6 @@ %D The next one is handy in predictable situations: -\def\syst_helpers_do_if_fast_optional_check_else - {\ifx\nexttoken\syst_helpers_next_optional_character_token - \expandafter\m_syst_action_yes - \else - \expandafter\m_syst_action_nop - \fi} - \permanent\protected\def\doifelsefastoptionalcheck#1#2% {\def\m_syst_action_yes{#1}% \def\m_syst_action_nop{#2}% @@ -898,6 +891,8 @@ %D \def\command[#1]{... #1 ...} %D \stoptyping +\let\syst_helpers_do_process_comma_list_with_parameters\gobbleoneargument + \permanent\protected\def\processcommalistwithparameters[#1]#2% {\def\syst_helpers_do_process_comma_list_with_parameters##1{#2[##1]}% \processcommalist[#1]\syst_helpers_do_process_comma_list_with_parameters} @@ -967,6 +962,11 @@ \mutable\let\commalistelement\empty +\let\m_syst_string_one\empty +\let\m_syst_string_two\empty + +\let\syst_helpers_do_compare_process_action\relax + \protected\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% {\edef\m_syst_string_two{#1}% \ifx\m_syst_string_two\s!default @@ -1019,6 +1019,9 @@ \fi [#1]} +\let\syst_helpers_do_process_action \gobbleoneargument +\let\syst_helpers_do_do_process_action\gobbleoneargument + \tolerant\protected\def\syst_helpers_process_first_action_in_set_indeed[#1]#*[#2]% {\def\syst_helpers_do_process_action##1% {\def\syst_helpers_do_do_process_action####1{\syst_helpers_do_compare_process_action_c[####1][##1]}% @@ -1309,6 +1312,8 @@ %D The gain in speed depends on the length of the argument (the longer the argument, %D the less we gain). The question is: do we still need these raw variants? +\let\syst_helpers_do_make_raw_comma_list\gobbleoneargument + \permanent\protected\def\makerawcommalist[#1]#2% use \processnext ... here {\scratchtoks\emptytoks \def\syst_helpers_do_make_raw_comma_list##1{\iftok\scratchtoks\emptytoks\scratchtoks{##1}\else\toksapp\scratchtoks{,##1}\fi}% @@ -1601,6 +1606,8 @@ %D \getemptyparameters [label] [...=...,...=...] %D \stoptyping +\let\syst_helpers_get_empty_parameters\gobbleoneargument + \permanent\protected\def\getemptyparameters[#1]#*[#2]% {\def\syst_helpers_get_empty_parameters##1{\doassignempty[#1][##1]}% \processcommalist[#2]\syst_helpers_get_empty_parameters} @@ -1630,9 +1637,11 @@ \mutable\let\currentassignmentlistkey \empty \mutable\let\currentassignmentlistvalue \empty +\let\syst_helpers_process_assign_entry\gobbleoneargument + \permanent\protected\def\processassignmentlist[#1]#2% #2 == \command{key}{value] - {\def\syst_helpers_process_assignment_entry##1{#2}% {##2}{##3} % namespace is ignored - \dogetparameters\syst_helpers_process_assignment_entry[][#1]} + {\def\syst_helpers_process_assign_entry##1{#2}% {##2}{##3} % namespace is ignored + \dogetparameters\syst_helpers_process_assign_entry[][#1]} \permanent\protected\def\processassignmentcommand[#1]% {\normalexpanded{\processassignmentlist[#1]}} @@ -1692,6 +1701,8 @@ %D By using \type {\docopyvalue} we've prepared this command for use in a %D multi||lingual environment. +\let\syst_helpers_copy_parameter\relax + \permanent\protected\def\copyparameters[#1]#*[#2]#*[#3]% {\doifnot{#1}{#2} {\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#2}}% ##1 @@ -2884,6 +2895,8 @@ \def\syst_helpers_dodo_global {\resetglobal\global} +\let\syst_helpers_redo_global\relax + \permanent\protected\def\saveglobal {\let\syst_helpers_dodo_global\dodoglobal \let\syst_helpers_redo_global\redoglobal} @@ -3240,6 +3253,8 @@ %D \dowith{a,b,c}{[#1]} %D \stoptyping +\let\syst_helpers_with\gobbleoneargument + \permanent\protected\def\dowith#1#2% {\def\syst_helpers_with##1{#2}% \normalexpanded{\processcommalist[#1]}\syst_helpers_with} @@ -3471,10 +3486,10 @@ %D Think of: %D %D \starttyping -%D \domatch {(\letterpercent w+) *(\letterpercent w*)} {aa bb cc dd} { +%D \doloopovermatch {(\letterpercent w+) *(\letterpercent w*)} {aa bb cc dd} { %D [ -%D \domatch{(\letterpercent w)(\letterpercent w)} {#1} {(##1 ##2)} -%D \domatch{(\letterpercent w)(\letterpercent w)} {#2} {(##1 ##2)} +%D \doloopovermatch{(\letterpercent w)(\letterpercent w)} {#1} {(##1 ##2)} +%D \doloopovermatch{(\letterpercent w)(\letterpercent w)} {#2} {(##1 ##2)} %D ] %D } %D @@ -3875,6 +3890,9 @@ \permanent\protected\def\gobbleuntil#1% {\def\syst_helpers_gobble_indeed##-#1{}\syst_helpers_gobble_indeed} +\permanent\protected\def\gobbleuntilandfinalize#1% + {\def\syst_helpers_gobble_indeed##-#1{#1}\syst_helpers_gobble_indeed} + \permanent\protected\def\gobbleuntilrelax#-\relax {} @@ -4433,6 +4451,8 @@ % {\scratchtoks{xaa} \removetoks x\from\scratchtoks [\the\scratchtoks]} % {\scratchtoks{a\relax b} \removetoks \relax\from\scratchtoks [\showthe\scratchtoks]} +\let\syst_helpers_remove_toks\relax + \permanent\protected\def\removetoks#1\from#2% {\def\syst_helpers_remove_toks##1#1##2\empty\empty\empty##3^^^^0004% {\def\m_syst_string_one{##3}% @@ -5083,6 +5103,8 @@ %D A complete match of two sets can be tested with \type {\doifallcommonelse}, where %D the first two arguments are sets. +\let\syst_helpers_do_common_check_all\gobbleoneargument + \def\syst_helpers_do_if_all_common_else#1#2#3#4% slow {\def\syst_helpers_do_common_check_all##1% {\doifnotinset{##1}{#4}\donefalse @@ -5216,6 +5238,7 @@ %D As we can see below, spaces following a control sequence are to enclosed in \type %D {{}}. +\let\syst_helpers_strip_character \relax \let\m_syst_helpers_strip_character\empty \permanent\protected\def\stripcharacter#1\from#2\to#3% @@ -5429,6 +5452,9 @@ % {\syst_helpers_process_assign_list_assign[##1==\relax]}% % \processcommalist[#2]\syst_helpers_process_assign_list_step} +\let\syst_helpers_process_assign_list_assign\gobbleoneoptional +\let\syst_helpers_process_assign_list_step \gobbleoneargument + \permanent\protected\def\processassignlist#1[#2]#3% {\def\syst_helpers_process_assign_list_assign[##1=##-=##2]% {\doif{##2}\relax{#3{##1}}}% @@ -5628,6 +5654,8 @@ %D Running this one not always gives the expected results. Consider for instance the %D macro for which I originally wrote this token handler. +\let\syst_helpers_split_off_tokens\gobbleoneargument + \permanent\protected\def\splitofftokens#1\from#2\to#3% slow but hardly used {\ifnum#1>\zerocount \privatescratchcounter#1\relax @@ -5674,6 +5702,8 @@ \mutable\let\nexthandledtoken\empty % part of public interface +\let\syst_helpers_handle_tokens_command\relax + \protected\def\syst_helpers_handle_tokens {\futurelet\nexthandledtoken\syst_helpers_handle_tokens_indeed} @@ -6231,6 +6261,9 @@ \newcount\c_syst_helpers_test_feature_n \newcount\c_syst_helpers_test_feature_m +\let\syst_helpers_test_feature_yes\relax +\let\syst_helpers_test_feature_nop\relax + \permanent\def\currentfeaturetest{\number\c_syst_helpers_test_feature_n} \permanent\protected\def\testfeature#1#2% diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index ec55c49d1..781515615 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -395,6 +395,7 @@ \mutable\let\tempstring \empty +\mutable\let\scratchstring \empty \mutable\let\scratchstringone\empty \mutable\let\scratchstringtwo\empty @@ -935,6 +936,8 @@ %D get. Beware: this macro does not support nested loops. We use a namespace %D prefix \type {@@pln}. +\let\syst_plain_body\relax + \permanent\def\loop#1\repeat{\def\syst_plain_body{#1}\syst_plain_iterate} % might go %D The following makes \type {\loop} \unknown\ \type {\if} \unknown\ \type @@ -1167,4 +1170,147 @@ \suggestedalias \dimen@i \scratchdimenone \suggestedalias \dimen@ii \scratchdimentwo +%D The next feature is experimental and could go into another system module, but it +%D feels more natural to have it here. +%D +%D \starttyping +%D \begingroup +%D \newlocaldimen\mydimena % \mydimena1\onepoint +%D \newlocaldimen\mydimenb % \mydimenb2\onepoint +%D \begingroup +%D \newlocaldimen\mydimena % \mydimena3\onepoint +%D \newlocaldimen\mydimenb % \mydimenb4\onepoint +%D \newlocaldimen\mydimenc % \mydimenc5\onepoint +%D \endgroup +%D \endgroup +%D +%D \begingroup +%D \setlocaldimen\mydimena 1\onepoint +%D \setlocaldimen\mydimenb 2\onepoint +%D \begingrou +%D \setlocaldimen\mydimena 3\onepoint +%D \setlocaldimen\mydimenb 4\onepoint +%D \setlocaldimen\mydimenc 5\onepoint +%D \endgroup +%D \endgroup +%D \stoptyping +%D +%D There is a little extra overhead in the overload protection but not that much. +%D Instead of: + +% \newcount\c_syst_local_count \c_syst_local_count \c_syst_max_allocated_register +% \newcount\c_syst_local_dimen \c_syst_local_dimen \c_syst_local_count +% \newcount\c_syst_local_skip \c_syst_local_skip \c_syst_local_count +% \newcount\c_syst_local_muskip\c_syst_local_muskip\c_syst_local_count +% \newcount\c_syst_local_box \c_syst_local_box \c_syst_local_count +% \newcount\c_syst_local_toks \c_syst_local_toks \c_syst_local_count + +%D We do this: + +\permanent\countdef\c_syst_local_count = 72 \c_syst_local_count = \c_syst_max_allocated_register +\permanent\countdef\c_syst_local_dimen = 73 \c_syst_local_dimen = \c_syst_local_count +\permanent\countdef\c_syst_local_skip = 74 \c_syst_local_skip = \c_syst_local_count +\permanent\countdef\c_syst_local_muskip = 75 \c_syst_local_muskip = \c_syst_local_count +\permanent\countdef\c_syst_local_box = 76 \c_syst_local_box = \c_syst_local_count +\permanent\countdef\c_syst_local_toks = 77 \c_syst_local_toks = \c_syst_local_count +\permanent\countdef\c_syst_local_read = 78 \c_syst_local_read = \c_syst_local_count +\permanent\countdef\c_syst_local_write = 79 \c_syst_local_write = \c_syst_local_count + +% We should have used \c_syst_local_dimen = \numexpr \c_syst_max_allocated_register + +% 1\relax, but we do this instead (it's no problem loosing a few registers). + +\c_syst_max_allocated_register \numexpr\c_syst_max_allocated_register:2\relax % floor + +\permanent\protected\def\syst_local_overflow#1#2{\writestatus\m!system{no room for local #1 \string#2}\wait} + +\permanent\protected\def\setnewlocaldimen#1% + {\ifnum\c_syst_local_dimen>\c_syst_max_allocated_register + \advance\c_syst_local_dimen\minusone\dimendef#1\c_syst_local_dimen + \else + \syst_local_overflow_dimen#1% + \fi + #1} + +\permanent\protected\def\setnewlocalcount#1% + {\ifnum\c_syst_local_count>\c_syst_max_allocated_register + \advance\c_syst_local_count\minusone + \overloaded\frozen\countdef#1\c_syst_local_count + \else + \syst_local_overflow_count#1% + \fi + #1} + +\permanent\protected\def\setnewlocalskip#1% + {\ifnum\c_syst_local_skip>\c_syst_max_allocated_register + \advance\c_syst_local_skip\minusone + \overloaded\frozen\skipdef#1\c_syst_local_skip + \else + \syst_local_overflow_skip#1% + \fi + #1} + +\permanent\protected\def\setnewlocalmuskip#1% + {\ifnum\c_syst_local_muskip>\c_syst_max_allocated_register + \advance\c_syst_local_muskip\minusone + \overloaded\frozen\muskipdef#1\c_syst_local_muskip + \else + \syst_local_overflow_muskip#1% + \fi + #1} + +\permanent\protected\def\setnewlocaltoks#1% + {\ifnum\c_syst_local_toks>\c_syst_max_allocated_register + \advance\c_syst_local_toks\minusone + \overloaded\frozen\toksdef#1\c_syst_local_toks + \else + \syst_local_overflow_toks#1% + \fi + #1} + +\permanent\protected\def\setnewlocalbox#1% + {\ifnum\c_syst_local_box>\c_syst_max_allocated_register + \advance\c_syst_local_box\minusone + \overloaded\frozen\integerdef#1\c_syst_local_box + \else + \syst_local_overflow_box#1% + \fi + \setbox#1} + +\permanent\protected\def\newlocalread#1% so no set + {\ifnum\c_syst_local_read>\c_syst_max_allocated_register + \advance\c_syst_local_read\minusone + \overloaded\frozen\integerdef#1\c_syst_local_read + \else + \syst_local_overflow_read#1% + \fi} + +\permanent\protected\def\newlocalwrite#1% so no set + {\ifnum\c_syst_local_write>\c_syst_max_allocated_register + \advance\c_syst_local_write\minusone + \overloaded\frozen\integerdef#1\c_syst_local_write + \else + \syst_local_overflow_write#1% + \fi} + +%D The error handlers: + +\permanent\protected\def\syst_local_overflow_count {\syst_local_overflow {count}} +\permanent\protected\def\syst_local_overflow_dimen {\syst_local_overflow {dimen}} +\permanent\protected\def\syst_local_overflow_skip {\syst_local_overflow {skip}} +\permanent\protected\def\syst_local_overflow_muskip{\syst_local_overflow{muskip}} +\permanent\protected\def\syst_local_overflow_toks {\syst_local_overflow {toks}} +\permanent\protected\def\syst_local_overflow_box {\syst_local_overflow {box}} +\permanent\protected\def\syst_local_overflow_read {\syst_local_overflow {read}} +\permanent\protected\def\syst_local_overflow_write {\syst_local_overflow {write}} + +%D We sacrifice a little performance but save some tokens by not defineing these +%D completely: + +\permanent\protected\def\newlocalcount #1{\setnewlocalcount #1\zerocount } +\permanent\protected\def\newlocaldimen #1{\setnewlocaldimen #1\zeropoint } +\permanent\protected\def\newlocalskip #1{\setnewlocalskip #1\zeroskip } +\permanent\protected\def\newlocalmuskip#1{\setnewlocalmuskip#1\zeromuskip} +\permanent\protected\def\newlocaltoks #1{\setnewlocaltoks #1\emptytoks } +\permanent\protected\def\newlocalbox #1{\setnewlocalbox #1\emptybox } + \protect \endinput diff --git a/tex/context/base/mkxl/syst-lua.lmt b/tex/context/base/mkxl/syst-lua.lmt index 911f9cbdf..a89cea852 100644 --- a/tex/context/base/mkxl/syst-lua.lmt +++ b/tex/context/base/mkxl/syst-lua.lmt @@ -396,9 +396,12 @@ do usage = "value", actions = function(prefix) local n = scaninteger() - scankeyword("to") - local m = scancsname(true) local c = channels[n] + if scankeyword("line") and c then + c:gotoline(scaninteger()) + end + scankeyword("to") + local m = scancsname(true) local g = 0 local s l = 0 @@ -466,9 +469,12 @@ do usage = "value", actions = function(prefix) local n = scaninteger() - scankeyword("to") - local m = scancsname(true) local c = channels[n] + if scankeyword("line") and c then + c:gotoline(scaninteger()) + end + scankeyword("to") + local m = scancsname(true) local s = c and c:reader() if s then local e = texgetcount("endlinechar") -- we can have tex.endline if needed diff --git a/tex/context/base/mkxl/tabl-mis.mkxl b/tex/context/base/mkxl/tabl-mis.mkxl index 8f83a65a7..7b6f0ffac 100644 --- a/tex/context/base/mkxl/tabl-mis.mkxl +++ b/tex/context/base/mkxl/tabl-mis.mkxl @@ -127,6 +127,8 @@ \aliased\let\typo_paragraphs_setup_saved\setupparagraphs +\let\typo_paragraphs_setup_step\gobbleoneargument + \overloaded\permanent\tolerant\protected\def\setupparagraphs[#1]#*[#2]#*[#3]% we are downward compatible with [each] and [1,3] {\ifarguments\or \typo_paragraphs_setup_saved[#1]% @@ -141,12 +143,12 @@ \fi} \appendtoks - \frozen\instance\letvalue{\e!next \currentparagraphs}\nextparagraphs - \frozen\instance\letvalue\currentparagraphs\nextparagraphs - \frozen\instance\setuevalue{\e!start\currentparagraphs}{\startparagraphs[\currentparagraphs]}% - \frozen\instance\letvalue{\e!stop \currentparagraphs}\stopparagraphs + \frozen\instance\letcsname\e!next \currentparagraphs\endcsname\nextparagraphs + \frozen\instance\letcsname\currentparagraphs\endcsname\nextparagraphs + \frozen\instance\protected\edefcsname\e!start\currentparagraphs\endcsname{\startparagraphs[\currentparagraphs]}% + \frozen\instance\letcsname\e!stop \currentparagraphs\endcsname\stopparagraphs %frozen\instance\setuevalue{\e!setup\currentparagraph\e!endsetup}{\typo_paragraphs_setup_saved[\currentparagraphs]}% - \dorecurse{\paragraphsparameter\c!n} + \dorecurse{\paragraphsparameter\c!n}% {\normalexpanded{\typo_paragraphs_setup_saved[\currentparagraphs:\recurselevel][\c!width=,\s!parent=\??paragraphs\currentparagraphs]}}% \typo_paragraphs_setup_saved[\currentparagraphs:1][\c!distance=\zeropoint]% \to \everydefineparagraphs @@ -156,6 +158,9 @@ \newdimen\d_typo_paragraphs_width \newdimen\d_typo_paragraphs_auto +\let\typo_paragraphs_start_cell\relax +\let\typo_paragraphs_stop_cell \relax + \permanent\protected\def\startparagraphs[#1]% quite slow {\bgroup % (1) \edef\currentparagraphs{#1}% @@ -187,7 +192,7 @@ \fi \parindent\zeropoint \c_typo_paragraphs_n\zerocount - \enforced\let\\\typo_paragraphs_next % downward compatible + \enforced\let\\\nextparagraphs % downward compatible \edef\p_offset{\paragraphsparameter\c!offset}% \doifelsedimension\p_offset {\scratchoffset\p_offset}% diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl index 57538e460..5b30c449c 100644 --- a/tex/context/base/mkxl/tabl-ntb.mkxl +++ b/tex/context/base/mkxl/tabl-ntb.mkxl @@ -404,6 +404,9 @@ \let\tabl_ntb_parameters_get\setupcurrentnaturaltablelocal +\let\tabl_ntb_setup_step \gobbleoneargument +\let\tabl_ntb_setup_step_step\gobbleoneargument + \permanent\tolerant\protected\def\setupTABLE[#1]#*[#2]#*[#3]% {\ifarguments \expandafter\gobblethreeoptionals @@ -1536,6 +1539,8 @@ \newdimen\d_tabl_ntb_saved_hsize +\let\tabl_ntb_pass\relax + \def\tabl_ntb_table_stop {\forgetall % new, here see narrower-004.tex %\setbox\scratchbox\hbox diff --git a/tex/context/base/mkxl/tabl-tab.mkxl b/tex/context/base/mkxl/tabl-tab.mkxl index 045560b2c..547ff93ff 100644 --- a/tex/context/base/mkxl/tabl-tab.mkxl +++ b/tex/context/base/mkxl/tabl-tab.mkxl @@ -1473,6 +1473,8 @@ % \def\doverysimpletableHL % todo % {\noalign{\normalexpanded{\noexpand\tabl_table_normal_full_rule\m_tabl_table_HLheight}} +\let\tabl_table_restart\relax + \def\tabl_table_restart_indeed#1% {\gdef\tabl_table_restart{#1}% \tabl_table_restart diff --git a/tex/context/base/mkxl/type-ini.mklx b/tex/context/base/mkxl/type-ini.mklx index 39b3224a5..bba2d433b 100644 --- a/tex/context/base/mkxl/type-ini.mklx +++ b/tex/context/base/mkxl/type-ini.mklx @@ -575,7 +575,7 @@ \permanent\tolerant\protected\def\inherittypeface[#name]#spacer[#styles]#spacer[#parentclass]% {\iftok{#styles}\emptytoks - \font_typescripts_inherit_indeed[#name][\s!rm,\s!ss,\s!tt,\s!mm][\fontclass]% + \inherittypeface[#name][\s!rm,\s!ss,\s!tt,\s!mm][\fontclass]% \orelse\iftok{#name}{#parentclass}\else \glet\font_typescripts_inherit_check\font_typescripts_inherit_check_indeed \def\font_typescripts_inherit_check_step#style{\edefcsname\??typescriptinheritances#name:#style\endcsname{#parentclass}}% diff --git a/tex/context/base/mkxl/typo-itm.mkxl b/tex/context/base/mkxl/typo-itm.mkxl index 3a2e2ce17..7ae1b732f 100644 --- a/tex/context/base/mkxl/typo-itm.mkxl +++ b/tex/context/base/mkxl/typo-itm.mkxl @@ -134,13 +134,8 @@ % rendering -\setvalue{\??itemshorizontal\v!margin}#1% - {\ifnum\c_typo_items_m=\plusone\hss\else\hfill\fi - \strut#1% - \ifnum\c_typo_items_m=\c_typo_items_n\hss\else\hfill\fi} - -\setvalue{\??itemshorizontal\s!unknown}% - {\simplealignedbox\scratchwidth\m_typo_items_align} +\let\typo_items_item\relax +\let\typo_items_make\relax \def\typo_items_item_horizontal {\advance\c_typo_items_m\plusone @@ -152,9 +147,6 @@ \fi \endcsname} -\setvalue{\??itemsvertical\s!unknown}% - {\simplealignedbox\scratchwidth\m_typo_items_align} - \def\typo_items_item_vertical {\advance\c_typo_items_m\plusone \csname\??itemsvertical @@ -165,6 +157,17 @@ \fi \endcsname} +\defcsname\??itemshorizontal\v!margin\endcsname#1% + {\ifnum\c_typo_items_m=\plusone\hss\else\hfill\fi + \strut#1% + \ifnum\c_typo_items_m=\c_typo_items_n\hss\else\hfill\fi} + +\defcsname\??itemshorizontal\s!unknown\endcsname + {\simplealignedbox\scratchwidth\m_typo_items_align} + +\defcsname\??itemsvertical\s!unknown\endcsname + {\simplealignedbox\scratchwidth\m_typo_items_align} + \def\typo_items_make_horizontal#1% {\divide\scratchwidth\c_typo_items_n \hbox{#1}} diff --git a/tex/context/modules/mkiv/m-system-readers.mkxl b/tex/context/modules/mkiv/m-system-readers.mkxl new file mode 100644 index 000000000..a077b20a3 --- /dev/null +++ b/tex/context/modules/mkiv/m-system-readers.mkxl @@ -0,0 +1,148 @@ +%D \module +%D [ file=m-system-readers, +%D version=2021.02.13, +%D title=\CONTEXT\ Modules, +%D subtitle=Reading from files, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] + +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmodule[system-readers] + +% \unprotect +% +% \installcorenamespace {markedlines} +% +% \permanent\protected\def\startmarkedlines[#1]% +% {\edef\scratchstring{#1}% +% \scratchcounter\numexpr\inputlineno+\plusone\relax +% \gobbleuntilandfinalize\stopmarkedlines} +% +% \permanent\protected\def\stopmarkedlines +% {\edefcsname\??markedlines\scratchstring\endcsname +% {{\the\scratchcounter}{\the\numexpr\inputlineno+\minusone\relax}}} +% +% \protected\def\firstmarkedline#1% +% {\numexpr +% \ifcsname\??markedlines#1\endcsname +% \normalexpanded{\noexpand\firstoftwoarguments\lastnamedcs}% +% \else +% \zerocount +% \fi +% \relax} +% +% \protected\def\lastmarkedline#1% +% {\numexpr +% \ifcsname\??markedlines#1\endcsname +% \normalexpanded{\noexpand\secondoftwoarguments\lastnamedcs}% +% \else +% \zerocount +% \fi +% \relax} +% +% \protected\def\markedlines#1% +% {\ifcsname\??markedlines\scratchstring\endcsname\lastnamedcs\else{0}{0}\fi} +% +% \protect + +\startluacode + + local createtoken = token.create + local gobbletoken = token.gobble + local integer_value = tokens.values.integer + + local marked = { } + + interfaces.implement { + name = "startmarkedlines", + public = true, + protected = true, + arguments = "optional", + actions = function(tag) + local start = status.readstate.linenumber + 1 + gobbletoken(createtoken("startmarkedlines"),createtoken("stopmarkedlines")) + local state = status.readstate + marked[tag] = { state.filename, start, state.linenumber - 1 } + end + } + + + interfaces.implement { + name = "markedfilename", + public = true, + -- usage = "value", + arguments = "string", + actions = function(tag) + local m = marked[tag] + -- return m and m[1] or "" + context(m and m[1] or "") + end + } + + interfaces.implement { + name = "firstmarkedline", + public = true, + usage = "value", + arguments = "string", + actions = function(tag) + local m = marked[tag] + return integer_value, m and m[2] or 0 + end + } + + interfaces.implement { + name = "lastmarkedline", + public = true, + usage = "value", + arguments = "string", + actions = function(tag) + local m = marked[tag] + return integer_value, m and m[3] or 0 + end + } + +\stopluacode + +\continueifinputfile{m-system-readers.mkxl} + +\starttext + +\startmarkedlines[test] +SOME LINE 1 +SOME LINE 2 +SOME LINE 3 +SOME LINE 4 +\stopmarkedlines + +\startmarkedlines[more] +SOME MORE 1 +SOME MORE 2 +SOME MORE 3 +SOME MORE 4 +\stopmarkedlines + +\begingroup + \newlocalread\myreada + \immediate\openin\myreada {\markedfilename{test}} + \dostepwiserecurse{\lastmarkedline{test}}{\firstmarkedline{test}}{-1}{ + \readline\myreada line #1 to \scratchstring #1 : \scratchstring \par + } + \immediate\closein\myreada +\endgroup + +\blank + +\begingroup + \newlocalread\myreada + \immediate\openin\myreada {\markedfilename{more}} + \dostepwiserecurse{\firstmarkedline{more}}{\lastmarkedline{more}}{1}{ + \read \myreada line #1 to \scratchstring #1 : \scratchstring \par + } + \immediate\closein\myreada +\endgroup + +\stoptext diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl index c779157fc..0f2644403 100644 --- a/tex/context/modules/mkiv/s-system-macros.mkxl +++ b/tex/context/modules/mkiv/s-system-macros.mkxl @@ -146,11 +146,12 @@ ctx_NC() if primitive then ctx_bold(csname) else ctx_verb(csname) end ctx_NC() if parameters then context(parameters > 0 and parameters or "-") end - ctx_NC() context(cscommand) + ctx_NC() if undefined then context.red(false) end + context(cscommand) ctx_NC() if primitive then context(primitive) end ctx_NC() if permanent then context(permanent) end - ctx_NC() if frozen then context(frozen) end ctx_NC() if immutable then context(immutable) end + ctx_NC() if frozen then context(frozen) end ctx_NC() if mutable then context(mutable) end ctx_NC() if instance then context(instance) end ctx_NC() if noaligned then context(noaligned) end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2b731fbd1..cf618d021 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-02-12 18:45 +-- merge date : 2021-02-14 16:11 do -- begin closure to overcome local limits and interference -- cgit v1.2.3