From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/48805 Path: news.gmane.org!not-for-mail From: luigi scarso Newsgroups: gmane.comp.tex.context Subject: Re: The very last macro Date: Thu, 26 Mar 2009 16:39:11 +0100 Message-ID: References: <49CB504F.7080706@wxs.nl> <49CB5DE3.3060408@wxs.nl> <49CB89F4.1010005@wxs.nl> <49CB96CE.4020601@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0466998599==" X-Trace: ger.gmane.org 1238082024 32497 80.91.229.12 (26 Mar 2009 15:40:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Mar 2009 15:40:24 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Mar 26 16:41:41 2009 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Lmrhw-00038h-0A for gctc-ntg-context-518@m.gmane.org; Thu, 26 Mar 2009 16:41:28 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5C1F11FBD0; Thu, 26 Mar 2009 16:40:01 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10745-04; Thu, 26 Mar 2009 16:39:23 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id EC9EA1FB8C; Thu, 26 Mar 2009 16:39:22 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5FAA91FB8C for ; Thu, 26 Mar 2009 16:39:21 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03183-07-2 for ; Thu, 26 Mar 2009 16:39:12 +0100 (CET) Original-Received: from filter1-til.mf.surf.net (filter1-til.mf.surf.net [194.171.167.217]) by ronja.ntg.nl (Postfix) with ESMTP id DB5D91FB57 for ; Thu, 26 Mar 2009 16:39:12 +0100 (CET) Original-Received: from mail-fx0-f176.google.com (mail-fx0-f176.google.com [209.85.220.176]) by filter1-til.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n2QFdBx8019292 for ; Thu, 26 Mar 2009 16:39:12 +0100 Original-Received: by fxm24 with SMTP id 24so664557fxm.2 for ; Thu, 26 Mar 2009 08:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=xmtMvzupWMfLz0yqDFI75RYBeDDp3hQqUCcmrIiTStg=; b=Eh0teO7xm2KhxW4HCrZig86Iw1PdcmlKQP6FYiO/BtWJZOK02AHeZXNfTlRvY5twSz rkz/pDDCVN0Txbb/NBW7Ckxn2hbUlYN/r5VSxu7FePd3OU7Jbyt2Dfirh1kGFKt47N7U SLl5BUGd1H5Swe75Mn0gF29Up47dJZWxeCjKQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Bt5G/Ehh1an/3qt24u8u4UKcz3cX8eTqkhh8FP28wY9/Sd+idXjj/BUCj3UyrTc1rl ysjdiAlfXXW5k161Df3hVxFvAkazhoOUNSJZ7jutzBoszv2p5B4r+ayZIOSqhRRzT5d0 3fpAuPfTo8tJNy5WQBTzIRCNPzYi4PEfHIiuo= Original-Received: by 10.204.31.101 with SMTP id x37mr338170bkc.4.1238081951582; Thu, 26 Mar 2009 08:39:11 -0700 (PDT) In-Reply-To: <49CB96CE.4020601@wxs.nl> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.220.176; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 199649993 - 0ef845148401 - 20090326 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.217 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.11 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:48805 Archived-At: --===============0466998599== Content-Type: multipart/alternative; boundary=001485f1a1f0ed4ae80466076a07 --001485f1a1f0ed4ae80466076a07 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit > > 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; @@; 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: @; @; history:=spotless; {ready to go!} @ 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 --001485f1a1f0ed4ae80466076a07 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
the problem is in your definition of 'end' and 'botto= m'
??
end :=3D end of run
bottom :=3D bottom of last p= age, in this case

=C2=A0

the real final thing is \end and \everygoodbye happens just before that (th= e only calls after it are postponed error messages, which have no consequen= ce for any pdf and the primitive \end which is really needed)
yes, as I seen=C2=A0 in \def\stoptext=C2=A0


of course there can be pending conditional branches that needs to be finish= ed; just try \appendtoks\tracingall\to\everygoodbye
true
=C2=A0

You can also do something

\startluacode
=C2=A0 =C2=A0table.insert(input.stop_actions, function()
=C2=A0 =C2=A0 =C2=A0 =C2=A0texio.write_nl("I still have no clue why y= ou need it.")
=C2=A0 =C2=A0end)
\stopluacode

=C2=A0ok thank you -- I like lua code=C2=A0 --
=C2=A0

any other hook in itself will introduce a new situation of 'something d= one before the real \end'
=

exactly what I mean:
"any other hook in itsel= f will introduce a new situation of 'something done before the real \en= d'"
that potentially can modify current page .




C= onsider 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=C2=A0 'frozen' so any modi= fication=C2=A0 will never influence=C2=A0 pdf or dvi , only to log or termi= nal or external files}
{*******************************************}

in =C2=A0 almost_death= you can do what ever you want -- you will never modify=C2=A0 (relevant par= t of ) state
that can influence final pdf or dvi .

=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
@ Now this is really it: \TeX\ starts and ends here.

The initial tes= t involving |ready_already| should be deleted if the
\PASCAL\ runtime sy= stem is smart enough to detect such a ``mistake.''
@^system depe= ndencies@>

@p begin @!{|start_here|}
history:=3Dfatal_error_stop; {in case we q= uit during initialization}
t_open_out; {open the terminal for output}if ready_already=3D314159 then goto start_of_TEX;
@<Check the ``cons= tant'' values...@>@;
if bad>0 then
=C2=A0 begin wterm_ln('Ouch---my internal constants= have been clobbered!',
=C2=A0=C2=A0=C2=A0 '---case ',bad:1)= ;
@.Ouch...clobbered@>
=C2=A0 goto final_end;
=C2=A0 end;
in= itialize; {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:=3Dstr_ptr; init_pool_ptr:= =3Dpool_ptr; fix_date_and_time;
tini@/
ready_already:=3D314159;
st= art_of_TEX: @<Initialize the output routines@>;
@<Get the first line of input and prepare to start@>;
history:=3Ds= potless; {ready to go!}
@<Initialize synctex primitive@>
main_c= ontrol; {come to life}
final_cleanup; {prepare for death}
{**********= *** MY HACK ************}
almost_death ;{I see state, but it's=C2=A0 'frozen' so any modi= fication=C2=A0 will never influence=C2=A0 pdf or dvi , only to log or terminal or external= files}
{*******************************************}
end_of_TEX: clo= se_files_and_terminate;
final_end: ready_already:=3D0;
end.

= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


anyway,=C2=A0 as I wrote , this is not bad:

\def\LuigisWhateverShouldHappen{\immediate\write16{BOOOM!}Something
Lu= igi want to do for some unknown reason.\immediate\write16{BOOOM!}}

\appendtoks\LuigisWhateverShouldHappen \to \everylastshipout
<= div class=3D"im">\starttext
hello
\stoptext

\LuigisWhate= verShouldHappen
can be made more robust -- for example you can find a wa= y to nullify
"Something...reason." so it doesn't appear on final pdf , and= so on --



--
luigi

--001485f1a1f0ed4ae80466076a07-- --===============0466998599== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============0466998599==--