From: luigi scarso <luigi.scarso@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: The very last macro
Date: Thu, 26 Mar 2009 16:39:11 +0100 [thread overview]
Message-ID: <fe8d59da0903260839y318ccc5cp195714f710d2fce4@mail.gmail.com> (raw)
In-Reply-To: <49CB96CE.4020601@wxs.nl>
[-- Attachment #1.1: Type: text/plain, Size: 3440 bytes --]
>
> the problem is in your definition of 'end' and 'bottom'
>
??
end := end of run
bottom := bottom of last page, in this case
>
> the real final thing is \end and \everygoodbye happens just before that
> (the only calls after it are postponed error messages, which have no
> consequence for any pdf and the primitive \end which is really needed)
>
yes, as I seen in \def\stoptext
> of course there can be pending conditional branches that needs to be
> finished; just try \appendtoks\tracingall\to\everygoodbye
>
true
>
> You can also do something
>
> \startluacode
> table.insert(input.stop_actions, function()
> texio.write_nl("I still have no clue why you need it.")
> end)
> \stopluacode
>
ok thank you -- I like lua code --
>
> any other hook in itself will introduce a new situation of 'something done
> before the real \end'
>
exactly what I mean:
"any other hook in itself will introduce a new situation of 'something done
before the real \end'"
that potentially can modify current page .
Consider this:
between
final_cleanup; {prepare for death}
and
end_of_TEX: close_files_and_terminate;
insert
{************* MY HACK ************}
almost_death ;{I see state, but it's 'frozen' so any modification will
never influence pdf or dvi , only to log or terminal or external files}
{*******************************************}
in almost_death you can do what ever you want -- you will never modify
(relevant part of ) state
that can influence final pdf or dvi .
==================================================
@ Now this is really it: \TeX\ starts and ends here.
The initial test involving |ready_already| should be deleted if the
\PASCAL\ runtime system is smart enough to detect such a ``mistake.''
@^system dependencies@>
@p begin @!{|start_here|}
history:=fatal_error_stop; {in case we quit during initialization}
t_open_out; {open the terminal for output}
if ready_already=314159 then goto start_of_TEX;
@<Check the ``constant'' values...@>@;
if bad>0 then
begin wterm_ln('Ouch---my internal constants have been clobbered!',
'---case ',bad:1);
@.Ouch...clobbered@>
goto final_end;
end;
initialize; {set global variables to their starting values}
@!init if not get_strings_started then goto final_end;
init_prim; {call |primitive| for each primitive}
init_str_ptr:=str_ptr; init_pool_ptr:=pool_ptr; fix_date_and_time;
tini@/
ready_already:=314159;
start_of_TEX: @<Initialize the output routines@>;
@<Get the first line of input and prepare to start@>;
history:=spotless; {ready to go!}
@<Initialize synctex primitive@>
main_control; {come to life}
final_cleanup; {prepare for death}
{************* MY HACK ************}
almost_death ;{I see state, but it's 'frozen' so any modification will
never influence pdf or dvi , only to log or terminal or external files}
{*******************************************}
end_of_TEX: close_files_and_terminate;
final_end: ready_already:=0;
end.
=======================================
anyway, as I wrote , this is not bad:
\def\LuigisWhateverShouldHappen{\immediate\write16{BOOOM!}Something
Luigi want to do for some unknown reason.\immediate\write16{BOOOM!}}
\appendtoks\LuigisWhateverShouldHappen \to \everylastshipout
\starttext
hello
\stoptext
\LuigisWhateverShouldHappen
can be made more robust -- for example you can find a way to nullify
"Something...reason." so it doesn't appear on final pdf , and so on --
--
luigi
[-- Attachment #1.2: Type: text/html, Size: 4892 bytes --]
[-- Attachment #2: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2009-03-26 15:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 9:21 luigi scarso
2009-03-25 12:01 ` Wolfgang Schuster
2009-03-25 12:35 ` luigi scarso
2009-03-25 12:41 ` Wolfgang Schuster
2009-03-25 12:52 ` luigi scarso
2009-03-25 12:57 ` Wolfgang Schuster
2009-03-25 13:11 ` luigi scarso
2009-03-25 13:19 ` Wolfgang Schuster
2009-03-25 14:00 ` luigi scarso
2009-03-25 14:44 ` Wolfgang Schuster
2009-03-25 15:01 ` luigi scarso
2009-03-25 15:25 ` Peter Rolf
2009-03-25 15:31 ` luigi scarso
2009-03-25 15:40 ` Peter Rolf
2009-03-25 15:53 ` Aditya Mahajan
2009-03-25 16:13 ` luigi scarso
2009-03-26 8:56 ` Hans Hagen
2009-03-26 9:20 ` luigi scarso
2009-03-26 9:33 ` luigi scarso
2009-03-26 9:52 ` Hans Hagen
2009-03-26 10:19 ` luigi scarso
2009-03-26 10:50 ` Hans Hagen
2009-03-26 13:08 ` luigi scarso
2009-03-26 13:58 ` Hans Hagen
2009-03-26 14:14 ` luigi scarso
2009-03-26 14:53 ` Hans Hagen
2009-03-26 15:39 ` luigi scarso [this message]
2009-03-26 17:06 ` luigi scarso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fe8d59da0903260839y318ccc5cp195714f710d2fce4@mail.gmail.com \
--to=luigi.scarso@gmail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).