diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/syst-aux.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/syst-aux.lua | 133 |
1 files changed, 37 insertions, 96 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/syst-aux.lua b/Master/texmf-dist/tex/context/base/mkiv/syst-aux.lua index 9b0ca82c430..f9d8505f1d4 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/syst-aux.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/syst-aux.lua @@ -323,47 +323,9 @@ end implement { name = "texdefinition_one", actions = texdefinition_one, scope = "private", arguments = "string" } implement { name = "texdefinition_two", actions = texdefinition_two, scope = "private" } -do - - -- Quite probably we don't yet have characters loaded so we delay some - -- aliases. - - local _lower_, _upper_, _strip_ - - _lower_ = function(s) - if characters and characters.lower then - _lower_ = characters.lower - return _lower_(s) - end - return string.lower(s) - end - - _upper_ = function(s) - if characters and characters.upper then - _upper_ = characters.upper - return _upper_(s) - end - return string.upper(s) - end - - _strip_ = function(s) - -- or utf.strip - if string.strip then - _strip_ = string.strip - return _strip_(s) - end - return s - end - - local function lower(s) context(_lower_(s)) end - local function upper(s) context(_upper_(s)) end - local function strip(s) context(_strip_(s)) end - - implement { name = "upper", arguments = "string", actions = upper } - implement { name = "lower", arguments = "string", actions = lower } - implement { name = "strip", arguments = "string", actions = strip } - -end +implement { name = "upper", arguments = "string", actions = { utf.upper, context } } +implement { name = "lower", arguments = "string", actions = { utf.lower, context } } +implement { name = "strip", arguments = "string", actions = { string.strip, context } } -- or utf.strip implement { name = "converteddimen", @@ -411,17 +373,10 @@ implement { -- not faster but just less tracing: -local ctx_protected_cs = context.protected.cs -- more efficient - -local ctx_firstoftwoarguments = ctx_protected_cs.firstoftwoarguments -local ctx_secondoftwoarguments = ctx_protected_cs.secondoftwoarguments -local ctx_firstofoneargument = ctx_protected_cs.firstofoneargument -local ctx_gobbleoneargument = ctx_protected_cs.gobbleoneargument - -context.firstoftwoarguments = ctx_firstoftwoarguments -context.secondoftwoarguments = ctx_secondoftwoarguments -context.firstofoneargument = ctx_firstofoneargument -context.gobbleoneargument = ctx_gobbleoneargument +local firstoftwoarguments = context.firstoftwoarguments +local secondoftwoarguments = context.secondoftwoarguments +local firstofoneargument = context.firstofoneargument +local gobbleoneargument = context.gobbleoneargument local hash = utilities.parsers.hashes.settings_to_set @@ -429,9 +384,9 @@ local function doifelsecommon(a,b) if a == b then setmacro("commalistelement",a) if a == "" then - ctx_secondoftwoarguments() + secondoftwoarguments() else - ctx_firstoftwoarguments() + firstoftwoarguments() end return end @@ -445,7 +400,7 @@ local function doifelsecommon(a,b) for k in next, ha do if hb[k] then setmacro("commalistelement",k) - ctx_firstoftwoarguments() + firstoftwoarguments() return end end @@ -453,28 +408,28 @@ local function doifelsecommon(a,b) if hash[a][b] then -- if settings_to_set(a)[b] then setmacro("commalistelement",b) - ctx_firstoftwoarguments() + firstoftwoarguments() return end elseif bb then if hash[b][a] then -- if settings_to_set(b)[a] then setmacro("commalistelement",a) - ctx_firstoftwoarguments() + firstoftwoarguments() return end end setmacro("commalistelement","") - ctx_secondoftwoarguments() + secondoftwoarguments() end local function doifcommon(a,b) if a == b then setmacro("commalistelement",a) if a == "" then - ctx_gobbleoneargument() + gobbleoneargument() else - ctx_firstofoneargument() + firstofoneargument() end return end @@ -488,7 +443,7 @@ local function doifcommon(a,b) for k in next, ha do if hb[k] then setmacro("commalistelement",k) - ctx_firstofoneargument() + firstofoneargument() return end end @@ -496,28 +451,28 @@ local function doifcommon(a,b) if hash[a][b] then -- if settings_to_set(a)[b] then setmacro("commalistelement",b) - ctx_firstofoneargument() + firstofoneargument() return end elseif bb then if hash[b][a] then -- if settings_to_set(b)[a] then setmacro("commalistelement",a) - ctx_firstofoneargument() + firstofoneargument() return end end setmacro("commalistelement","") - ctx_gobbleoneargument() + gobbleoneargument() end local function doifnotcommon(a,b) if a == b then setmacro("commalistelement",a) if a == "" then - ctx_firstofoneargument() + firstofoneargument() else - ctx_gobbleoneargument() + gobbleoneargument() end return end @@ -531,7 +486,7 @@ local function doifnotcommon(a,b) for k in next, ha do if hb[k] then setmacro("commalistelement",k) - ctx_gobbleoneargument() + gobbleoneargument() return end end @@ -539,28 +494,28 @@ local function doifnotcommon(a,b) if hash[a][b] then -- if settings_to_set(a)[b] then setmacro("commalistelement",b) - ctx_gobbleoneargument() + gobbleoneargument() return end elseif bb then if hash[b][a] then -- if settings_to_set(b)[a] then setmacro("commalistelement",a) - ctx_gobbleoneargument() + gobbleoneargument() return end end setmacro("commalistelement","") - ctx_firstofoneargument() + firstofoneargument() end local function doifelseinset(a,b) if a == b then setmacro("commalistelement",a) if a == "" then - ctx_secondoftwoarguments() + secondoftwoarguments() else - ctx_firstoftwoarguments() + firstoftwoarguments() end return end @@ -569,21 +524,21 @@ local function doifelseinset(a,b) if hash[b][a] then -- if settings_to_set(b)[a] then setmacro("commalistelement",a) - ctx_firstoftwoarguments() + firstoftwoarguments() return end end setmacro("commalistelement","") - ctx_secondoftwoarguments() + secondoftwoarguments() end local function doifinset(a,b) if a == b then setmacro("commalistelement",a) if a == "" then - ctx_gobbleoneargument() + gobbleoneargument() else - ctx_firstofoneargument() + firstofoneargument() end return end @@ -592,21 +547,21 @@ local function doifinset(a,b) if hash[b][a] then -- if settings_to_set(b)[a] then setmacro("commalistelement",a) - ctx_firstofoneargument() + firstofoneargument() return end end setmacro("commalistelement","") - ctx_gobbleoneargument() + gobbleoneargument() end local function doifnotinset(a,b) if a == b then setmacro("commalistelement",a) if a == "" then - ctx_firstofoneargument() + firstofoneargument() else - ctx_gobbleoneargument() + gobbleoneargument() end return end @@ -615,12 +570,12 @@ local function doifnotinset(a,b) if hash[b][a] then -- if settings_to_set(b)[a] then setmacro("commalistelement",a) - ctx_gobbleoneargument() + gobbleoneargument() return end end setmacro("commalistelement","") - ctx_firstofoneargument() + firstofoneargument() end implement { @@ -659,20 +614,6 @@ implement { arguments = "2 strings", } --- done elsewhere: --- --- local function firstinset(a) --- local aa = hash[a] --- context(aa and aa[1] or a) --- end --- --- implement { --- name = "firstinset", --- actions = firstinset, --- arguments = "string", --- private = false, --- } - -- implement { -- name = "stringcompare", -- arguments = "2 strings", |