From c49d2942bae7074f3bd4c04b6ee895cee1697ca3 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 29 Apr 2019 09:43:01 +0200 Subject: 2019-04-29 09:01:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-fr.mkii | 1 + tex/context/base/mkiv/buff-imp-default.mkiv | 12 ++--- tex/context/base/mkiv/buff-ini.lua | 46 ++++++++++++++++++- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/lpdf-mis.lua | 13 +++++- tex/context/base/mkiv/meta-ini.mkiv | 4 +- tex/context/base/mkiv/mult-aux.mkiv | 2 +- tex/context/base/mkiv/mult-def.lua | 4 ++ tex/context/base/mkiv/mult-ini.mkiv | 6 +++ tex/context/base/mkiv/mult-low.lua | 2 + tex/context/base/mkiv/pack-mrl.mkiv | 6 ++- tex/context/base/mkiv/pack-rul.mkiv | 12 ++--- tex/context/base/mkiv/spac-ver.mkiv | 2 +- tex/context/base/mkiv/status-files.pdf | Bin 26579 -> 26582 bytes tex/context/base/mkiv/status-lua.pdf | Bin 269096 -> 269122 bytes tex/context/base/mkiv/strc-reg.lua | 26 ++++++++--- tex/context/base/mkiv/syst-aux.lua | 7 +++ tex/context/base/mkiv/syst-aux.mkiv | 67 +++++++++++++--------------- tex/context/base/mkiv/syst-lua.mkiv | 56 +++++++++++------------ tex/context/base/mkiv/syst-mes.mkiv | 6 +-- tex/context/base/mkiv/tabl-ltb.mkiv | 6 +-- tex/context/base/mkiv/tabl-ntb.mkiv | 2 + tex/context/base/mkiv/tabl-tbl.mkiv | 17 ++++--- tex/context/base/mkiv/toks-ini.lua | 2 + tex/context/base/mkiv/trac-inf.lua | 24 ++++++++-- tex/context/base/mkiv/typo-scr.mkiv | 24 +++++----- 29 files changed, 230 insertions(+), 125 deletions(-) (limited to 'tex/context/base') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 6175e3b1f..61201c05c 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{2019.04.25 10:36} +\newcontextversion{2019.04.29 08:52} %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 a3ee5ac4a..4cb1304ab 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{2019.04.25 10:36} +\edef\contextversion{2019.04.29 08:52} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii index b551d9c71..4208b1406 100644 --- a/tex/context/base/mkii/mult-fr.mkii +++ b/tex/context/base/mkii/mult-fr.mkii @@ -373,6 +373,7 @@ \setinterfacevariable{nohz}{nohz} \setinterfacevariable{noline}{noline} \setinterfacevariable{nomarking}{sansmarquage} +\setinterfacevariable{nomenubar}{nomenubar} \setinterfacevariable{none}{rien} \setinterfacevariable{nonumber}{sansnumero} \setinterfacevariable{norepeat}{norepeat} diff --git a/tex/context/base/mkiv/buff-imp-default.mkiv b/tex/context/base/mkiv/buff-imp-default.mkiv index 4da4ff0df..1a125a073 100644 --- a/tex/context/base/mkiv/buff-imp-default.mkiv +++ b/tex/context/base/mkiv/buff-imp-default.mkiv @@ -15,11 +15,13 @@ \unprotect -\setupstartstop - [DefaultSnippet] - [\c!before={\typingparameter\c!before}, - \c!after={\typingparameter\c!after}, - \c!style={\typingparameter\c!style}] +% Happens elsewhere: +% +% \setupstartstop +% [DefaultSnippet] +% [\c!before={\typingparameter\c!before}, +% \c!after={\typingparameter\c!after}, +% \c!style={\typingparameter\c!style}] % Name % NamePrimitive diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua index 08cb03b9e..5b5c47867 100644 --- a/tex/context/base/mkiv/buff-ini.lua +++ b/tex/context/base/mkiv/buff-ini.lua @@ -36,6 +36,7 @@ local scanstring = scanners.string local scaninteger = scanners.integer local scanboolean = scanners.boolean local scancode = scanners.code +local scantokencode = scanners.tokencode ----- scantoken = scanners.token local getters = tokens.getters @@ -357,6 +358,23 @@ local split = table.setmetatableindex(function(t,k) return v end) +local tochar = { + [ 0] = "\\", + [ 1] = "{", + [ 2] = "}", + [ 3] = "$", + [ 4] = "&", + [ 5] = "\n", + [ 6] = "#", + [ 7] = "^", + [ 8] = "_", + [10] = " ", + [14] = "%", +} + +local experiment = false +local experiment = scantokencode and true + function tokens.pickup(start,stop) local stoplist = split[stop] -- totable(stop) local stoplength = #stoplist @@ -367,7 +385,8 @@ function tokens.pickup(start,stop) local list = { } local size = 0 local depth = 0 --- local done = 32 +-- local done = 32 + local scancode = experiment and scantokencode or scancode while true do -- or use depth local char = scancode() if char then @@ -418,15 +437,37 @@ function tokens.pickup(start,stop) local t = gettoken() if t then -- we're skipping leading stuff, like obeyedlines and relaxes + if experiment and size > 0 then + -- we're probably in a macro + local char = tochar[token.get_command(t)] -- could also be char(token.get_mode(t)) + if char then + size = size + 1 ; list[size] = char + else + local csname = token.get_csname(t) + if csname == stop then + stoplength = 0 + break + else + size = size + 1 ; list[size] = "\\" + size = size + 1 ; list[size] = csname + size = size + 1 ; list[size] = " " + end + end + else + -- ignore and hope for the best + end else break end end end local start = 1 - local stop = size-stoplength-1 + local stop = size - stoplength - 1 -- not good enough: only empty lines, but even then we miss the leading -- for verbatim + -- + -- the next is not yet adapted to the new scanner ... we don't need lpeg here + -- for i=start,stop do local li = list[i] if lpegmatch(blackspace,li) then @@ -445,6 +486,7 @@ function tokens.pickup(start,stop) break end end + -- if start <= stop then return concat(list,"",start,stop) else diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 485de7771..ce2c3dae4 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.04.25 10:36} +\newcontextversion{2019.04.29 08:52} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 8b9d4d7b7..9af0fd2e0 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.04.25 10:36} +\edef\contextversion{2019.04.29 08:52} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua index 77f11918b..0f51ea4f6 100644 --- a/tex/context/base/mkiv/lpdf-mis.lua +++ b/tex/context/base/mkiv/lpdf-mis.lua @@ -76,6 +76,7 @@ local v_layer = variables.layer local v_lefttoright = variables.lefttoright local v_righttoleft = variables.righttoleft local v_title = variables.title +local v_nomenubar = variables.nomenubar local positive = register(pageliteral("/GSpositive gs")) local negative = register(pageliteral("/GSnegative gs")) @@ -329,6 +330,9 @@ local plusspecs = { [v_righttoleft] ={ direction = "R2R", }, + [v_nomenubar] ={ + nomenubar = true, + }, } local pagespecs = { @@ -393,6 +397,11 @@ local pagespecs = { duplex = "Simplex", paper = true, }, + [v_nomenubar] = { + mode = "UseNone", + layout = "auto", + nomenubar = true, + }, } local pagespec, topoffset, leftoffset, height, width, doublesided = "default", 0, 0, 0, 0, false @@ -472,6 +481,7 @@ local function documentspecification() local paper = spec.paper local title = spec.title local direction = spec.direction + local nomenubar = spec.nomenubar if layout then addtocatalog("PageLayout",pdfconstant(layout)) end @@ -490,7 +500,7 @@ local function documentspecification() prints = pdfarray(flattened(pages.toranges(marked))) end end - if fit or fixed or duplex or copies or paper or prints or title or direction then + if fit or fixed or duplex or copies or paper or prints or title or direction or nomenubar then addtocatalog("ViewerPreferences",pdfdictionary { FitWindow = fit and true or nil, PrintScaling = fixed and pdfconstant("None") or nil, @@ -500,6 +510,7 @@ local function documentspecification() PrintPageRange = prints or nil, DisplayDocTitle = title and true or nil, Direction = direction and pdfconstant(direction) or nil, + HideMenubar = nomenubar and true or nil, }) end addtoinfo ("Trapped", pdfconstant("False")) -- '/Trapped' in /Info, 'Trapped' in XMP diff --git a/tex/context/base/mkiv/meta-ini.mkiv b/tex/context/base/mkiv/meta-ini.mkiv index ef13affbb..cf2dc883c 100644 --- a/tex/context/base/mkiv/meta-ini.mkiv +++ b/tex/context/base/mkiv/meta-ini.mkiv @@ -594,9 +594,9 @@ \startlmtxmode \def\meta_prepare_variable_yes - {\ifdimen\m_meta_current_variable\or + {\ifchkdim\m_meta_current_variable\or \meta_prepare_variable_dimension - \else\ifnumber\m_meta_current_variable\or + \else\ifchknum\m_meta_current_variable\or \meta_prepare_variable_number \else \doifelsecolor\m_meta_current_variable diff --git a/tex/context/base/mkiv/mult-aux.mkiv b/tex/context/base/mkiv/mult-aux.mkiv index a599f1673..a0839d9f1 100644 --- a/tex/context/base/mkiv/mult-aux.mkiv +++ b/tex/context/base/mkiv/mult-aux.mkiv @@ -31,7 +31,7 @@ \edef\??empty{\Uchar25} \letvalue{\Uchar25}\empty % cancel: dec:24 hex:18 -%edef\s!parent{\Uchar29} \letvalue{\Uchar29}\empty % + inlining  is ugly, a tiny bit faster, but neglectable on a run +% \edef\s!parent{\Uchar29} % inlining  is ugly, a tiny bit faster, but neglectable on a run %D \starttyping %D \unprotect diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index e03a82a76..0fb19e18e 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -15154,6 +15154,10 @@ return { ["pe"]="بدون‌نشانه‌گذاری", ["ro"]="faramarcare", }, + ["nomenubar"]={ + ["en"]="nomenubar", + ["nl"]="geenmenubalk", + }, ["none"]={ ["cs"]="zadny", ["de"]="kein", diff --git a/tex/context/base/mkiv/mult-ini.mkiv b/tex/context/base/mkiv/mult-ini.mkiv index 678d2e965..aa19b4207 100644 --- a/tex/context/base/mkiv/mult-ini.mkiv +++ b/tex/context/base/mkiv/mult-ini.mkiv @@ -124,6 +124,12 @@ \def\s!top {top} \def\s!both {both} +\def\s!orientation{orientation} +\def\s!xoffset {xoffset} +\def\s!xmove {xmove} +\def\s!yoffset {yoffset} +\def\s!ymove {ymove} + %D \macros %D {defineinterfaceconstant, %D defineinterfacevariable, diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 422d47c30..e19f4aa76 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -141,6 +141,8 @@ return { "Ux", "eUx", "Umathaccents", -- "parfillleftskip", "parfillrightskip", + -- + "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode" }, ["helpers"] = { -- diff --git a/tex/context/base/mkiv/pack-mrl.mkiv b/tex/context/base/mkiv/pack-mrl.mkiv index 665d245b3..4a0b68332 100644 --- a/tex/context/base/mkiv/pack-mrl.mkiv +++ b/tex/context/base/mkiv/pack-mrl.mkiv @@ -145,14 +145,16 @@ \setvalue{\??blackruletype mp}% {\frule type {mp}% - data {\includeMPgraphic{\directblackrulesparameter\c!mp}}} + data {\includeMPgraphic{\directblackrulesparameter\c!mp}} + line \dimexpr\directblackrulesparameter\c!rulethickness\relax + } \letvalue{\??blackruletype\s!no }\novrule %letvalue{\??blackruletype\s!yes}\vrule - \setupblackrules [\c!n=3, + \c!rulethickness=\linewidth, \c!alternative=\c!a, \c!distance=.25\emwidth, \c!color=] diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv index 599547032..5fb5c4853 100644 --- a/tex/context/base/mkiv/pack-rul.mkiv +++ b/tex/context/base/mkiv/pack-rul.mkiv @@ -1827,14 +1827,14 @@ \setbox\b_framed_normal\hpack{\lower\d_framed_locator_dp\box\b_framed_normal}% \ht\b_framed_normal\strutht \dp\b_framed_normal\strutdp - \hpack{\box\b_framed_normal}} % why pack + \hpack{\box\b_framed_normal}} % why do we pack .. dange of loosing? \installframedlocator \v!line {} {\setbox\b_framed_normal\hpack{\lower.5\ht\b_framed_normal\box\b_framed_normal}% \ht\b_framed_normal.5\lineheight \dp\b_framed_normal.5\lineheight - \hpack{\box\b_framed_normal}} + \hpack{\box\b_framed_normal}} % why do we pack .. dange of loosing? \installframedlocator \v!low {} @@ -1850,7 +1850,7 @@ \setbox\b_framed_normal\hpack{\lower\d_framed_locator_dp\box\b_framed_normal}% \ht\b_framed_normal\d_framed_locator_ht \dp\b_framed_normal\d_framed_locator_dp - \hpack{\box\b_framed_normal}} + \hpack{\box\b_framed_normal}} % why do we pack .. dange of loosing? \installframedlocator \v!middle {} @@ -1858,7 +1858,7 @@ \setbox\b_framed_normal\hpack{\lower\scratchdimen\box\b_framed_normal}% \ht\b_framed_normal\scratchdimen \dp\b_framed_normal\scratchdimen - \hpack{\box\b_framed_normal}} + \hpack{\box\b_framed_normal}} % why do we pack .. dange of loosing? \installframedlocator \v!lohi % maybe also \v!center {\pack_framed_locator_before\v!middle} @@ -1870,7 +1870,7 @@ \setbox\b_framed_normal\hpack{\lower\d_framed_locator_ht\box\b_framed_normal}% \ht\b_framed_normal\d_framed_locator_dp \dp\b_framed_normal\d_framed_locator_ht - \hpack{\box\b_framed_normal}} + \hpack{\box\b_framed_normal}} % why do we pack .. dange of loosing? \installframedlocator \v!keep % retains height/depth {\pack_framed_remove_depth} @@ -1884,7 +1884,7 @@ \setbox\b_framed_normal\hpack{\lower\d_framed_locator_dp\box\b_framed_normal}% \ht\b_framed_normal\d_framed_locator_ht \dp\b_framed_normal\d_framed_locator_dp - \hpack{\box\b_framed_normal}} + \hpack{\box\b_framed_normal}} % why do we pack .. dange of loosing? % also used in fastlocalframed diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv index 647af3ff6..6c21542dc 100644 --- a/tex/context/base/mkiv/spac-ver.mkiv +++ b/tex/context/base/mkiv/spac-ver.mkiv @@ -2167,7 +2167,7 @@ \unexpanded\def\directvspacing#1% {\par - \ifdimen#1\or + \ifchkdim#1\or \spac_vspacing_dim_preset{\the\dimexpr#1}% \else\ifcsname\??vspacing#1\endcsname \lastnamedcs diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 822213061..e1aed452d 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 8cd4fd845..50ed35f86 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-reg.lua b/tex/context/base/mkiv/strc-reg.lua index 47ba1c533..be3436bd4 100644 --- a/tex/context/base/mkiv/strc-reg.lua +++ b/tex/context/base/mkiv/strc-reg.lua @@ -719,14 +719,30 @@ function registers.compare(a,b) local ka = a.metadata.kind local kb = b.metadata.kind if ka == kb then - local page_a = a.references.realpage - local page_b = b.references.realpage - if not page_a or not page_b then + local ra = a.references + local rb = b.references + local pa = ra.realpage + local pb = rb.realpage + if not pa or not pb then return 0 - elseif page_a < page_b then + elseif pa < pb then return -1 - elseif page_a > page_b then + elseif pa > pb then return 1 + else + -- new, we need to pick the right one of multiple and + -- we want to prevent oscillation in the tuc file so: + local ia = ra.internal + local ib = rb.internal + if not ia or not ib then + return 0 + elseif ia < ib then + return -1 + elseif ia > ib then + return 1 + else + return 0 + end end elseif ka == "see" then return 1 diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua index 15c2ca294..e26da1fc9 100644 --- a/tex/context/base/mkiv/syst-aux.lua +++ b/tex/context/base/mkiv/syst-aux.lua @@ -389,6 +389,13 @@ implement { end } +implement { + name = "benchmarktimer", + actions = function() + statistics.benchmarktimer("whatever") + end +} + implement { name = "elapsedtime", actions = function() diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 80e11d68a..2b7bad2aa 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -572,7 +572,7 @@ % \def\syst_helpers_ignore_par_partoken % {\afterassignment\m_syst_action\let\nexttoken} -\unexpanded\def\assumelongusagecs#1% can be relaxed when we have long support in \hbox etc +\unexpanded\def\assumelongusagecs#1% {\let\m_syst_action#1% \futurelet\nexttoken\syst_helpers_ignore_spacing} @@ -696,9 +696,9 @@ %D \macros %D {globallet,glet} %D -%D In \CONTEXT\ of May 2000 using \type {\globallet} instead of the two -%D tokens will save us some $300\times4=1200$ bytes of format file on a 32~bit -%D system. Not that it matters much today. This shortcut is already defined: +%D In \CONTEXT\ of May 2000 using \type {\globallet} instead of the two tokens will +%D save us some $300\times4=1200$ bytes of format file on a 32~bit system. Not that +%D it matters much today. This shortcut is already defined: \let\globallet\glet @@ -766,13 +766,13 @@ %D {\undefined}! In \ETEX\ we have \type {\ifcsname} and that way of testing on %D existance is not the same as the one described here. Therefore we introduce: -\def\letbeundefined#1% potential stack buildup when used \global +\unexpanded\def\letbeundefined#1% potential stack buildup when used \global {\expandafter\let\csname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue -\def\localundefine#1% conditional +\unexpanded\def\localundefine#1% conditional {\ifcsname#1\endcsname\expandafter\let\csname#1\endcsname\undefined\fi} -\def\globalundefine#1% conditional +\unexpanded\def\globalundefine#1% conditional {\ifcsname#1\endcsname\expandafter\glet\csname#1\endcsname\undefined\fi} %D Beware, being \type {\undefined} in \ETEX\ means that the macro {\em is} defined! @@ -843,23 +843,6 @@ \expandafter\secondoftwoarguments \fi} -%D Slightly faster on longer arguments (0.179 downto 0.141): -%D -%D \testfeatureonce{100000}{\doifelse{aaaaaaaaaaaaaaa}{bbbbbbbbbbbbbbb}\relax\relax} - -% \unexpanded\def\doifelse -% {\afterassignment\doifelse_n\edef\m_syst_string_one} -% -% \unexpanded\def\doifelse_n -% {\afterassignment\doifelse_n_n\edef\m_syst_string_two} -% -% \unexpanded\def\doifelse_n_n -% {\ifx\m_syst_string_one\m_syst_string_two -% \expandafter\firstoftwoarguments -% \else -% \expandafter\secondoftwoarguments -% \fi} - %D \macros %D {doifempty,doifemptyelse,doifnotempty} %D @@ -1228,7 +1211,7 @@ % \else % % \def\syst_helpers_do_process_comma_item -% {\futureexpandis]\gobbleoneargument\syst_helpers_do_do_do_process_comma_item_indeed} +% {\futureexpandis]\gobbleoneargument\syst_helpers_do_do_do_process_comma_item} % % \fi @@ -1374,8 +1357,8 @@ %D \processallactionsinset [x,y,z] [a=>\a,b=>\b,c=>\c] %D \stoptyping %D -%D We can supply both a \type{default} action and an action -%D to be undertaken when an \type{unknown} value is met: +%D We can supply both a \type {default} action and an action to be undertaken when +%D an \type {unknown} value is met: %D %D \starttyping %D \processallactionsinset @@ -1664,21 +1647,21 @@ \startlmtxmode \def\doifelsenumber#1% - {\ifnumber#1\or + {\ifchknum#1\or \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} \def\doifnumber#1% - {\ifnumber#1\or + {\ifchknum#1\or \expandafter\firstoftwoarguments \else \expandafter\gobbleoneargument \fi} \def\doifnotnumber#1% - {\ifnumber#1\or + {\ifchknum#1\or \expandafter\gobbleoneargument \else \expandafter\firstofoneargument @@ -7241,12 +7224,12 @@ \let\syst_helpers_with_set_step \relax \def\syst_helpers_with_set_double[#1][#2]% - {\doifsomething{#1} + {\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} + {\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}} @@ -8132,7 +8115,7 @@ \startlmtxmode \def\doifelsedimension#1% - {\ifdimen#1\or + {\ifchkdim#1\or \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -8357,6 +8340,8 @@ \expandafter\secondoftwoarguments \fi} +% used ? + \def\doifelsenonzeropositive#1% {\begingroup\afterassignment\syst_helpers_if_non_zero_positive_else\privatescratchcounter=0#1\relax\empty\end} @@ -8408,20 +8393,28 @@ \unexpanded\def\testfeature#1#2% {\chardef\c_syst_helpers_test_feature_m#1\relax - \def\syst_helpers_test_feature_step + \def\syst_helpers_test_feature_yes {\advance\c_syst_helpers_test_feature_n\plusone \ifnum\c_syst_helpers_test_feature_n>\c_syst_helpers_test_feature_m\else - #2\expandafter\syst_helpers_test_feature_step + #2\expandafter\syst_helpers_test_feature_yes + \fi}% + \def\syst_helpers_test_feature_nop + {\advance\c_syst_helpers_test_feature_n\plusone + \ifnum\c_syst_helpers_test_feature_n>\c_syst_helpers_test_feature_m\else + \expandafter\syst_helpers_test_feature_nop \fi}% \retestfeature} \unexpanded\def\retestfeature % timer support is new per 10/5/2005 {\bgroup \ifcase\interactionmode\let\wait\relax\fi + \clf_resettimer + \c_syst_helpers_test_feature_n\zerocount + \syst_helpers_test_feature_nop + \clf_benchmarktimer \writestatus\m!system{starting feature test (n=\number\c_syst_helpers_test_feature_m)}\wait - \resettimer \c_syst_helpers_test_feature_n\zerocount - \syst_helpers_test_feature_step + \syst_helpers_test_feature_yes \writestatus\m!system{\number\c_syst_helpers_test_feature_m\space feature tests done (\elapsedseconds s)}% \wait \egroup} diff --git a/tex/context/base/mkiv/syst-lua.mkiv b/tex/context/base/mkiv/syst-lua.mkiv index 3600dac34..a9905c7cc 100644 --- a/tex/context/base/mkiv/syst-lua.mkiv +++ b/tex/context/base/mkiv/syst-lua.mkiv @@ -24,36 +24,32 @@ %D {\expanded} primitive were mentioned in talks.} trip. For now I don't really see %D other useful applications. -\ifdefined\immediateassignment - - \def\expandeddoif#1#2% - {\immediateassignment\edef\m_syst_string_one{#1}% - \immediateassignment\edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} - - \def\expandeddoifnot#1#2% - {\immediateassignment\edef\m_syst_string_one{#1}% - \immediateassignment\edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\gobbleoneargument - \else - \expandafter\firstofoneargument - \fi} - - \def\expandeddoifelse#1#2% - {\immediateassignment\edef\m_syst_string_one{#1}% - \immediateassignment\edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} - -\fi +\def\expandeddoif#1#2% + {\immediateassignment\edef\m_syst_string_one{#1}% + \immediateassignment\edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + +\def\expandeddoifnot#1#2% + {\immediateassignment\edef\m_syst_string_one{#1}% + \immediateassignment\edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + +\def\expandeddoifelse#1#2% + {\immediateassignment\edef\m_syst_string_one{#1}% + \immediateassignment\edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} % \testfeatureonce{100000}{\doifelse{hello world}{here i am}{}} % 0.3 % \testfeatureonce{100000}{\expandabledoifelse{hello world}{here i am}{}} % 1.5 diff --git a/tex/context/base/mkiv/syst-mes.mkiv b/tex/context/base/mkiv/syst-mes.mkiv index 3b16d7f97..4ed2697f1 100644 --- a/tex/context/base/mkiv/syst-mes.mkiv +++ b/tex/context/base/mkiv/syst-mes.mkiv @@ -11,8 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\def\writestring {\immediate\write\statuswrite} -\def\writeline {\writestring{}} -\let\message \normalmessage +\normalprotected\def\writestring {\immediate\write\statuswrite} +\normalprotected\def\writeline {\writestring{}} + \let\message \normalmessage \endinput diff --git a/tex/context/base/mkiv/tabl-ltb.mkiv b/tex/context/base/mkiv/tabl-ltb.mkiv index 20ae8bf5a..ae9ff9151 100644 --- a/tex/context/base/mkiv/tabl-ltb.mkiv +++ b/tex/context/base/mkiv/tabl-ltb.mkiv @@ -293,7 +293,7 @@ \def\tabl_lines_wrap_up_auto {\edef\p_height{\linetablerparameter{x\c!height}}% \edef\p_depth {\linetablerparameter{x\c!depth }}% - \hbox + \hpack {\blackrule [ \c!color=\linetablecparameter\c!backgroundcolor, \c!height=\ifx\p_height\empty\ht\scratchbox\else\p_height\fi, @@ -340,7 +340,7 @@ \nointerlineskip % fix topskip \fi \noindent\strut - \hbox to \hsize{\box\tablebox\c_tabl_lines_part\hss}% + \hpack to \hsize{\box\tablebox\c_tabl_lines_part\hss}% \endgraf \ifnum\c_tabl_lines_part<\c_tabl_lines_n_of_parts\relax \linetableparameter\c!inbetween @@ -756,8 +756,6 @@ \showframe \showstruts -\setupcolors[state=start] - \setuppagenumbering[alternative=doublesided]\page[left] \startlinetable diff --git a/tex/context/base/mkiv/tabl-ntb.mkiv b/tex/context/base/mkiv/tabl-ntb.mkiv index ca3d78800..4bc39da97 100644 --- a/tex/context/base/mkiv/tabl-ntb.mkiv +++ b/tex/context/base/mkiv/tabl-ntb.mkiv @@ -992,6 +992,8 @@ \let\nofTABLErows \!!zerocount \let\nofTABLEcolumns \!!zerocount +% there is no gain in a \doifelsenextoptionalcs variant + \unexpanded\def\dobTR{\dosingleempty\tabl_ntb_tr} % also used in tabl-nte \unexpanded\def\dobTD{\dosingleempty\tabl_ntb_td} % also used in tabl-nte \unexpanded\def\dobTH{\dosingleempty\tabl_ntb_th} % also used in tabl-nte diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv index b18b5e618..ab4fef64a 100644 --- a/tex/context/base/mkiv/tabl-tbl.mkiv +++ b/tex/context/base/mkiv/tabl-tbl.mkiv @@ -2335,7 +2335,7 @@ \def\tabl_tabulate_process {\c_tabl_tabulate_pass\plusone \tabl_tabulate_check_full_content - \edef\v_tabl_tabulate_align{\executeifdefined{\??tabulatealigning\p_align}0}% + \edef\v_tabl_tabulate_align{\ifcsname\??tabulatealigning\p_align\endcsname\lastnamedcs\else0\fi}% \s_tabl_tabulate_first.5\d_tabl_tabulate_unit \s_tabl_tabulate_last\s_tabl_tabulate_first \s_tabl_tabulate_pre\zeropoint @@ -2357,11 +2357,16 @@ \else \donetrue \fi\fi - \ifdone - \global\c_tabl_tabulate_repeathead\executeifdefined{\??tabulateheader\tabulationparameter\c!header}\zerocount - \else - \global\c_tabl_tabulate_repeathead\zerocount - \fi + \global\c_tabl_tabulate_repeathead + \ifdone + \ifcsname\??tabulateheader\tabulationparameter\c!header\endcsname + \lastnamedcs + \else + \zerocount + \fi + \else + \zerocount + \fi % \the\t_tabl_tabulate_initializers_first % collect more here % diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua index 2a288caf6..b7657625b 100644 --- a/tex/context/base/mkiv/toks-ini.lua +++ b/tex/context/base/mkiv/toks-ini.lua @@ -36,6 +36,7 @@ local scan_argument = token.scan_argument local scan_tokenlist = token.scan_tokenlist local scan_int = token.scan_int local scan_code = token.scan_code +local scan_token_code = token.scan_token_code local scan_dimen = token.scan_dimen local scan_glue = token.scan_glue local scan_keyword = token.scan_keyword @@ -146,6 +147,7 @@ tokens.scanners = { -- these expand tokenlist = scan_tokenlist, verbatim = scan_verbatim, code = scan_code, + tokencode = scan_token_code, word = scan_word, number = scan_number, boolean = scan_boolean, diff --git a/tex/context/base/mkiv/trac-inf.lua b/tex/context/base/mkiv/trac-inf.lua index a7823c251..71c65a3f4 100644 --- a/tex/context/base/mkiv/trac-inf.lua +++ b/tex/context/base/mkiv/trac-inf.lua @@ -29,7 +29,7 @@ statistics.threshold = 0.01 local statusinfo, n, registered, timers = { }, 0, { }, { } setmetatableindex(timers,function(t,k) - local v = { timing = 0, loadtime = 0 } + local v = { timing = 0, loadtime = 0, offset = 0 } t[k] = v return v end) @@ -39,7 +39,7 @@ local function hastiming(instance) end local function resettiming(instance) - timers[instance or "notimer"] = { timing = 0, loadtime = 0 } + timers[instance or "notimer"] = { timing = 0, loadtime = 0, offset = 0 } end local ticks = clock @@ -118,12 +118,27 @@ local function stoptiming(instance) return 0 end +local function benchmarktimer(instance) + local timer = timers[instance or "notimer"] + local it = timer.timing + if it > 1 then + timer.timing = it - 1 + else + local starttime = timer.starttime + if starttime and starttime > 0 then + timer.offset = ticks() - starttime + else + timer.offset = 0 + end + end +end + local function elapsed(instance) if type(instance) == "number" then return instance else local timer = timers[instance or "notimer"] - return timer and seconds(timer.loadtime) or 0 + return timer and seconds(timer.loadtime - 2*(timer.offset or 0)) or 0 end end @@ -138,7 +153,7 @@ local function currenttime(instance) else local starttime = timer.starttime if starttime and starttime > 0 then - return seconds(timer.loadtime + ticks() - starttime) + return seconds(timer.loadtime + ticks() - starttime - 2*(timer.offset or 0)) end end return 0 @@ -168,6 +183,7 @@ statistics.elapsed = elapsed statistics.elapsedtime = elapsedtime statistics.elapsedindeed = elapsedindeed statistics.elapsedseconds = elapsedseconds +statistics.benchmarktimer = benchmarktimer -- general function .. we might split this module diff --git a/tex/context/base/mkiv/typo-scr.mkiv b/tex/context/base/mkiv/typo-scr.mkiv index 0dfd111ae..f2b4b0d04 100644 --- a/tex/context/base/mkiv/typo-scr.mkiv +++ b/tex/context/base/mkiv/typo-scr.mkiv @@ -138,18 +138,21 @@ {\dontleavehmode \runninghbox\bgroup \edef\currentlowhigh{#1}% - \dosingleempty} % #2 + \dosingleempty} % #2 \unexpanded\def\typo_scripts_lowhigh_indeed[#1]#2#3% todo: align .. [#1] is compatible hack {\dostarttagged\t!subsup\currentlowhigh + \scratchdimen\lowhighparameter\c!distance\relax \setbox\plusfour\hpack{\typo_scripts_lowhigh_low_high\lower\c!down\t!sub{#2}}% \setbox\plussix \hpack{\typo_scripts_lowhigh_low_high\raise\c!up \t!sup{#3}}% - \doif{#1}{\v!left} - {\ifdim\wd\plusfour<\wd\plussix - \setbox\plusfour\hpack to \wd\plussix {\hss\box\plusfour}% - \else - \setbox\plussix \hpack to \wd\plusfour{\hss\box\plussix }% - \fi}% + \edef\p_align{#1}% + \ifx\p_align\v!left + \ifdim\wd\plusfour<\wd\plussix + \setbox\plusfour\hpack to \wd\plussix {\hss\box\plusfour}% + \else + \setbox\plussix \hpack to \wd\plusfour{\hss\box\plussix }% + \fi + \fi \ifdim\wd\plusfour<\wd\plussix \wd\plusfour\zeropoint \box\plusfour @@ -163,9 +166,7 @@ \egroup} \def\typo_scripts_lowhigh_low_high#1#2#3#4% - {\dontleavehmode - \begingroup - \kern\lowhighparameter\c!distance\relax + {\kern\scratchdimen \setbox\scratchbox\hpack\bgroup #1\lowhighparameter#2\hbox\bgroup \ifx\fontsize\empty @@ -184,8 +185,7 @@ \egroup \ht\scratchbox\strutht \dp\scratchbox\strutdp - \box\scratchbox - \endgroup} + \box\scratchbox} \unexpanded\def\typo_scripts_highlow_indeed[#1]#2#3% {\typo_scripts_lowhigh_indeed[#1]{#3}{#2}} -- cgit v1.2.3