diff options
author | Karl Berry <karl@freefriends.org> | 2020-10-02 21:49:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-10-02 21:49:18 +0000 |
commit | 5255c37137345163348d22ab46af2304cf9f55a6 (patch) | |
tree | 88246497477ddcc26834e5708566ad4c1c862a19 /Master/texmf-dist/source/latex/base/ltluatex.dtx | |
parent | 1922ba4684a59cde742dcef9ed152381d2d7b110 (diff) |
latex2e (2oct20)
git-svn-id: svn://tug.org/texlive/trunk@56514 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltluatex.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltluatex.dtx | 68 |
1 files changed, 46 insertions, 22 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltluatex.dtx b/Master/texmf-dist/source/latex/base/ltluatex.dtx index 1f9ab8d1332..8573b3e6ca6 100644 --- a/Master/texmf-dist/source/latex/base/ltluatex.dtx +++ b/Master/texmf-dist/source/latex/base/ltluatex.dtx @@ -23,12 +23,12 @@ %<tex> \ProvidesFile\undefined\begingroup\def\ProvidesFile %<tex> #1#2[#3]{\endgroup\immediate\write-1{File: #1 #3}} %<tex>\fi -%<plain>\ProvidesFile{ltluatex.tex} +%<plain>\ProvidesFile{ltluatex.tex}% %<*driver> \ProvidesFile{ltluatex.dtx} %</driver> %<*tex> -[2020/02/02 v1.1l +[2020/09/25 v1.1s %</tex> %<plain> LuaTeX support for plain TeX (core) %<*tex> @@ -406,6 +406,14 @@ \fi % \end{macrocode} % +% \changes{v1.1n}{2020/06/10}{Define \cs{@gobble}/\cs{@firstofone} even for \LaTeX\ to allow early loading.} +% Two simple \LaTeX\ macros from |ltdefns.dtx| have to be defined here +% because ltdefns.dtx is not loaded yet when ltluatex.dtx is executed. +% \begin{macrocode} +\long\def\@gobble#1{} +\long\def\@firstofone#1{#1} +% \end{macrocode} +% % \subsection{Older \LaTeX{}/Plain \TeX\ setup} % % \begin{macrocode} @@ -451,7 +459,7 @@ % \end{macrocode} % luatex/xetex also allow more math fam. % \begin{macrocode} -\edef \et@xmaxfam {\ifx\Umathchar\@undefined\sixt@@n\else\@cclvi\fi} +\edef \et@xmaxfam {\ifx\Umathcode\@undefined\sixt@@n\else\@cclvi\fi} % \end{macrocode} % % \begin{macrocode} @@ -521,12 +529,6 @@ \fi}% % \end{macrocode} % -% Two simple \LaTeX\ macros used in |ltlatex.sty|. -% \begin{macrocode} -\long\def\@gobble#1{} -\long\def\@firstofone#1{#1} -% \end{macrocode} -% % Fix up allocations not to clash with |etex.src|. % % \begin{macrocode} @@ -544,23 +546,23 @@ %</tex> % \end{macrocode} % -% % \subsection{Attributes} % % \begin{macro}{\newattribute} % \changes{v1.0a}{2015/09/24}{Macro added} +% \changes{v1.1q}{2020/08/02}{Move reset to $0$ inside conditional} % As is generally the case for the Lua\TeX{} registers we start here % from~$1$. Notably, some code assumes that |\attribute0| is never used so % this is important in this case. % \begin{macrocode} \ifx\e@alloc@attribute@count\@undefined \countdef\e@alloc@attribute@count=258 + \e@alloc@attribute@count=\z@ \fi \def\newattribute#1{% \e@alloc\attribute\attributedef \e@alloc@attribute@count\m@ne\e@alloc@top#1% } -\e@alloc@attribute@count=\z@ % \end{macrocode} % \end{macro} % @@ -585,13 +587,13 @@ % \begin{macrocode} \ifx\e@alloc@ccodetable@count\@undefined \countdef\e@alloc@ccodetable@count=259 + \e@alloc@ccodetable@count=\z@ \fi \def\newcatcodetable#1{% \e@alloc\catcodetable\chardef \e@alloc@ccodetable@count\m@ne{"8000}#1% \initcatcodetable\allocationnumber } -\e@alloc@ccodetable@count=\z@ % \end{macrocode} % \end{macro} % @@ -698,18 +700,19 @@ % % \begin{macro}{\newluafunction} % \changes{v1.0a}{2015/09/24}{Macro added} +% \changes{v1.1q}{2020/08/02}{Move reset to $0$ inside conditional} % Much the same story for allocating Lua\TeX{} functions except here they are % just numbers so they are allocated in the same way as boxes. % Lua indexes from~$1$ so once again slot~$0$ is skipped. % \begin{macrocode} \ifx\e@alloc@luafunction@count\@undefined \countdef\e@alloc@luafunction@count=260 + \e@alloc@luafunction@count=\z@ \fi \def\newluafunction{% \e@alloc\luafunction\e@alloc@chardef \e@alloc@luafunction@count\m@ne\e@alloc@top } -\e@alloc@luafunction@count=\z@ % \end{macrocode} % \end{macro} % @@ -717,17 +720,18 @@ % % \begin{macro}{\newwhatsit} % \changes{v1.0a}{2015/09/24}{Macro added} +% \changes{v1.1q}{2020/08/02}{Move reset to $0$ inside conditional} % These are only settable from Lua but for consistency are definable % here. % \begin{macrocode} \ifx\e@alloc@whatsit@count\@undefined \countdef\e@alloc@whatsit@count=261 + \e@alloc@whatsit@count=\z@ \fi \def\newwhatsit#1{% \e@alloc\whatsit\e@alloc@chardef \e@alloc@whatsit@count\m@ne\e@alloc@top#1% } -\e@alloc@whatsit@count=\z@ % \end{macrocode} % \end{macro} % @@ -735,17 +739,18 @@ % % \begin{macro}{\newluabytecode} % \changes{v1.0a}{2015/09/24}{Macro added} +% \changes{v1.1q}{2020/08/02}{Move reset to $0$ inside conditional} % These are only settable from Lua but for consistency are definable % here. % \begin{macrocode} \ifx\e@alloc@bytecode@count\@undefined \countdef\e@alloc@bytecode@count=262 + \e@alloc@bytecode@count=\z@ \fi \def\newluabytecode#1{% \e@alloc\luabytecode\e@alloc@chardef \e@alloc@bytecode@count\m@ne\e@alloc@top#1% } -\e@alloc@bytecode@count=\z@ % \end{macrocode} % \end{macro} % @@ -753,12 +758,14 @@ % \begin{macro}{\newluachunkname} % \changes{v1.0a}{2015/09/24}{Macro added} +% \changes{v1.1q}{2020/08/02}{Move reset to $0$ inside conditional} % As for bytecode registers, but in addition we need to add a string % to the \verb|lua.name| table to use in stack tracing. We use the % name of the command passed to the allocator, with no backslash. % \begin{macrocode} \ifx\e@alloc@luachunk@count\@undefined \countdef\e@alloc@luachunk@count=263 + \e@alloc@luachunk@count=\z@ \fi \def\newluachunkname#1{% \e@alloc\luachunk\e@alloc@chardef @@ -766,19 +773,31 @@ {\escapechar\m@ne \directlua{lua.name[\the\allocationnumber]="\string#1"}}% } -\e@alloc@luachunk@count=\z@ % \end{macrocode} % \end{macro} % % \subsection{Lua loader} +% \changes{v1.1r}{2020/08/10}{Load ltluatex Lua module during format building} +% +% Lua code loaded in the format often has to to be loaded again at the +% beginning of every job, so we define a helper whch allows us to avoid +% duplicated code: +% +% \begin{macrocode} +\def\now@and@everyjob#1{% + \everyjob\expandafter{\the\everyjob + #1% + }% + #1% +} +% \end{macrocode} % % Load the Lua code at the start of every job. % For the conversion of \TeX{} into numbers at the Lua side we need some % known registers: for convenience we use a set of systematic names, which % means using a group around the Lua loader. % \begin{macrocode} -%<2ekernel>\everyjob\expandafter{% -%<2ekernel> \the\everyjob +%<2ekernel>\now@and@everyjob{% \begingroup \attributedef\attributezero=0 % \chardef \charzero =0 % @@ -1321,6 +1340,7 @@ local callbacktypes = callbacktypes or { % \changes{v1.1k}{2019/10/02}{process\_rule is \texttt{exclusive}} % \changes{v1.1k}{2019/10/02}{mlist\_to\_hlist is \texttt{exclusive}} % \changes{v1.1l}{2020/02/02}{post\_linebreak\_filter is \texttt{reverselist}} +% \changes{v1.1p}{2020/08/01}{new\_graf is \texttt{exclusive}} % \begin{macrocode} contribute_filter = simple, buildpage_filter = simple, @@ -1342,7 +1362,7 @@ local callbacktypes = callbacktypes or { pre_mlist_to_hlist_filter = list, mlist_to_hlist = exclusive, post_mlist_to_hlist_filter = reverselist, - new_graf = simple, + new_graf = exclusive, % \end{macrocode} % Section 8.5: information reporting callbacks. % \changes{v1.0m}{2016/02/11}{show\_warning\_message added} @@ -1481,6 +1501,7 @@ end % \end{macrocode} % Handler for |list| callbacks. % \changes{v1.0k}{2015/12/02}{resolve name and i.description (PHG)} +% \changes{v1.1s}{2020/12/02}{Fix return value of list callbacks} % \begin{macrocode} local function list_handler(name) return function(head, ...) @@ -1493,7 +1514,7 @@ local function list_handler(name) "Function `" .. i.description .. "' returned false\n" .. "in callback `" .. name .."'" ) - break + return false end if ret ~= true then alltrue = false @@ -1526,7 +1547,7 @@ local function reverselist_handler(name) "Function `" .. cb.description .. "' returned false\n" .. "in callback `" .. name .."'" ) - break + return false end if ret ~= true then alltrue = false @@ -1716,6 +1737,7 @@ luatexbase.add_to_callback = add_to_callback % \changes{v1.0a}{2015/09/24}{Function added} % \changes{v1.0k}{2015/12/02}{adjust initialisation of cb local (PHG)} % \changes{v1.0k}{2015/12/02}{Give more specific error messages (PHG)} +% \changes{v1.1m}{2020/03/07}{Do not call callback.register for user-defined callbacks} % Remove a function from a callback. First check arguments. % \begin{macrocode} local function remove_from_callback(name, description) @@ -1761,7 +1783,9 @@ local function remove_from_callback(name, description) ) if #l == 0 then callbacklist[name] = nil - callback_register(name, nil) + if user_callbacks_defaults[name] == nil then + callback_register(name, nil) + end end return cb.func,cb.description end |