diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/core-env.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/core-env.lua | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/core-env.lua b/Master/texmf-dist/tex/context/base/mkiv/core-env.lua index 50759dd1941..1c5165ac891 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/core-env.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/core-env.lua @@ -47,12 +47,12 @@ local cache = tokens.cache local iftrue = cache["iftrue"].mode -local dimencode = cache["scratchdimen"] .command -local countcode = cache["scratchcounter"] .command -local tokencode = cache["scratchtoken"] .command -local skipcode = cache["scratchskip"] .command -local muskipcode = cache["scratchmuskip"] .command ------ attributecode = cache["scratchattribute"].command +local dimencode = cache["scratchdimen"] .command -- tokens.commands.register_dimen +local countcode = cache["scratchcounter"].command -- tokens.commands.register_int +local tokencode = cache["scratchtoks"] .command -- tokens.commands.register_toks +local skipcode = cache["scratchskip"] .command -- tokens.commands.register_glue +local muskipcode = cache["scratchmuskip"] .command -- tokens.commands.register_mu_glue +local conditioncode = cache["iftrue"] .command -- tokens.commands.if_test local types = { [dimencode] = "dimen", @@ -61,6 +61,7 @@ local types = { [skipcode] = "skip", [muskipcode] = "muskip", -- [attributecode] = "attribute", + [conditioncode] = "condition" } setmetatableindex(texmodes, function(t,k) @@ -80,10 +81,6 @@ setmetatableindex(texmodes, function(t,k) end end) -setmetatablenewindex(texmodes, function(t,k) - report_mode("you cannot set the %s named %a this way","mode",k) -end) - setmetatableindex(texsystemmodes, function(t,k) local m = systemmodes[k] if m then @@ -98,30 +95,39 @@ setmetatableindex(texsystemmodes, function(t,k) end end end) -setmetatablenewindex(texsystemmodes, function(t,k) - report_mode("you cannot set the %s named %a this way","systemmode",k) + +do -- we could do the same as in lmtx (use the mode) + + local trialtypesettingstate = createtoken("trialtypesettingstate").index + local texgetcount = tex.getcount + + context.settrialtypesettingmethod(function() + return texgetcount(trialtypesettingstate) ~= 0 + end) + +end + +setmetatablenewindex(texmodes, function(t,k) report_mode("you cannot set the %s named %a this way","mode", k) end) +setmetatablenewindex(texsystemmodes, function(t,k) report_mode("you cannot set the %s named %a this way","systemmode", k) end) +setmetatablenewindex(texconstants, function(t,k) report_mode("you cannot set the %s named %a this way","constant", k) end) +setmetatablenewindex(texconditionals, function(t,k) report_mode("you cannot set the %s named %a this way","conditional",k) end) +setmetatablenewindex(texifs, function(t,k) end) + +setmetatablenewindex(texifs, function(t,k) + -- just ignore end) setmetatableindex(texconstants, function(t,k) return cache[k].mode ~= 0 and texgetcount(k) or 0 end) -setmetatablenewindex(texconstants, function(t,k) - report_mode("you cannot set the %s named %a this way","constant",k) -end) setmetatableindex(texconditionals, function(t,k) -- 0 == true return cache[k].mode ~= 0 and texgetcount(k) == 0 end) -setmetatablenewindex(texconditionals, function(t,k) - report_mode("you cannot set the %s named %a this way","conditional",k) -end) -table.setmetatableindex(texifs, function(t,k) +setmetatableindex(texifs, function(t,k) return cache[k].mode == iftrue end) -setmetatablenewindex(texifs, function(t,k) - -- just ignore -end) tex.isdefined = isdefined |