diff options
Diffstat (limited to 'tex')
42 files changed, 919 insertions, 675 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 61201c05c..02e45fa51 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.29 08:52} +\newcontextversion{2019.05.12 19:05} %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 4cb1304ab..3c43d0529 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.29 08:52} +\edef\contextversion{2019.05.12 19:05} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii index 0f9cc15e1..3eb5e7b3d 100644 --- a/tex/context/base/mkii/mult-en.mkii +++ b/tex/context/base/mkii/mult-en.mkii @@ -373,6 +373,7 @@ \setinterfacevariable{nohz}{nohz} \setinterfacevariable{noline}{noline} \setinterfacevariable{nomarking}{nomarking} +\setinterfacevariable{nomenubar}{nomenubar} \setinterfacevariable{none}{none} \setinterfacevariable{nonumber}{nonumber} \setinterfacevariable{norepeat}{norepeat} diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii index d83672d38..fe387aa1a 100644 --- a/tex/context/base/mkii/mult-it.mkii +++ b/tex/context/base/mkii/mult-it.mkii @@ -373,6 +373,7 @@ \setinterfacevariable{nohz}{nohz} \setinterfacevariable{noline}{noline} \setinterfacevariable{nomarking}{nomarcature} +\setinterfacevariable{nomenubar}{nomenubar} \setinterfacevariable{none}{nessuno} \setinterfacevariable{nonumber}{nonumber} \setinterfacevariable{norepeat}{norepeat} diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index f24438189..e1d0e9b5f 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -373,6 +373,7 @@ \setinterfacevariable{nohz}{nohz} \setinterfacevariable{noline}{noline} \setinterfacevariable{nomarking}{بدوننشانهگذاری} +\setinterfacevariable{nomenubar}{nomenubar} \setinterfacevariable{none}{هیچکدام} \setinterfacevariable{nonumber}{بدونشماره} \setinterfacevariable{norepeat}{norepeat} diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii index 786319956..0f70d88c0 100644 --- a/tex/context/base/mkii/mult-ro.mkii +++ b/tex/context/base/mkii/mult-ro.mkii @@ -373,6 +373,7 @@ \setinterfacevariable{nohz}{nohz} \setinterfacevariable{noline}{noline} \setinterfacevariable{nomarking}{faramarcare} +\setinterfacevariable{nomenubar}{nomenubar} \setinterfacevariable{none}{niciunul} \setinterfacevariable{nonumber}{nonumber} \setinterfacevariable{norepeat}{norepeat} diff --git a/tex/context/base/mkiv/back-lpd.lua b/tex/context/base/mkiv/back-lpd.lua index 1bb4ab846..9a52130b8 100644 --- a/tex/context/base/mkiv/back-lpd.lua +++ b/tex/context/base/mkiv/back-lpd.lua @@ -175,7 +175,8 @@ local pdfcharacters local horizontalmode = true ----- widefontmode = true local scalefactor = 1 -local threshold = 655360 / (10 * 5) -- default is 5 +----- threshold = 655360 / (10 * 5) -- default is 5 +local threshold = 655360 * 50 / 100 local tjfactor = 100 / 65536 lpdf.usedcharacters = usedcharacters @@ -190,7 +191,8 @@ local function updatefontstate(font) horizontalmode = fontparameters.writingmode ~= "vertical" -- widefontmode = fontproperties.encodingbytes == 2 scalefactor = (designsize/size) * tjfactor - threshold = designsize / (10 * (fontproperties.threshold or 5)) + -- threshold = designsize / (10 * (fontproperties.threshold or 5)) + threshold = designsize * (fontproperties.threshold or 50) / 100 end -- helpers @@ -502,6 +504,7 @@ local flushcharacter do if move or need_tm then if not need_tm then if horizontalmode then +-- print(tj_delta,threshold) if (saved_text_pos_v + tmty) ~= pdf_v then need_tm = true elseif tj_delta >= threshold or tj_delta <= -threshold then diff --git a/tex/context/base/mkiv/buff-imp-xml.lua b/tex/context/base/mkiv/buff-imp-xml.lua index 0c48ed3b0..7bac868d7 100644 --- a/tex/context/base/mkiv/buff-imp-xml.lua +++ b/tex/context/base/mkiv/buff-imp-xml.lua @@ -41,7 +41,9 @@ local handler = visualizers.newhandler { } local comment = P("--") -local name = (patterns.letter + patterns.digit + S('_-.'))^1 +local alsoname = patterns.utf8two + patterns.utf8three + patterns.utf8four +----- alsoname = R("\128\255") -- basically any encoding without checking (fast) +local name = (patterns.letter + patterns.digit + S('_-.') + alsoname)^1 local entity = P("&") * (1-P(";"))^1 * P(";") local openbegin = P("<") local openend = P("</") diff --git a/tex/context/base/mkiv/cont-log.mkiv b/tex/context/base/mkiv/cont-log.mkiv index f9fc6a8f7..8a256a7a9 100644 --- a/tex/context/base/mkiv/cont-log.mkiv +++ b/tex/context/base/mkiv/cont-log.mkiv @@ -198,14 +198,14 @@ %D Some placeholders: -\unexpanded\def\eTeX {\mathematics{\varepsilon}-\TeX} -\unexpanded\def\pdfTeX {pdf\wordboundary\TeX} -\unexpanded\def\pdfeTeX {pdfe-\wordboundary\TeX} -\unexpanded\def\luaTeX {lua\wordboundary\TeX} -\unexpanded\def\Lua {Lua} -\unexpanded\def\luajitTeX{luajit\wordboundary\TeX} -\unexpanded\def\metaTeX {meta\wordboundary\TeX} -%unexpanded\def\XeTeX {X\lower.5\exheight\hbox{\kern-.15\emwidth\mirror{E}}\kern-.1667\emwidth\TeX} +\unexpanded\def\eTeX {\mathematics{\varepsilon}-\TeX} +\unexpanded\def\pdfTeX {pdf\wordboundary\TeX} +\unexpanded\def\pdfeTeX {pdfe-\wordboundary\TeX} +\unexpanded\def\luaTeX {lua\wordboundary\TeX} +\unexpanded\def\Lua {Lua} +\unexpanded\def\luajitTeX {lua\wordboundary jit\wordboundary\TeX} +\unexpanded\def\luametaTeX{lua\wordboundary meta\wordboundary\TeX} +%unexpanded\def\XeTeX {X\lower.5\exheight\hbox{\kern-.15\emwidth\mirror{E}}\kern-.1667\emwidth\TeX} % Adapted from a patch by Mojca: @@ -229,13 +229,15 @@ \fi}% \kern-.1667\emwidth\TeX} -\let\ETEX \eTeX -\let\PDFTEX \pdfTeX -\let\PDFETEX \pdfeTeX -\let\LUATEX \luaTeX -\let\LUAJITTEX\luajitTeX -\let\LuaTeX \luaTeX -\let\XETEX \XeTeX +\let\ETEX \eTeX +\let\PDFTEX \pdfTeX +\let\PDFETEX \pdfeTeX +\let\LUATEX \luaTeX +\let\LUAJITTEX \luajitTeX +\let\LuaTeX \luaTeX +\let\LuaMetaTeX\luametaTeX +\let\LUAMETATEX\luametaTeX +\let\XETEX \XeTeX \unexpanded\def\LuaTeX {\dontleavehmode @@ -286,15 +288,16 @@ \unexpanded\def\LMTX{lmtx} \appendtoks - \def\ConTeXt {ConTeXt}% - \def\MetaPost {MetaPost}% - \def\MetaFont {MetaFont}% - \def\MetaFun {MetaFun}% - \def\TeX {TeX}% - \def\TeXsuffix{TeX}% - \def\TeXprefix{TeX}% - \def\LuaTeX {LuaTeX}% - \def\LuajitTeX{LuajitTeX}% + \def\ConTeXt {ConTeXt}% + \def\MetaPost {MetaPost}% + \def\MetaFont {MetaFont}% + \def\MetaFun {MetaFun}% + \def\TeX {TeX}% + \def\TeXsuffix {TeX}% + \def\TeXprefix {TeX}% + \def\LuaTeX {LuaTeX}% + \def\LuajitTeX {LuajitTeX}% + \def\LuaMetaTeX{LuaMetaTeX}% \let\wordboundary\empty \to \everysimplifycommands diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index ce2c3dae4..91e76c307 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.29 08:52} +\newcontextversion{2019.05.12 19:05} %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 9af0fd2e0..42af8904e 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.29 08:52} +\edef\contextversion{2019.05.12 19:05} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/driv-shp.lua b/tex/context/base/mkiv/driv-shp.lua index bc8073233..4dffa947e 100644 --- a/tex/context/base/mkiv/driv-shp.lua +++ b/tex/context/base/mkiv/driv-shp.lua @@ -234,6 +234,9 @@ local function flush_vf_packet(pos_h,pos_v,pos_r,font,char,data,factor,vfcommand if fnt then pos_h = pos_h + flushchar(font,char,fnt,chr,f,e) end + else + -- safeguard, we assume the font itself (often index 1) + pos_h = pos_h + flushchar(font,char,font,chr,f,e) end end elseif command == "right" then diff --git a/tex/context/base/mkiv/font-imp-quality.lua b/tex/context/base/mkiv/font-imp-quality.lua index 56e91df99..5152d212f 100644 --- a/tex/context/base/mkiv/font-imp-quality.lua +++ b/tex/context/base/mkiv/font-imp-quality.lua @@ -523,8 +523,8 @@ local function initialize(tfmdata,value) if properties then value = tonumber(value) if value then - if value < 5 then - value = 5 + if value < 0 then + value = 0 elseif value > 100 then value = 100 end diff --git a/tex/context/base/mkiv/lpdf-emb.lua b/tex/context/base/mkiv/lpdf-emb.lua index 744011341..8eab10c3b 100644 --- a/tex/context/base/mkiv/lpdf-emb.lua +++ b/tex/context/base/mkiv/lpdf-emb.lua @@ -127,9 +127,7 @@ local tounicode_template = [[ <0000> <FFFF> endcodespacerange %i beginbfchar - %s - endbfchar endcmap CMapName currentdict /CMap defineresource pop @@ -1709,7 +1707,6 @@ function lpdf.flushfonts() end -- this is no not yet ok for tfm / type 1 - for hash, details in sortedhash(mainfonts) do if next(details.indices) then local filename = details.filename @@ -1860,7 +1857,7 @@ updaters.register("backend.update.pdf",function() function pdf.includechar () end -- maybe, when we need it function pdf.includefont () end -- maybe, when we need it function pdf.includecharlist () end -- maybe, when we need it - function pdf.setomitcidset (v) includecidset = not v end + function pdf.setomitcidset (v) includecidset = not toboolean(v) end function pdf.setomitcharset () end -- we don't need that in lmtx function pdf.setsuppressoptionalinfo() end -- we don't need that in lmtx function pdf.mapfile (n) loadmapfile(n) end diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua index b255477cb..348ecbbe4 100644 --- a/tex/context/base/mkiv/lxml-ini.lua +++ b/tex/context/base/mkiv/lxml-ini.lua @@ -82,7 +82,7 @@ implement { name = "xmllast", actions = lxml.last, arg implement { name = "xmllastatt", actions = lxml.lastatt } implement { name = "xmllastmatch", actions = lxml.lastmatch } implement { name = "xmllastpar", actions = lxml.lastpar } -implement { name = "xmlload", actions = lxml.load, arguments = "3 strings" } +implement { name = "xmlloadfile", actions = lxml.load, arguments = "3 strings" } implement { name = "xmlloadbuffer", actions = lxml.loadbuffer, arguments = "3 strings" } implement { name = "xmlloaddata", actions = lxml.loaddata, arguments = "3 strings" } implement { name = "xmlloaddirectives", actions = lxml.directives.load, arguments = "string" } diff --git a/tex/context/base/mkiv/lxml-ini.mkiv b/tex/context/base/mkiv/lxml-ini.mkiv index 5cb4bb22d..773772e61 100644 --- a/tex/context/base/mkiv/lxml-ini.mkiv +++ b/tex/context/base/mkiv/lxml-ini.mkiv @@ -38,9 +38,14 @@ \def\xmlconcat #1#2#3{\clf_xmlconcat {#1}{#2}{\detokenize{#3}}} \def\xmlconcatrange #1#2#3#4#5{\clf_xmlconcatrange{#1}{#2}{#3}{#4}{\detokenize{#5}}} -\def\xmlload #1#2{\clf_xmlload {#1}{#2}{\directxmlparameter\c!compress}} -\def\xmlloadbuffer #1#2{\clf_xmlloadbuffer {#1}{#2}{\directxmlparameter\c!compress}} -\def\xmlloaddata #1#2{\clf_xmlloaddata {#1}{#2}{\directxmlparameter\c!compress}} + +%D Maybe I should add \type {\unexpanded} here: + +\def\xmlloadfile #1#2{\clf_xmlloadfile {#1}{#2}{\directxmlparameter\c!compress}} +\def\xmlloadbuffer#1#2{\clf_xmlloadbuffer{#1}{#2}{\directxmlparameter\c!compress}} +\def\xmlloaddata #1#2{\clf_xmlloaddata {#1}{#2}{\directxmlparameter\c!compress}} + +\let\xmlload\xmlloadfile % aliased diff --git a/tex/context/base/mkiv/lxml-tab.lua b/tex/context/base/mkiv/lxml-tab.lua index 1ef83c47d..a779cd50c 100644 --- a/tex/context/base/mkiv/lxml-tab.lua +++ b/tex/context/base/mkiv/lxml-tab.lua @@ -920,6 +920,15 @@ local function handlenewline() currentline = currentline + 1 end +-- first = ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#x00F8-#x02FF] | +-- [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | +-- [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | +-- [#x10000-#xEFFFF] +-- rest = "-" | "." | [0-9] | #xB7 | [#x300-#x36F] | [#x203F-#x2040] +-- name = first + (first + rest)^1 +-- +-- We assume utf and do no real checking! + local spacetab = S(' \t') local space = S(' \r\n\t') local newline = lpegpatterns.newline / handlenewline @@ -933,7 +942,11 @@ local slash = P('/') local colon = P(':') local semicolon = P(';') local ampersand = P('&') -local valid = R('az', 'AZ', '09') + S('_-.') +----- valid_0 = lpegpatterns.utf8two + lpegpatterns.utf8three + lpegpatterns.utf8four +local valid_0 = R("\128\255") -- basically any encoding without checking (fast) +local valid_1 = R('az', 'AZ') + S('_') + valid_0 +local valid_2 = valid_1 + R('09') + S('-.') +local valid = valid_1 * valid_2^0 local name_yes = C(valid^1) * colon * C(valid^1) local name_nop = C(P(true)) * C(valid^1) local name = name_yes + name_nop diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua index 0d501890b..1ced3a998 100644 --- a/tex/context/base/mkiv/node-ltp.lua +++ b/tex/context/base/mkiv/node-ltp.lua @@ -7,9 +7,8 @@ if not modules then modules = { } end modules ['node-par'] = { comment = "a translation of the built in parbuilder, initial convertsin by Taco Hoekwater", } +-- todo: not yet in sync with the experimental variant on my disk -- todo: remove nest_stack from linebreak.w --- todo: use ex field as signal (index in ?) --- todo: attr driven unknown/on/off -- todo: permit global steps i.e. using an attribute that sets min/max/step and overloads the font parameters -- todo: split the three passes into three functions -- todo: simplify the direction stack, no copy needed @@ -19,10 +18,8 @@ if not modules then modules = { } end modules ['node-par'] = { -- todo: maybe split expansion code paths -- todo: fix line numbers (cur_list.pg_field needed) -- todo: check and improve protrusion --- todo: arabic etc (we could use pretty large scales there) .. marks and cursive --- todo: see: we need to check this with the latest patches to the tex kernel +-- todo: I need to check this with the latest patches to the tex kernel -- todo: adapt math glue spacing to new model (left/right) - -- todo: optimize a bit more (less par.*) --[[ @@ -132,56 +129,11 @@ if not modules then modules = { } end modules ['node-par'] = { A next iteration will provide plug-ins and more control. I will also explore the possibility to avoid the redundant hpack calculations (easier now, although I've only done some quick and dirty experiments.) -]]-- - ---[[-- - -#define dir_TLT 0 -#define dir_TRT 1 -#define dir_LTL 2 -#define dir_RTT 3 - -#define dir_TLT_or_TRT(A) (A < 2) -#define dir_LTL_or_RTT(A) (A > 1) - -#define textdir_parallel(A,B) (\ -(dir_TLT_or_TRT(A) and dir_TLT_or_TRT(B)) or \ -(dir_LTL_or_RTT(A) and dir_LTL_or_RTT(B))\ -) - -#define pardir_parallel(A,B) (\ -(dir_TLT_or_TRT(A) and dir_TLT_or_TRT(B)) or \ -(dir_LTL_or_RTT(A) and dir_LTL_or_RTT(B))\ -) - -#define pardir_opposite(A,B) (\ -(A == dir_LTL and B == dir_RTT) or \ -(A == dir_RTT and B == dir_LTL)\ -) - -#define textdir_opposite(A,B) (\ -(A == dir_TLT and B == dir_TRT) or \ -(A == dir_TRT and B == dir_TLT)\ -) - -#define glyphdir_opposite(A,B) 0 - -#define pardir_equal(A,B) (\ -(dir_TLT_or_TRT(A) and dir_TLT_or_TRT(B)) or \ -(A == dir_LTL and B == dir_LTL) or \ -(A == dir_RTT and B == dir_RTT)\ -) + The code has been adapted to the more reasonable and simplified direction model. -#define textdir_equal(A,B) (\ -(A == dir_TLT and B == dir_TLT) or \ -(A == dir_TRT and B == dir_TRT) or \ -(A == dir_LTL and dir_LTL_or_RTT(B)) or \ -(A == dir_RTT and dir_LTL_or_RTT(B))\ -) - ---]]-- +]]-- -local tonumber = tonumber +local tonumber, unpack = tonumber, unpack local utfchar = utf.char local write, write_nl = texio.write, texio.write_nl local sub, formatters = string.sub, string.formatters @@ -199,8 +151,12 @@ local report_parbuilders = logs.reporter("nodes","parbuilders") ----- report_hpackers = logs.reporter("nodes","hpackers") local calculate_badness = tex.badness -local texnest = tex.nest +----- texnest = tex.nest local texlists = tex.lists +local texget = tex.get +local texset = tex.set +local texgetglue = tex.getglue + -- (t == 0 and 0) or (s <= 0 and 10000) or calculate_badness(t,s) @@ -259,7 +215,6 @@ local getwidth = nuts.getwidth local getheight = nuts.getheight local getdepth = nuts.getdepth local getdata = nuts.getdata -local getwhd = nuts.getwhd local isglyph = nuts.isglyph @@ -279,7 +234,6 @@ local setshift = nuts.setshift local setwidth = nuts.setwidth local setexpansion = nuts.setexpansion -local slide_node_list = nuts.slide -- get rid of this, probably ok > 78.2 local find_tail = nuts.tail local copy_node = nuts.copy local flush_node = nuts.flush @@ -291,6 +245,7 @@ local insert_node_after = nuts.insert_after local insert_node_before = nuts.insert_before local is_zero_glue = nuts.is_zero_glue local is_skipable = nuts.protrusion_skippable +local setattributelist = nuts.setattributelist local nodepool = nuts.pool @@ -320,6 +275,7 @@ local unset_code = nodecodes.unset local marginkern_code = nodecodes.marginkern local dir_code = nodecodes.dir local boundary_code = nodecodes.boundary +local localpar_code = nodecodes.localpar local protrusionboundary_code = boundarycodes.protrusion @@ -552,12 +508,10 @@ local function kern_stretch_shrink(p,d) local stretch = data.stretch local shrink = data.shrink if stretch ~= 0 then - -- stretch = data.factor * (d * stretch - d) - stretch = data.factor * d * (stretch - 1) + stretch = data.factor * d * (stretch - 1) end if shrink ~= 0 then - -- shrink = data.factor * (d * shrink - d) - shrink = data.factor * d * (shrink - 1) + shrink = data.factor * d * (shrink - 1) end return stretch, shrink end @@ -785,12 +739,7 @@ local function add_to_width(line_break_dir,checked_expansion,s) -- split into tw while s do local char, id = isglyph(s) if char then - local wd, ht, dp = getwhd(s) - if is_rotated(line_break_dir) then - size = size + ht + dp - else - size = size + wd - end + size = size + getwidth(s) if checked_expansion then local data = checked_expansion[id] -- id == font if data then @@ -802,12 +751,7 @@ local function add_to_width(line_break_dir,checked_expansion,s) -- split into tw end end elseif id == hlist_code or id == vlist_code then - local wd, ht, dp = getwhd(s) - if textdir_parallel(getdirection(s),line_break_dir) then - size = size + wd - else - size = size + ht + dp - end + size = size + getwidth(s) elseif id == kern_code then local kern = getkern(s) if kern ~= 0 then @@ -910,20 +854,21 @@ do local function append_to_vlist(par, b) local prev_depth = par.prev_depth local head_field = par.head_field - local tail_field = head_field and slide_node_list(head_field) -- todo: find_tail + local tail_field = head_field and find_tail(head_field) local is_hlist = getid(b) == hlist_code - -- if prev_depth > par.ignored_dimen then if prev_depth > ignore_depth then if is_hlist then - local width, stretch, shrink, stretch_order, shrink_order = getglue(par.baseline_skip) + -- we can fetch the skips values earlier if needed + local width, stretch, shrink, stretch_order, shrink_order = unpack(par.baseline_skip) local delta = width - prev_depth - getheight(b) -- deficiency of space between baselines local skip = nil if delta < par.line_skip_limit then - width, stretch, shrink, stretch_order, shrink_order = getglue(par.lineskip) + width, stretch, shrink, stretch_order, shrink_order = unpack(par.lineskip) skip = new_lineskip(width, stretch, shrink, stretch_order, shrink_order) else skip = new_baselineskip(delta, stretch, shrink, stretch_order, shrink_order) end + setattributelist(skip,par.head) if head_field then setlink(tail_field,skip) else @@ -941,14 +886,14 @@ do if is_hlist then local pd = getdepth(b) par.prev_depth = pd - texnest[texnest.ptr].prevdepth = pd + texset("prevdepth",pd) end end local function append_list(par, b) local head_field = par.head_field if head_field then - local n = slide_node_list(head_field) -- todo: find_tail + local n = find_tail(head_field) setlink(n,b) else par.head_field = b @@ -961,18 +906,18 @@ do local function initialize_line_break(head,display) - local hang_indent = tex.hangindent or 0 - local hsize = tex.hsize or 0 - local hang_after = tex.hangafter or 0 - local par_shape_ptr = tex.parshape - local left_skip = tonut(tex.leftskip) -- nodes - local right_skip = tonut(tex.rightskip) -- nodes - local pretolerance = tex.pretolerance - local tolerance = tex.tolerance - local adjust_spacing = tex.adjustspacing - local protrude_chars = tex.protrudechars - local last_line_fit = tex.lastlinefit - local par_dir = tex.pardirection + local hang_indent = texget("hangindent") + local hsize = texget("hsize") + local hang_after = texget("hangafter") + local par_shape_ptr = texget("parshape") + local left_skip = tonut(texget("leftskip")) -- nodes + local right_skip = tonut(texget("rightskip")) -- nodes + local pretolerance = texget("pretolerance") + local tolerance = texget("tolerance") + local adjust_spacing = texget("adjustspacing") + local protrude_chars = texget("protrudechars") + local last_line_fit = texget("lastlinefit") + local par_dir = texget("pardirection") local newhead = new_temp() setnext(newhead,head) @@ -996,11 +941,11 @@ do pass_number = 0, -- the number of passive nodes allocated on this pass auto_breaking = 0, -- make auto_breaking accessible out of line_break - active_width = { size = 0, stretch = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0, adjust_stretch = 0, adjust_shrink = 0 }, - break_width = { size = 0, stretch = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0, adjust_stretch = 0, adjust_shrink = 0 }, + active_width = { size = 0, normal = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0, adjust_stretch = 0, adjust_shrink = 0 }, + break_width = { size = 0, normal = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0, adjust_stretch = 0, adjust_shrink = 0 }, disc_width = { size = 0, adjust_stretch = 0, adjust_shrink = 0 }, - fill_width = { stretch = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0 }, - background = { size = 0, stretch = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0 }, + fill_width = { normal = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0 }, + background = { size = 0, normal = 0, fi = 0, fil = 0, fill = 0, filll = 0, shrink = 0 }, hang_indent = hang_indent, hsize = hsize, @@ -1017,39 +962,29 @@ do max_shrink_ratio = adjust_spacing_status, cur_font_step = adjust_spacing_status, checked_expansion = false, - tracing_paragraphs = tex.tracingparagraphs > 0, - - emergency_stretch = tex.emergencystretch or 0, - looseness = tex.looseness or 0, - line_penalty = tex.linepenalty or 0, - hyphen_penalty = tex.hyphenpenalty or 0, - broken_penalty = tex.brokenpenalty or 0, - inter_line_penalty = tex.interlinepenalty or 0, - club_penalty = tex.clubpenalty or 0, - widow_penalty = tex.widowpenalty or 0, - display_widow_penalty = tex.displaywidowpenalty or 0, - ex_hyphen_penalty = tex.exhyphenpenalty or 0, - - adj_demerits = tex.adjdemerits or 0, - double_hyphen_demerits = tex.doublehyphendemerits or 0, - final_hyphen_demerits = tex.finalhyphendemerits or 0, + tracing_paragraphs = texget("tracingparagraphs") > 0, - first_line = 0, -- texnest[texnest.ptr].modeline, -- 0, -- cur_list.pg_field + emergency_stretch = texget("emergencystretch") or 0, + looseness = texget("looseness") or 0, + line_penalty = texget("linepenalty") or 0, + broken_penalty = texget("brokenpenalty") or 0, + inter_line_penalty = texget("interlinepenalty") or 0, + club_penalty = texget("clubpenalty") or 0, + widow_penalty = texget("widowpenalty") or 0, + display_widow_penalty = texget("displaywidowpenalty") or 0, - -- each_line_height = tex.pdfeachlineheight or 0, -- this will go away - -- each_line_depth = tex.pdfeachlinedepth or 0, -- this will go away - -- first_line_height = tex.pdffirstlineheight or 0, -- this will go away - -- last_line_depth = tex.pdflastlinedepth or 0, -- this will go away + adj_demerits = texget("adjdemerits") or 0, + double_hyphen_demerits = texget("doublehyphendemerits") or 0, + final_hyphen_demerits = texget("finalhyphendemerits") or 0, - -- ignored_dimen = tex.pdfignoreddimen or 0, + first_line = texget("prevgraf"), + prev_depth = texget("prevdepth"), - baseline_skip = tonut(tex.baselineskip), - lineskip = tonut(tex.lineskip), - line_skip_limit = tex.lineskiplimit, + baseline_skip = { texgetglue("baselineskip") }, + lineskip = { texgetglue("lineskip") }, + line_skip_limit = texget("lineskiplimit"), - prev_depth = texnest[texnest.ptr].prevdepth, - - final_par_glue = slide_node_list(head), -- todo: we know tail already, slow + final_par_glue = find_tail(head), par_break_dir = par_dir, line_break_dir = par_dir, @@ -1243,22 +1178,18 @@ do local function post_line_break(par) - local prevgraf = texnest[texnest.ptr].prevgraf + local prevgraf = par.first_line -- or texget("prevgraf") local current_line = prevgraf + 1 -- the current line number being justified - local adjust_spacing = par.adjust_spacing local protrude_chars = par.protrude_chars local statistics = par.statistics - - local stack = new_dir_stack() - local leftskip = par.used_left_skip -- used or normal ? local rightskip = par.right_skip local parshape = par.par_shape_ptr - ----- ignored_dimen = par.ignored_dimen - local adapt_width = par.adapt_width + local stack = new_dir_stack() + -- reverse the links of the relevant passive nodes, goto first breakpoint local current_break = nil @@ -1288,7 +1219,7 @@ do if not lastnode then -- only at the end - lastnode = slide_node_list(head) -- todo: find_tail + lastnode = find_tail(head) if lastnode == par.final_par_glue then lineend = lastnode lastnode = getprev(lastnode) @@ -1297,7 +1228,9 @@ do local id = getid(lastnode) if id == glue_code then -- lastnode is normal skip - lastnode = replace_node(lastnode,new_rightskip(rightskip)) + local r = new_rightskip(rightskip) + setattributelist(r,lastnode) + lastnode = replace_node(lastnode,r) glue_break = true lineend = lastnode lastnode = getprev(lastnode) @@ -1387,34 +1320,38 @@ do setnext(lineend) if not glue_break then if rightskip then - insert_node_after(lineend,lineend,new_rightskip(right_skip)) -- lineend moves on as pseudo head + local r = new_rightskip(right_skip) + setattributelist(r,lastnode) + insert_node_after(lineend,lineend,r) -- lineend moves on as pseudo head end end -- each time ? - local q = getnext(head) + local start = getnext(head) setlink(head,r) -- insert leftbox (if needed after parindent) local leftbox = current_break.passive_left_box if leftbox then - local first = getnext(q) + local first = getnext(start) if first and current_line == (par.first_line + 1) and getid(first) == hlist_code and not getlist(first) then - insert_node_after(q,q,copy_node(leftbox)) + insert_node_after(start,start,copy_node(leftbox)) else - q = insert_node_before(q,q,copy_node(leftbox)) + start = insert_node_before(start,start,copy_node(leftbox)) end end if protrude_chars > 0 then - local p = find_protchar_left(q) + local p = find_protchar_left(start) if p and getid(p) == glyph_code then local w, last_leftmost_char = left_pw(p) if last_leftmost_char and w ~= 0 then - -- so we inherit attributes, q is pseudo head and moves back - q = insert_node_before(q,q,new_leftmarginkern(copy_node(last_leftmost_char),-w)) + -- so we inherit attributes, start is pseudo head and moves back + start = insert_node_before(start,start,new_leftmarginkern(copy_node(last_leftmost_char),-w)) end end end if leftskip then - q = insert_node_before(q,q,new_leftskip(leftskip)) + local l = new_leftskip(leftskip) + setattributelist(l,start) + start = insert_node_before(start,start,l) end local cur_width, cur_indent if current_line > par.last_special_line then @@ -1439,9 +1376,9 @@ do local finished_line = nil if adjust_spacing > 0 then statistics.nofadjustedlines = statistics.nofadjustedlines + 1 - finished_line = xpack_nodes(q,cur_width,"cal_expand_ratio",par.par_break_dir,par.first_line,current_line) -- ,current_break.analysis) + finished_line = xpack_nodes(start,cur_width,"cal_expand_ratio",par.par_break_dir,par.first_line,current_line) -- ,current_break.analysis) else - finished_line = xpack_nodes(q,cur_width,"exactly",par.par_break_dir,par.first_line,current_line) -- ,current_break.analysis) + finished_line = xpack_nodes(start,cur_width,"exactly",par.par_break_dir,par.first_line,current_line) -- ,current_break.analysis) end if protrude_chars > 0 then statistics.nofprotrudedlines = statistics.nofprotrudedlines + 1 @@ -1451,22 +1388,7 @@ do local pre_adjust_head = texlists.pre_adjust_head -- setshift(finished_line,cur_indent) - -- - -- -- this is gone: - -- - -- if par.each_line_height ~= ignored_dimen then - -- setheight(finished_line,par.each_line_height) - -- end - -- if par.each_line_depth ~= ignored_dimen then - -- setdepth(finished_line,par.each_line_depth) - -- end - -- if par.first_line_height ~= ignored_dimen and (current_line == par.first_line + 1) then - -- setheight(finished_line,par.first_line_height) - -- end - -- if par.last_line_depth ~= ignored_dimen and current_line + 1 == par.best_line then - -- setdepth(finished_line,par.last_line_depth) - -- end - -- + -- if texlists.pre_adjust_head ~= pre_adjust_head then append_list(par, texlists.pre_adjust_head) texlists.pre_adjust_head = pre_adjust_head @@ -1502,7 +1424,9 @@ do end end if pen ~= 0 then - append_to_vlist(par,new_penalty(pen)) + local p = new_penalty(pen) + setattributelist(p,par.head) + append_to_vlist(par,p) end end current_line = current_line + 1 @@ -1548,12 +1472,24 @@ do -- if current_line ~= par.best_line then -- report_parbuilders("line breaking") -- end - par.head = nil -- needs checking + local h = par.head + if h then + if trace_basic then + if getnext(h) then + report_parbuilders("something is left over") + end + if getid(h) ~= localpar_code then + report_parbuilders("no local par node") + end + end + flush_node(h) + par.head = nil -- needs checking + end current_line = current_line - 1 if trace_basic then report_parbuilders("paragraph broken into %a lines",current_line) end - texnest[texnest.ptr].prevgraf = current_line + texset("prevgraf",current_line) end local function wrap_up(par) @@ -1580,10 +1516,18 @@ do end -- we have a bunch of glue and and temp nodes not freed local head = par.head - if getid(head) == temp_code then - par.head = getnext(head) + if head and getid(head) == temp_code then + local next = getnext(head) + par.head = next + if next then + setprev(next) + end flush_node(head) end +flush_node(par.left_skip) +flush_node(par.right_skip) +par.left_skip = nil +par.right_skip = nil post_line_break(par) reset_meta(par) register_statistics(par) @@ -1603,13 +1547,13 @@ do if prev_r == active then r = active.next if r.id == delta_code then - local aw = active_width.size + r.size active_width.size = aw cur_active_width.size = aw - local aw = active_width.stretch + r.stretch active_width.stretch = aw cur_active_width.stretch = aw - local aw = active_width.fi + r.fi active_width.fi = aw cur_active_width.fi = aw - local aw = active_width.fil + r.fil active_width.fil = aw cur_active_width.fil = aw - local aw = active_width.fill + r.fill active_width.fill = aw cur_active_width.fill = aw - local aw = active_width.filll + r.filll active_width.filll = aw cur_active_width.filll = aw - local aw = active_width.shrink + r.shrink active_width.shrink = aw cur_active_width.shrink = aw + local aw = active_width.size + r.size active_width.size = aw cur_active_width.size = aw + local aw = active_width.normal + r.normal active_width.normal = aw cur_active_width.normal = aw + local aw = active_width.fi + r.fi active_width.fi = aw cur_active_width.fi = aw + local aw = active_width.fil + r.fil active_width.fil = aw cur_active_width.fil = aw + local aw = active_width.fill + r.fill active_width.fill = aw cur_active_width.fill = aw + local aw = active_width.filll + r.filll active_width.filll = aw cur_active_width.filll = aw + local aw = active_width.shrink + r.shrink active_width.shrink = aw cur_active_width.shrink = aw if checked_expansion then local aw = active_width.adjust_stretch + r.adjust_stretch active_width.adjust_stretch = aw cur_active_width.adjust_stretch = aw local aw = active_width.adjust_shrink + r.adjust_shrink active_width.adjust_shrink = aw cur_active_width.adjust_shrink = aw @@ -1621,13 +1565,13 @@ do elseif prev_r.id == delta_code then r = prev_r.next if r == active then - cur_active_width.size = cur_active_width.size - prev_r.size - cur_active_width.stretch = cur_active_width.stretch - prev_r.stretch - cur_active_width.fi = cur_active_width.fi - prev_r.fi - cur_active_width.fil = cur_active_width.fil - prev_r.fil - cur_active_width.fill = cur_active_width.fill - prev_r.fill - cur_active_width.filll = cur_active_width.filll - prev_r.filll - cur_active_width.shrink = cur_active_width.shrink - prev_r.shrink + cur_active_width.size = cur_active_width.size - prev_r.size + cur_active_width.normal = cur_active_width.normal - prev_r.normal + cur_active_width.fi = cur_active_width.fi - prev_r.fi + cur_active_width.fil = cur_active_width.fil - prev_r.fil + cur_active_width.fill = cur_active_width.fill - prev_r.fill + cur_active_width.filll = cur_active_width.filll - prev_r.filll + cur_active_width.shrink = cur_active_width.shrink - prev_r.shrink if checked_expansion then cur_active_width.adjust_stretch = cur_active_width.adjust_stretch - prev_r.adjust_stretch cur_active_width.adjust_shrink = cur_active_width.adjust_shrink - prev_r.adjust_shrink @@ -1637,13 +1581,13 @@ do -- prev_r = nil prev_r = prev_prev_r elseif r.id == delta_code then - local rn = r.size cur_active_width.size = cur_active_width.size + rn prev_r.size = prev_r.size + rn - local rn = r.stretch cur_active_width.stretch = cur_active_width.stretch + rn prev_r.stretch = prev_r.stretch + rn - local rn = r.fi cur_active_width.fi = cur_active_width.fi + rn prev_r.fi = prev_r.fi + rn - local rn = r.fil cur_active_width.fil = cur_active_width.fil + rn prev_r.fil = prev_r.fil + rn - local rn = r.fill cur_active_width.fill = cur_active_width.fill + rn prev_r.fill = prev_r.fill + rn - local rn = r.filll cur_active_width.filll = cur_active_width.filll + rn prev_r.filll = prev_r.fill + rn - local rn = r.shrink cur_active_width.shrink = cur_active_width.shrink + rn prev_r.shrink = prev_r.shrink + rn + local rn = r.size cur_active_width.size = cur_active_width.size + rn prev_r.size = prev_r.size + rn + local rn = r.normal cur_active_width.normal = cur_active_width.normal + rn prev_r.normal = prev_r.normal + rn + local rn = r.fi cur_active_width.fi = cur_active_width.fi + rn prev_r.fi = prev_r.fi + rn + local rn = r.fil cur_active_width.fil = cur_active_width.fil + rn prev_r.fil = prev_r.fil + rn + local rn = r.fill cur_active_width.fill = cur_active_width.fill + rn prev_r.fill = prev_r.fill + rn + local rn = r.filll cur_active_width.filll = cur_active_width.filll + rn prev_r.filll = prev_r.fill + rn + local rn = r.shrink cur_active_width.shrink = cur_active_width.shrink + rn prev_r.shrink = prev_r.shrink + rn if checked_expansion then local rn = r.adjust_stretch cur_active_width.adjust_stretch = cur_active_width.adjust_stretch + rn prev_r.adjust_stretch = prev_r.adjust_stretch + rn local rn = r.adjust_shrink cur_active_width.adjust_shrink = cur_active_width.adjust_shrink + rn prev_r.adjust_shrink = prev_r.adjust_shrink + rn @@ -1663,7 +1607,7 @@ do if cur_active_width.fi ~= fill_width.fi or cur_active_width.fil ~= fill_width.fil or cur_active_width.fill ~= fill_width.fill or cur_active_width.filll ~= fill_width.filll then return false, 0, fit_decent_class, 0, 0 end - local adjustment = active_short > 0 and cur_active_width.stretch or cur_active_width.shrink + local adjustment = active_short > 0 and cur_active_width.normal or cur_active_width.shrink if adjustment <= 0 then return false, 0, fit_decent_class, adjustment, 0 end @@ -1673,7 +1617,7 @@ do end local fit_class = fit_decent_class if adjustment > 0 then - local stretch = cur_active_width.stretch + local stretch = cur_active_width.normal if adjustment > shortfall then adjustment = shortfall end @@ -1756,7 +1700,7 @@ do local cur_active_width = checked_expansion and { -- distance from current active node size = active_width.size, - stretch = active_width.stretch, + normal = active_width.normal, fi = active_width.fi, fil = active_width.fil, fill = active_width.fill, @@ -1766,7 +1710,7 @@ do adjust_shrink = active_width.adjust_shrink, } or { size = active_width.size, - stretch = active_width.stretch, + normal = active_width.normal, fi = active_width.fi, fil = active_width.fil, fill = active_width.fill, @@ -1777,13 +1721,13 @@ do while true do r = prev_r.next if r.id == delta_code then - cur_active_width.size = cur_active_width.size + r.size - cur_active_width.stretch = cur_active_width.stretch + r.stretch - cur_active_width.fi = cur_active_width.fi + r.fi - cur_active_width.fil = cur_active_width.fil + r.fil - cur_active_width.fill = cur_active_width.fill + r.fill - cur_active_width.filll = cur_active_width.filll + r.filll - cur_active_width.shrink = cur_active_width.shrink + r.shrink + cur_active_width.size = cur_active_width.size + r.size + cur_active_width.normal = cur_active_width.normal + r.normal + cur_active_width.fi = cur_active_width.fi + r.fi + cur_active_width.fil = cur_active_width.fil + r.fil + cur_active_width.fill = cur_active_width.fill + r.fill + cur_active_width.filll = cur_active_width.filll + r.filll + cur_active_width.shrink = cur_active_width.shrink + r.shrink if checked_expansion then cur_active_width.adjust_stretch = cur_active_width.adjust_stretch + r.adjust_stretch cur_active_width.adjust_shrink = cur_active_width.adjust_shrink + r.adjust_shrink @@ -1797,13 +1741,13 @@ do if minimum_demerits < awful_badness and (old_line_number ~= par.easy_line or r == par.active) then if no_break_yet then no_break_yet = false - break_width.size = background.size - break_width.stretch = background.stretch - break_width.fi = background.fi - break_width.fil = background.fil - break_width.fill = background.fill - break_width.filll = background.filll - break_width.shrink = background.shrink + break_width.size = background.size + break_width.normal = background.normal + break_width.fi = background.fi + break_width.fil = background.fil + break_width.fill = background.fill + break_width.filll = background.filll + break_width.shrink = background.shrink if checked_expansion then break_width.adjust_stretch = 0 break_width.adjust_shrink = 0 @@ -1813,25 +1757,25 @@ do end end if prev_r.id == delta_code then - prev_r.size = prev_r.size - cur_active_width.size + break_width.size - prev_r.stretch = prev_r.stretch - cur_active_width.stretc + break_width.stretch - prev_r.fi = prev_r.fi - cur_active_width.fi + break_width.fi - prev_r.fil = prev_r.fil - cur_active_width.fil + break_width.fil - prev_r.fill = prev_r.fill - cur_active_width.fill + break_width.fill - prev_r.filll = prev_r.filll - cur_active_width.filll + break_width.filll - prev_r.shrink = prev_r.shrink - cur_active_width.shrink + break_width.shrink + prev_r.size = prev_r.size - cur_active_width.size + break_width.size + prev_r.normal = prev_r.normal - cur_active_width.normal + break_width.normal + prev_r.fi = prev_r.fi - cur_active_width.fi + break_width.fi + prev_r.fil = prev_r.fil - cur_active_width.fil + break_width.fil + prev_r.fill = prev_r.fill - cur_active_width.fill + break_width.fill + prev_r.filll = prev_r.filll - cur_active_width.filll + break_width.filll + prev_r.shrink = prev_r.shrink - cur_active_width.shrink + break_width.shrink if checked_expansion then prev_r.adjust_stretch = prev_r.adjust_stretch - cur_active_width.adjust_stretch + break_width.adjust_stretch prev_r.adjust_shrink = prev_r.adjust_shrink - cur_active_width.adjust_shrink + break_width.adjust_shrink end elseif prev_r == par.active then - active_width.size = break_width.size - active_width.stretch = break_width.stretch - active_width.fi = break_width.fi - active_width.fil = break_width.fil - active_width.fill = break_width.fill - active_width.filll = break_width.filll - active_width.shrink = break_width.shrink + active_width.size = break_width.size + active_width.normal = break_width.normal + active_width.fi = break_width.fi + active_width.fil = break_width.fil + active_width.fill = break_width.fill + active_width.filll = break_width.filll + active_width.shrink = break_width.shrink if checked_expansion then active_width.adjust_stretch = break_width.adjust_stretch active_width.adjust_shrink = break_width.adjust_shrink @@ -1842,7 +1786,7 @@ do subtype = nosubtype_code, next = r, size = break_width.size - cur_active_width.size, - stretch = break_width.stretch - cur_active_width.stretch, + normal = break_width.normal - cur_active_width.normal, fi = break_width.fi - cur_active_width.fi, fil = break_width.fil - cur_active_width.fil, fill = break_width.fill - cur_active_width.fill, @@ -1851,16 +1795,16 @@ do adjust_stretch = break_width.adjust_stretch - cur_active_width.adjust_stretch, adjust_shrink = break_width.adjust_shrink - cur_active_width.adjust_shrink, } or { - id = delta_code, - subtype = nosubtype_code, - next = r, - size = break_width.size - cur_active_width.size, - stretch = break_width.stretch - cur_active_width.stretch, - fi = break_width.fi - cur_active_width.fi, - fil = break_width.fil - cur_active_width.fil, - fill = break_width.fill - cur_active_width.fill, - filll = break_width.filll - cur_active_width.filll, - shrink = break_width.shrink - cur_active_width.shrink, + id = delta_code, + subtype = nosubtype_code, + next = r, + size = break_width.size - cur_active_width.size, + normal = break_width.normal - cur_active_width.normal, + fi = break_width.fi - cur_active_width.fi, + fil = break_width.fil - cur_active_width.fil, + fill = break_width.fill - cur_active_width.fill, + filll = break_width.filll - cur_active_width.filll, + shrink = break_width.shrink - cur_active_width.shrink, } prev_r.next = q prev_prev_r = prev_r @@ -1929,7 +1873,7 @@ do subtype = nosubtype_code, next = r, size = cur_active_width.size - break_width.size, - stretch = cur_active_width.stretch - break_width.stretch, + normal = cur_active_width.normal - break_width.normal, fi = cur_active_width.fi - break_width.fi, fil = cur_active_width.fil - break_width.fil, fill = cur_active_width.fill - break_width.fill, @@ -1938,16 +1882,16 @@ do adjust_stretch = cur_active_width.adjust_stretch - break_width.adjust_stretch, adjust_shrink = cur_active_width.adjust_shrink - break_width.adjust_shrink, } or { - id = delta_code, - subtype = nosubtype_code, - next = r, - size = cur_active_width.size - break_width.size, - stretch = cur_active_width.stretch - break_width.stretch, - fi = cur_active_width.fi - break_width.fi, - fil = cur_active_width.fil - break_width.fil, - fill = cur_active_width.fill - break_width.fill, - filll = cur_active_width.filll - break_width.filll, - shrink = cur_active_width.shrink - break_width.shrink, + id = delta_code, + subtype = nosubtype_code, + next = r, + size = cur_active_width.size - break_width.size, + normal = cur_active_width.normal - break_width.normal, + fi = cur_active_width.fi - break_width.fi, + fil = cur_active_width.fil - break_width.fil, + fill = cur_active_width.fill - break_width.fill, + filll = cur_active_width.filll - break_width.filll, + shrink = cur_active_width.shrink - break_width.shrink, } -- q.next = r -- already done prev_r.next = q @@ -2068,7 +2012,7 @@ do shortfall = 0 end else - local stretch = cur_active_width.stretch + local stretch = cur_active_width.normal if shortfall > 7230584 and stretch < 1663497 then b = infinite_badness fit_class = fit_very_loose_class @@ -2101,7 +2045,7 @@ do -- g = 0 shortfall = 0 elseif shortfall > 0 then - g = cur_active_width.stretch + g = cur_active_width.normal elseif shortfall < 0 then g = cur_active_width.shrink else @@ -2192,7 +2136,6 @@ do if trace_basic then report_parbuilders("starting at %a",head) end - local par = initialize_line_break(head,d) local checked_expansion = par.checked_expansion @@ -2225,13 +2168,13 @@ do active_short = 0, active_glue = 0, } - active_width.size = background.size - active_width.stretch = background.stretch - active_width.fi = background.fi - active_width.fil = background.fil - active_width.fill = background.fill - active_width.filll = background.filll - active_width.shrink = background.shrink + active_width.size = background.size + active_width.normal = background.normal + active_width.fi = background.fi + active_width.fil = background.fil + active_width.fill = background.fill + active_width.filll = background.filll + active_width.shrink = background.shrink if checked_expansion then active_width.adjust_stretch = 0 @@ -2288,12 +2231,7 @@ do while current and p_active ~= n_active do local char, id = isglyph(current) if char then - local wd, ht, dp = getwhd(current) - if is_rotated(par.line_break_dir) then - active_width.size = active_width.size + ht + dp - else - active_width.size = active_width.size + wd - end + active_width.size = active_width.size + getwidth(current) if checked_expansion then local font = id -- == font local data = checked_expansion[font] @@ -2312,14 +2250,8 @@ do end end elseif id == hlist_code or id == vlist_code then - local wd, ht, dp = getwhd(current) - if textdir_parallel(getdirection(current),par.line_break_dir) then - active_width.size = active_width.size + wd - else - active_width.size = active_width.size + ht + dp - end + active_width.size = active_width.size + getwidth(current) elseif id == glue_code then - -- if par.auto_breaking then if auto_breaking then local prev_p = getprev(current) if prev_p and prev_p ~= temp_head then @@ -2346,10 +2278,7 @@ do if subtype ~= seconddisc_code then local line_break_dir = par.line_break_dir if second_pass or subtype <= automaticdisc_code then - local actual_pen = subtype == automaticdisc_code and par.ex_hyphen_penalty or par.hyphen_penalty - -- 0.81 : - -- local actual_pen = getpenalty(current) - -- + local actual_pen = getpenalty(current) local pre, post, replace = getdisc(current) if not pre then -- trivial pre-break disc_width.size = 0 @@ -2420,43 +2349,36 @@ do end elseif id == kern_code then local s = getsubtype(current) + local kern = getkern(current) if s == userkern_code or s == italickern_code then local v = getnext(current) - -- if par.auto_breaking and getid(v) == glue_code then if auto_breaking and getid(v) == glue_code then p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) end local active_width = par.active_width - active_width.size = active_width.size + getkern(current) - else - local kern = getkern(current) - if kern ~= 0 then - active_width.size = active_width.size + kern - if checked_expansion and expand_kerns and getsubtype(current) == fontkern_code then - local stretch, shrink = kern_stretch_shrink(current,kern) - if expand_kerns == "stretch" then - active_width.adjust_stretch = active_width.adjust_stretch + stretch - elseif expand_kerns == "shrink" then - active_width.adjust_shrink = active_width.adjust_shrink + shrink - else - active_width.adjust_stretch = active_width.adjust_stretch + stretch - active_width.adjust_shrink = active_width.adjust_shrink + shrink - end + active_width.size = active_width.size + kern + elseif kern ~= 0 then + active_width.size = active_width.size + kern + if checked_expansion and expand_kerns and s == fontkern_code then + local stretch, shrink = kern_stretch_shrink(current,kern) + if expand_kerns == "stretch" then + active_width.adjust_stretch = active_width.adjust_stretch + stretch + elseif expand_kerns == "shrink" then + active_width.adjust_shrink = active_width.adjust_shrink + shrink + else + active_width.adjust_stretch = active_width.adjust_stretch + stretch + active_width.adjust_shrink = active_width.adjust_shrink + shrink end end end elseif id == math_code then - -- par.auto_breaking = getsubtype(current) == endmath_code auto_breaking = getsubtype(current) == endmath_code local v = getnext(current) - -- if par.auto_breaking and getid(v) == glue_code then if auto_breaking and getid(v) == glue_code then p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) end local active_width = par.active_width - active_width.size = active_width.size + getkern(current) -- surround - -- new in luatex - + getwidth(current) + active_width.size = active_width.size + getkern(current) + getwidth(current) elseif id == rule_code then active_width.size = active_width.size + getwidth(current) elseif id == penalty_code then @@ -2533,8 +2455,8 @@ do if tracing_paragraphs then diagnostics.current_pass(par,"emergencypass") end - par.background.stretch = par.background.stretch + par.emergency_stretch - par.final_pass = true + par.background.normal = par.background.normal + par.emergency_stretch + par.final_pass = true end end return wrap_up(par) @@ -2547,7 +2469,7 @@ end do local function write_esc(cs) - local esc = tex.escapechar + local esc = texget("escapechar") if esc then write("log",utfchar(esc),cs) else @@ -2895,7 +2817,7 @@ do local cal_expand_ratio = method == "cal_expand_ratio" or method == "subst_ex_font" - direction = direction or tex.textdir + direction = direction or texget("textdir") local line = 0 @@ -2915,8 +2837,8 @@ do local adjust_head = texlists.adjust_head local pre_adjust_head = texlists.pre_adjust_head - local adjust_tail = adjust_head and slide_node_list(adjust_head) -- todo: find_tail - local pre_adjust_tail = pre_adjust_head and slide_node_list(pre_adjust_head) -- todo: find_tail + local adjust_tail = adjust_head and find_tail(adjust_head) + local pre_adjust_tail = pre_adjust_head and find_tail(pre_adjust_head) new_dir_stack(hpack_dir) @@ -3022,9 +2944,7 @@ do depth = dp end elseif id == math_code then - natural = natural + getkern(current) -- surround - -- new in luatex - + getwidth(current) + natural = natural + getkern(current) + getwidth(current) elseif id == unset_code then local wd, ht, dp = getwhd(current) local sh = getshift(current) @@ -3056,7 +2976,7 @@ do else adjust_head = list end - adjust_tail = slide_node_list(list) -- find_tail(list) + adjust_tail = find_tail(list) elseif id == dir_code then hpack_dir = checked_line_dir(stack,current) or hpack_dir elseif id == marginkern_code then @@ -3144,7 +3064,7 @@ do -- todo elseif order == 0 then -- and getlist(hlist) then last_badness = calculate_badness(delta,total_stretch[0]) - if last_badness > tex.hbadness then + if last_badness > texget("hbadness") then if last_badness > 100 then diagnostics.underfull_hbox(hlist,line,last_badness) else @@ -3202,16 +3122,16 @@ do last_badness = 1000000 setfield(hlist,"glue_set",1) local fuzz = - delta - total_shrink[0] - local hfuzz = tex.hfuzz - if fuzz > hfuzz or tex.hbadness < 100 then - local overfullrule = tex.overfullrule + local hfuzz = texget("hfuzz") + if fuzz > hfuzz or texget("hbadness") < 100 then + local overfullrule = texget("overfullrule") if fuzz > hfuzz and overfullrule > 0 then -- weird, is always called and no rules shows up - setnext(slide_node_list(list),new_rule(overfullrule,nil,nil,getdirection(hlist))) -- todo: find_tail + setnext(find_tail(list),new_rule(overfullrule,nil,nil,getdirection(hlist))) end diagnostics.overfull_hbox(hlist,line,-delta) end - elseif order == 0 and getlist(hlist) and last_badness > tex.hbadness then + elseif order == 0 and getlist(hlist) and last_badness > texget("hbadness") then diagnostics.bad_hbox(hlist,line,last_badness) end end diff --git a/tex/context/base/mkiv/page-pcl.mkiv b/tex/context/base/mkiv/page-pcl.mkiv index 140444fc2..9772320e7 100644 --- a/tex/context/base/mkiv/page-pcl.mkiv +++ b/tex/context/base/mkiv/page-pcl.mkiv @@ -112,13 +112,19 @@ %D \unknown +\def\page_col_registered_text_area_b#1% + {\begingroup + \makeupwidth\d_page_col_column_width + \page_one_registered_text_area_b{#1}% + \endgroup} + \unexpanded\def\page_col_command_package_contents#1#2% \box<n> \unvbox<n> % this one will be redone (checked) {\bgroup \setbox\b_page_one_contents\vbox to \textheight {\page_one_registered_text_area_a#1#2}% \page_one_command_package_show_state \ht\b_page_one_contents\textheight - \page_one_registered_text_area_b + \page_col_registered_text_area_b {\box\b_page_one_contents}% \egroup} @@ -174,13 +180,13 @@ \ht\b_page_one_bottom_notes\zeropoint \wd\b_page_one_bottom_notes\zeropoint \wd\b_page_one_bottom_notes\d_page_col_column_width - \page_one_registered_text_area_b + \page_col_registered_text_area_b {\vpack to \textheight - {\hbox{\box\b_page_one_contents\box\b_page_one_bottom_notes}}}% + {\hpack{\box\b_page_one_contents\box\b_page_one_bottom_notes}}}% \else \ht\b_page_one_contents\textheight \wd\b_page_one_contents\d_page_col_column_width - \page_one_registered_text_area_b + \page_col_registered_text_area_b {\box\b_page_one_contents}% \fi \egroup} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex e1aed452d..24636e090 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 50ed35f86..3a16e2d66 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi index 02f6fd753..2af60b41d 100644 --- a/tex/context/base/mkiv/strc-flt.mkvi +++ b/tex/context/base/mkiv/strc-flt.mkvi @@ -312,30 +312,86 @@ \let\floatcaptionsuffix\empty % an optional suffix \let\floatcaptionnumber\empty % a logical counter -% the split is needed when for instance the float goes into -% a multi page field and the list of figs becomes larger than -% one page: cycle between 'only flush when object ref ok' -% and 'one/many page fig list'; see "uguide finometer" +% For a while these were placeholders: % -% potential sync bug with sectionblocks, see uguide.tex - -% begin of todo - -\unexpanded\def\placefloatcaption{\dodoubleempty\strc_floats_place_caption} -\unexpanded\def\setfloatcaption {\dodoubleempty\strc_floats_set_caption} - -\def\strc_floats_place_caption[#tag][#reference]#caption{[not supported]} -\def\strc_floats_set_caption [#tag][#reference]#caption{[not supported]} - -\unexpanded\def\placefloatcaptiontext [#tag]{[not suported yet]} -\unexpanded\def\placefloatcaptionnumber [#tag]{[not suported yet]} -\unexpanded\def\placefloatcaptionreference[#tag]{[not suported yet]} - -\let\placefloatlabel \placefloatcaption -\let\placefloatlabeltext \placefloatcaptiontext -\let\placefloatlabelreference\placefloatcaptionreference - -% end of todo +%D \starttyping +%D \unexpanded\def\placefloatcaption{\dodoubleempty\strc_floats_place_caption} +%D \unexpanded\def\setfloatcaption {\dodoubleempty\strc_floats_set_caption} +%D +%D \def\strc_floats_place_caption[#tag][#reference]#caption{[not supported]} +%D \def\strc_floats_set_caption [#tag][#reference]#caption{[not supported]} +%D +%D \unexpanded\def\placefloatcaptiontext [#tag]{[not suported yet]} +%D \unexpanded\def\placefloatcaptionnumber [#tag]{[not suported yet]} +%D \unexpanded\def\placefloatcaptionreference[#tag]{[not suported yet]} +%D \stoptyping +%D +%D because in \MKII\ we had: +%D +%D \starttyping +%D \let\placefloatlabel \placefloatcaption +%D \let\placefloatlabeltext \placefloatcaptiontext +%D \let\placefloatlabelreference\placefloatcaptionreference +%D \stoptyping +%D +%D But as it was never advertised we don't provide it in \MKIV. However, at some +%D point HvdM wanted this: +%D +%D \starttyping +%D \placefigure {labeltext-1} {\externalfigure[figure-1]} +%D \placefloatcaption[figure][title={labeltext-2}] \externalfigure[figure-2] +%D \placefigure {labeltext-3} {\externalfigure[figure-3]} +%D \stoptyping +%D +%D So there you have it: + +\unexpanded\def\placefloatcaption + {\dotripleempty\strc_floats_place_caption} + +\def\strc_floats_place_caption[#category][#settings][#userdata]% + {\ifsecondargument + % we need at least a category and title + \dontleavehmode + \bgroup + \edef\currentfloat{#category}% + \let\currentfloatcaption\currentfloat + \resetfloatcaptionparameter\c!reference + \resetfloatcaptionparameter\c!title + \resetfloatcaptionparameter\c!marking + \resetfloatcaptionparameter\c!list + \resetfloatcaptionparameter\c!bookmark + \setupcurrentfloatcaption[#settings]% + \edef\currentfloatcounter{\namedcounterparameter\currentfloat\s!name}% + \iftrialtypesetting\strc_counters_save\currentfloatcounter\fi + \strc_counters_increment\currentfloatcounter + \strc_counters_register_component + \s!float + \setupcurrentfloatcaption + \floatcaptionparameter + \detokenizedfloatcaptionparameter + \relax + \relax + \relax + [\s!name=\currentfloat, + \s!counter=\currentfloatcounter,% + \s!hascaption=\v!yes,% + \s!hasnumber=\v!yes,% + \s!hastitle=\v!yes]% + [#userdata]% + \glet\previousfloatnumber \m_strc_counters_last_registered_index + \glet\currentfloatnumber \m_strc_counters_last_registered_index + \glet\currentfloatattribute \m_strc_counters_last_registered_attribute + \glet\currentfloatsynchronize\m_strc_counters_last_registered_synchronize + % + % \iflocation + % \attribute\destinationattribute\currentfloatattribute\relax + % \fi + \currentfloatsynchronize + \strc_floats_make_complete_caption + % + \iftrialtypesetting\strc_counters_restore\currentfloatcounter\fi + \egroup + \fi} \newbox \b_strc_floats_caption \newbox \b_strc_floats_content diff --git a/tex/context/base/mkiv/strc-reg.mkiv b/tex/context/base/mkiv/strc-reg.mkiv index 1ab7d8ae0..ae247d9bd 100644 --- a/tex/context/base/mkiv/strc-reg.mkiv +++ b/tex/context/base/mkiv/strc-reg.mkiv @@ -425,7 +425,12 @@ \def\strc_registers_finish_entry_indeed#1#2#3% register data userdata {\begingroup \edef\currentregister{#1}% - \setupcurrentregister[\c!entries=,\c!label=,\c!keys=,\c!alternative=,#2]% todo: fast setter + %\setupcurrentregister[\c!entries=,\c!label=,\c!keys=,\c!alternative=,#2]% todo: fast setter + \resetregisterparameter\c!entries + \resetregisterparameter\c!label + \resetregisterparameter\c!keys + \resetregisterparameter\c!alternative + \setupcurrentregister[#2]% \edef\currentregisterlabel {\registerparameter\c!label}% \edef\currentregisterexpansion{\registerparameter\c!expansion}% \edef\currentregisterownnumber{\registerparameter\c!ownnumber}% diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua index e26da1fc9..46bb8e3f7 100644 --- a/tex/context/base/mkiv/syst-aux.lua +++ b/tex/context/base/mkiv/syst-aux.lua @@ -701,6 +701,7 @@ implement { name = "doifelseinset", actions = doifelseinset, arguments = "2 strings", +-- arguments = { "argument", "argument" }, } implement { diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 2b7bad2aa..5decc5886 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -816,32 +816,61 @@ %D \doifelse {string1} {string2} {then ...}{else ...} %D \stoptyping -\unexpanded\def\doif#1#2% - {\edef\m_syst_string_one{#1}% - \edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} +\startmkivmode -\unexpanded\def\doifnot#1#2% - {\edef\m_syst_string_one{#1}% - \edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\gobbleoneargument - \else - \expandafter\firstofoneargument - \fi} + \unexpanded\def\doif#1#2% + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} -\unexpanded\def\doifelse#1#2% - {\edef\m_syst_string_one{#1}% - \edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} + \unexpanded\def\doifnot#1#2% + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + + \unexpanded\def\doifelse#1#2% + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doifelse#1#2% + {\iftok{#1}{#2}% + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + + \unexpanded\def\doif#1#2% + {\iftok{#1}{#2}% + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + + \unexpanded\def\doifnot#1#2% + {\iftok{#1}{#2}% + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + +\stoplmtxmode %D \macros %D {doifempty,doifemptyelse,doifnotempty} @@ -6999,88 +7028,166 @@ %D three tokens per call. Anyone familiar with the not||values ones, can derive %D their meaning from the definitions. -\unexpanded\def\doifvalue#1#2% - {\edef\m_syst_string_one{\csname#1\endcsname}% - \edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} +\startmkivmode -\unexpanded\def\doifnotvalue#1#2% - {\edef\m_syst_string_one{\csname#1\endcsname}% - \edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\gobbleoneargument - \else - \expandafter\firstofoneargument - \fi} + \unexpanded\def\doifvalue#1#2% + {\edef\m_syst_string_one{\csname#1\endcsname}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} -\unexpanded\def\doifelsevalue#1#2% - {\edef\m_syst_string_one{\csname#1\endcsname}% - \edef\m_syst_string_two{#2}% - \ifx\m_syst_string_one\m_syst_string_two - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} + \unexpanded\def\doifnotvalue#1#2% + {\edef\m_syst_string_one{\csname#1\endcsname}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} -\unexpanded\def\doifnothing#1% - {\edef\m_syst_string_one{#1}% - \ifx\m_syst_string_one\empty - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} + \unexpanded\def\doifelsevalue#1#2% + {\edef\m_syst_string_one{\csname#1\endcsname}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} -\unexpanded\def\doifsomething#1% - {\edef\m_syst_string_one{#1}% - \ifx\m_syst_string_one\empty - \expandafter\gobbleoneargument - \else - \expandafter\firstofoneargument - \fi} + \unexpanded\def\doifnothing#1% + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} -\unexpanded\def\doifelsenothing#1% - {\edef\m_syst_string_one{#1}% - \ifx\m_syst_string_one\empty - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} + \unexpanded\def\doifsomething#1% + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} -\unexpanded\def\doifelsesomething#1% - {\edef\m_syst_string_one{#1}% - \ifx\m_syst_string_one\empty - \expandafter\secondoftwoarguments - \else - \expandafter\firstoftwoarguments - \fi} + \unexpanded\def\doifelsenothing#1% + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} -\unexpanded\def\doifvaluenothing#1% - {\edef\m_syst_string_one{\csname#1\endcsname}% - \ifx\m_syst_string_one\empty - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} + \unexpanded\def\doifelsesomething#1% + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty + \expandafter\secondoftwoarguments + \else + \expandafter\firstoftwoarguments + \fi} -\unexpanded\def\doifvaluesomething#1% - {\edef\m_syst_string_one{\csname#1\endcsname}% - \ifx\m_syst_string_one\empty - \expandafter\gobbleoneargument - \else - \expandafter\firstofoneargument - \fi} + \unexpanded\def\doifvaluenothing#1% + {\edef\m_syst_string_one{\csname#1\endcsname}% + \ifx\m_syst_string_one\empty + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} -\unexpanded\def\doifelsevaluenothing#1% - {\edef\m_syst_string_one{\csname#1\endcsname}% - \ifx\m_syst_string_one\empty - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} + \unexpanded\def\doifvaluesomething#1% + {\edef\m_syst_string_one{\csname#1\endcsname}% + \ifx\m_syst_string_one\empty + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + + \unexpanded\def\doifelsevaluenothing#1% + {\edef\m_syst_string_one{\csname#1\endcsname}% + \ifx\m_syst_string_one\empty + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doifvalue#1#2% + {\iftok{\csname#1\endcsname}{#2}% + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + + \unexpanded\def\doifnotvalue#1#2% + {\iftok{\csname#1\endcsname}{#2}% + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + + \unexpanded\def\doifelsevalue#1#2% + {\iftok{\csname#1\endcsname}{#2}% + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + + \unexpanded\def\doifnothing#1% + {\iftok{#1}\emptytoks + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + + \unexpanded\def\doifsomething#1% + {\iftok{#1}\emptytoks + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + + \unexpanded\def\doifelsenothing#1% + {\iftok{#1}\emptytoks + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + + \unexpanded\def\doifelsesomething#1% + {\iftok{#1}\emptytoks + \expandafter\secondoftwoarguments + \else + \expandafter\firstoftwoarguments + \fi} + + \unexpanded\def\doifvaluenothing#1% + {\iftok{\csname#1\endcsname}\emptytoks + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + + \unexpanded\def\doifvaluesomething#1% + {\iftok{\csname#1\endcsname}\emptytoks + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + + \unexpanded\def\doifelsevaluenothing#1% + {\iftok{\csname#1\endcsname}\emptytoks + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\stoplmtxmode \let\doifvalueelse \doifelsevalue \let\doifnothingelse \doifelsenothing @@ -7860,31 +7967,60 @@ %D %D Not that fast I guess, but here's a way to test for token registers being empty. -\unexpanded\def\doifelsesometoks#1% - {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok - \ifx\m_syst_string_one\empty - \expandafter\secondoftwoarguments - \else - \expandafter\firstoftwoarguments - \fi} +\startmkivmode -\let\doifsometokselse\doifelsesometoks + \unexpanded\def\doifelsesometoks#1% + {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok + \ifx\m_syst_string_one\empty + \expandafter\secondoftwoarguments + \else + \expandafter\firstoftwoarguments + \fi} -\unexpanded\def\doifsometoks#1% - {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok - \ifx\m_syst_string_one\empty - \expandafter\gobbleoneargument - \else - \expandafter\firstofoneargument - \fi} + \unexpanded\def\doifsometoks#1% + {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok + \ifx\m_syst_string_one\empty + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} -\unexpanded\def\doifemptytoks#1% - {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok - \ifx\m_syst_string_one\empty - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} + \unexpanded\def\doifemptytoks#1% + {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok + \ifx\m_syst_string_one\empty + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + +\stopmkivmode + +\startlmtxmode + + \unexpanded\def\doifelsesometoks#1% + {\iftok#1\emptytoks + \expandafter\secondoftwoarguments + \else + \expandafter\firstoftwoarguments + \fi} + + \unexpanded\def\doifsometoks#1% + {\iftok#1\emptytoks + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + + \unexpanded\def\doifemptytoks#1% + {\iftok#1\emptytoks + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + +\stoplmtxmode + +\let\doifsometokselse\doifelsesometoks %D \macros %D {startstrictinspectnextcharacter} diff --git a/tex/context/base/mkiv/trac-deb.lua b/tex/context/base/mkiv/trac-deb.lua index 9788e72a0..bd406b0e5 100644 --- a/tex/context/base/mkiv/trac-deb.lua +++ b/tex/context/base/mkiv/trac-deb.lua @@ -32,6 +32,7 @@ local texgetdimen = tex.getdimen local texgettoks = tex.gettoks local texgetcount = tex.getcount local texgethelp = tex.gethelptext or function() end +local fatalerror = tex.fatalerror local implement = interfaces.implement @@ -204,9 +205,25 @@ end -- so one can overload the printer if (really) needed + +if fatalerror then + callback.register("terminal_input",function(what) + if what == "*" then + fatalerror("some kind of input expected, file ends too soon, quitting now") + else + fatalerror("bad input, quitting now") + end + end) +else + -- tex.print("\\nonstopmode") +end + local quitonerror = true -directives.register("system.quitonerror",function(v) quitonerror = toboolean(v) end) +directives.register("system.quitonerror",function(v) + quitonerror = toboolean(v) + -- tex.print("\\errorstopmode") +end) local busy = false diff --git a/tex/context/base/mkiv/trac-inf.lua b/tex/context/base/mkiv/trac-inf.lua index 71c65a3f4..d3e348ce4 100644 --- a/tex/context/base/mkiv/trac-inf.lua +++ b/tex/context/base/mkiv/trac-inf.lua @@ -209,10 +209,16 @@ function statistics.show() -- register("luatex banner", function() -- return lower(status.banner) -- end) - register("used engine", function() - return format("%s version %s with functionality level %s, banner: %s", - LUATEXENGINE, LUATEXVERSION, LUATEXFUNCTIONALITY, lower(status.banner)) - end) + if LUATEXENGINE == "luametatex" then + register("used engine", function() + return format("%s version %s", LUATEXENGINE, LUATEXVERSION) + end) + else + register("used engine", function() + return format("%s version %s with functionality level %s, banner: %s", + LUATEXENGINE, LUATEXVERSION, LUATEXFUNCTIONALITY, lower(status.banner)) + end) + end register("control sequences", function() return format("%s of %s + %s", status.cs_count, status.hash_size,status.hash_extra) end) diff --git a/tex/context/base/mkiv/typo-bld.lua b/tex/context/base/mkiv/typo-bld.lua index 55d74281f..d6a4fd9fd 100644 --- a/tex/context/base/mkiv/typo-bld.lua +++ b/tex/context/base/mkiv/typo-bld.lua @@ -43,7 +43,12 @@ local new_baselineskip = nodepool.baselineskip local new_lineskip = nodepool.lineskip local insert_node_before = nodes.insert_before local hpack_node = nodes.hpack -local count_nodes = nodes.countall + +local nuts = nodes.nuts +local tonode = nodes.tonode +local tonut = nodes.tonut +local count_nodes = nuts.countall +local getattr = nuts.getattr local starttiming = statistics.starttiming local stoptiming = statistics.stoptiming @@ -114,7 +119,7 @@ function constructors.handler(head,followed_by_display) if type(head) == "boolean" then return head else - local attribute = head[a_parbuilder] -- or mainconstructor + local attribute = getattr(head,a_parbuilder) -- or mainconstructor if attribute then local method = names[attribute] if method then @@ -167,7 +172,9 @@ local function processor(head,followed_by_display) -- todo: not again in otr so we need to flag if enabled then starttiming(parbuilders) - local head = actions(head,followed_by_display) + head = tonut(head) + head = actions(head,followed_by_display) + head = tonode(head) stoptiming(parbuilders) return head else @@ -195,6 +202,7 @@ function builders.vpack_filter(head,groupcode,size,packtype,maxdepth,direction) local done = false if head then starttiming(builders) + head = tonut(head) if trace_vbox_builder then local before = count_nodes(head) head, done = vboxactions(head,groupcode,size,packtype,maxdepth,direction) @@ -203,6 +211,7 @@ function builders.vpack_filter(head,groupcode,size,packtype,maxdepth,direction) else head, done = vboxactions(head,groupcode) end + head = tonode(head) stoptiming(builders) end return head, done diff --git a/tex/context/base/mkiv/typo-par.mkiv b/tex/context/base/mkiv/typo-par.mkiv index 066dc6a69..fae07b235 100644 --- a/tex/context/base/mkiv/typo-par.mkiv +++ b/tex/context/base/mkiv/typo-par.mkiv @@ -23,7 +23,8 @@ \unprotect -\registerctxluafile{node-ltp}{optimize} +% \registerctxluafile{node-ltp}{optimize} +\registerctxluafile{node-ltp}{} \registerctxluafile{trac-par}{} \protect \endinput diff --git a/tex/context/base/mkiv/typo-sus.lua b/tex/context/base/mkiv/typo-sus.lua index 6c02b9291..bb5b03912 100644 --- a/tex/context/base/mkiv/typo-sus.lua +++ b/tex/context/base/mkiv/typo-sus.lua @@ -72,6 +72,7 @@ local a_characters = attributes.private("characters") local a_suspecting = attributes.private('suspecting') local a_suspect = attributes.private('suspect') local texsetattribute = tex.setattribute +local unsetvalue = attributes.unsetvalue local enabled = false local enableaction = nodes.tasks.enableaction diff --git a/tex/context/base/mkiv/util-dim.lua b/tex/context/base/mkiv/util-dim.lua index fd9351a28..76b5fd20b 100644 --- a/tex/context/base/mkiv/util-dim.lua +++ b/tex/context/base/mkiv/util-dim.lua @@ -397,18 +397,22 @@ function dimen(a) end function string.todimen(str) -- maybe use tex.sp when available - if type(str) == "number" then + local t = type(str) + if t == "number" then return str else local k = known[str] if not k then - local value, unit = lpegmatch(dimenpair,str) - if value and unit then - k = value/unit -- to be considered: round + if t == "string" then + local value, unit = lpegmatch(dimenpair,str) + if value and unit then + k = value/unit -- to be considered: round + else + k = 0 + end else k = 0 end - -- print(str,value,unit) known[str] = k end return k diff --git a/tex/context/base/mkiv/util-seq.lua b/tex/context/base/mkiv/util-seq.lua index e7a503faf..8f719e0d5 100644 --- a/tex/context/base/mkiv/util-seq.lua +++ b/tex/context/base/mkiv/util-seq.lua @@ -34,8 +34,8 @@ local report = logs.reporter("sequencer") local usedcount = 0 local usednames = { } -trackers.register("sequencers.used", function(v) trace_used = true end) -trackers.register("sequencers.detail",function(v) trace_detail = true end) +trackers.register("sequencers.used", function(v) trace_used = v end) +trackers.register("sequencers.detail",function(v) trace_detail = v end) local sequencers = { } utilities.sequencers = sequencers diff --git a/tex/context/base/mkiv/util-sha.lua b/tex/context/base/mkiv/util-sha.lua index d84e46975..ea7220733 100644 --- a/tex/context/base/mkiv/util-sha.lua +++ b/tex/context/base/mkiv/util-sha.lua @@ -38,9 +38,12 @@ end -- -- On short strings 256 seems faster than 512 while on a megabyte blob 512 wins -- from 256 (64 bit internals). +-- +-- Using the stream reader we can probably speed up the following code a bit +-- because it's faster than unpack. -local packstring, unpackstring = string.pack, string.unpack -local unpack, setmetatable = unpack, setmetatable +local packstring, unpackstring, formatstring = string.pack, string.unpack, string.format +local repstring = string.rep local constants256 = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, @@ -72,31 +75,6 @@ local constants512 = { 0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817, } --- Not really needed, but more in tune with md5. In fact, as we use the mtxlib --- helpers I might as well assume more. - -local tohex, toHEX - -if lpeg then local lpegpatterns = lpeg.patterns if lpegpatterns then - - local lpegmatch = lpeg.match - local bytestohex = lpegpatterns.bytestohex - local bytestoHEX = lpegpatterns.bytestoHEX - - tohex = function(s) return lpegmatch(bytestohex,s) end - toHEX = function(s) return lpegmatch(bytestoHEX,s) end - -end end - -if not tohex then - - local format, byte, gsub = string.format, string.byte, string.gsub - - tohex = function(s) return (gsub(s,".",function(c) return format("%02X",byte(c)) end)) end - toHEX = function(s) return (gsub(s,".",function(c) return format("%02X",byte(c)) end)) end - -end - local prepare = { } if utilities and utilities.strings then @@ -112,13 +90,11 @@ if utilities and utilities.strings then else - local rep = string.rep - prepare[256] = function(str,len) - return str .. "\128" .. rep("\0",-(1 + 8 + len) % 64) .. packstring(">I8", 8 * len) + return str .. "\128" .. repstring("\0",-(1 + 8 + len) % 64) .. packstring(">I8", 8 * len) end prepare[512] = function(str,len) - return str .. "\128" .. rep("\0",-(1 + 16 + len) % 128) .. packstring(">I16", 8 * len) + return str .. "\128" .. repstring("\0",-(1 + 16 + len) % 128) .. packstring(">I16", 8 * len) end end @@ -162,9 +138,10 @@ local list = { } -- some 5% faster digest[256] = function(str,i,hash) - for i=1,#str,64 do + local hash1, hash2, hash3, hash4 = hash[1], hash[2], hash[3], hash[4] + local hash5, hash6, hash7, hash8 = hash[5], hash[6], hash[7], hash[8] - -- local w = { unpackstring(">I4I4I4I4I4I4I4I4I4I4I4I4I4I4I4I4",str,i) } + for i=1,#str,64 do list[ 1], list[ 2], list[ 3], list[ 4], list[ 5], list[ 6], list[ 7], list[ 8], list[ 9], list[10], list[11], list[12], list[13], list[14], list[15], list[16] = @@ -183,7 +160,7 @@ digest[256] = function(str,i,hash) & 0xffffffff end - local a, b, c, d, e, f, g, h = -- unpack(hash) + local a, b, c, d, e, f, g, h = hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], hash[8] for i=1,64 do @@ -208,23 +185,27 @@ digest[256] = function(str,i,hash) a = (t1 + t2) & 0xffffffff end - hash[1] = (hash[1] + a) & 0xffffffff - hash[2] = (hash[2] + b) & 0xffffffff - hash[3] = (hash[3] + c) & 0xffffffff - hash[4] = (hash[4] + d) & 0xffffffff - hash[5] = (hash[5] + e) & 0xffffffff - hash[6] = (hash[6] + f) & 0xffffffff - hash[7] = (hash[7] + g) & 0xffffffff - hash[8] = (hash[8] + h) & 0xffffffff + hash1 = (hash1 + a) & 0xffffffff + hash2 = (hash2 + b) & 0xffffffff + hash3 = (hash3 + c) & 0xffffffff + hash4 = (hash4 + d) & 0xffffffff + hash5 = (hash5 + e) & 0xffffffff + hash6 = (hash6 + f) & 0xffffffff + hash7 = (hash7 + g) & 0xffffffff + hash8 = (hash8 + h) & 0xffffffff end + + return hash1, hash2, hash3, hash4, hash5, hash6, hash7, hash8 + end digest[512] = function(str,i,hash) - for i=1,#str,128 do + local hash1, hash2, hash3, hash4 = hash[1], hash[2], hash[3], hash[4] + local hash5, hash6, hash7, hash8 = hash[5], hash[6], hash[7], hash[8] - -- local w = { unpackstring(">I4I4I4I4I4I4I4I4I4I4I4I4I4I4I4I4",str,i) } + for i=1,#str,128 do list[ 1], list[ 2], list[ 3], list[ 4], list[ 5], list[ 6], list[ 7], list[ 8], list[ 9], list[10], list[11], list[12], list[13], list[14], list[15], list[16] = @@ -243,7 +224,7 @@ digest[512] = function(str,i,hash) -- & 0xffffffffffffffff end - local a, b, c, d, e, f, g, h = -- unpack(hash) + local a, b, c, d, e, f, g, h = hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7], hash[8] for i=1,80 do @@ -268,70 +249,159 @@ digest[512] = function(str,i,hash) a = (t1 + t2) -- & 0xffffffffffffffff end - hash[1] = (hash[1] + a) -- & 0xffffffffffffffff - hash[2] = (hash[2] + b) -- & 0xffffffffffffffff - hash[3] = (hash[3] + c) -- & 0xffffffffffffffff - hash[4] = (hash[4] + d) -- & 0xffffffffffffffff - hash[5] = (hash[5] + e) -- & 0xffffffffffffffff - hash[6] = (hash[6] + f) -- & 0xffffffffffffffff - hash[7] = (hash[7] + g) -- & 0xffffffffffffffff - hash[8] = (hash[8] + h) -- & 0xffffffffffffffff + hash1 = (hash1 + a) -- & 0xffffffffffffffff + hash2 = (hash2 + b) -- & 0xffffffffffffffff + hash3 = (hash3 + c) -- & 0xffffffffffffffff + hash4 = (hash4 + d) -- & 0xffffffffffffffff + hash5 = (hash5 + e) -- & 0xffffffffffffffff + hash6 = (hash6 + f) -- & 0xffffffffffffffff + hash7 = (hash7 + g) -- & 0xffffffffffffffff + hash8 = (hash8 + h) -- & 0xffffffffffffffff end + + return hash1, hash2, hash3, hash4, hash5, hash6, hash7, hash8 + end digest[224] = digest[256] digest[384] = digest[512] -local finalize = { - [224] = function(hash,tohex) local s = packstring(">I4I4I4I4I4I4I4", unpack(hash)) return tohex and tohex(s) or s end, -- # 56 - [256] = function(hash,tohex) local s = packstring(">I4I4I4I4I4I4I4I4",unpack(hash)) return tohex and tohex(s) or s end, -- # 64 - [384] = function(hash,tohex) local s = packstring(">I8I8I8I8I8I8", unpack(hash)) return tohex and tohex(s) or s end, -- # 96 - [512] = function(hash,tohex) local s = packstring(">I8I8I8I8I8I8I8I8",unpack(hash)) return tohex and tohex(s) or s end, -- # 128 -} - local hash = { } -local function hashed(str,method,tohex) +local function hashed(str,method,convert,pattern) local s = prepare[method](str,#str) local h = initialize[method](hash) - digest[method](s,i,h) - return finalize[method](h,tohex) + return convert(pattern,digest[method](s,i,h)) end local sha2 = { - digest224 = function(str) return hashed(str,224) end, - digest256 = function(str) return hashed(str,256) end, - digest384 = function(str) return hashed(str,384) end, - digest512 = function(str) return hashed(str,512) end, - hash224 = function(str) return hashed(str,224,tohex) end, - hash256 = function(str) return hashed(str,256,tohex) end, - hash384 = function(str) return hashed(str,384,tohex) end, - hash512 = function(str) return hashed(str,512,tohex) end, - HASH224 = function(str) return hashed(str,224,toHEX) end, - HASH256 = function(str) return hashed(str,256,toHEX) end, - HASH384 = function(str) return hashed(str,384,toHEX) end, - HASH512 = function(str) return hashed(str,512,toHEX) end, + digest224 = function(str) return hashed(str,224,packstring,">I4I4I4I4I4I4I4") end, + digest256 = function(str) return hashed(str,256,packstring,">I4I4I4I4I4I4I4I4") end, + digest384 = function(str) return hashed(str,384,packstring,">I8I8I8I8I8I8") end, + digest512 = function(str) return hashed(str,512,packstring,">I8I8I8I8I8I8I8I8") end, + hash224 = function(str) return hashed(str,224,formatstring,"%0x04%0x04%0x04%0x04%0x04%0x04%0x04") end, + hash256 = function(str) return hashed(str,256,formatstring,"%0x04%0x04%0x04%0x04%0x04%0x04%0x04%0x04") end, + hash384 = function(str) return hashed(str,384,formatstring,"%0x08%0x08%0x08%0x08%0x08%0x08") end, + hash512 = function(str) return hashed(str,512,formatstring,"%0x08%0x08%0x08%0x08%0x08%0x08%0x08%0x08") end, + HASH224 = function(str) return hashed(str,224,formatstring,"%0X04%0X04%0X04%0X04%0X04%0X04%0X04") end, + HASH256 = function(str) return hashed(str,256,formatstring,"%0X04%0X04%0X04%0X04%0X04%0X04%0X04%0X04") end, + HASH384 = function(str) return hashed(str,384,formatstring,"%0X08%0X08%0X08%0X08%0X08%0X08") end, + HASH512 = function(str) return hashed(str,512,formatstring,"%0X08%0X08%0X08%0X08%0X08%0X08%0X08%0X08") end, } --- local setmetatableindex = table.setmetatableindex +-- The wikipedia provides the code: +-- +-- https://en.wikipedia.org/wiki/SHA-1 +-- +-- and (nor being in th emood to writ it myself) a bit of googling gave a decent +-- starting point: +-- +-- https://github.com/gdyr/LuaSHA1/blob/master/sha1.lua -- --- if setmetatableindex then --- sha2.hashed = setmetatableindex(function(t,k) --- local v = digest[k] and function(str) return hashed(str,k,tohex) end or false --- t[k] = v --- return v --- end) --- sha2.HASHED = setmetatableindex(function(t,k) --- local v = digest[k] and function(str) return hashed(str,k,toHEX) end or false --- t[k] = v --- return v --- end) --- end +-- and after that it was just a matter of optimizing the code a bit. I just put +-- it here as reference as we probably don't use it. We could use a repeater as +-- we do with sha2. + +local function digest(str) + + local h1 = 0x67452301 + local h2 = 0xEFCDAB89 + local h3 = 0x98BADCFE + local h4 = 0x10325476 + local h5 = 0xC3D2E1F0 + + local len = #str + local list = { } -- we can even move this outside the function + + str = str .. "\128" .. repstring("\0", (120 - ((len + 1) % 64)) % 64) .. packstring(">I8", 8 * len) + + for i=1,#str,64 do + + list[ 1], list[ 2], list[ 3], list[ 4], list[ 5], list[ 6], list[ 7], list[ 8], + list[ 9], list[10], list[11], list[12], list[13], list[14], list[15], list[16] = + unpackstring(">I4I4I4I4I4I4I4I4I4I4I4I4I4I4I4I4",str,i) + + for i=17,80 do + local v = list[i-3] ~ list[i-8] ~ list[i-14] ~ list[i-16] + list[i] = ((v << 1) | (v >> 31)) & 0xFFFFFFFF + end + + local a, b, c, d, e = h1, h2, h3, h4, h5 + + for i=1,20 do + local f = (b & c) | ((~b) & d) + local r = (a << 5) | (a >> 27) + local s = (f + r + e + 0x5A827999 + list[i]) & 0xFFFFFFFF + e = d + d = c + c = (b << 30) | (b >> 2) + b = a + a = s + end + + for i=21,40 do + local f = b ~ c ~ d + local r = (a << 5) | (a >> 27) + local s = (f + r + e + 0x6ED9EBA1 + list[i]) & 0xFFFFFFFF + e = d + d = c + c = (b << 30) | (b >> 2) + b = a + a = s + end + + for i=41,60 do + local f = (b & c) | (b & d) | (c & d) + local r = (a << 5) | (a >> 27) + local s = (f + r + e + 0x8F1BBCDC + list[i]) & 0xFFFFFFFF + e = d + d = c + c = (b << 30) | (b >> 2) + b = a + a = s + end + + for i=61,80 do + local f = b ~ c ~ d + local r = (a << 5) | (a >> 27) + local s = (f + r + e + 0xCA62C1D6 + list[i]) & 0xFFFFFFFF + e = d + d = c + c = (b << 30) | (b >> (32 - 30)) + b = a + a = s + end + + h1 = (h1 + a) & 0xFFFFFFFF + h2 = (h2 + b) & 0xFFFFFFFF + h3 = (h3 + c) & 0xFFFFFFFF + h4 = (h4 + d) & 0xFFFFFFFF + h5 = (h5 + e) & 0xFFFFFFFF + + end + + return h1, h2, h3, h4, h5 + +end + +-- A similar wrapper as we use for sha2: + +local sha1 = { + digest = function(str) + return packstring(">I4I4I4I4I4",digest(str)) + end, + hash = function(str) + return formatstring("%08x%08x%08x%08x%08x",digest(str)) + end, + HASH = function(str) + return formatstring("%08X%08X%08X%08X%08X",digest(str)) + end, +} if utilities then utilities.sha2 = sha2 + utilities.sha1 = sha1 end return sha2 - diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml index 686a4dc06..2dd29cfd9 100644 --- a/tex/context/interface/mkii/keys-en.xml +++ b/tex/context/interface/mkii/keys-en.xml @@ -376,6 +376,7 @@ <cd:variable name='nohz' value='nohz'/> <cd:variable name='noline' value='noline'/> <cd:variable name='nomarking' value='nomarking'/> + <cd:variable name='nomenubar' value='nomenubar'/> <cd:variable name='none' value='none'/> <cd:variable name='nonumber' value='nonumber'/> <cd:variable name='norepeat' value='norepeat'/> diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml index 2ebcb4a9d..0c1d450ec 100644 --- a/tex/context/interface/mkii/keys-it.xml +++ b/tex/context/interface/mkii/keys-it.xml @@ -376,6 +376,7 @@ <cd:variable name='nohz' value='nohz'/> <cd:variable name='noline' value='noline'/> <cd:variable name='nomarking' value='nomarcature'/> + <cd:variable name='nomenubar' value='nomenubar'/> <cd:variable name='none' value='nessuno'/> <cd:variable name='nonumber' value='nonumber'/> <cd:variable name='norepeat' value='norepeat'/> diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index 872e9955c..160f4f3fc 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -376,6 +376,7 @@ <cd:variable name='nohz' value='nohz'/> <cd:variable name='noline' value='noline'/> <cd:variable name='nomarking' value='بدوننشانهگذاری'/> + <cd:variable name='nomenubar' value='nomenubar'/> <cd:variable name='none' value='هیچکدام'/> <cd:variable name='nonumber' value='بدونشماره'/> <cd:variable name='norepeat' value='norepeat'/> diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml index 5f165f88b..5ee43cc05 100644 --- a/tex/context/interface/mkii/keys-ro.xml +++ b/tex/context/interface/mkii/keys-ro.xml @@ -376,6 +376,7 @@ <cd:variable name='nohz' value='nohz'/> <cd:variable name='noline' value='noline'/> <cd:variable name='nomarking' value='faramarcare'/> + <cd:variable name='nomenubar' value='nomenubar'/> <cd:variable name='none' value='niciunul'/> <cd:variable name='nonumber' value='nonumber'/> <cd:variable name='norepeat' value='norepeat'/> diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 835722e95..87182c2a3 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -20946,28 +20946,16 @@ </cd:interface> <cd:interface file="i-logo.xml"> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="TeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="ConTeXt"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PPCHTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PRAGMA"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LaTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="TaBlE"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PiCTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="AmSTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LamSTeX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="TEX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="Context"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="ConTeXt"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="CONTEXT"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MetaFont"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="METAFONT"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MetaPost"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="METAPOST"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MetaFun"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="eTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="pdfTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="pdfeTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="Lua"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="luaTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="luajitTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="metaTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="XeTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LuaTeX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LuajitTeX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="METAFUN"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MKII"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MKIV"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MKVI"/> @@ -20976,23 +20964,37 @@ <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MPII"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MPIV"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="MPVI"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="METAFONT"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="METAPOST"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PPCHTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PPCHTEX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="CONTEXT"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="METAFUN"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="TEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PRAGMA"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LaTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LATEX"/> - <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PICTEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="TaBlE"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="TABLE"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PiCTeX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PICTEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="AmSTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="AMSTEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LamSTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LAMSTEX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="INRSTEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="eTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="ETEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="pdfTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PDFTEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="pdfeTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="PDFETEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="Lua"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="luaTeX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LuaTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LUATEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="luajitTeX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LuajitTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LUAJITTEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="luametaTeX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LuaMetaTeX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="LUAMETATEX"/> + <cd:command category="symbols" file="cont-log.mkiv" level="document" name="XeTeX"/> <cd:command category="symbols" file="cont-log.mkiv" level="document" name="XETEX"/> </cd:interface> <cd:interface file="i-lohi.xml"> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 25bed32b9..70a537ece 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-logo.xml b/tex/context/interface/mkiv/i-logo.xml index 8f8186a83..3208555e0 100644 --- a/tex/context/interface/mkiv/i-logo.xml +++ b/tex/context/interface/mkiv/i-logo.xml @@ -5,101 +5,77 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands"> <cd:command name="TeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="ConTeXt" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="PPCHTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="PRAGMA" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="LaTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="TaBlE" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="PiCTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="AmSTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="LamSTeX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="TEX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="Context" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="ConTeXt" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="CONTEXT" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="MetaFont" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="METAFONT" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="MetaPost" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="METAPOST" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="MetaFun" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="eTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="pdfTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="pdfeTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="Lua" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="luaTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="luajitTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="metaTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="XeTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="LuaTeX" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="LuajitTeX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="METAFUN" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="MKII" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="MKIV" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="MKVI" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="MKIX" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="MKXI" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="MPII" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="MPIV" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="MPVI" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="METAFONT" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="METAPOST" level="document" category="symbols" file="cont-log.mkiv"/> - + <cd:command name="PPCHTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="PPCHTEX" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="CONTEXT" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="METAFUN" level="document" category="symbols" file="cont-log.mkiv"/> - - <cd:command name="TEX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="PRAGMA" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="LaTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="LATEX" level="document" category="symbols" file="cont-log.mkiv"/> - <cd:command name="PICTEX" level="document" category="symbols" file="cont-log.mkiv"/> - + <cd:command name="TaBlE" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="TABLE" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="PiCTeX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="PICTEX" level="document" category="symbols" file="cont-log.mkiv"/> + + <cd:command name="AmSTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="AMSTEX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="LamSTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="LAMSTEX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="INRSTEX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="eTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="ETEX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="pdfTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="PDFTEX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="pdfeTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="PDFETEX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="Lua" level="document" category="symbols" file="cont-log.mkiv"/> + + <cd:command name="luaTeX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="LuaTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="LUATEX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="luajitTeX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="LuajitTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="LUAJITTEX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="luametaTeX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="LuaMetaTeX" level="document" category="symbols" file="cont-log.mkiv"/> + <cd:command name="LUAMETATEX" level="document" category="symbols" file="cont-log.mkiv"/> + + <cd:command name="XeTeX" level="document" category="symbols" file="cont-log.mkiv"/> <cd:command name="XETEX" level="document" category="symbols" file="cont-log.mkiv"/> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 8a0f44c44..8fccc9173 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index dc44ed818..f5f9653de 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 : 04/29/19 08:52:24 +-- merge date : 05/12/19 19:05:50 do -- begin closure to overcome local limits and interference |