From 3bc02e08823ca9d94cd3da01161ec511c9fdec3f Mon Sep 17 00:00:00 2001
From: Hans Hagen
After a lot of experiments (mostly by Taco, me and Idris) the first implementation -becaus quite useful. When it did most of what we wanted, a more optimized version +was already quite useful. When it did most of what we wanted, a more optimized version evolved. Of course all errors are mine and of course the code can be improved. There are quite some optimizations going on here and processing speed is currently quite acceptable and has been improved over time. Many complex scripts are not yet supported diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index 8032f3c24..a59ac8ac2 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -707,7 +707,7 @@ implement { name = "figurefilepath", actions = { get, file.dirname, context }, implement { name = "figurefilename", actions = { get, file.nameonly, context }, arguments = { "'used'", "'fullname'" } } implement { name = "figurefiletype", actions = { get, file.extname, context }, arguments = { "'used'", "'fullname'" } } -implement { name = "figuresetdimensions", actions = setdimensions, arguments = { "integer" } } +implement { name = "figuresetdimensions", actions = setdimensions, arguments = "integer" } -- todo: local path or cache path diff --git a/tex/context/base/mkiv/meta-ini.mkiv b/tex/context/base/mkiv/meta-ini.mkiv index 6ba0abfa6..52aafac62 100644 --- a/tex/context/base/mkiv/meta-ini.mkiv +++ b/tex/context/base/mkiv/meta-ini.mkiv @@ -136,25 +136,34 @@ \let\stopMPinclusions\relax +% The next was broken since we added instances so it will go away! + \unexpanded\def\MPinclusions {\dosingleempty\meta_inclusions} \def\meta_inclusions[#1]% {\edef\m_meta_option{#1}% - \dosinglegroupempty\meta_inclusions_indeed} + \dodoublegroupempty\meta_inclusions_indeed} \def\meta_inclusions_indeed#1#2% {\let\m_meta_saved_instance\currentMPinstance - \edef\currentMPinstance{#1}% - \ifx\currentMPinstance\empty - \let\currentMPinstance\defaultMPinstance - \fi \ifx\m_meta_option\!!plustoken \else \global\t_meta_inclusions\emptytoks \fi - \gtoksapp\t_meta_inclusions{#2}% + \ifsecondargument + \edef\currentMPinstance{#1}% + \ifx\currentMPinstance\empty + \let\currentMPinstance\defaultMPinstance + \fi + \gtoksapp\t_meta_inclusions{#2}% + \else + \let\currentMPinstance\defaultMPinstance + \gtoksapp\t_meta_inclusions{#1}% + \fi \let\currentMPinstance\m_meta_saved_instance} +% so far + \installcommandhandler \??mpinstance {MPinstance} \??mpinstance \setupMPinstance diff --git a/tex/context/base/mkiv/meta-ini.mkxl b/tex/context/base/mkiv/meta-ini.mkxl index dbb7aeb57..513f87ae2 100644 --- a/tex/context/base/mkiv/meta-ini.mkxl +++ b/tex/context/base/mkiv/meta-ini.mkxl @@ -135,25 +135,34 @@ \let\stopMPinclusions\relax +% The next was broken since we added instances so it will go away! + \unexpanded\def\MPinclusions {\dosingleempty\meta_inclusions} \def\meta_inclusions[#1]% {\edef\m_meta_option{#1}% - \dosinglegroupempty\meta_inclusions_indeed} + \dodoublegroupempty\meta_inclusions_indeed} \def\meta_inclusions_indeed#1#2% {\let\m_meta_saved_instance\currentMPinstance - \edef\currentMPinstance{#1}% - \ifempty\currentMPinstance - \let\currentMPinstance\defaultMPinstance - \fi \ifx\m_meta_option\!!plustoken \else \global\t_meta_inclusions\emptytoks \fi - \gtoksapp\t_meta_inclusions{#2}% + \ifsecondargument + \edef\currentMPinstance{#1}% + \ifx\currentMPinstance\empty + \let\currentMPinstance\defaultMPinstance + \fi + \gtoksapp\t_meta_inclusions{#2}% + \else + \let\currentMPinstance\defaultMPinstance + \gtoksapp\t_meta_inclusions{#1}% + \fi \let\currentMPinstance\m_meta_saved_instance} +% so far + \installcommandhandler \??mpinstance {MPinstance} \??mpinstance \setupMPinstance diff --git a/tex/context/base/mkiv/page-lin.lua b/tex/context/base/mkiv/page-lin.lua index 5ad660460..06983ef5c 100644 --- a/tex/context/base/mkiv/page-lin.lua +++ b/tex/context/base/mkiv/page-lin.lua @@ -485,15 +485,6 @@ function boxed.stage_two(n,m) local m = li[2] local ti = t[i] if ti then - -- local d = getdirection(n) - -- local l = getlist(n) - -- if d == 1 then - -- local w = getwidth(n) - -- ti = hpack_nodes(linked_nodes(new_kern(-w),ti,new_kern(w))) - -- end - -- setnext(ti,l) - -- setprev(l,ti) - -- setlist(n,ti) addtoline(n,ti) resolve(n,m) else diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 26777bb6d..1cd7d90a0 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index ad3136f2a..770293cb2 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/strc-doc.lua b/tex/context/base/mkiv/strc-doc.lua index 9877a0f9c..aadbd8a90 100644 --- a/tex/context/base/mkiv/strc-doc.lua +++ b/tex/context/base/mkiv/strc-doc.lua @@ -1103,9 +1103,9 @@ implement { name = "namedstructureuservariable", actions = sections.userdata, implement { name = "setstructurelevel", actions = sections.setlevel, arguments = "2 strings" } implement { name = "getstructurelevel", actions = sections.getcurrentlevel, arguments = "string" } implement { name = "setstructurenumber", actions = sections.setnumber, arguments = { "integer", "string" } } -- string as we support +- -implement { name = "getstructurenumber", actions = sections.getnumber, arguments = { "integer" } } +implement { name = "getstructurenumber", actions = sections.getnumber, arguments = "integer" } implement { name = "getsomestructurenumber", actions = sections.getnumber, arguments = { "integer", "string" } } -implement { name = "getfullstructurenumber", actions = sections.fullnumber, arguments = { "integer" } } +implement { name = "getfullstructurenumber", actions = sections.fullnumber, arguments = "integer" } implement { name = "getsomefullstructurenumber", actions = sections.fullnumber, arguments = { "integer", "string" } } implement { name = "getspecificstructuretitle", actions = sections.structuredata, arguments = { "string", "'titledata.title'",false,"string" } } diff --git a/tex/context/base/mkiv/strc-lst.lua b/tex/context/base/mkiv/strc-lst.lua index 9f4e0fe63..fdbb97873 100644 --- a/tex/context/base/mkiv/strc-lst.lua +++ b/tex/context/base/mkiv/strc-lst.lua @@ -1216,7 +1216,7 @@ implement { implement { name = "doifelselisthastitle", actions = { lists.hastitledata, commands.doifelse }, arguments = { "string", "integer" } } implement { name = "doifelselisthaspage", actions = { lists.haspagedata, commands.doifelse }, arguments = { "string", "integer" } } implement { name = "doifelselisthasnumber", actions = { lists.hasnumberdata, commands.doifelse }, arguments = { "string", "integer" } } -implement { name = "doifelselisthasentry", actions = { lists.iscached, commands.doifelse }, arguments = { "integer" } } +implement { name = "doifelselisthasentry", actions = { lists.iscached, commands.doifelse }, arguments = "integer" } local function savedlisttitle(name,n,tag) local data = cached[tonumber(n)] @@ -1274,7 +1274,7 @@ implement { implement { name = "discardfromlist", actions = lists.discard, - arguments = { "integer" } + arguments = "integer" } -- new and experimental and therefore off by default diff --git a/tex/context/base/mkiv/strc-pag.lua b/tex/context/base/mkiv/strc-pag.lua index 9b3a77e74..47fa9463c 100644 --- a/tex/context/base/mkiv/strc-pag.lua +++ b/tex/context/base/mkiv/strc-pag.lua @@ -440,6 +440,6 @@ implement { -- weird place interfaces.implement { name = "pageofinternal", - arguments = { "integer" }, + arguments = "integer", actions = helpers.pageofinternal, } diff --git a/tex/context/base/mkiv/supp-ran.lua b/tex/context/base/mkiv/supp-ran.lua index ef2654406..08889edf3 100644 --- a/tex/context/base/mkiv/supp-ran.lua +++ b/tex/context/base/mkiv/supp-ran.lua @@ -142,7 +142,7 @@ implement { name = "getrandomnumber", actions = { getrandomnumber, context }, implement { name = "getrandomdimen", actions = { getrandomnumber, context }, arguments = { "dimen", "dimen" } } implement { name = "getrandomfloat", actions = { getrandomnumber, context }, arguments = { "number", "number" } } --------- { name = "getmprandomnumber", actions = { getmprandomnumber, context } } -implement { name = "setrandomseed", actions = { setrandomseed }, arguments = { "integer" } } +implement { name = "setrandomseed", actions = { setrandomseed }, arguments = "integer" } implement { name = "getrandomseed", actions = { getrandomseed, context } } implement { name = "pushrandomseed", actions = { pushrandomseed } } implement { name = "poprandomseed", actions = { poprandomseed } } diff --git a/tex/context/base/mkiv/typo-lin.lua b/tex/context/base/mkiv/typo-lin.lua index 15e543c52..1d523a200 100644 --- a/tex/context/base/mkiv/typo-lin.lua +++ b/tex/context/base/mkiv/typo-lin.lua @@ -123,10 +123,10 @@ local getreserved = jobpositions.getreserved local paragraphs = { } typesetters.paragraphs = paragraphs -local addskips = false +local addskips = false -- todo: use engine normalizer local noflines = 0 --- This is the third version, a mix between immediate (prestice lines) and delayed +-- This is the third version, a mix between immediate (prestine lines) and delayed -- as we don't want anchors that are not used. -- I will make a better variant once lmtx is stable i.e. less clutter. diff --git a/tex/context/modules/mkiv/m-chart.lua b/tex/context/modules/mkiv/m-chart.lua index 76efbedfd..6c57f070e 100644 --- a/tex/context/modules/mkiv/m-chart.lua +++ b/tex/context/modules/mkiv/m-chart.lua @@ -323,7 +323,7 @@ implement { implement { name = "flow_set_text", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(align,str) temp.texts[#temp.texts+1] = { align = align, @@ -358,7 +358,7 @@ implement { implement { name = "flow_set_label", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(location,text) temp.labels[#temp.labels+1] = { location = location, @@ -369,7 +369,7 @@ implement { implement { name = "flow_set_comment", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(location,text) local connections = temp.connections if connections then @@ -389,7 +389,7 @@ implement { implement { name = "flow_set_exit", - arguments = { "string", "string" }, + arguments = "2 strings", actions = function(location,text) temp.exits[#temp.exits+1] = { location = location, @@ -582,7 +582,7 @@ implement { implement { name = "flow_set_connection", - arguments = { "string", "string", "string" }, + arguments = "3 strings", actions = function(location,displacement,name) local dx, dy = lpegmatch(splitter,displacement) dx = tonumber(dx) diff --git a/tex/context/modules/mkiv/m-steps.lua b/tex/context/modules/mkiv/m-steps.lua index ce84866a4..bbc267274 100644 --- a/tex/context/modules/mkiv/m-steps.lua +++ b/tex/context/modules/mkiv/m-steps.lua @@ -399,7 +399,7 @@ end interfaces.implement { name = "step_start_chart", - arguments = { "string", "string" }, + arguments = "2 strings", actions = step_start_chart, } diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 471d32d1b..b4b5d0af1 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2020-06-25 10:55 +-- merge date : 2020-06-26 13:25 do -- begin closure to overcome local limits and interference -- cgit v1.2.3