diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-03-21 22:04:41 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-03-21 22:04:41 +0100 |
commit | cb28e8807d7908cc9644c2bd77c9d214dd8caefe (patch) | |
tree | 8865d48126fcb896a21252a42ea679ef6d867973 /tex/context/base/mkxl | |
parent | 9fed721832d90d94caa292b8e6b7f22c88d03c3b (diff) | |
download | context-cb28e8807d7908cc9644c2bd77c9d214dd8caefe.tar.gz |
2021-03-21 21:08:00
Diffstat (limited to 'tex/context/base/mkxl')
-rw-r--r-- | tex/context/base/mkxl/cont-new.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/context.mkxl | 6 | ||||
-rw-r--r-- | tex/context/base/mkxl/driv-shp.lmt | 32 | ||||
-rw-r--r-- | tex/context/base/mkxl/lang-hup.lmt | 156 | ||||
-rw-r--r-- | tex/context/base/mkxl/lang-hyp.lmt | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/luat-cod.lmt | 3 | ||||
-rw-r--r-- | tex/context/base/mkxl/node-bck.lmt | 1 | ||||
-rw-r--r-- | tex/context/base/mkxl/node-res.lmt | 1 | ||||
-rw-r--r-- | tex/context/base/mkxl/page-cst.mkxl | 6 | ||||
-rw-r--r-- | tex/context/base/mkxl/page-mix.mkxl | 30 | ||||
-rw-r--r-- | tex/context/base/mkxl/strc-mat.mkxl | 1 | ||||
-rw-r--r-- | tex/context/base/mkxl/syst-ini.mkxl | 4 |
12 files changed, 118 insertions, 126 deletions
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index bd37945c2..73b7d4664 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.03.20 01:03} +\newcontextversion{2021.03.21 21:05} %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 6a211f58c..6fe6e92a8 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.03.20 01:03} +\immutable\edef\contextversion{2021.03.21 21:05} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -606,12 +606,12 @@ \ctxlua{statistics.savefmtstatus("\jobname","\contextversion","context.mkxl","\contextbanner")}% can become automatic \to \everydump -% some day: +% maybe some day (but also inhibits): % % \prependtoks % \overloadmode 255 % \to \everyjob -\overloadmode 0 % for now +\overloadmode\zerocount % for now \errorstopmode \dump \endinput diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt index d3a47bf0d..80c2faffe 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -54,7 +54,6 @@ local setfield = nuts.setfield local setlink = nuts.setlink local isglyph = nuts.isglyph -local findtail = nuts.tail local nextdir = nuts.traversers.dir local nextnode = nuts.traversers.node @@ -1320,11 +1319,16 @@ do local periods = utilities.strings.newrepeater(".") - local function showdetails(n,l) + local f_detail_0 = formatters["%s %s = %s"] + local f_detail_1 = formatters["%i: %s %s = %s"] + local f_detail_2 = formatters["%i:%i: %s %s = %s"] + + local function showdetails(n,l,tlp,l1,l2) local p = properties[tonut(n)] if p then for k, v in sortedhash(p) do local t = type(v) + local p = periods[l+1] if t == "string" then if find(v,"[\n\r]") then v = "\n" .. stripstring(v) .. "\n" @@ -1336,7 +1340,15 @@ do else v = "<" .. tostring(v) .. ">" end - flushline(periods[l+1] .. " " .. k .. " = " .. v) + if tlp == 3 then + flushline(f_detail_2(l1,l2,p,k,v)) + elseif tlp == 2 then + flushline(f_detail_1(l2,p,k,v)) + elseif tlp == 1 then + flushline(f_detail_1(l1,p,k,v)) + else + flushline(f_detail_0(p,k,v)) + end end end end @@ -1346,12 +1358,16 @@ do literal = showdetails, } - callback.register("show_whatsit",function(n,l) + callback.register("show_whatsit",function(n,what,l,tlp,l1,l2) local s = nodes.whatsitcodes[n.subtype] - flush(" [" .. s .. "]") - local w = whatsittracers[s] - if w then - w(n,l) + if what == 1 then + return s or "unknown" + -- elseif what == 2 then + else + local w = whatsittracers[s] + if w then + w(n,l,tlp,l1,l2) + end end end) diff --git a/tex/context/base/mkxl/lang-hup.lmt b/tex/context/base/mkxl/lang-hup.lmt index cde677102..41548d84d 100644 --- a/tex/context/base/mkxl/lang-hup.lmt +++ b/tex/context/base/mkxl/lang-hup.lmt @@ -6,8 +6,13 @@ if not modules then modules = { } end modules ['lang-hup'] = { license = "see context related readme files" } +local type, next = type, next local utfchar = utf.char local concat, sortedhash = table.concat, table.sortedhash +local basename = file.basename + +local status = status +local nodes = nodes local specialskips = nodes.specialskipcodes local nodecodes = nodes.nodecodes @@ -20,7 +25,6 @@ local par_code = nodecodes.par local line_code = nodes.listcodes.line local fontkern_code = nodes.kerncodes.fontkern local nuts = nodes.nuts -local findtail = nuts.tail local getlist = nuts.getlist local getnext = nuts.getnext local getprev = nuts.getprev @@ -28,9 +32,10 @@ local getid = nuts.getid local getsubtype = nuts.getsubtype local getreplace = nuts.getreplace local getdiscpart = nuts.getdiscpart -local isglyph = nuts.isglyph +local isnextglyph = nuts.isnextglyph local nexthlist = nuts.traversers.list local nextglyph = nuts.traversers.glyph +local traverse = nuts.traverse local setcolor = nodes.tracers.colors.set local setaction = nodes.tasks.setaction @@ -40,146 +45,113 @@ local hash = table.setmetatableindex("number") local report = logs.reporter("hyphenated") local trace_detail = false --- local nexthlist = nuts.traversers.list --- local nextglyph = nuts.traversers.glyph --- --- local setcolor = nodes.tracers.colors.set --- --- function nodes.handlers.showhyphenation(head) --- for current, id, subtype, list in nexthlist, head do --- if subtype == line_code then --- for n in nextglyph, list do --- local d = getdiscpart(n) --- if d == 0 then --- -- nothing --- elseif d == 1 then --- setcolor(n,"red") -- pre --- elseif d == 2 then --- setcolor(n,"blue") -- post --- elseif d == 3 then --- setcolor(n,"green") -- replace --- end --- end --- end --- end --- return head --- end - -local hash = table.setmetatableindex("number") - -local characters = fonts.hashes.characters - -local function collect(t,head) +local characters = fonts.hashes.characters + +local word = { } +local w = 0 + +----- function collect(word,head) +local function collect(head) local last = nil while head do - local char, id = isglyph(head) + local nxt, char, id = isnextglyph(head) if char then local u = characters[id][char].unicode - if u then - if type(u) == "table" then - for i=1,#u do - t[#t+1] = utfchar(u[i]) - end - else - t[#t+1] = utfchar(u) + if type(u) == "table" then + for i=1,#u do + -- word[#word+1] = utfchar(u[i]) + w = w + 1 ; word[w] = utfchar(u[i]) end else - t[#t+1] = utfchar(char) + -- word[#word+1] = utfchar(u or char) + w = w + 1 ; word[w] = utfchar(u or char) end last = head elseif id == disc_code then - collect(t,getreplace(head)) + -- collect(word,getreplace(head)) + collect(getreplace(head)) elseif id == kern_code and getsubtype(head,fontkern_code) then -- we're ok else break end - head = getnext(head) + head = nxt end return last and getdiscpart(last) == 1 end local function getpostpart(current) - local first = nil - while current do - local id = getid(current) + for n, id, subtype in traverse(current) do if id == glue_code then - if not specialskips[getsubtype(current)] then + if not specialskips[subtype] then break end elseif id == glyph_code or id == disc_code then - return current + return n elseif id ~= par_code then break end - current = getnext(current) end end local function findprepart(current) - local tail = findtail(current) - while tail do - local id = getid(tail) + for n, id, subtype in traverse(current,true,true) do if id == glue_code then - if not specialskips[getsubtype(tail)] then + if not specialskips[subtype] then break end - elseif id == glyph_code and getdiscpart(tail) == 1 then - return tail + elseif id == glyph_code and getdiscpart(n) == 1 then + return n else break end - tail = getprev(tail) end end local function getprepart(disc) - local back = getprev(disc) - local okay = back - while okay do - local id = getid(okay) - if id == glyph_code or id == disc_code or (id == kern_code and getsubtype(okay,fontkern_code)) then - back = okay + local back = disc + for n, id, subtype in traverse(getprev(disc),true) do + if id == glyph_code or id == disc_code or (id == kern_code and subtype == fontkern_code) then + back = n else - break + return back end - okay = getprev(okay) end return back end function nodes.handlers.showhyphenation(head) - local current = head - local word = { } - while current do - if getid(current) == hlist_code and getsubtype(current) == line_code then - local list = getlist(current) - if list then - if #word > 0 then - local after = getpostpart(list) - local more = collect(word,after) - if more then - goto skip - else - word = concat(word) - if trace_detail then - local r = status.readstate - report("around line %s in file %s: %s",r.linenumber or "-",file.basename(r.filename),word) - end - hash[word] = hash[word] + 1 - word = { } + -- local word = { } + w = 0 + for current, id, subtype, list in nexthlist, head do + if list and subtype == line_code then + -- if #word > 0 then + if w > 0 then + local after = getpostpart(list) + -- local more = collect(word,after) + local more = collect(after) + if more then + goto skip + else + -- local result = concat(word) + local result = concat(word,"",1,w) + if trace_detail then + local r = status.readstate + report("around line %s in file %s: %s",r.linenumber or "-",basename(r.filename),result) end + hash[result] = hash[result] + 1 + -- word = { } + w = 0 end - local last = findprepart(list) - if last then - local before = getprepart(last) - collect(word,before) - - end - ::skip:: end + local last = findprepart(list) + if last then + local before = getprepart(last) + -- collect(word,before) + collect(before) + end + ::skip:: end - current = getnext(current) end return head end @@ -226,7 +198,7 @@ end) function nodes.handlers.visualizehyphenation(head) for current, id, subtype, list in nexthlist, head do - if subtype == line_code then + if list and subtype == line_code then for n in nextglyph, list do local d = getdiscpart(n) if d == 0 then diff --git a/tex/context/base/mkxl/lang-hyp.lmt b/tex/context/base/mkxl/lang-hyp.lmt index c356dbf3c..d75af4f46 100644 --- a/tex/context/base/mkxl/lang-hyp.lmt +++ b/tex/context/base/mkxl/lang-hyp.lmt @@ -1014,7 +1014,7 @@ featureset.hyphenonly = hyphenonly == v_yes -- [nodecodes.rule] = true, -- [nodecodes.dir] = true, -- [nodecodes.whatsit] = true, - -- [nodecodes.ins] = true, + -- [nodecodes.insert] = true, -- [nodecodes.adjust] = true, -- -- [nodecodes.math] = true, diff --git a/tex/context/base/mkxl/luat-cod.lmt b/tex/context/base/mkxl/luat-cod.lmt index 49d90777d..71f03c0e2 100644 --- a/tex/context/base/mkxl/luat-cod.lmt +++ b/tex/context/base/mkxl/luat-cod.lmt @@ -41,9 +41,6 @@ texconfig.properties_size = 10000 texconfig.error_line = 250 texconfig.half_error_line = 125 -texconfig.level_max = 500 -texconfig.level_chr = 46 -- period - -- registering bytecode chunks local bytedata = lua.bytedata or { } diff --git a/tex/context/base/mkxl/node-bck.lmt b/tex/context/base/mkxl/node-bck.lmt index 9dff3ac40..a814b329d 100644 --- a/tex/context/base/mkxl/node-bck.lmt +++ b/tex/context/base/mkxl/node-bck.lmt @@ -46,7 +46,6 @@ local setattributelist = nuts.setattributelist local setprop = nuts.setprop local takebox = nuts.takebox -local findtail = nuts.tail local nextnode = nuts.traversers.node local nexthlist = nuts.traversers.hlist diff --git a/tex/context/base/mkxl/node-res.lmt b/tex/context/base/mkxl/node-res.lmt index fbb1d1fe2..9c291fcbf 100644 --- a/tex/context/base/mkxl/node-res.lmt +++ b/tex/context/base/mkxl/node-res.lmt @@ -484,6 +484,7 @@ end -- housekeeping local function cleanup(nofboxes) -- todo + -- this is bonus, not really needed local tracers = nodes.tracers if tracers and tracers.steppers then -- to be resolved tracers.steppers.reset() -- todo: make a registration subsystem diff --git a/tex/context/base/mkxl/page-cst.mkxl b/tex/context/base/mkxl/page-cst.mkxl index a6f63a562..0afc2a645 100644 --- a/tex/context/base/mkxl/page-cst.mkxl +++ b/tex/context/base/mkxl/page-cst.mkxl @@ -64,8 +64,8 @@ \c!maxwidth=\makeupwidth] \appendtoks % could become an option - \frozen\instance\setuevalue{\e!start\currentpagegrid}{\startpagegrid[\currentpagegrid]}% - \frozen\instance\setuevalue{\e!stop \currentpagegrid}{\stoppagegrid}% + \frozen\instance\protected\edefcsname\e!start\currentpagegrid\endcsname{\startpagegrid[\currentpagegrid]}% + \frozen\instance\protected\edefcsname\e!stop \currentpagegrid\endcsname{\stoppagegrid}% \clf_definecolumnset { name {\currentpagegrid}% }% @@ -148,6 +148,8 @@ \d_page_grd_max_height\pagegridparameter\c!maxheight\relax \d_page_grd_distance \pagegridparameter\c!distance\relax % + \automigrationmode\zerocount % for now + % \ifcase\c_page_grd_n_of_rows \getrawnoflines{\dimexpr\d_page_grd_max_height-\strutheight+\topskip\relax}% \c_page_grd_n_of_rows\noflines diff --git a/tex/context/base/mkxl/page-mix.mkxl b/tex/context/base/mkxl/page-mix.mkxl index 433d94ab6..86abaca2f 100644 --- a/tex/context/base/mkxl/page-mix.mkxl +++ b/tex/context/base/mkxl/page-mix.mkxl @@ -93,8 +93,8 @@ \appendtoks % could become an option \ifcstok{\mixedcolumnsparameter\c!define}\v!yes - \frozen\instance\setuevalue{\e!start\currentmixedcolumns}{\startmixedcolumns[\currentmixedcolumns]}% - \frozen\instance\setuevalue{\e!stop \currentmixedcolumns}{\stopmixedcolumns}% + \frozen\instance\protected\edefcsname\e!start\currentmixedcolumns\endcsname{\startmixedcolumns[\currentmixedcolumns]}% + \frozen\instance\protected\edefcsname\e!stop \currentmixedcolumns\endcsname{\stopmixedcolumns}% \fi \to \everydefinemixedcolumns @@ -342,7 +342,7 @@ \installcorenamespace{mixedcolumnsseparator} \permanent\protected\def\installmixedcolumnseparator#1#2% - {\setvalue{\??mixedcolumnsseparator#1}{#2}} + {\defcsname\??mixedcolumnsseparator#1\endcsname{#2}} \installmixedcolumnseparator\v!rule {\vrule @@ -591,11 +591,13 @@ \useblankparameter \mixedcolumnsparameter \useprofileparameter\mixedcolumnsparameter % new % + \automigrationmode\zerocount % for now + % \nofcolumns\c_page_mix_n_of_columns} % public %D The otr method related hooks are defined next: -% \setvalue{\??mixedcolumnsbefore\s!otr}% +% \defcsname\??mixedcolumnsbefore\s!otr\endcsname % {\par % \ifdim\pagetotal=\zeropoint \else % \verticalstrut % probably no longer needed @@ -604,7 +606,7 @@ \newcount\c_page_mix_otr_nesting -% \setvalue{\??mixedcolumnsbefore\s!otr}% +% \defcsname\??mixedcolumnsbefore\s!otr\endcsname % {\par % \global\advance\c_page_mix_otr_nesting\plusone % \ifcase\c_page_mix_otr_nesting\or @@ -613,7 +615,7 @@ % \fi % \fi} -\setvalue{\??mixedcolumnsbefore\s!otr}% +\defcsname\??mixedcolumnsbefore\s!otr\endcsname {\par \global\advance\c_page_mix_otr_nesting\plusone \ifcase\c_page_mix_otr_nesting\or @@ -625,7 +627,7 @@ \fi \fi} -\setvalue{\??mixedcolumnsstart\s!otr}% +\defcsname\??mixedcolumnsstart\s!otr\endcsname {\ifcase\c_page_mix_otr_nesting\or \scratchwidth\textwidth \setupoutputroutine[\s!mixedcolumn]% @@ -651,14 +653,14 @@ \usealignparameter\mixedcolumnsparameter \usesetupsparameter\mixedcolumnsparameter} -% \setvalue{\??mixedcolumnsstop\s!otr}% +% \defcsname\??mixedcolumnsstop\s!otr\endcsname % {\par % \ifcase\c_page_mix_otr_nesting\or % \c_page_mix_routine\c_page_mix_routine_balance % \page_otr_trigger_output_routine % \fi} -\setvalue{\??mixedcolumnsstop\s!otr}% +\defcsname\??mixedcolumnsstop\s!otr\endcsname {\par \ifcase\c_page_mix_otr_nesting\or \doifelse{\mixedcolumnsparameter\c!balance}\v!yes @@ -671,7 +673,7 @@ \fi \fi} -\setvalue{\??mixedcolumnsafter\s!otr}% +\defcsname\??mixedcolumnsafter\s!otr\endcsname {\ifcase\c_page_mix_otr_nesting\or \prevdepth\strutdp \page_otr_command_set_vsize @@ -918,10 +920,10 @@ %D Next we define the hooks: -\letvalue{\??mixedcolumnsbefore\s!box}\donothing -\letvalue{\??mixedcolumnsafter \s!box}\donothing +\letcsname\??mixedcolumnsbefore\s!box\endcsname\donothing +\letcsname\??mixedcolumnsafter \s!box\endcsname\donothing -\setvalue{\??mixedcolumnsstart\s!box}% +\defcsname\??mixedcolumnsstart\s!box\endcsname {\edef\p_page_mix_strut{\mixedcolumnsparameter\c!strut}% \setbox\b_page_mix_collected\vbox \bgroup \let\currentoutputroutine\s!mixedcolumn % makes \column work @@ -934,7 +936,7 @@ \ignorespaces \fi} -\setvalue{\??mixedcolumnsstop\s!box}% +\defcsname\??mixedcolumnsstop\s!box\endcsname {\ifx\p_page_mix_strut\v!yes \removeunwantedspaces \endstrut diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl index 5399da133..7efae6a8b 100644 --- a/tex/context/base/mkxl/strc-mat.mkxl +++ b/tex/context/base/mkxl/strc-mat.mkxl @@ -195,7 +195,6 @@ \protected\def\strc_formulas_store_number#1#2#3#4#5% ref, todo:str, \sync % todo: title etc (like float) {\settrue\c_strc_formulas_handle_number - \edef\xx{\formulaparameter\c!list}% \strc_counters_register_component {formula}% \setupcurrentformula \formulaparameter \detokenizedformulaparameter diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index 50304d104..45536d4e4 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -1316,4 +1316,8 @@ \permanent\protected\def\newlocaltoks #1{\setnewlocaltoks #1\emptytoks } \permanent\protected\def\newlocalbox #1{\setnewlocalbox #1\emptybox } +%D Let's be detailed: grouplevel:inputlevel: + +\tracinglevels\plusthree + \protect \endinput |