diff options
Diffstat (limited to 'tex')
31 files changed, 445 insertions, 146 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 7b2009ec1..dbf7190d6 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.01.28 18:17} +\newcontextversion{2021.01.29 19:41} %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 1ea02bd7a..7702d079d 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.01.28 18:17} +\edef\contextversion{2021.01.29 19:41} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index d265ced0d..39f0f5193 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -774,6 +774,8 @@ \setinterfaceconstant{deepnumbercommand}{فرمانشمارهعمیق} \setinterfaceconstant{deeptextcommand}{فرمانمتنعمیق} \setinterfaceconstant{default}{پیشفرض} +\setinterfaceconstant{defaultheight}{defaultheight} +\setinterfaceconstant{defaultwidth}{defaultwidth} \setinterfaceconstant{define}{define} \setinterfaceconstant{delay}{تاخیر} \setinterfaceconstant{depth}{عمق} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index f57a3cd66..5eb0a9601 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.01.28 18:17} +\newcontextversion{2021.01.29 19:41} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 1c9c3f894..843c8cb33 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.01.28 18:17} +\edef\contextversion{2021.01.29 19:41} %D Kind of special: diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua index 16448c429..f16908321 100644 --- a/tex/context/base/mkiv/luat-cnf.lua +++ b/tex/context/base/mkiv/luat-cnf.lua @@ -27,6 +27,8 @@ texconfig.max_strings = 500000 texconfig.hash_extra = 200000 texconfig.function_size = 32768 texconfig.properties_size = 10000 +texconfig.level_max = 500 +texconfig.level_chr = 46 -- period if CONTEXTLMTXMODE > 0 then @@ -70,6 +72,8 @@ local variablenames = CONTEXTLMTXMODE > 0 and { token_size = true, node_size = true, buffer_size = true, + level_max = true, + level_chr = true, } or { error_line = false, half_error_line = false, @@ -85,6 +89,8 @@ local variablenames = CONTEXTLMTXMODE > 0 and { function_size = true, properties_size = true, fix_mem_init = true, + level_max = true, + level_chr = true, } local stub = [[ diff --git a/tex/context/base/mkiv/luat-cod.lua b/tex/context/base/mkiv/luat-cod.lua index 927f6dfab..12f7a31e6 100644 --- a/tex/context/base/mkiv/luat-cod.lua +++ b/tex/context/base/mkiv/luat-cod.lua @@ -33,6 +33,8 @@ texconfig.stack_size = 10000 texconfig.function_size = 32768 texconfig.properties_size = 10000 texconfig.fix_mem_init = 1000000 +texconfig.level_max = 500 +texconfig.level_chr = 46 -- period -- registering bytecode chunks diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index f9f233892..450238c16 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -8368,6 +8368,14 @@ return { ["pe"]="پیشفرض", ["ro"]="implicit", }, + ["defaultwidth"]={ + ["en"]="defaultwidth", + ["nl"]="defaultbreedte", + }, + ["defaultheight"]={ + ["en"]="defaultheight", + ["nl"]="defaulthoogte", + }, ["delay"]={ ["cs"]="prodleva", ["de"]="wartezeit", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 6f5ee9318..5209919ea 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 6c4204d6a..6eab06ae2 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/buff-ver.mkxl b/tex/context/base/mkxl/buff-ver.mkxl index 7d193553c..11ad92784 100644 --- a/tex/context/base/mkxl/buff-ver.mkxl +++ b/tex/context/base/mkxl/buff-ver.mkxl @@ -448,8 +448,8 @@ %D The basic display verbatim commands are defined in an indirect way. As we %D will see, they are a specific case of a more general mechanism. -\let\beginofverbatimlines\relax % hooks -\let\endofverbatimlines \relax % hooks +\mutable\let\beginofverbatimlines\relax % hooks +\mutable\let\endofverbatimlines \relax % hooks \protected\def\buff_verbatim_typing_start#1% tricky non standard lookahead {\begingroup diff --git a/tex/context/base/mkxl/colo-ini.mkxl b/tex/context/base/mkxl/colo-ini.mkxl index b9170ea40..7dfa541db 100644 --- a/tex/context/base/mkxl/colo-ini.mkxl +++ b/tex/context/base/mkxl/colo-ini.mkxl @@ -1220,10 +1220,10 @@ %D \getbuffer %D \stopexample -\let\currentcolorname\s!black % todo -\let\outercolorname \s!black % todo +\mutable\let\currentcolorname\s!black % todo +\mutable\let\outercolorname \s!black % todo -\let\colorformatseparator\space +\mutable\let\colorformatseparator\space \permanent\def\MPcolor#1% {\clf_mpcolor diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 4b239b6ff..6e7b34537 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.01.28 18:17} +\newcontextversion{2021.01.29 19:41} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index f70ae4c46..5d26d4fbe 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.01.28 18:17} +\immutable\edef\contextversion{2021.01.29 19:41} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -52,11 +52,11 @@ \ifdefined\normalinput \else \aliased\let\normalinput\input \fi -\def\loadmarkfile#1{\normalinput{#1.\mksuffix}} -\def\loadmkivfile#1{\normalinput{#1.mkiv}} -\def\loadmkvifile#1{\normalinput{#1.mkvi}} -\def\loadmkxlfile#1{\normalinput{#1.mkxl}} -\def\loadmklxfile#1{\normalinput{#1.mklx}} +\permanent\protected\def\loadmarkfile#1{\normalinput{#1.\mksuffix}} +\permanent\protected\def\loadmkivfile#1{\normalinput{#1.mkiv}} +\permanent\protected\def\loadmkvifile#1{\normalinput{#1.mkvi}} +\permanent\protected\def\loadmkxlfile#1{\normalinput{#1.mkxl}} +\permanent\protected\def\loadmklxfile#1{\normalinput{#1.mklx}} %D First we load the system modules. These implement a lot of manipulation macros. %D We start with setting up some basic \TEX\ machinery. diff --git a/tex/context/base/mkxl/core-con.mkxl b/tex/context/base/mkxl/core-con.mkxl index cf88a0eea..bfa8079e6 100644 --- a/tex/context/base/mkxl/core-con.mkxl +++ b/tex/context/base/mkxl/core-con.mkxl @@ -450,19 +450,16 @@ \endgroup} \permanent\tolerant\protected\def\setdate[#1]% sets the date ! - {\dontleavehmode - \ifparameter#1\or - \begingroup - \letdummyparameter\c!d\normalday - \letdummyparameter\c!m\normalmonth - \letdummyparameter\c!y\normalyear - \getdummyparameters[#1]% - \normalexpanded - {\endgroup - \normalday \number\directdummyparameter\c!d\relax - \normalmonth\number\directdummyparameter\c!m\relax - \normalyear \number\directdummyparameter\c!y\relax}% - \fi} + {\begingroup + \letdummyparameter\c!d\normalday + \letdummyparameter\c!m\normalmonth + \letdummyparameter\c!y\normalyear + \getdummyparameters[#1]% + \normalexpanded + {\endgroup + \normalday \number\directdummyparameter\c!d\relax + \normalmonth\number\directdummyparameter\c!m\relax + \normalyear \number\directdummyparameter\c!y\relax}} \permanent\tolerant\protected\def\date[#1]#*[#2]% sets the date ! {\dontleavehmode diff --git a/tex/context/base/mkxl/driv-ini.lmt b/tex/context/base/mkxl/driv-ini.lmt index 7b50a8cbf..729196e87 100644 --- a/tex/context/base/mkxl/driv-ini.lmt +++ b/tex/context/base/mkxl/driv-ini.lmt @@ -61,6 +61,150 @@ local defaulthandlers = { outputfilename = dummy, } +local installwhatsits do + + local leaderlevel = 0 + local backends = backends + + local function pushleaderlevel() + leaderlevel = leaderlevel + 1 + end + + local function popleaderlevel() + leaderlevel = leaderlevel - 1 + end + + local function flushlatelua(current,h,v) + -- Here we assume maganement by the lua function so currently we don't + -- check for leaderlevel. + return backends.latelua(current,h,v) + end + + local function flushwriteout(current) + if leaderlevel == 0 then + backends.writeout(current) + end + end + + local function flushopenout(current) + if leaderlevel == 0 then + backends.openout(current) + end + end + + local function flushcloseout(current) + if leaderlevel == 0 then + backends.closeout(current) + end + end + + local function flushsavepos(current,pos_h,pos_v) + local jp = job.positions + jp.lastx = pos_h + jp.lasty = pos_v + end + + local function flushuserdefined() + -- nothing here + end + + local whatsitcodes = nodes.whatsitcodes + + local trace = true trackers.register("backends.whatsits",function(v) trace = v end) + + installwhatsits = function(name,flushers) + + -- latelua : specific + -- userdefined : special purpose, handled in callbacks + -- savepos : only used by generic packages + -- open : generic + -- close : generic + -- write : generic + + -- An alternative is to have a first time setter. + + local function checkagain(t, k) + local v = rawget(flushers,k) -- in case it's registered later + if not v then + if trace then + report("unsupported whatsit %a in driver %a",whatsitcodes[k] or k,name) + end + v = function() end + end + t[k] = v + return v + end + + -- flushers.whatsit = setmetatableindex ( { + -- [whatsitcodes.literal] = flushers.literal, + -- [whatsitcodes.latelua] = flushlatelua, + -- [whatsitcodes.userdefined] = flushuserdefined, + -- [whatsitcodes.savepos] = flushsavepos, + -- [whatsitcodes.save] = flushers.save, + -- [whatsitcodes.restore] = flushers.restore, + -- [whatsitcodes.setmatrix] = flushers.setmatrix, + -- [whatsitcodes.open] = flushopenout, + -- [whatsitcodes.close] = flushcloseout, + -- [whatsitcodes.write] = flushwriteout, + -- [whatsitcodes.startmatrix] = flushers.startmatrix, + -- [whatsitcodes.stopmatrix] = flushers.stopmatrix, + -- [whatsitcodes.startscaling] = flushers.startscaling, + -- [whatsitcodes.stopscaling] = flushers.stopscaling, + -- [whatsitcodes.startrotation] = flushers.startrotation, + -- [whatsitcodes.stoprotation] = flushers.stoprotation, + -- [whatsitcodes.startmirroring] = flushers.startmirroring, + -- [whatsitcodes.stopmirroring] = flushers.stopmirroring, + -- [whatsitcodes.startclipping] = flushers.startclipping, + -- [whatsitcodes.stopclipping] = flushers.stopclipping, + -- [whatsitcodes.setstate] = flushers.setstate, + -- }, checkagain ) + + -- -- sparse + + -- flushers.whatsit = setmetatableindex ( { + -- [whatsitcodes.latelua] = flushlatelua, + -- [whatsitcodes.userdefined] = flushuserdefined, + -- [whatsitcodes.savepos] = flushsavepos, + -- [whatsitcodes.open] = flushopenout, + -- [whatsitcodes.close] = flushcloseout, + -- [whatsitcodes.write] = flushwriteout, + -- }, checkagain ) + + -- -- delayed + + local whatsit ; whatsit = setmetatableindex ( { + [whatsitcodes.literal] = flushers.literal or function(...) return checkagain(whatsit,whatsitcodes.literal )(...) end, + [whatsitcodes.latelua] = flushlatelua, + [whatsitcodes.userdefined] = flushuserdefined, + [whatsitcodes.savepos] = flushsavepos, + [whatsitcodes.save] = flushers.save or function(...) return checkagain(whatsit,whatsitcodes.save )(...) end, + [whatsitcodes.restore] = flushers.restore or function(...) return checkagain(whatsit,whatsitcodes.restore )(...) end, + [whatsitcodes.setmatrix] = flushers.setmatrix or function(...) return checkagain(whatsit,whatsitcodes.setmatrix )(...) end, + [whatsitcodes.open] = flushopenout, + [whatsitcodes.close] = flushcloseout, + [whatsitcodes.write] = flushwriteout, + [whatsitcodes.startmatrix] = flushers.startmatrix or function(...) return checkagain(whatsit,whatsitcodes.startmatrix )(...) end, + [whatsitcodes.stopmatrix] = flushers.stopmatrix or function(...) return checkagain(whatsit,whatsitcodes.stopmatrix )(...) end, + [whatsitcodes.startscaling] = flushers.startscaling or function(...) return checkagain(whatsit,whatsitcodes.startscaling )(...) end, + [whatsitcodes.stopscaling] = flushers.stopscaling or function(...) return checkagain(whatsit,whatsitcodes.stopscaling )(...) end, + [whatsitcodes.startrotation] = flushers.startrotation or function(...) return checkagain(whatsit,whatsitcodes.startrotation )(...) end, + [whatsitcodes.stoprotation] = flushers.stoprotation or function(...) return checkagain(whatsit,whatsitcodes.stoprotation )(...) end, + [whatsitcodes.startmirroring] = flushers.startmirroring or function(...) return checkagain(whatsit,whatsitcodes.startmirroring)(...) end, + [whatsitcodes.stopmirroring] = flushers.stopmirroring or function(...) return checkagain(whatsit,whatsitcodes.stopmirroring )(...) end, + [whatsitcodes.startclipping] = flushers.startclipping or function(...) return checkagain(whatsit,whatsitcodes.startclipping )(...) end, + [whatsitcodes.stopclipping] = flushers.stopclipping or function(...) return checkagain(whatsit,whatsitcodes.stopclippin )(...) end, + [whatsitcodes.setstate] = flushers.setstate or function(...) return checkagain(whatsit,whatsitcodes.setstate )(...) end, + }, checkagain) + + flushers.whatsit = whatsit + + flushers.pushleaderlevel = pushleaderlevel + flushers.popleaderlevel = popleaderlevel + + end + +end + function drivers.install(specification) local name = specification.name if not name then @@ -77,6 +221,7 @@ function drivers.install(specification) report("no flushers for driver %a",name) return end + installwhatsits(name,flushers) -- report("driver %a is installed",name) setmetatableindex(actions, defaulthandlers) setmetatableindex(flushers, function() return dummy end) diff --git a/tex/context/base/mkxl/driv-shp.lmt b/tex/context/base/mkxl/driv-shp.lmt index d231b8f0a..945d3c963 100644 --- a/tex/context/base/mkxl/driv-shp.lmt +++ b/tex/context/base/mkxl/driv-shp.lmt @@ -138,6 +138,7 @@ local flushcharacter local flushfontchar local flushrule local flushliteral +local flushwhatsit -- make local @@ -533,39 +534,6 @@ local function reset_dir_stack() dirstack = { } end -local leaderlevel = 0 - -local function flushlatelua(current,h,v) - -- Here we assume maganement by the lua function so currently we don't - -- check for leaderlevel. - return backends.latelua(current,h,v) -end - -local function flushwriteout(current) - if leaderlevel == 0 then - backends.writeout(current) - end -end - -local function flushopenout(current) - if leaderlevel == 0 then - backends.openout(current) - end -end - -local function flushcloseout(current) - if leaderlevel == 0 then - backends.closeout(current) - end -end - -local function flushsavepos(current,pos_h,pos_v) - jobpositions.lastx = pos_h - jobpositions.lasty = pos_v -end - -local flushwhatsit - local hlist_out, vlist_out do local function applyanchor(orientation,x,y,width,height,depth,woffset,hoffset,doffset,xoffset,yoffset) @@ -732,7 +700,7 @@ local hlist_out, vlist_out do end end local shift = getshift(leader) - leaderlevel = leaderlevel + 1 + pushleaderlevel() while cur_h + width <= edge do local basepoint_h = 0 -- local basepoint_v = shift @@ -754,7 +722,7 @@ local hlist_out, vlist_out do end cur_h = cur_h + width + lx end - leaderlevel = leaderlevel - 1 + popleaderlevel() cur_h = edge - 10 else cur_h = cur_h + gluewidth @@ -1050,7 +1018,7 @@ local hlist_out, vlist_out do end end local shift = getshift(leader) - leaderlevel = leaderlevel + 1 + pushleaderlevel() while cur_v + total <= edge do -- todo: <= edge - total -- synch_pos_with_cur(ref_h, ref_v, getshift(leader), cur_v + height) if pos_r == righttoleft_code then @@ -1067,7 +1035,7 @@ local hlist_out, vlist_out do end cur_v = cur_v + total + ly end - leaderlevel = leaderlevel - 1 + popleaderlevel() cur_v = edge - 10 else cur_v = cur_v + glueheight @@ -1215,52 +1183,21 @@ function drivers.converters.lmtx(driver,box,smode,objnum,specification) initialize = actions.initialize finalize = actions.finalize - -- we need to do this once ... - --- if not updatefontstate then - - updatefontstate = flushers.updatefontstate - - pushorientation = flushers.pushorientation - poporientation = flushers.poporientation - - flushcharacter = flushers.character - flushfontchar = flushers.fontchar - flushrule = flushers.rule - flushsimplerule = flushers.simplerule - flushspecialrule = flushers.specialrule - flushliteral = flushers.literal - - flushwhatsit = rawget(flushers,"whatsit") - - if not flushwhatsit then - flushwhatsit = setmetatableindex ( { - [whatsitcodes.literal] = flushliteral, - [whatsitcodes.latelua] = flushlatelua, - [whatsitcodes.userdefined] = function() end, -- special purpose, handled in callbacks - [whatsitcodes.savepos] = flushsavepos, -- only used by generic packages - [whatsitcodes.save] = flushers.save, - [whatsitcodes.restore] = flushers.restore, - [whatsitcodes.setmatrix] = flushers.setmatrix, - [whatsitcodes.open] = flushopenout, -- generic - [whatsitcodes.close] = flushcloseout, -- generic - [whatsitcodes.write] = flushwriteout, -- generic - [whatsitcodes.startmatrix] = flushers.startmatrix, - [whatsitcodes.stopmatrix] = flushers.stopmatrix, - [whatsitcodes.startscaling] = flushers.startscaling, - [whatsitcodes.stopscaling] = flushers.stopscaling, - [whatsitcodes.startrotation] = flushers.startrotation, - [whatsitcodes.stoprotation] = flushers.stoprotation, - [whatsitcodes.startmirroring] = flushers.startmirroring, - [whatsitcodes.stopmirroring] = flushers.stopmirroring, - [whatsitcodes.startclipping] = flushers.startclipping, - [whatsitcodes.stopclipping] = flushers.stopclipping, - [whatsitcodes.setstate] = flushers.setstate, - }, function(t, k) report("weird whatsit %a",k) return function() end end) - flushers.whatsit = flushwhatsit - end + updatefontstate = flushers.updatefontstate + + pushorientation = flushers.pushorientation + poporientation = flushers.poporientation + + pushleaderlevel = flushers.pushleaderlevel + popleaderlevel = flushers.popleaderlevel --- end + flushcharacter = flushers.character + flushfontchar = flushers.fontchar + flushrule = flushers.rule + flushsimplerule = flushers.simplerule + flushspecialrule = flushers.specialrule + flushliteral = flushers.literal + flushwhatsit = flushers.whatsit reset_dir_stack() reset_state() diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt index d60333766..f1949c816 100644 --- a/tex/context/base/mkxl/font-ctx.lmt +++ b/tex/context/base/mkxl/font-ctx.lmt @@ -1362,6 +1362,7 @@ do -- else too many locals end mathematics.resolvefallbacks(tfmdata,specification,fallbacks) context(function() + -- We're doing math fallbacks. busy = false mathematics.finishfallbacks(tfmdata,specification,fallbacks) tfmdata.original = specification.specification @@ -1370,6 +1371,7 @@ do -- else too many locals properties.id = id -- already set definers.register(tfmdata,id) -- to be sure, normally already done texdefinefont(global,cs,id) + -- texdefinefont(cs,id,global and "global") constructors.finalize(tfmdata) if trace_defining then report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a", @@ -1407,6 +1409,7 @@ do -- else too many locals properties.id = id -- already set definers.register(tfmdata,id) -- to be sure, normally already done texdefinefont(global,cs,id) + -- texdefinefont(cs,id,global and "global") constructors.finalize(tfmdata) if trace_defining then report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a, step %a", @@ -1426,6 +1429,7 @@ do -- else too many locals end csnames[tfmdata] = specification.cs texdefinefont(global,cs,tfmdata) + -- texdefinefont(cs,tfmdata,global and "global") -- resolved (when designsize is used): local size = round(fontdata[tfmdata].parameters.size or 0) -- ctx_setsomefontsize(size .. "sp") @@ -1541,6 +1545,7 @@ do -- else too many locals elseif type(tfmdata) == "number" then if cs then texdefinefont(specification.global,cs,tfmdata) + -- texdefinefont(cs,tfmdata,specification.global and "global") csnames[tfmdata] = cs end stoptiming(fonts) @@ -1551,6 +1556,7 @@ do -- else too many locals definers.register(tfmdata,id) if cs then texdefinefont(specification.global,cs,id) + -- texdefinefont(cs,id,specification.global and "global") csnames[id] = cs end constructors.finalize(tfmdata) diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 4baacf970..2960cd9fb 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -814,7 +814,7 @@ %\scaledfontsize\plusone \let\somefontspec\empty \let\lastrawfontcall\relax - \letcsname#csname\endcsname\relax + \mutable\letcsname#csname\endcsname\relax \else \edef\somefontspec{at \number\scaledfontsize sp}% we need the resolved designsize (for fallbacks) \expandafter\let\expandafter\lastrawfontcall\csname#csname\endcsname @@ -923,7 +923,7 @@ %\scaledfontsize\plusone \let\somefontspec\empty \let\lastrawfontcall\relax - \letcsname#csname\endcsname\relax + \mutable\letcsname#csname\endcsname\relax \else \edef\somefontspec{at \number\scaledfontsize sp}% we need the resolved designsize (for fallbacks) % @@ -940,7 +940,7 @@ \edef\somefontsizey{\glyphyscale\somefontsizey\relax}% \fi \ifempty\fontclass\else\global\fi - \protected\edefcsname#csname\endcsname + \mutable\protected\edefcsname#csname\endcsname {\setfontid\the\fontid\csname#csname\endcsname\relax \glyphscale\the\glyphscale\relax \somefontsizex @@ -1061,11 +1061,11 @@ \def\font_basics_define_font_a[#name][#specification][#settings]% [name][spec][1.6 | line=10pt | setup_id] {\doifelsesetups{#settings}% - {\setuvalue{#name}{\font_basics_define_font_with_setups {#name}{#specification}{#settings}}} - {\setuvalue{#name}{\font_basics_define_font_with_parameters{#name}{#specification}{#settings}}}} + {\mutable\protected\defcsname#name\endcsname{\font_basics_define_font_with_setups {#name}{#specification}{#settings}}} + {\mutable\protected\defcsname#name\endcsname{\font_basics_define_font_with_parameters{#name}{#specification}{#settings}}}} \def\font_basics_define_font_b[#name][#specification][#dummy]% - {\setuvalue{#name}{\font_basics_define_font_without_parameters{#name}{#specification}}} + {\mutable\protected\defcsname#name\endcsname{\font_basics_define_font_without_parameters{#name}{#specification}}} \def\font_basics_define_font_with_parameters#name#specification#settings% {\font_basics_define_font_without_parameters{#name}{#specification}% @@ -1086,7 +1086,7 @@ \csname#name\endcsname \glet\lastglobalrawfontcall\lastrawfontcall \endgroup - \letcsname#name\endcsname\lastglobalrawfontcall + \aliased\letcsname#name\endcsname\lastglobalrawfontcall \fi} %D The instance namespace protection makes the switch local so that we can redefine a @@ -2496,7 +2496,7 @@ %D We don't support language specific synonyms here. \permanent\tolerant\protected\def\definebodyfontswitch[#command]#spacer[#specification]% no longer a commalist (not useful) - {\setvalue{#command}{\switchtobodyfont[#specification]}}% + {\frozen\protected\defcsname#command\endcsname{\switchtobodyfont[#specification]}}% %D \macros %D {setsmallbodyfont,setmainbodyfont,setbigbodyfont} diff --git a/tex/context/base/mkxl/grph-inc.mkxl b/tex/context/base/mkxl/grph-inc.mkxl index 99ceea4d3..fe8971d35 100644 --- a/tex/context/base/mkxl/grph-inc.mkxl +++ b/tex/context/base/mkxl/grph-inc.mkxl @@ -76,6 +76,8 @@ \c!hfactor =, \c!wfactor =, \c!factor =, + \c!defaultwidth =8\lineheight, + \c!defaultheight =6\lineheight, \c!maxwidth =\externalfigureparameter\c!width, \c!maxheight =\externalfigureparameter\c!height, \c!xscale =, @@ -456,9 +458,9 @@ [\c!hfactor =\externalfigureparameter\c!hfactor, \c!wfactor =\externalfigureparameter\c!wfactor, \c!factor =\externalfigureparameter\c!factor, - \c!maxwidth =\externalfigureparameter\c!maxwidth , + \c!maxwidth =\externalfigureparameter\c!maxwidth, \c!maxheight =\externalfigureparameter\c!maxheight, - \c!equalwidth =\externalfigureparameter\c!equalwidth , + \c!equalwidth =\externalfigureparameter\c!equalwidth, \c!equalheight=\externalfigureparameter\c!equalheight, \c!xscale =\externalfigureparameter\c!xscale, \c!yscale =\externalfigureparameter\c!yscale, @@ -492,9 +494,6 @@ \newbox \foundexternalfigure \newtoks\externalfigurepostprocessors -\def\defaultfigurewidth {8\lineheight} % permanent ? frozen ? -\def\defaultfigureheight {6\lineheight} % permanent ? frozen ? - \permanent\def\figurestatus {\numexpr\clf_figurestatus{status}{0}\relax} % number: 0 = not found \permanent\def\figurewidth {\clf_figurestatus{width}{0}sp} \permanent\def\figureheight {\clf_figurestatus{height}{0}sp} @@ -513,8 +512,8 @@ \permanent\def\figurefilecache {\clf_figurerequest{cache}{}} \permanent\def\figurefileprefix {\clf_figurerequest{prefix}{}} -\permanent\def\figurenaturalwidth {\clf_figureused{width}{\number\dimexpr\defaultfigurewidth\relax}sp} -\permanent\def\figurenaturalheight {\clf_figureused{height}{\number\dimexpr\defaultfigureheight\relax}sp} +\permanent\def\figurenaturalwidth {\clf_figureused{width}{\number\dimexpr\externalfigureparameter\c!defaultwidth\relax}sp} +\permanent\def\figurenaturalheight {\clf_figureused{height}{\number\dimexpr\externalfigureparameter\c!defaultheight\relax}sp} \permanent\def\figurexresolution {\clf_figureused{xresolution}{0}} \permanent\def\figureyresolution {\clf_figureused{yresolution}{0}} \permanent\def\figureorientation {\clf_figureused{orientation}{1}} @@ -573,8 +572,8 @@ {\externalfigureparameter\c!directory}% \clf_figure_reset \foundexternalfigure - \defaultfigurewidth - \defaultfigureheight + \externalfigureparameter\c!defaultwidth + \externalfigureparameter\c!defaultheight \relax \to \everyexternalfigureresets @@ -651,7 +650,7 @@ {\hss\egroup\egroup} \permanent\protected\def\emptyfoundexternalfigure % sort of obsolete - {\startfoundexternalfigure\defaultfigurewidth\defaultfigureheight + {\startfoundexternalfigure{\externalfigureparameter\c!defaultwidth}{\externalfigureparameter\c!defaultheight}% \stopfoundexternalfigure} % \doifmodeelse{*\v!last} @@ -807,10 +806,10 @@ \d_grph_include_collection_maxheight\zeropoint} \permanent\protected\def\stopexternalfigurecollection - {\setxvalue{\??externalfigurecollection\currentexternalfigurecollection:\c!minwidth }{\the\d_grph_include_collection_minwidth }% - \setxvalue{\??externalfigurecollection\currentexternalfigurecollection:\c!maxwidth }{\the\d_grph_include_collection_maxwidth }% - \setxvalue{\??externalfigurecollection\currentexternalfigurecollection:\c!minheight}{\the\d_grph_include_collection_minheight}% - \setxvalue{\??externalfigurecollection\currentexternalfigurecollection:\c!maxheight}{\the\d_grph_include_collection_maxheight}% + {\xdefcsname\??externalfigurecollection\currentexternalfigurecollection:\c!minwidth \endcsname{\the\d_grph_include_collection_minwidth }% + \xdefcsname\??externalfigurecollection\currentexternalfigurecollection:\c!maxwidth \endcsname{\the\d_grph_include_collection_maxwidth }% + \xdefcsname\??externalfigurecollection\currentexternalfigurecollection:\c!minheight\endcsname{\the\d_grph_include_collection_minheight}% + \xdefcsname\??externalfigurecollection\currentexternalfigurecollection:\c!maxheight\endcsname{\the\d_grph_include_collection_maxheight}% \endgroup} \permanent\def\externalfigurecollectionparameter#1#2% diff --git a/tex/context/base/mkxl/luat-cod.lmt b/tex/context/base/mkxl/luat-cod.lmt index 8268c9f64..a1f46b1ae 100644 --- a/tex/context/base/mkxl/luat-cod.lmt +++ b/tex/context/base/mkxl/luat-cod.lmt @@ -41,6 +41,9 @@ texconfig.properties_size = 10000 texconfig.error_line = 250 texconfig.half_error_line = 125 +texconfig.level_max = 500 +texconfig.level_chr = 46 -- period + -- registering bytecode chunks local bytedata = lua.bytedata or { } diff --git a/tex/context/base/mkxl/luat-usr.lmt b/tex/context/base/mkxl/luat-usr.lmt new file mode 100644 index 000000000..4b876b935 --- /dev/null +++ b/tex/context/base/mkxl/luat-usr.lmt @@ -0,0 +1,177 @@ +if not modules then modules = { } end modules ['luat-usr'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local global = global + +local moduledata = moduledata +local thirddata = thirddata +local userdata = userdata +local documentdata = documentdata + +local context = context +local tostring = tostring +local tonumber = tonumber +local print = print + +local string = string +local table = table +local lpeg = lpeg +local math = math +local io = io +local os = os +local lpeg = lpeg + +local setmetatableindex = table.setmetatableindex +local load = load +local xpcall = xpcall +local instance_banner = string.formatters["=[instance: %s]"] -- the = controls the lua error / see: lobject.c +local tex_errormessage = context.errmessage + +local implement = interfaces.implement +local reporter = logs.reporter + +local report_instance = reporter("lua instance") +local report_script = reporter("lua script") +local report_thread = reporter("lua thread") +local newline = logs.newline + +lua.numbers = lua.numbers or { } +lua.messages = lua.messages or { } + +local numbers = lua.numbers +local messages = lua.messages + +storage.register("lua/numbers", numbers, "lua.numbers" ) +storage.register("lua/messages", messages, "lua.messages") + +-- First we implement a pure lua version of directlua and a persistent +-- variant of it: + +local function runscript(code) + local done, message = loadstring(code) + if done then + done() + else + newline() + report_script("error : %s",message or "unknown") + report_script() + report_script("code : %s",code) + newline() + end +end + +local threads = setmetatableindex(function(t,k) + local v = setmetatableindex({},global) + t[k] = v + return v +end) + +local function runthread(name,code) + if not code or code == "" then + threads[name] = nil + else + local thread = threads[name] + local done, message = loadstring(code,nil,nil,thread) + if done then + done() + else + newline() + report_thread("thread: %s",name) + report_thread("error : %s",message or "unknown") + report_thread() + report_thread("code : %s",code) + newline() + end + end +end + +interfaces.implement { + name = "luascript", + actions = runscript, + public = true, + protected = true, + arguments = "string" +} + +interfaces.implement { + name = "luathread", + actions = runthread, + public = true, + protected = true, + arguments = "2 strings", +} + +local function registername(name,message) + if not name or name == "" then + report_instance("no valid name given") + return + end + if not message or message == "" then + message = name + end + local lnn = numbers[name] + if not lnn then + lnn = #messages + 1 + messages[lnn] = message + numbers[name] = lnn + end + local report = reporter("lua instance",message) + local proxy = { + -- we can access all via: + global = global, -- or maybe just a metatable + -- some protected data + moduledata = setmetatableindex(moduledata), + thirddata = setmetatableindex(thirddata), + -- less protected data + userdata = userdata, + documentdata = documentdata, + -- always there fast + context = context, + -- + tostring = tostring, + tonumber = tonumber, + -- standard lua modules + string = string, + table = table, + lpeg = lpeg, + math = math, + io = io, + os = os, + lpeg = lpeg, + -- + print = print, + report = report, + } + return function(code) + local code, message = load(code,nil,nil,proxy) + if not code then + report_instance("error: %s",message or code) + elseif not xpcall(code,report) then + tex_errormessage("hit return to continue or quit this run") + end + end +end + +lua.registername = registername + +implement { + name = "registernamedlua", + arguments = "3 strings", + actions = function(name,message,csname) + if csname and csname ~= "" then + implement { + name = csname, + arguments = "string", + actions = registername(name,message) or report, + scope = "private", + } + else + report_instance("unvalid csname for %a",message or name or "?") + end + end +} diff --git a/tex/context/base/mkxl/luat-usr.mkxl b/tex/context/base/mkxl/luat-usr.mkxl index c32a030b2..b266044ce 100644 --- a/tex/context/base/mkxl/luat-usr.mkxl +++ b/tex/context/base/mkxl/luat-usr.mkxl @@ -15,7 +15,7 @@ \unprotect -\registerctxluafile{luat-usr}{} +\registerctxluafile{luat-usr}{autosuffix} %D A few goodies: %D @@ -30,8 +30,8 @@ %D %D \typebuffer \startlines \getbuffer \stoplines -\let\luascript\clf_luascript % todo: public implementors -\let\luathread\clf_luathread % todo: public implementors +% \luascript % defined at the lua end +% \luathread % defined at the lua end %D \macros %D {definenamedlua} diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index 17df200e2..2471f3ca2 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -989,11 +989,11 @@ \let\delayedendstrut\relax \let\delayedstrut \relax -\let\localoffset\empty -\let\localwidth \empty -\let\localheight\empty -\let\localformat\empty -\let\localstrut \empty +\mutable\let\localoffset\empty +\mutable\let\localwidth \empty +\mutable\let\localheight\empty +\mutable\let\localformat\empty +\mutable\let\localstrut \empty \protected\def\pack_framed_process_indeed {\d_framed_frameoffset\framedparameter\c!frameoffset diff --git a/tex/context/base/mkxl/page-bck.mkxl b/tex/context/base/mkxl/page-bck.mkxl index 9790cf3bf..dc4cc602a 100644 --- a/tex/context/base/mkxl/page-bck.mkxl +++ b/tex/context/base/mkxl/page-bck.mkxl @@ -50,7 +50,7 @@ %D We keep calculations and checks to a minimum and also try to minimize %D the amount of tracing due to expansion. -\let\currentotrbackground\empty +\mutable\let\currentotrbackground\empty %D This is the only spot where we have a low level dependency on the way %D parent chains are defined but we want the speed. diff --git a/tex/context/base/mkxl/scrn-but.mklx b/tex/context/base/mkxl/scrn-but.mklx index 3df4be248..4fd7bfffc 100644 --- a/tex/context/base/mkxl/scrn-but.mklx +++ b/tex/context/base/mkxl/scrn-but.mklx @@ -675,6 +675,14 @@ \endgroup \ignorespaces} +\aliased\let\startraw \aliased\let\stopraw\relax +\aliased\let\startbut \aliased\let\stopbut\relax +\aliased\let\startgot \aliased\let\stopgot\relax +\aliased\let\startnop \aliased\let\stopnop\relax +\aliased\let\starttxt \aliased\let\stoptxt\relax +\aliased\let\startrul \aliased\let\stoprul\relax +\aliased\let\startcom \aliased\let\stopcom\relax + \protected\def\scrn_menu_raw_start[#action]#text\stopraw {\scrn_menu_action_start \gotobox{\ignorespaces#text\unskip}[#action]% diff --git a/tex/context/base/mkxl/strc-num.mkxl b/tex/context/base/mkxl/strc-num.mkxl index b34fa4604..1eb4f605d 100644 --- a/tex/context/base/mkxl/strc-num.mkxl +++ b/tex/context/base/mkxl/strc-num.mkxl @@ -376,6 +376,9 @@ % currentstructurecomponent => \strc_current_ or just \m_strc_ +\mutable\let\currentname \empty +\mutable\let\currentcounter\empty + \protected\def\strc_counters_register_component#1#2#3#4#5#6#7[#8][#9]% maybe also nolist {\begingroup % diff --git a/tex/context/base/mkxl/strc-sbe.mkxl b/tex/context/base/mkxl/strc-sbe.mkxl index 4ff1263bf..d3141d28b 100644 --- a/tex/context/base/mkxl/strc-sbe.mkxl +++ b/tex/context/base/mkxl/strc-sbe.mkxl @@ -79,7 +79,7 @@ bookmark {\sectionblockparameter\c!bookmark}% \relax} -\let\currentsectionblock\empty % was \s!unknown +\mutable\let\currentsectionblock\empty % was \s!unknown \permanent\tolerant\protected\def\startsectionblock[#1]#*[#2]% {%\ctxlua{structures.counters.check(0)}% we assume sane usage of \page, as this is the only workable place (in push) diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl index a77cdb401..863c454a9 100644 --- a/tex/context/base/mkxl/strc-sec.mkxl +++ b/tex/context/base/mkxl/strc-sec.mkxl @@ -277,8 +277,8 @@ \setstructuresynchronization\currentstructurelistnumber \endgroup} -\let\currentsectioncountervalue \!!zerocount % redefined later -\let\previoussectioncountervalue\!!zerocount % redefined later +\mutable\let\currentsectioncountervalue \!!zerocount % redefined later +\mutable\let\previoussectioncountervalue\!!zerocount % redefined later % We can access the (stored) data with the following macros. % @@ -475,6 +475,10 @@ \setstructurelevel\currenthead{\thenamedheadlevel\currenthead}% \to \everyredefinehead +\mutable\let\currentsectionheadcoupling\empty +\mutable\let\currentsectionheadsection \empty +\mutable\let\currentsectionlevel \empty + \appendtoks % beware, this is a global register \begingroup diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index 2d4747c87..4a5558344 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -780,6 +780,8 @@ <cd:constant name='deepnumbercommand' value='فرمانشمارهعمیق'/> <cd:constant name='deeptextcommand' value='فرمانمتنعمیق'/> <cd:constant name='default' value='پیشفرض'/> + <cd:constant name='defaultheight' value='defaultheight'/> + <cd:constant name='defaultwidth' value='defaultwidth'/> <cd:constant name='define' value='define'/> <cd:constant name='delay' value='تاخیر'/> <cd:constant name='depth' value='عمق'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 96a533fd4..9ae017ec9 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-01-28 18:17 +-- merge date : 2021-01-29 19:41 do -- begin closure to overcome local limits and interference |