From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/62678 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: What is the replacement for the 'stop_run' callback? Date: Sun, 17 Oct 2010 18:24:08 +0200 Message-ID: <4CBB2328.8040509@wxs.nl> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1287332676 25935 80.91.229.12 (17 Oct 2010 16:24:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Oct 2010 16:24:36 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 17 18:24:34 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P7W2E-0004Lc-Im for gctc-ntg-context-518@m.gmane.org; Sun, 17 Oct 2010 18:24:34 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0BFD1CA75C; Sun, 17 Oct 2010 18:24:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TWjTwI-gW08P; Sun, 17 Oct 2010 18:24:30 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 8F174CA755; Sun, 17 Oct 2010 18:24:30 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E8431CA755 for ; Sun, 17 Oct 2010 18:24:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Bzt-O8bvviRO for ; Sun, 17 Oct 2010 18:24:17 +0200 (CEST) Original-Received: from filter5-ams.mf.surf.net (filter5-ams.mf.surf.net [192.87.102.73]) by balder.ntg.nl (Postfix) with ESMTP id 83E2ACA73E for ; Sun, 17 Oct 2010 18:24:17 +0200 (CEST) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter5-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o9HGOGAr006126 for ; Sun, 17 Oct 2010 18:24:17 +0200 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by pragma-net.nl (SurgeMail 4.3g4) with ESMTP id 9881-1713362 for multiple; Sun, 17 Oct 2010 18:21:51 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4 ThunderBrowse/3.3.2 In-Reply-To: X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; region=11; city=Den Haag; latitude=52.0833; longitude=4.3000; http://maps.google.com/maps?q=52.0833,4.3000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0BDjQogc7 - 4e70724cbf99 - 20101017 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.73 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:62678 Archived-At: On 17-10-2010 4:06, Tad Ashlock wrote: > I'm trying to update a ConTeXt module of mine. It does some data gathering > during the ConTeXt run, and then processes it after the run is complete. > This used to work last year: > > local id, err = callback.register('stop_run', new_stop_run_function) > > But now err is set to "callback 'stop_run' is frozen (actions performed at > the end of a run)". indeed > After trying various approaches for a couple of hours, I'm calling for help. > :) > Here's what I ended up with: > > \startluacode > print('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TEST1') > local function after_run (head, groupcode) > print('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TEST2') > return head, true > end > nodes.tasks.appendaction('finalizers','after','after_run') > \stopluacode > \starttext > \input knuth > \stoptext > > In the output, I see the TEST1 line, but not the TEST2 line. because after_run is not seen, function myprivatenamespace.after_run ... nodes.tasks.appendaction('finalizers','after','myprivatenamespace.after_run') > I don't know what "head" and "groupcode" are, but those seem to be the > expected parameters for an action. I don't know why it returns "head, > true", but that was recommended in a posting ( > http://archive.contextgarden.net/message/20100410.005025.76ac9efd.en.html). whatever, it's not the place to hook in your finalizer as there finalizers are just a specific place in node list processing > I have no idea if 'finalizers' is the right parameter, but I didn't see any > others that looked like it could be synonymous with 'stop_run'. You can use (preferable no messages there): luatex.registerstopactions(yourfunction) or for messages: statistics.register("banner",function() return "text" end) in this case returning false (or nil) will not show the statistic which makes sense if there's nothing useful to report. At some point there will be a formal description for this. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________