diff --git a/base/changes.txt b/base/changes.txt index 11787edca..e02fdbac5 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -6,14 +6,19 @@ completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ +2022-08-13 Marcel Krüger + + * ltluatex.dtx: + Unregister mlist_to_hlist callback when no related callbacks are registered + 2022-08-07 Frank Mittelbach * lttextcomp.dtx: Make \DeclareEncodingSubset act globally so that it can be used in fd files (gh/905) -2022-07-23 Joseph Wright +2022-07-23 Joseph Wright - * ltkeys.dtx: Output 'friendly' package names in messages + * ltkeys.dtx: Output 'friendly' package names in messages 2022-07-10 David Carlisle diff --git a/base/doc/ltnews36.tex b/base/doc/ltnews36.tex index 347cf9745..bcd356f40 100644 --- a/base/doc/ltnews36.tex +++ b/base/doc/ltnews36.tex @@ -207,6 +207,15 @@ \subsection{EC sans serif at small sizes} \githubissue{879} +\subsection{\LuaTeX\ callback efficiency improvement} + +The mechanism for providing the +\texttt{pre/post\_mlist\_to\_hlist\_filter} callbacks in \LuaTeX\ has +been improved to make it more reusable and to avoid overhead if these +callbacks are not used. +% +\githubissue{830} + diff --git a/base/ltluatex.dtx b/base/ltluatex.dtx index 18623fd67..ab81c3620 100644 --- a/base/ltluatex.dtx +++ b/base/ltluatex.dtx @@ -28,7 +28,7 @@ \ProvidesFile{ltluatex.dtx} % %<*tex> -[2021/12/27 v1.1x +[2022/08/13 v1.1y % % LuaTeX support for plain TeX (core) %<*tex> @@ -1398,9 +1398,7 @@ local callbacktypes = callbacktypes or { ligaturing = simple, kerning = simple, insert_local_par = simple, - pre_mlist_to_hlist_filter = list, - mlist_to_hlist = exclusive, - post_mlist_to_hlist_filter = reverselist, +% mlist_to_hlist = exclusive, new_graf = exclusive, % \end{macrocode} % Section 8.5: information reporting callbacks. @@ -1461,6 +1459,30 @@ local callbacktypes = callbacktypes or { luatexbase.callbacktypes=callbacktypes % \end{macrocode} % +% \changes{v1.1y}{2022/08/13}{shared\_callbacks added} +% Sometimes multiple callbacks correspond to a single underlying engine level callback. +% Then the engine level callback should be registered as long as at least one of these +% callbacks is in use. This is implemented though a shared table which counts how many +% of the involved callbacks are currently in use. The enging level callback is registered +% iff this count is not 0. +% +% We add |mlist_to_hlist| directly to the list to demonstrate this, but the handler gets +% added later when it is actually defined. +% +% All callbacks in this list are treated as user defined callbacks. +% +% \begin{macrocode} +local shared_callbacks = { + mlist_to_hlist = { + callback = "mlist_to_hlist", + count = 0, + handler = nil, + }, +} +shared_callbacks.pre_mlist_to_hlist_filter = shared_callbacks.mlist_to_hlist +shared_callbacks.post_mlist_to_hlist_filter = shared_callbacks.mlist_to_hlist +% \end{macrocode} +% % \begin{macro}{callback.register} % \changes{v1.0a}{2015/09/24}{Function modified} % Save the original function for registering callbacks and prevent the @@ -1639,11 +1661,7 @@ local defaults = { % If a default function is not required, it may be declared as |false|. % First we need a list of user callbacks. % \begin{macrocode} -local user_callbacks_defaults = { - pre_mlist_to_hlist_filter = list_handler_default, - mlist_to_hlist = node.mlist_to_hlist, - post_mlist_to_hlist_filter = list_handler_default, -} +local user_callbacks_defaults = {} % \end{macrocode} % % \begin{macro}{create_callback} @@ -1738,9 +1756,19 @@ local function add_to_callback(name, func, description) l = { } callbacklist[name] = l % \end{macrocode} +% \changes{v1.1y}{2022/08/13}{Adapted code for shared\_callbacks} +% Handle count for shared engine callbacks. +% \begin{macrocode} + local shared = shared_callbacks[name] + if shared then + shared.count = shared.count + 1 + if shared.count == 1 then + callback_register(shared.callback, shared.handler) + end +% \end{macrocode} % If it is not a user defined callback use the primitive callback register. % \begin{macrocode} - if user_callbacks_defaults[name] == nil then + elseif user_callbacks_defaults[name] == nil then callback_register(name, handlers[callbacktypes[name]](name)) end end @@ -1778,6 +1806,7 @@ luatexbase.add_to_callback = add_to_callback % \changes{v1.0k}{2015/12/02}{adjust initialization 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} +% \changes{v1.1y}{2022/08/13}{Adapted code for shared\_callbacks} % Remove a function from a callback. First check arguments. % \begin{macrocode} local function remove_from_callback(name, description) @@ -1823,7 +1852,13 @@ local function remove_from_callback(name, description) ) if #l == 0 then callbacklist[name] = nil - if user_callbacks_defaults[name] == nil then + local shared = shared_callbacks[name] + if shared then + shared.count = shared.count - 1 + if shared.count == 0 then + callback_register(shared.callback, nil) + end + elseif user_callbacks_defaults[name] == nil then callback_register(name, nil) end end @@ -1917,10 +1952,14 @@ luatexbase.uninstall = uninstall % \end{macro} % \begin{macro}{mlist_to_hlist} % \changes{v1.1l}{2020/02/02}{|pre/post_mlist_to_hlist| added} +% \changes{v1.1y}{2022/08/13}{Use shared\_callback system for pre/post/mlist_to_hlist} % To emulate these callbacks, the ``real'' |mlist_to_hlist| is replaced by a % wrapper calling the wrappers before and after. % \begin{macrocode} -callback_register("mlist_to_hlist", function(head, display_type, need_penalties) +create_callback('pre_mlist_to_hlist_filter', 'list') +create_callback('mlist_to_hlist', 'exclusive', node.mlist_to_hlist) +create_callback('post_mlist_to_hlist_filter', 'list') +function shared_callbacks.mlist_to_hlist.handler(head, display_type, need_penalties) local current = call_callback("pre_mlist_to_hlist_filter", head, display_type, need_penalties) if current == false then flush_list(head) @@ -1933,7 +1972,7 @@ callback_register("mlist_to_hlist", function(head, display_type, need_penalties) return nil end return post -end) +end % \end{macrocode} % \end{macro} % \endgroup diff --git a/base/testfiles/tlb-ltluatex-001.luatex.tlg b/base/testfiles/tlb-ltluatex-001.luatex.tlg index 53c7483d1..719637d9c 100644 --- a/base/testfiles/tlb-ltluatex-001.luatex.tlg +++ b/base/testfiles/tlb-ltluatex-001.luatex.tlg @@ -7,7 +7,7 @@ stack traceback: ^^I[C]: in function 'error' ^^I./ltluatex.lua:110: in upvalue 'module_error' ^^I./ltluatex.lua:117: in upvalue 'luatexbase_error' -^^I./ltluatex.lua:428: in field 'create_callback' +^^I./ltluatex.lua:430: in field 'create_callback' ^^I[\directlua]:1: in main chunk. l. ...} The lua interpreter ran into a problem, so the diff --git a/base/testfiles/tlb-mathcallbacks.luatex.tlg b/base/testfiles/tlb-mathcallbacks-001.luatex.tlg similarity index 100% rename from base/testfiles/tlb-mathcallbacks.luatex.tlg rename to base/testfiles/tlb-mathcallbacks-001.luatex.tlg diff --git a/base/testfiles/tlb-mathcallbacks.lvt b/base/testfiles/tlb-mathcallbacks-001.lvt similarity index 96% rename from base/testfiles/tlb-mathcallbacks.lvt rename to base/testfiles/tlb-mathcallbacks-001.lvt index 7c231d4be..0bb924690 100644 --- a/base/testfiles/tlb-mathcallbacks.lvt +++ b/base/testfiles/tlb-mathcallbacks-001.lvt @@ -1,4 +1,5 @@ \input{test2e} +\documentclass{minimal} \begin{document} \START \ifx\directlua\undefined\END\expandafter\stop\fi diff --git a/base/testfiles/tlb-mathcallbacks.tlg b/base/testfiles/tlb-mathcallbacks-001.tlg similarity index 100% rename from base/testfiles/tlb-mathcallbacks.tlg rename to base/testfiles/tlb-mathcallbacks-001.tlg diff --git a/base/testfiles/tlb-mathcallbacks-002.luatex.tlg b/base/testfiles/tlb-mathcallbacks-002.luatex.tlg new file mode 100644 index 000000000..d4cf21bac --- /dev/null +++ b/base/testfiles/tlb-mathcallbacks-002.luatex.tlg @@ -0,0 +1,26 @@ +This is a generated file for the LaTeX2e validation system. +Don't change this file in any respect. +Removing `l3build.shift' from `post_mlist_to_hlist_filter'. +false +Inserting `filter' at position 1 in `pre_mlist_to_hlist_filter'. +true +Removing `filter' from `pre_mlist_to_hlist_filter'. +false +Inserting `filter' at position 1 in `pre_mlist_to_hlist_filter'. +Inserting `filter' at position 1 in `post_mlist_to_hlist_filter'. +true +Removing `filter' from `pre_mlist_to_hlist_filter'. +true +Removing `filter' from `post_mlist_to_hlist_filter'. +false +Inserting `filter' at position 1 in `mlist_to_hlist'. +true +Removing `filter' from `mlist_to_hlist'. +false +Inserting `filter' at position 1 in `mlist_to_hlist'. +Inserting `filter' at position 1 in `post_mlist_to_hlist_filter'. +true +Removing `filter' from `mlist_to_hlist'. +true +Removing `filter' from `post_mlist_to_hlist_filter'. +false diff --git a/base/testfiles/tlb-mathcallbacks-002.lvt b/base/testfiles/tlb-mathcallbacks-002.lvt new file mode 100644 index 000000000..5d139f3d2 --- /dev/null +++ b/base/testfiles/tlb-mathcallbacks-002.lvt @@ -0,0 +1,31 @@ +\input{test2e} +\documentclass{minimal} +\begin{document} +\START +\ifx\directlua\undefined\END\expandafter\stop\fi +\directlua{luatexbase.remove_from_callback('post_mlist_to_hlist_filter', 'l3build.shift')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.add_to_callback('pre_mlist_to_hlist_filter', function(...) print(...) return true end, 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.remove_from_callback('pre_mlist_to_hlist_filter', 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.add_to_callback('pre_mlist_to_hlist_filter', function(...) print(...) return true end, 'filter')} +\directlua{luatexbase.add_to_callback('post_mlist_to_hlist_filter', function(...) print(...) return true end, 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.remove_from_callback('pre_mlist_to_hlist_filter', 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.remove_from_callback('post_mlist_to_hlist_filter', 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.add_to_callback('mlist_to_hlist', function(...) print(...) return true end, 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.remove_from_callback('mlist_to_hlist', 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.add_to_callback('mlist_to_hlist', function(...) print(...) return true end, 'filter')} +\directlua{luatexbase.add_to_callback('post_mlist_to_hlist_filter', function(...) print(...) return true end, 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.remove_from_callback('mlist_to_hlist', 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\directlua{luatexbase.remove_from_callback('post_mlist_to_hlist_filter', 'filter')} +\directlua{texio.write_nl(tostring(callback.list().mlist_to_hlist))} +\END +\end{document} diff --git a/base/testfiles/tlb-mathcallbacks-002.tlg b/base/testfiles/tlb-mathcallbacks-002.tlg new file mode 100644 index 000000000..1d0c69753 --- /dev/null +++ b/base/testfiles/tlb-mathcallbacks-002.tlg @@ -0,0 +1,2 @@ +This is a generated file for the LaTeX2e validation system. +Don't change this file in any respect. diff --git a/required/latex-lab/testfiles-OR/footmisc-003.tlg b/required/latex-lab/testfiles-OR/footmisc-003.tlg index 158cc5b71..001f6ba73 100644 --- a/required/latex-lab/testfiles-OR/footmisc-003.tlg +++ b/required/latex-lab/testfiles-OR/footmisc-003.tlg @@ -129,7 +129,7 @@ Completed box being shipped out [1] .....\pdfliteral page{/P /l3pdf5 BDC} .....\write1{\newlabeldata{l3pdf5}{{abspage}{\__ref_attribute_abspage: }}} .....\pdfliteral page{EMC} -.....\write1{\newlabeldata{tagpdfstruct-fn.1}{{tagstruct}{5}{tagstructobj}{22 0 R}}} +.....\write1{\newlabeldata{tagpdfstruct-fn.1}{{tagstruct}{5}{tagstructobj}{21 0 R}}} .....\write1{\newlabeldata{mcid-10}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{10}{tagmcid}{9}}} .....\pdfliteral page{/P /l3pdf10 BDC} .....\write1{\newlabeldata{l3pdf10}{{abspage}{\__ref_attribute_abspage: }}} @@ -200,7 +200,7 @@ Completed box being shipped out [1] .....\pdfliteral page{/P /l3pdf15 BDC} .....\write1{\newlabeldata{l3pdf15}{{abspage}{\__ref_attribute_abspage: }}} .....\pdfliteral page{EMC} -.....\write1{\newlabeldata{tagpdfstruct-fn.2}{{tagstruct}{11}{tagstructobj}{40 0 R}}} +.....\write1{\newlabeldata{tagpdfstruct-fn.2}{{tagstruct}{11}{tagstructobj}{39 0 R}}} .....\write1{\newlabeldata{mcid-20}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{20}{tagmcid}{19}}} .....\pdfliteral page{/P /l3pdf20 BDC} .....\write1{\newlabeldata{l3pdf20}{{abspage}{\__ref_attribute_abspage: }}} @@ -438,7 +438,7 @@ Completed box being shipped out [2] .....\pdfliteral page{/P /l3pdf25 BDC} .....\write1{\newlabeldata{l3pdf25}{{abspage}{\__ref_attribute_abspage: }}} .....\pdfliteral page{EMC} -.....\write1{\newlabeldata{tagpdfstruct-fn.3}{{tagstruct}{17}{tagstructobj}{70 0 R}}} +.....\write1{\newlabeldata{tagpdfstruct-fn.3}{{tagstruct}{17}{tagstructobj}{69 0 R}}} .....\write1{\newlabeldata{mcid-32}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{32}{tagmcid}{9}}} .....\pdfliteral page{/P /l3pdf30 BDC} .....\write1{\newlabeldata{l3pdf30}{{abspage}{\__ref_attribute_abspage: }}} diff --git a/required/latex-lab/testfiles-OR/footmisc-004.tlg b/required/latex-lab/testfiles-OR/footmisc-004.tlg index 851f705a4..6c9592abd 100644 --- a/required/latex-lab/testfiles-OR/footmisc-004.tlg +++ b/required/latex-lab/testfiles-OR/footmisc-004.tlg @@ -131,7 +131,7 @@ Completed box being shipped out [1] .....\pdfliteral page{/P /l3pdf5 BDC} .....\write1{\newlabeldata{l3pdf5}{{abspage}{\__ref_attribute_abspage: }}} .....\pdfliteral page{EMC} -.....\write1{\newlabeldata{tagpdfstruct-fn.1}{{tagstruct}{5}{tagstructobj}{22 0 R}}} +.....\write1{\newlabeldata{tagpdfstruct-fn.1}{{tagstruct}{5}{tagstructobj}{21 0 R}}} .....\write1{\newlabeldata{mcid-10}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{10}{tagmcid}{9}}} .....\pdfliteral page{/P /l3pdf10 BDC} .....\write1{\newlabeldata{l3pdf10}{{abspage}{\__ref_attribute_abspage: }}} @@ -204,7 +204,7 @@ Completed box being shipped out [1] .....\pdfliteral page{/P /l3pdf15 BDC} .....\write1{\newlabeldata{l3pdf15}{{abspage}{\__ref_attribute_abspage: }}} .....\pdfliteral page{EMC} -.....\write1{\newlabeldata{tagpdfstruct-fn.2}{{tagstruct}{11}{tagstructobj}{40 0 R}}} +.....\write1{\newlabeldata{tagpdfstruct-fn.2}{{tagstruct}{11}{tagstructobj}{39 0 R}}} .....\write1{\newlabeldata{mcid-20}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{20}{tagmcid}{19}}} .....\pdfliteral page{/P /l3pdf20 BDC} .....\write1{\newlabeldata{l3pdf20}{{abspage}{\__ref_attribute_abspage: }}} @@ -444,7 +444,7 @@ Completed box being shipped out [2] .....\pdfliteral page{/P /l3pdf25 BDC} .....\write1{\newlabeldata{l3pdf25}{{abspage}{\__ref_attribute_abspage: }}} .....\pdfliteral page{EMC} -.....\write1{\newlabeldata{tagpdfstruct-fn.3}{{tagstruct}{17}{tagstructobj}{70 0 R}}} +.....\write1{\newlabeldata{tagpdfstruct-fn.3}{{tagstruct}{17}{tagstructobj}{69 0 R}}} .....\write1{\newlabeldata{mcid-32}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{32}{tagmcid}{9}}} .....\pdfliteral page{/P /l3pdf30 BDC} .....\write1{\newlabeldata{l3pdf30}{{abspage}{\__ref_attribute_abspage: }}} diff --git a/required/latex-lab/testfiles-OR/footmisc-005.tlg b/required/latex-lab/testfiles-OR/footmisc-005.tlg index 9c6b8f5f8..d785effef 100644 --- a/required/latex-lab/testfiles-OR/footmisc-005.tlg +++ b/required/latex-lab/testfiles-OR/footmisc-005.tlg @@ -114,7 +114,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf3 BDC} ....\write1{\newlabeldata{l3pdf3}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.1}{{tagstruct}{4}{tagstructobj}{17 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.1}{{tagstruct}{4}{tagstructobj}{16 0 R}}} ....\write1{\newlabeldata{mcid-6}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{6}{tagmcid}{5}}} ....\pdfliteral page{/P /l3pdf6 BDC} ....\write1{\newlabeldata{l3pdf6}{{abspage}{\__ref_attribute_abspage: }}} @@ -166,7 +166,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf9 BDC} ....\write1{\newlabeldata{l3pdf9}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.2}{{tagstruct}{8}{tagstructobj}{27 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.2}{{tagstruct}{8}{tagstructobj}{26 0 R}}} ....\write1{\newlabeldata{mcid-12}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{12}{tagmcid}{11}}} ....\pdfliteral page{/P /l3pdf12 BDC} ....\write1{\newlabeldata{l3pdf12}{{abspage}{\__ref_attribute_abspage: }}} @@ -218,7 +218,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf15 BDC} ....\write1{\newlabeldata{l3pdf15}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.3}{{tagstruct}{12}{tagstructobj}{37 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.3}{{tagstruct}{12}{tagstructobj}{36 0 R}}} ....\write1{\newlabeldata{mcid-18}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{18}{tagmcid}{17}}} ....\pdfliteral page{/P /l3pdf18 BDC} ....\write1{\newlabeldata{l3pdf18}{{abspage}{\__ref_attribute_abspage: }}} @@ -237,7 +237,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf20 BDC} ....\write1{\newlabeldata{l3pdf20}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.4}{{tagstruct}{15}{tagstructobj}{45 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.4}{{tagstruct}{15}{tagstructobj}{44 0 R}}} ....\write1{\newlabeldata{mcid-23}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{23}{tagmcid}{22}}} ....\pdfliteral page{/P /l3pdf23 BDC} ....\write1{\newlabeldata{l3pdf23}{{abspage}{\__ref_attribute_abspage: }}} @@ -303,7 +303,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf26 BDC} ....\write1{\newlabeldata{l3pdf26}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.5}{{tagstruct}{19}{tagstructobj}{55 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.5}{{tagstruct}{19}{tagstructobj}{54 0 R}}} ....\write1{\newlabeldata{mcid-29}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{29}{tagmcid}{28}}} ....\pdfliteral page{/P /l3pdf29 BDC} ....\write1{\newlabeldata{l3pdf29}{{abspage}{\__ref_attribute_abspage: }}} @@ -355,7 +355,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf32 BDC} ....\write1{\newlabeldata{l3pdf32}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.6}{{tagstruct}{23}{tagstructobj}{65 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.6}{{tagstruct}{23}{tagstructobj}{64 0 R}}} ....\write1{\newlabeldata{mcid-35}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{35}{tagmcid}{34}}} ....\pdfliteral page{/P /l3pdf35 BDC} ....\write1{\newlabeldata{l3pdf35}{{abspage}{\__ref_attribute_abspage: }}} @@ -379,7 +379,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf37 BDC} ....\write1{\newlabeldata{l3pdf37}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.7}{{tagstruct}{26}{tagstructobj}{73 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.7}{{tagstruct}{26}{tagstructobj}{72 0 R}}} ....\write1{\newlabeldata{mcid-40}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{40}{tagmcid}{39}}} ....\pdfliteral page{/P /l3pdf40 BDC} ....\write1{\newlabeldata{l3pdf40}{{abspage}{\__ref_attribute_abspage: }}} diff --git a/required/latex-lab/testfiles-OR/footmisc-013-scrartcl.tlg b/required/latex-lab/testfiles-OR/footmisc-013-scrartcl.tlg index 7160e0efc..5a3563c35 100644 --- a/required/latex-lab/testfiles-OR/footmisc-013-scrartcl.tlg +++ b/required/latex-lab/testfiles-OR/footmisc-013-scrartcl.tlg @@ -111,7 +111,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf3 BDC} ....\write1{\newlabeldata{l3pdf3}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.1}{{tagstruct}{4}{tagstructobj}{17 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.1}{{tagstruct}{4}{tagstructobj}{16 0 R}}} ....\write1{\newlabeldata{mcid-8}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{8}{tagmcid}{7}}} ....\pdfliteral page{/P /l3pdf8 BDC} ....\write1{\newlabeldata{l3pdf8}{{abspage}{\__ref_attribute_abspage: }}} @@ -165,7 +165,7 @@ Completed box being shipped out [1] ....\pdfliteral page{/P /l3pdf11 BDC} ....\write1{\newlabeldata{l3pdf11}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.2}{{tagstruct}{9}{tagstructobj}{30 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.2}{{tagstruct}{9}{tagstructobj}{29 0 R}}} ....\write1{\newlabeldata{mcid-16}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{16}{tagmcid}{15}}} ....\pdfliteral page{/P /l3pdf16 BDC} ....\write1{\newlabeldata{l3pdf16}{{abspage}{\__ref_attribute_abspage: }}} @@ -376,7 +376,7 @@ Completed box being shipped out [2] ....\pdfliteral page{/P /l3pdf19 BDC} ....\write1{\newlabeldata{l3pdf19}{{abspage}{\__ref_attribute_abspage: }}} ....\pdfliteral page{EMC} -....\write1{\newlabeldata{tagpdfstruct-fn.3}{{tagstruct}{14}{tagstructobj}{51 0 R}}} +....\write1{\newlabeldata{tagpdfstruct-fn.3}{{tagstruct}{14}{tagstructobj}{50 0 R}}} ....\write1{\newlabeldata{mcid-26}{{tagabspage}{\__ref_attribute_tagabspage: }{tagmcabs}{26}{tagmcid}{7}}} ....\pdfliteral page{/P /l3pdf24 BDC} ....\write1{\newlabeldata{l3pdf24}{{abspage}{\__ref_attribute_abspage: }}} diff --git a/support/regression-test.tex b/support/regression-test.tex index 09164b6b6..0a1ef5fef 100644 --- a/support/regression-test.tex +++ b/support/regression-test.tex @@ -6,7 +6,7 @@ %% %% l3build.dtx (with options: `package') %% -%% Copyright (C) 2014-2016 The LaTeX3 Project +%% Copyright (C) 2014-2021 The LaTeX Project %% %% It may be distributed and/or modified under the conditions of %% the LaTeX Project Public License (LPPL), either version 1.3c of @@ -20,8 +20,7 @@ %% \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname eTeXversion\endcsname\relax - \errmessage{e-TeX is required to use regression-test.tex}% - \expandafter\endinput + \message{e-TeX is required by some regression-test.tex features}% \fi \ifx\unprotect\undefined \expandafter\edef\csname reset\string @catcodes\endcsname{% @@ -32,7 +31,11 @@ \unprotect \def\reset@catcodes{\protect}% \fi -\ifnum\interactionmode>1 \scrollmode\fi +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname interactionmode\endcsname\relax +\else + \ifnum\interactionmode>1 \scrollmode\fi +\fi \errorcontextlines=-1 % \showboxbreadth=\maxdimen \showboxdepth=\maxdimen @@ -73,6 +76,13 @@ \LONGTYPEOUT{^^JEND-TEST-LOG^^J}% \@@@end } +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname currentgrouplevel\endcsname\relax + \def\END{% + \LONGTYPEOUT{^^JEND-TEST-LOG^^J}% + \@@@end + } +\fi \ifx\@@end\@undefined \let\end\END \else @@ -80,6 +90,27 @@ \fi \def\OMIT{\LONGTYPEOUT{OMIT}} \def\TIMO{\LONGTYPEOUT{TIMO}} +\begingroup % within the scope of this groups each line needs to end in % ! +\catcode`\^^M\active % +\gdef\SHOWFILE#1{% + \typeout{-------- #1 (start) ---------}% +\IfFileExists{#1}% + {\begingroup % + \catcode`\^^M\active % + \edef^^M{^\string^M^^J}% + \everyeof{\noexpand}% + \obeyspaces % + \@sanitize % + \message{\@@input #1 }% + \endgroup }% + {\message{Not found}}% + \typeout{-------- #1 (end) -----------}% +}% +\endgroup +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname everyeof\endcsname\relax + \def\SHOWFILE#1{\TYPE{FEATURE UNAVAILABLE}} +\fi \ifx\InputIfFileExists\@undefined \newread\@inputcheck \long\def\InputIfFileExists#1#2#3{% @@ -101,36 +132,108 @@ ============================================================% }% } -\long\def\TEST#1#2{% +\csname protected\endcsname\long\def\BEGINTEST#1{% \global\advance\gTESTint by 1 % \SEPARATOR \LONGTYPEOUT{TEST \the\gTESTint: \detokenize{#1}}% \SEPARATOR \begingroup \let\TYPE\LONGTYPEOUT - #2% +} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname detokenize\endcsname\relax + \long\def\BEGINTEST#1{% + \global\advance\gTESTint by 1 % + \SEPARATOR + \begingroup + \toks0={#1}% + \LONGTYPEOUT{TEST \the\gTESTint: \the\toks0 }% + \endgroup + \SEPARATOR + \begingroup + \let\TYPE\LONGTYPEOUT + } +\fi +\csname protected\endcsname\long\def\ENDTEST{% \endgroup \SEPARATOR \LONGTYPEOUT{}% } +\long\def\TEST#1#2{% + \BEGINTEST{#1}% + #2% + \ENDTEST +} \long\def\TESTEXP#1#2{% - \global\advance\gTESTint by 1 % - \SEPARATOR - \LONGTYPEOUT{% - TEST \the\gTESTint: \detokenize{#1}}% - \SEPARATOR - \begingroup - \long\def\TYPE##1{##1}% - \LONGTYPEOUT{#2}% - \endgroup - \SEPARATOR - \LONGTYPEOUT{}% + \BEGINTEST{#1}% + \LONGTYPEOUT{#2}% + \ENDTEST } \def \TRUE {\TYPE{TRUE}} \def \FALSE {\TYPE{FALSE}} \def \YES {\TYPE{YES}} \def \NO {\TYPE{NO}} \def \NEWLINE {\TYPE{^^J}} +\csname protected\endcsname\long\def\ASSERT#1#2{% + \begingroup + \edef\@tempa{#1}% + \edef\@tempb{#2}% + \ifx\@tempa\@tempb + \TYPE{PASSED}% + \else + \TYPE{FAILED}% + \fi + \endgroup +} +\csname protected\endcsname\long\def\ASSERTSTR#1#2{% + \begingroup + \edef\@tempa{#1}% + \edef\@tempb{#2}% + \edef\@tempa{\meaning\@tempa}% + \edef\@tempb{\meaning\@tempb}% + \ifx\@tempa\@tempb + \TYPE{PASSED}% + \else + \TYPE{FAILED}% + \fi + \endgroup +} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname detokenize\endcsname\relax + \long\def\ASSERTSTR#1#2{% + \TYPE{FEATURE UNAVAILABLE}% + } +\fi +\ifnum 0% + \ifx\pdfoutput\@undefined\else\ifnum\pdfoutput>0 1\fi\fi + \ifx\outputmode\@undefined\else\ifnum\outputmode>0 1\fi\fi + >0 % + \ifx\pdfvariable\@undefined + \pdfcompresslevel=0 % + \pdfobjcompresslevel=0 % + \else + \pdfvariable compresslevel=0 % + \pdfvariable objcompresslevel=0 % + \fi +\else + \ifx\XeTeXversion\@undefined + \special{% + ps: /setdistillerparams + where + {pop << /CompressPages false /CompressStreams false >> setdistillerparams} + if + }% + \else + \special{dvipdfmx:config z 0}% Compress level + \special{dvipdfmx:config C 0x40}% Object compression + \fi +\fi +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname protected\endcsname\relax + \reset@catcodes + \let\protected\undefined + \expandafter\endinput +\fi \ifx\pdfoutput\@undefined \ifx\outputmode\@undefined \else @@ -143,39 +246,51 @@ \pdfmapfile{pdftex.map}% \fi \fi -\ifnum 0% - \ifx\pdfoutput\@undefined\else\ifnum\pdfoutput>0 1\fi\fi - \ifx\outputmode\@undefined\else\ifnum\outputmode>0 1\fi\fi - >0 % - \ifx\pdfvariable\@undefined - \pdfinfo{/Producer (\ifx\directlua\@undefined pdf\else Lua\fi TeX)} - \ifx\pdfinfoomitdate\@undefined\else - \pdfinfoomitdate = 1 % - \pdfsuppressptexinfo = 1 % - \pdftrailerid{} +\ifcsname pdfmeta_set_regression_data:\endcsname + \csname pdfmeta_set_regression_data:\endcsname +\else + \ifnum 0% + \ifx\pdfoutput\@undefined\else\ifnum\pdfoutput>0 1\fi\fi + \ifx\outputmode\@undefined\else\ifnum\outputmode>0 1\fi\fi + >0 % + \ifx\pdfvariable\@undefined + \pdfinfo{/Producer (\ifx\directlua\@undefined pdf\else Lua\fi TeX)} + \ifx\pdfinfoomitdate\@undefined\else + \pdfinfoomitdate = 1 % + \pdfsuppressptexinfo = \numexpr + 0 + + 1 % PTEX.Fullbanner + + 2 % PTEX.FileName + \relax + \pdftrailerid{} + \fi + \else + \pdfextension info{/Producer (LuaTeX)} + \pdfvariable suppressoptionalinfo \numexpr + 0 + + 1 % PTEX.Fullbanner + + 2 % PTEX.FileName + + 32 % CreationDate + + 64 % ModDate + + 512 % ID + \relax \fi \else - \pdfextension info{/Producer (LuaTeX)} - \pdfvariable suppressoptionalinfo \numexpr - 0 - + 1 % PTEX.Fullbanner - + 32 % CreationDate - + 64 % ModDate - \relax + \ifx\XeTeXversion\@undefined + \special{! <> setpagedevice} + \special{! <> setpagedevice} + \else + \special{% + pdf: docinfo + << + /Creator (TeX) + /CreationDate () + /ModDate () + /Producer (xdvipdfmx) + >> + } + \fi \fi -\else - \special{% - pdf: docinfo - << - /Creator (TeX) - /CreationDate () - /ModDate () - /Producer (\ifx\XeTeXversion\@undefined\else x\fi dvipdfmx) - >> - } -\fi -\ifx\directlua\@undefined\else - \directlua{require'fixup_mathaxis'}% \fi \reset@catcodes %%