Dear collegues, I'm trying to hook the moment when luatex has just finished \shipout of the very last page and there is nothing more to typeset. First thought was to use buildpage_filter when it is called with "end" keyword. But seemingly the callback is called on occurance of \end, while there still may be quite some main list material to be written out. Even if there are no insertions, the remaining material may still generate quite some pages. Can one propose some way to hook "the last shipout/output is over" moment without macros such as \bye? -- Pawe/l Jackowski P.Jackowski@gust.org.pl
On 4-2-2010 17:35, Paweł Jackowski wrote:
Dear collegues,
I'm trying to hook the moment when luatex has just finished \shipout of the very last page and there is nothing more to typeset. First thought was to use buildpage_filter when it is called with "end" keyword. But seemingly the callback is called on occurance of \end, while there still may be quite some main list material to be written out. Even if there are no insertions, the remaining material may still generate quite some pages. Can one propose some way to hook "the last shipout/output is over" moment without macros such as \bye?
luatex can never know when the last shipout occurs (the last call to the output routine can result in multiple shipouts and macro packages can call \shipout any time, so you need to register the last page number and use that information; only the macro package knows when and what you could abuse the stop_run callback for some purposes Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
[...] Can one propose some way to hook "the last shipout/output is over" moment without macros such as \bye?
luatex can never know when the last shipout occurs (the last call to the output routine can result in multiple shipouts and macro packages can call \shipout any time, so you need to register the last page number and use that information; only the macro package knows when and what
you could abuse the stop_run callback for some purposes
You're right, luatex cannot know which shipout is last. But finally it makes the decision "done, it's high time to die". I wondered if I can hook this moment, ie. to make the final update to pdf /Catalog or so. If not, will do with macros. Thank you, Paweł -- Pawe/l Jackowski P.Jackowski@gust.org.pl
On 4-2-2010 19:03, Paweł Jackowski wrote:
[...] Can one propose some way to hook "the last shipout/output is over" moment without macros such as \bye?
luatex can never know when the last shipout occurs (the last call to the output routine can result in multiple shipouts and macro packages can call \shipout any time, so you need to register the last page number and use that information; only the macro package knows when and what
you could abuse the stop_run callback for some purposes
You're right, luatex cannot know which shipout is last. But finally it makes the decision "done, it's high time to die". I wondered if I can hook this moment, ie. to make the final update to pdf /Catalog or so. If not, will do with macros.
well, if you do it at the tex end, the 'next' shipout (i.e. the one triggered by bye or end) is quite ok as it is unlikely that changes to the catalog will happen afterwards (e.g. user will not change info fields etc after their last bye) even if you hook it into some finalizing lua code there are pitfalls on the agenda, that is once the backend code is mostly redone) there will be finalizer callbacks for the catalog, but we delayed that because it will be part of more finalizer code (and temporary solutions can change and in turn result in messy debugging of existing code because timing is so important here) (hm, i could make a nice technical talk about this for bachotek if there is any interest at all in such issues -) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
well, if you do it at the tex end, the 'next' shipout (i.e. the one triggered by bye or end) is quite ok as it is unlikely that changes to the catalog will happen afterwards (e.g. user will not change info fields etc after their last bye)
But there may be layers (or other interactive stuff that lives in root structures) not referenced so far.
even if you hook it into some finalizing lua code there are pitfalls
on the agenda, that is once the backend code is mostly redone) there will be finalizer callbacks for the catalog, but we delayed that because it will be part of more finalizer code (and temporary solutions can change and in turn result in messy debugging of existing code because timing is so important here)
Sure.
(hm, i could make a nice technical talk about this for bachotek if there is any interest at all in such issues -)
Please do! If you haven't got call for papers, you'll get it soon. On behalf on prog committee. -- Pawe/l Jackowski P.Jackowski@gust.org.pl
On 4-2-2010 19:49, Paweł Jackowski wrote:
But there may be layers (or other interactive stuff that lives in root structures) not referenced so far.
you can always create forward references (indirect objects)
Please do! If you haven't got call for papers, you'll get it soon. On behalf on prog committee.
i'm in that committee -) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Paweł Jackowski