diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-03-31 12:15:06 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2015-03-31 12:15:06 +0200 |
commit | aab1c4e9206382c1a96d738fddabf3d98218f267 (patch) | |
tree | f2f2deb68b14da978dde592e28c67c9c627d841a | |
parent | 859ed31b143659de2ed45291cb5b121c41cecede (diff) | |
download | context-aab1c4e9206382c1a96d738fddabf3d98218f267.tar.gz |
2015-03-31 12:06:00
27 files changed, 385 insertions, 303 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 8becf779b..e9b9555bd 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -8311,7 +8311,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 7011, stripped down to: 5590 +-- original size: 6704, stripped down to: 5343 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -8484,15 +8484,6 @@ function statistics.tracefunction(base,tag,...) statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end) end end -commands=commands or {} -function commands.resettimer(name) - resettiming(name or "whatever") - starttiming(name or "whatever") -end -function commands.elapsedtime(name) - stoptiming(name or "whatever") - context(elapsedtime(name or "whatever")) -end end -- of closure @@ -17831,8 +17822,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 746515 --- stripped bytes : 272377 +-- original bytes : 746208 +-- stripped bytes : 272317 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 8becf779b..e9b9555bd 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -8311,7 +8311,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 7011, stripped down to: 5590 +-- original size: 6704, stripped down to: 5343 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -8484,15 +8484,6 @@ function statistics.tracefunction(base,tag,...) statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end) end end -commands=commands or {} -function commands.resettimer(name) - resettiming(name or "whatever") - starttiming(name or "whatever") -end -function commands.elapsedtime(name) - stoptiming(name or "whatever") - context(elapsedtime(name or "whatever")) -end end -- of closure @@ -17831,8 +17822,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 746515 --- stripped bytes : 272377 +-- original bytes : 746208 +-- stripped bytes : 272317 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 8becf779b..e9b9555bd 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -8311,7 +8311,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 7011, stripped down to: 5590 +-- original size: 6704, stripped down to: 5343 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -8484,15 +8484,6 @@ function statistics.tracefunction(base,tag,...) statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end) end end -commands=commands or {} -function commands.resettimer(name) - resettiming(name or "whatever") - starttiming(name or "whatever") -end -function commands.elapsedtime(name) - stoptiming(name or "whatever") - context(elapsedtime(name or "whatever")) -end end -- of closure @@ -17831,8 +17822,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 746515 --- stripped bytes : 272377 +-- original bytes : 746208 +-- stripped bytes : 272317 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 8becf779b..e9b9555bd 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -8311,7 +8311,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-inf"] = package.loaded["trac-inf"] or true --- original size: 7011, stripped down to: 5590 +-- original size: 6704, stripped down to: 5343 if not modules then modules={} end modules ['trac-inf']={ version=1.001, @@ -8484,15 +8484,6 @@ function statistics.tracefunction(base,tag,...) statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end) end end -commands=commands or {} -function commands.resettimer(name) - resettiming(name or "whatever") - starttiming(name or "whatever") -end -function commands.elapsedtime(name) - stoptiming(name or "whatever") - context(elapsedtime(name or "whatever")) -end end -- of closure @@ -17831,8 +17822,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 746515 --- stripped bytes : 272377 +-- original bytes : 746208 +-- stripped bytes : 272317 -- end library merge diff --git a/tex/context/base/attr-neg.lua b/tex/context/base/attr-neg.lua index 37de9a4da..1347c3d1a 100644 --- a/tex/context/base/attr-neg.lua +++ b/tex/context/base/attr-neg.lua @@ -89,10 +89,16 @@ negatives.enable = enable local enabled = false -function commands.triggernegative(stamp) +function negatives.set(stamp) if not enabled then enable() enabled = true end texsetattribute(a_negative,register(stamp)) end + +interfaces.implement { + name = "setnegative", + actions = negatives.set, + arguments = "string", +} diff --git a/tex/context/base/attr-neg.mkiv b/tex/context/base/attr-neg.mkiv index 102b220ba..ff1f52a96 100644 --- a/tex/context/base/attr-neg.mkiv +++ b/tex/context/base/attr-neg.mkiv @@ -25,6 +25,6 @@ \unexpanded\def\startpositive{\attr_trigger_negative\v!positive} \unexpanded\def\stoppositive {\attr_trigger_negative\v!negative} -\def\attr_trigger_negative#1{\ctxcommand{triggernegative('#1')}} +\def\attr_trigger_negative#1{\clf_setnegative{#1}} \protect \endinput diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index bb8f9e38c..139afb2a3 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.03.30 23:33} +\newcontextversion{2015.03.31 12:04} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex d1915c91d..6c9b3a8c3 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 50fa0da05..646c99cb4 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.03.30 23:33} +\edef\contextversion{2015.03.31 12:04} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-env.lua b/tex/context/base/core-env.lua index 75cbbb607..a3a87b7f7 100644 --- a/tex/context/base/core-env.lua +++ b/tex/context/base/core-env.lua @@ -32,7 +32,7 @@ tex.isdefined = allocate { } local modes = { } local systemmodes = { } -if newtoken then +-- if newtoken then -- we keep the old code for historic reasons -- undefined: mode == 0 or cmdname = "undefined_cs" @@ -137,99 +137,99 @@ if newtoken then return types[cache[name].command] or "macro" end -else - - local csname_id = token.csname_id - local create = token.create - - local undefined = csname_id("*undefined*crap*") - local iftrue = create("iftrue")[2] -- inefficient hack - - setmetatableindex(tex.modes, function(t,k) - local m = modes[k] - if m then - return m() - else - local n = "mode>" .. k - if csname_id(n) == undefined then - return false - else - modes[k] = function() return texgetcount(n) == 1 end - return texgetcount(n) == 1 -- 2 is prevented - end - end - end) - - setmetatableindex(tex.systemmodes, function(t,k) - local m = systemmodes[k] - if m then - return m() - else - local n = "mode>*" .. k - if csname_id(n) == undefined then - return false - else - systemmodes[k] = function() return texgetcount(n) == 1 end - return texgetcount(n) == 1 -- 2 is prevented - end - end - end) - - setmetatableindex(tex.constants, function(t,k) - return csname_id(k) ~= undefined and texgetcount(k) or 0 - end) - - setmetatableindex(tex.conditionals, function(t,k) -- 0 == true - return csname_id(k) ~= undefined and texgetcount(k) == 0 - end) - - setmetatableindex(tex.ifs, function(t,k) - -- k = "if" .. k -- better not - return csname_id(k) ~= undefined and create(k)[2] == iftrue -- inefficient, this create, we need a helper - end) - - setmetatableindex(tex.isdefined, function(t,k) - return k and csname_id(k) ~= undefined - end) - setmetatablecall(tex.isdefined, function(t,k) - return k and csname_id(k) ~= undefined - end) - - local lookuptoken = token.lookup - - local dimencode = lookuptoken("scratchdimen" )[1] - local countcode = lookuptoken("scratchcounter")[1] - local tokencode = lookuptoken("scratchtoken" )[1] - local skipcode = lookuptoken("scratchskip" )[1] - - local types = { - [dimencode] = "dimen", - [countcode] = "count", - [tokencode] = "token", - [skipcode ] = "skip", - } - - function tex.isdimen(name) - return lookuptoken(name)[1] == dimencode - end - - function tex.iscount(name) - return lookuptoken(name)[1] == countcode - end - - function tex.istoken(name) - return lookuptoken(name)[1] == tokencode - end - - function tex.isskip(name) - return lookuptoken(name)[1] == skipcode - end - - function tex.type(name) - return types[lookuptoken(name)[1]] or "macro" - end - -end +-- else +-- +-- local csname_id = token.csname_id +-- local create = token.create +-- +-- local undefined = csname_id("*undefined*crap*") +-- local iftrue = create("iftrue")[2] -- inefficient hack +-- +-- setmetatableindex(tex.modes, function(t,k) +-- local m = modes[k] +-- if m then +-- return m() +-- else +-- local n = "mode>" .. k +-- if csname_id(n) == undefined then +-- return false +-- else +-- modes[k] = function() return texgetcount(n) == 1 end +-- return texgetcount(n) == 1 -- 2 is prevented +-- end +-- end +-- end) +-- +-- setmetatableindex(tex.systemmodes, function(t,k) +-- local m = systemmodes[k] +-- if m then +-- return m() +-- else +-- local n = "mode>*" .. k +-- if csname_id(n) == undefined then +-- return false +-- else +-- systemmodes[k] = function() return texgetcount(n) == 1 end +-- return texgetcount(n) == 1 -- 2 is prevented +-- end +-- end +-- end) +-- +-- setmetatableindex(tex.constants, function(t,k) +-- return csname_id(k) ~= undefined and texgetcount(k) or 0 +-- end) +-- +-- setmetatableindex(tex.conditionals, function(t,k) -- 0 == true +-- return csname_id(k) ~= undefined and texgetcount(k) == 0 +-- end) +-- +-- setmetatableindex(tex.ifs, function(t,k) +-- -- k = "if" .. k -- better not +-- return csname_id(k) ~= undefined and create(k)[2] == iftrue -- inefficient, this create, we need a helper +-- end) +-- +-- setmetatableindex(tex.isdefined, function(t,k) +-- return k and csname_id(k) ~= undefined +-- end) +-- setmetatablecall(tex.isdefined, function(t,k) +-- return k and csname_id(k) ~= undefined +-- end) +-- +-- local lookuptoken = token.lookup +-- +-- local dimencode = lookuptoken("scratchdimen" )[1] +-- local countcode = lookuptoken("scratchcounter")[1] +-- local tokencode = lookuptoken("scratchtoken" )[1] +-- local skipcode = lookuptoken("scratchskip" )[1] +-- +-- local types = { +-- [dimencode] = "dimen", +-- [countcode] = "count", +-- [tokencode] = "token", +-- [skipcode ] = "skip", +-- } +-- +-- function tex.isdimen(name) +-- return lookuptoken(name)[1] == dimencode +-- end +-- +-- function tex.iscount(name) +-- return lookuptoken(name)[1] == countcode +-- end +-- +-- function tex.istoken(name) +-- return lookuptoken(name)[1] == tokencode +-- end +-- +-- function tex.isskip(name) +-- return lookuptoken(name)[1] == skipcode +-- end +-- +-- function tex.type(name) +-- return types[lookuptoken(name)[1]] or "macro" +-- end +-- +-- end function context.setconditional(name,value) if value then @@ -253,7 +253,9 @@ local pattern = ( + sep^1 )^1 -function commands.autosetups(str) - lpegmatch(pattern,str) -end +interfaces.implement { + name = "autosetups", + actions = function(str) lpegmatch(pattern,str) end, + arguments = "string" +} diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv index 0ee5a0fb3..41a2a17aa 100644 --- a/tex/context/base/core-env.mkiv +++ b/tex/context/base/core-env.mkiv @@ -499,11 +499,11 @@ % setups={S1,lua(S2),xml(test{123}),S3} \def\syst_setups_process_local - {\ctxcommand{autosetups("\m_syst_setups_asked")}% + {\clf_autosetups{\m_syst_setups_asked}% \relax} % let's prevent lookahead \def\autosetups#1% - {\ctxcommand{autosetups("#1")}} + {\clf_autosetups{#1}} \edef\setupwithargument#1% saves a few expansions {\noexpand\csname\??setup:\noexpand\ifcsname\??setup:#1\endcsname#1\noexpand\else\letterpercent\noexpand\fi\endcsname} diff --git a/tex/context/base/luat-ini.mkiv b/tex/context/base/luat-ini.mkiv index 38b8be3ae..f2355da2a 100644 --- a/tex/context/base/luat-ini.mkiv +++ b/tex/context/base/luat-ini.mkiv @@ -334,6 +334,14 @@ % % \installctxfunction\foo{commands.foo} +% This is a forward definition: + +\def\checkedstrippedcsname#1% this permits \strippedcsname{\xxx} and \strippedcsname{xxx} + {\expandafter\syst_helpers_checked_stripped_csname\string#1} + +\def\syst_helpers_checked_stripped_csname#1% + {\if\noexpand#1\letterbackslash\else#1\fi} + \normalprotected\def\installctxfunction#1#2% {\expandafter\chardef\csname\??luafunction\checkedstrippedcsname#1\endcsname\ctxcommand{ctxfunction("#2",true)}\relax \expandafter\edef\csname\checkedstrippedcsname#1\endcsname{\noexpand\luafunction\csname\??luafunction\checkedstrippedcsname#1\endcsname}} diff --git a/tex/context/base/publ-fnd.lua b/tex/context/base/publ-fnd.lua index 65c025f22..909b102db 100644 --- a/tex/context/base/publ-fnd.lua +++ b/tex/context/base/publ-fnd.lua @@ -257,7 +257,7 @@ end -- { "tag", "bar5678" }, -- } -local f_template = string.formatters[ [[ +local f_template = formatters[ [[ local find = string.find local lower = characters.lower local anywhere = publications.anywhere diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 137a56e48..6a9dd744f 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -394,7 +394,7 @@ do end end end - elseif kind == "userdata" then + elseif kind == "btx" or kind == "userdata" then -- will go: kind == "userdata" -- list entry (each cite) local userdata = entry.userdata if userdata then @@ -1601,7 +1601,7 @@ do local luadata = current.luadata for listindex=1,#result do local r = result[listindex] - local u = r.userdata + local u = r.userdata -- better check on metadata.kind == "btx" if u then local set = u.btxset or v_default if set == dataset then @@ -1639,7 +1639,7 @@ do for listindex=1,#result do local r = result[listindex] local u = r.userdata - if u then + if u then -- better check on metadata.kind == "btx" local set = u.btxset or v_default if set == dataset then local tag = u.btxref @@ -1667,7 +1667,9 @@ do list[#list+1] = { tag, listindex, 0, u, u.btxint, data and data.index or 0 } end end - registerpage(pages,tag,result,listindex) + if tag then + registerpage(pages,tag,result,listindex) + end end end end @@ -1717,7 +1719,8 @@ do keyword = nil end filtermethod(dataset,rendering,keyword) - ctx_btxsetnoflistentries(#rendering.list) + local list = rendering.list + ctx_btxsetnoflistentries(list and #list or 0) end -- for determining width @@ -2001,7 +2004,7 @@ do { "repeated" }, { "ignored" }, { "group" }, - }, + } } } diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 958397ca9..d75ba036e 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -137,7 +137,11 @@ \let\currentbtxspecificationfallback\empty \fi % has to be done explicitly: \loadbtxdefinitionfile[\currentbtxspecification]% - \clf_btxsetspecification{\currentbtxspecification}}% todo: ,true == also load + \ifx\currentbtxspecification\empty + % we set default at the end + \else + \clf_btxsetspecification{\currentbtxspecification}% + \fi}% todo: ,true == also load \installcorenamespace {btx} @@ -841,16 +845,20 @@ \endgroup} \unexpanded\def\btxlistprefixednumber % hack but alan needs it - {\ctxcommand{listprefixednumber("\currentlist",\currentbtxlistindex, { - prefix = "\listparameter\c!prefix", - separatorset = "\listparameter\c!prefixseparatorset", - conversionset = "\listparameter\c!prefixconversionset", - starter = \!!bs\listparameter\c!prefixstarter\!!es, - stopper = \!!bs\listparameter\c!prefixstopper\!!es, - set = "\listparameter\c!prefixset", - segments = "\listparameter\c!prefixsegments", - connector = \!!bs\listparameter\c!prefixconnector\!!es, - })}} + {\clf_listprefixednumber + {\currentlist}% + \currentbtxlistindex + {% + prefix {\listparameter\c!prefix}% + separatorset {\listparameter\c!prefixseparatorset}% + conversionset {\listparameter\c!prefixconversionset}% + starter {\listparameter\c!prefixstarter}% + stopper {\listparameter\c!prefixstopper}% + set {\listparameter\c!prefixset}% + segments {\listparameter\c!prefixsegments}% + connector {\listparameter\c!prefixconnector}% + }% + \relax} \unexpanded\def\btx_reference_checked {\dontleavehmode\hbox\bgroup @@ -871,12 +879,12 @@ {\btx_trace_list_cross\empty\currentbtxbacktrace \global\advance\c_btx_list_reference\plusone \strc_references_direct_full_user - {\ifx\currentbtxdataset\v!default\else\s!btxset="\currentbtxdataset",\fi% - \s!btxref="\currentbtxtag",% - \s!btxspc="\currentbtxspecification",% - \ifx\currentbtxbefore\empty\else\s!btxbtx=\!!bs\currentbtxbefore\!!es,\fi% - \ifx\currentbtxafter \empty\else\s!btxatx=\!!bs\currentbtxafter \!!es,\fi% - \ifx\currentbtxbacklink\currentbtxbacktrace\s!btxint="\currentbtxbacklink"\else\s!btxbck="\currentbtxbacktrace"\fi}% + {\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% + \s!btxref=\currentbtxtag,% + \s!btxspc=\currentbtxspecification,% + \ifx\currentbtxbefore\empty\else\s!btxbtx={\currentbtxbefore},\fi% + \ifx\currentbtxafter \empty\else\s!btxatx={\currentbtxafter },\fi% + \ifx\currentbtxbacklink\currentbtxbacktrace\s!btxint=\currentbtxbacklink\else\s!btxbck=\currentbtxbacktrace\fi}% {\s!btx::\v!list::\number\c_btx_list_reference}% {\currentbtxnumber}} @@ -898,17 +906,30 @@ \newtoks\t_btx_reference_inject +% \def\btx_cite_reference_inject_indeed +% {\btx_trace_list_cross\currentbtxbacklink\empty +% \the\t_btx_reference_inject +% \normalexpanded{\writedatatolist % can be done faster .. just merge code here (not much) / also type btx +% [\s!btx]% +% [\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% +% \s!btxref=\currentbtxtag,% +% \ifx\currentbtxbefore\empty\else\s!btxbtx=\!!bs\currentbtxbefore\!!es,\fi% +% \ifx\currentbtxafter \empty\else\s!btxatx=\!!bs\currentbtxafter \!!es,\fi% +% \s!btxint=\number\currentbtxbacklink +% \ifx\currentbtxciteuservariables\empty\else,\currentbtxciteuservariables\fi]}} + \def\btx_cite_reference_inject_indeed {\btx_trace_list_cross\currentbtxbacklink\empty \the\t_btx_reference_inject - \normalexpanded{\writedatatolist + \strc_lists_inject_direct % todo: make like \btx_list_reference_inject_now with { } [\s!btx]% + [\c!type=\s!btx]% \c!location=\v!none [\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% \s!btxref=\currentbtxtag,% \ifx\currentbtxbefore\empty\else\s!btxbtx=\!!bs\currentbtxbefore\!!es,\fi% \ifx\currentbtxafter \empty\else\s!btxatx=\!!bs\currentbtxafter \!!es,\fi% \s!btxint=\number\currentbtxbacklink - \ifx\currentbtxciteuservariables\empty\else,\currentbtxciteuservariables\fi]}} + \ifx\currentbtxciteuservariables\empty\else,\currentbtxciteuservariables\fi]} \def\currentbtxuservariable #1{\clf_btxuservariable {\currentbtxdataset}{#1}} \def\btxdoifelseuservariable#1{\clf_btxdoifelseuservariable{\currentbtxdataset}{#1}} diff --git a/tex/context/base/scrn-ini.lua b/tex/context/base/scrn-ini.lua index 4831408f9..ce9f9f71b 100644 --- a/tex/context/base/scrn-ini.lua +++ b/tex/context/base/scrn-ini.lua @@ -16,7 +16,7 @@ local codeinjections = backends.codeinjections local identitydata = { } -local function setupidentity(specification) +function general.setupidentity(specification) for k, v in next, specification do identitydata[k] = v end @@ -27,6 +27,17 @@ function general.getidentity() return identitydata end -general.setupidentity = setupidentity - -commands.setupidentity = setupidentity +interfaces.implement { + name = "setupidentity", + actions = general.setupidentity, + arguments = { + { + { "title" }, + { "subtitle" }, + { "author" }, + { "creator" }, + { "date" }, + { "keywords" }, + } + } +} diff --git a/tex/context/base/scrn-ini.mkvi b/tex/context/base/scrn-ini.mkvi index f5b294624..f6e4486a0 100644 --- a/tex/context/base/scrn-ini.mkvi +++ b/tex/context/base/scrn-ini.mkvi @@ -176,14 +176,14 @@ %D Identity \def\scrn_identity_synchronize - {\ctxcommand{setupidentity{ - title = \!!bs\interactionparameter\c!title\!!es, - subtitle = \!!bs\interactionparameter\c!subtitle\!!es, - author = \!!bs\interactionparameter\c!author\!!es, - creator = \!!bs ConTeXt - \contextversion\!!es, - date = \!!bs\interactionparameter\c!date\!!es, - keywords = \!!bs\interactionparameter\c!keyword\!!es, - }}} + {\clf_setupidentity + title {\interactionparameter\c!title}% + subtitle {\interactionparameter\c!subtitle}% + author {\interactionparameter\c!author}% + creator { ConTeXt - \contextversion}% + date {\interactionparameter\c!date}% + keywords {\interactionparameter\c!keyword}% + \relax} \appendtoks \scrn_identity_synchronize diff --git a/tex/context/base/scrn-pag.lua b/tex/context/base/scrn-pag.lua index 7003d0285..4d7b388ee 100644 --- a/tex/context/base/scrn-pag.lua +++ b/tex/context/base/scrn-pag.lua @@ -10,18 +10,43 @@ interactions = interactions or { } interactions.pages = interactions.pages or { } local pages = interactions.pages +local implement = interfaces.implement + local codeinjections = backends.codeinjections -local function setupcanvas(specification) +function pages.setupcanvas(specification) codeinjections.setupcanvas(specification) end -local function setpagetransition(specification) +function pages.setpagetransition(specification) codeinjections.setpagetransition(specification) end -pages.setupcanvas = setupcanvas -pages.setpagetransition = setpagetransition +implement { + name = "setupcanvas", + actions = pages.setupcanvas, + arguments = { + { + { "mode" }, + { "singlesided", "boolean" }, + { "doublesided", "boolean" }, + { "leftoffset", "dimen" }, + { "topoffset", "dimen" }, + { "width", "dimen" }, + { "height", "dimen" }, + { "paperwidth", "dimen" }, + { "paperheight", "dimen" }, + } + } +} -commands.setupcanvas = setupcanvas -commands.setpagetransition = setpagetransition +implement { + name = "setpagetransition", + actions = pages.setpagetransition, + arguments = { + { + { "n" }, + { "delay", "integer" }, + } + } +} diff --git a/tex/context/base/scrn-pag.mkvi b/tex/context/base/scrn-pag.mkvi index 749c98e7a..3dfcd65c5 100644 --- a/tex/context/base/scrn-pag.mkvi +++ b/tex/context/base/scrn-pag.mkvi @@ -133,30 +133,28 @@ \to \everysetuplayout \def\scrn_canvas_synchronize_simple_indeed - {\ctxcommand{setupcanvas{ - paperwidth = \number\printpaperwidth, - paperheight = \number\printpaperheight - }}% + {\clf_setupcanvas + paperwidth \printpaperwidth + paperheight \printpaperheight + \relax %\global\let\scrn_canvas_synchronize_simple \relax - \global\let\scrn_canvas_synchronize_complex\relax - } + \global\let\scrn_canvas_synchronize_complex\relax} \def\scrn_canvas_synchronize_complex_indeed {\scrn_canvas_calculate % otherwise we need to hook it into setuppage etc - \ctxcommand{setupcanvas{ - mode = "\interactionscreenparameter\c!option", - singlesided = \ifsinglesided true\else false\fi, - doublesided = \ifdoublesided true\else false\fi, - leftoffset = \number\canvasbackoffset, - topoffset = \number\canvastopoffset, - width = \number\canvaswidth, - height = \number\canvasheight, - paperwidth = \number\canvasmaxwidth, - paperheight = \number\canvasmaxheight - }}% + \clf_setupcanvas + mode {\interactionscreenparameter\c!option}% + singlesided \ifsinglesided true\else false\fi\space + doublesided \ifdoublesided true\else false\fi\space + leftoffset \canvasbackoffset + topoffset \canvastopoffset + width \canvaswidth + height \canvasheight + paperwidth \canvasmaxwidth + paperheight \canvasmaxheight + \relax %\global\let\scrn_canvas_synchronize_simple \relax - \global\let\scrn_canvas_synchronize_complex\relax - } + \global\let\scrn_canvas_synchronize_complex\relax} \appendtoks \begingroup @@ -216,10 +214,10 @@ \def\scrn_transitions_set_indeed {\begingroup \edef\currentinteractionscreendelay{\interactionscreenparameter\c!delay}% - \ctxcommand{setpagetransition{ - n = "\scrn_transitions_list", - delay = "\ifx\currentinteractionscreendelay\v!none 0\else\currentinteractionscreendelay\fi" - }}% + \clf_setpagetransition + n {\scrn_transitions_list}% + delay \ifx\currentinteractionscreendelay\v!none \zerocount\else\currentinteractionscreendelay\fi + \relax \endgroup} \prependtoks diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex c62a009b8..f6528b644 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 21d601a72..4863d95ae 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index 6bc2ad67e..3595f74cc 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -125,7 +125,7 @@ \def\strc_lists_inject_nop[#dummya][#dummyb]% {\endgroup} -\def\strc_lists_inject_yes[#settings][#userdata]% +\unexpanded\def\strc_lists_inject_yes[#settings][#userdata]% can be used directly {\setupcurrentlist[\c!type=userdata,\c!location=\v!none,#settings]% grouped (use \let... \edef\p_location{\listparameter\c!location}% \setnextinternalreference @@ -142,7 +142,7 @@ % level structures.sections.currentlevel() catcodes \catcodetable } - userdata {\detokenize{#userdata}} + userdata {\detokenize\expandafter{\normalexpanded{#userdata}}} \relax \edef\currentlistnumber{\the\scratchcounter}% \ifx\p_location\v!here @@ -157,6 +157,13 @@ \fi \endgroup} +% todo: make like \strc_references_direct_full_user ... with {}{}{} + +\unexpanded\def\strc_lists_inject_direct[#tag]% [#settings][#userdata] + {\begingroup + \edef\currentlist{#tag}% + \strc_lists_inject_yes} % [#settings][#userdata] + \unexpanded\def\writebetweenlist{\dodoubleempty \strc_lists_write_between} \unexpanded\def\writedatatolist {\dotripleargument\strc_lists_write_data_to} \unexpanded\def\writetolist {\dodoubleempty \strc_lists_write_to} @@ -382,25 +389,25 @@ \unexpanded\def\structurelistgenericnumber % tricky, we need to delay tagging as we have nested lua calls {\dostarttagged\t!listtag\empty \clf_listprefixednumber - {\currentlist} - \currentlistindex - { - prefix {\listparameter\c!prefix} - separatorset {\listparameter\c!prefixseparatorset} - conversionset {\listparameter\c!prefixconversionset} - starter {\listparameter\c!prefixstarter} - stopper {\listparameter\c!prefixstopper} - set {\listparameter\c!prefixset} - segments {\listparameter\c!prefixsegments} - connector {\listparameter\c!prefixconnector} - } - { - separatorset {\listparameter\c!numberseparatorset} - conversionset {\listparameter\c!numberconversionset} - starter {\listparameter\c!numberstarter} - stopper {\listparameter\c!numberstopper} - segments {\listparameter\c!numbersegments} - } + {\currentlist}% + \currentlistindex + {% + prefix {\listparameter\c!prefix}% + separatorset {\listparameter\c!prefixseparatorset}% + conversionset {\listparameter\c!prefixconversionset}% + starter {\listparameter\c!prefixstarter}% + stopper {\listparameter\c!prefixstopper}% + set {\listparameter\c!prefixset}% + segments {\listparameter\c!prefixsegments}% + connector {\listparameter\c!prefixconnector}% + }% + {% + separatorset {\listparameter\c!numberseparatorset}% + conversionset {\listparameter\c!numberconversionset}% + starter {\listparameter\c!numberstarter}% + stopper {\listparameter\c!numberstopper}% + segments {\listparameter\c!numbersegments}% + }% \relax \dostoptagged} diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index 678f9ca4f..2deb32f65 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -315,7 +315,7 @@ }% \fi \ifx\m_strc_references_user\empty \else - userdata {\m_strc_references_user}% + userdata {\m_strc_references_user}% \detokenize\expandafter{\normalexpanded{...}} \fi }% \relax diff --git a/tex/context/base/syst-aux.lua b/tex/context/base/syst-aux.lua index fba27a303..ab4358b85 100644 --- a/tex/context/base/syst-aux.lua +++ b/tex/context/base/syst-aux.lua @@ -20,39 +20,62 @@ local todimen = number.todimen local commands = commands local context = context +local implement = interfaces.implement + local setcatcode = tex.setcatcode local utf8character = lpeg.patterns.utf8character local settings_to_array = utilities.parsers.settings_to_array -local setvalue = context.setvalue +local setmacro = interfaces.setmacro local pattern = C(utf8character^-1) * C(P(1)^0) -function commands.getfirstcharacter(str) - local first, rest = lpegmatch(pattern,str) - setvalue("firstcharacter",first) - setvalue("remainingcharacters",rest) -end +implement { + name = "getfirstcharacter", + arguments = "string", + actions = function(str) + local first, rest = lpegmatch(pattern,str) + setmacro("firstcharacter",first) + setmacro("remainingcharacters",rest) + end +} -function commands.thefirstcharacter(str) - local first, rest = lpegmatch(pattern,str) - context(first) -end -function commands.theremainingcharacters(str) - local first, rest = lpegmatch(pattern,str) - context(rest) -end +implement { + name = "thefirstcharacter", + arguments = "string", + actions = function(str) + local first, rest = lpegmatch(pattern,str) + context(first) + end +} + +implement { + name = "theremainingcharacters", + arguments = "string", + actions = function(str) + local first, rest = lpegmatch(pattern,str) + context(rest) + end +} local pattern = C(utf8character^-1) -function commands.doiffirstcharelse(chr,str) - commands.doifelse(lpegmatch(pattern,str) == chr) -end +implement { + name = "doiffirstcharelse", + arguments = { "string", "string" }, + actions = function(str) + commands.doifelse(lpegmatch(pattern,str) == chr) + end +} -function commands.getsubstring(str,first,last) - context(utfsub(str,tonumber(first),tonumber(last))) -end +implement { + name = "getsubstring", + arguments = { "string", "string", "string" }, + actions = function(str) + context(utfsub(str,tonumber(first),tonumber(last))) + end +} -- function commands.addtocommalist(list,item) -- if list == "" then @@ -86,11 +109,15 @@ end local pattern = (C((1-P("%"))^1) * Carg(1)) /function(n,d) return format("%.0fsp",d * tonumber(n)/100) end * P("%") * P(-1) -- .0 ? --- commands.percentageof("10%",65536*10) +-- percentageof("10%",65536*10) -function commands.percentageof(str,dim) - context(lpegmatch(pattern,str,1,dim) or str) -end +implement { + name = "percentageof", + arguments = { "string", "dimen" }, + actions = function(str,dim) + context(lpegmatch(pattern,str,1,dim) or str) + end +} -- \gdef\setpercentdimen#1#2% -- {#1=\ctxcommand{percentageof("#2",\number#1)}\relax} @@ -133,7 +160,7 @@ local pattern = Cs( -- ^-1 local ctx_dostarttexdefinition = context.dostarttexdefinition -function commands.texdefinition_1(str) +local function texdefinition_one(str) usespaces = nil texpreamble = lpegmatch(pattern,str) if usespaces == true then @@ -150,14 +177,39 @@ function commands.texdefinition_1(str) ctx_dostarttexdefinition() end -function commands.texdefinition_2() +local function texdefinition_two() context(texpreamble) end -local upper, lower, strip = utf.upper, utf.lower, string.strip +implement { name = "texdefinition_one", actions = texdefinition_one, scope = "private", arguments = "string" } +implement { name = "texdefinition_two", actions = texdefinition_two, scope = "private" } + +implement { name = "upper", arguments = "string", actions = { utf.upper, context } } +implement { name = "lower", arguments = "string", actions = { utf.lower, context } } +implement { name = "strip", arguments = "string", actions = { utf.strip, context } } -function commands.upper(s) context(upper(s)) end -function commands.lower(s) context(lower(s)) end -function commands.strip(s) context(strip(s)) end +-- implement { +-- name = "converteddimen", +-- arguments = { "dimen", "string" }, +-- actions = function(dimen,unit) +-- context(todimen(dimen,unit or "pt","%0.5f")) -- no unit appended (%F) +-- end +-- } + +-- where, not really the best spot for this: -function commands.converteddimen(dimen,unit) context(todimen(dimen,unit or "pt","%0.5f")) end -- no unit appended (%F) +implement { + name = "resettimer", + actions = function() + statistics.resettiming("whatever") + statistics.starttiming("whatever") + end +} + +implement { + name = "elapsedtime", + actions = function() + statistics.stoptiming("whatever") + context(statistics.elapsedtime("whatever")) + end +} diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index bf936caa4..2689354e5 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -1315,10 +1315,10 @@ \let\firstcharacter \empty \let\remainingcharacters\empty -\unexpanded\def\getfirstcharacter #1{\ctxcommand{getfirstcharacter(\!!bs#1\!!es)}} -\unexpanded\def\doiffirstcharelse #1#2{\ctxcommand{doiffirstcharelse(\!!bs#1\!!es,\!!bs#2\!!es)}} % chr str -\unexpanded\def\thefirstcharacter #1{\ctxcommand{thefirstcharacter(\!!bs#1\!!es)}} -\unexpanded\def\theremainingcharacters#1{\ctxcommand{theremainingcharacters(\!!bs#1\!!es)}} +\unexpanded\def\getfirstcharacter #1{\clf_getfirstcharacter{#1}} +\unexpanded\def\doiffirstcharelse #1#2{\clf_doiffirstcharelse{#1}{#2}} % chr str +\unexpanded\def\thefirstcharacter #1{\clf_thefirstcharacter{#1}} +\unexpanded\def\theremainingcharacters#1{\clf_theremainingcharacters{#1}} %D \macros %D {doifinstringelse, doifincsnameelse} @@ -1455,10 +1455,10 @@ %D \stoptyping \def\percentdimen#1#2% dimen percentage (with %) - {\dimexpr\ctxcommand{percentageof("#2",\number#1)}\relax} + {\dimexpr\clf_percentageof{#2}\dimexpr#1\relax} \unexpanded\def\setpercentdimen#1#2% dimen percentage (with %) - {#1=\ctxcommand{percentageof("#2",\number#1)}\relax} + {#1=\clf_percentageof{#2}\dimexpr#1\relax} %D \macros %D {makerawcommalist, @@ -3295,11 +3295,11 @@ \gdef\syst_helpers_start_tex_definition#1 {\catcode\endoflineasciicode\ignorecatcode% - \ctxcommand{texdefinition_1("#1")}} + \clf_texdefinition_one{#1}} \gdef\dostarttexdefinition#1\stoptexdefinition% {\egroup% - \ctxcommand{texdefinition_2()}{#1}} + \clf_texdefinition_two{#1}} \egroup @@ -5966,11 +5966,11 @@ %D These macros are sort of obsolete as we never use uppercase this %D way. But nevertheless we provide them: -\def\utfupper#1{\ctxcommand{upper(\!!bs#1\!!es)}} % expandable -\def\utflower#1{\ctxcommand{lower(\!!bs#1\!!es)}} % expandable +\def\utfupper#1{\clf_upper{#1}} % expandable +\def\utflower#1{\clf_lower{#1}} % expandable -\unexpanded\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\ctxcommand{upper(\!!bs#1\!!es)}}} -\unexpanded\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\ctxcommand{lower(\!!bs#1\!!es)}}} +\unexpanded\def\uppercasestring#1\to#2{\dodoglobal\edef#2{\clf_upper{#1}}} +\unexpanded\def\lowercasestring#1\to#2{\dodoglobal\edef#2{\clf_lower{#1}}} %D \macros %D {handletokens} @@ -6743,8 +6743,8 @@ % \fi % \def\elapsedseconds{\expandafter\withoutpt\the\dimexpr\elapsedtime sp\relax} -\def\resettimer {\ctxcommand{resettimer()}} -\def\elapsedtime {\ctxcommand{elapsedtime()}} +\let\resettimer \clf_resettimer +\let\elapsedtime \clf_elapsedtime \let\elapsedseconds \elapsedtime \newcount\c_syst_helpers_test_feature_n @@ -7035,12 +7035,11 @@ % expandable: -%def\getsubstring#1#2#3{\cldcontext{utf.sub([[#3]],tonumber("#1"),tonumber("#2"))}} -\def\getsubstring#1#2#3{\ctxcommand{getsubstring(\!!bs#3\!!es,"#1","#2")}} +\def\getsubstring#1#2#3{\clf_getsubstring{#3}{#1}{#2}} %D Other dimensions than pt: -% \def\converteddimen#1#2{\ctxcommand{converteddimen(\number\dimexpr#1,"#2")}} +% \def\converteddimen#1#2{\clf_converteddimen\dimexpr#1\relax{#2}} %D Maybe (looks ugly): %D diff --git a/tex/context/base/trac-inf.lua b/tex/context/base/trac-inf.lua index 034726ffc..5497e54eb 100644 --- a/tex/context/base/trac-inf.lua +++ b/tex/context/base/trac-inf.lua @@ -207,17 +207,3 @@ function statistics.tracefunction(base,tag,...) statistics.register(formatters["%s.%s"](tag,name),function() return serialize(stat,"calls") end) end end - --- where, not really the best spot for this: - -commands = commands or { } - -function commands.resettimer(name) - resettiming(name or "whatever") - starttiming(name or "whatever") -end - -function commands.elapsedtime(name) - stoptiming(name or "whatever") - context(elapsedtime(name or "whatever")) -end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index cc3e40272..4ea486bb8 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 03/30/15 23:33:48 +-- merge date : 03/31/15 12:04:36 do -- begin closure to overcome local limits and interference |