From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/32389 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: store counter or variable and reread again Date: Sat, 30 Dec 2006 18:19:18 -0500 (EST) Message-ID: References: <45941026$0$4168$ba624c82@nntp02.dk.telia.net> <459670F8.5020106@elvenkind.com> <45968AED.7040904@gmx.net> <4596E9B0.8070705@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1167520782 10082 80.91.229.12 (30 Dec 2006 23:19:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 30 Dec 2006 23:19:42 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun Dec 31 00:19:40 2006 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 1H0nUK-0004jH-2g for gctc-ntg-context-518@m.gmane.org; Sun, 31 Dec 2006 00:19:40 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D12132006B; Sun, 31 Dec 2006 00:17:23 +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 17452-02-18; Sun, 31 Dec 2006 00:17:14 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C4CE82001B; Sun, 31 Dec 2006 00:17:14 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 97A1C2004A for ; Sun, 31 Dec 2006 00:17:11 +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 17425-05-15 for ; Sun, 31 Dec 2006 00:17:04 +0100 (CET) Original-Received: from hellskitchen.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.82]) by ronja.ntg.nl (Postfix) with SMTP id 590992001B for ; Sun, 31 Dec 2006 00:17:04 +0100 (CET) Original-Received: FROM aditya.annarb01.mi.comcast.net (c-68-40-50-205.hsd1.mi.comcast.net [68.40.50.205]) BY hellskitchen.mr.itd.umich.edu ID 4596F3F5.965D4.3505 ; 30 Dec 2006 18:19:18 -0500 Original-To: mailing list for ConTeXt users In-Reply-To: <4596E9B0.8070705@wxs.nl> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 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:32389 Archived-At: On Sat, 30 Dec 2006, Hans Hagen wrote: > Aditya Mahajan wrote: > > On Sat, 30 Dec 2006, Peter M???nster wrote: > > > > > >> On Sat, 30 Dec 2006, Aditya Mahajan wrote: > >> > >> > >>> % Now the rest of the magic to take care of the two pass run > >>> % Basically this says that rerun if \nofPoints != > >>> % \countervalue{Points}. In the next run we set \nofPoints to the > >>> % previous value of \countervalue{Points} (the \checkPoints macro in > >>> % the beginning), so things should be stable after two runs. > >>> \savetwopassdata {Points} {\nofPoints} {\countervalue{Points}} > >>> > >> Hello Aditya, > >> > >> with the following example, I get always 2 runs: > >> > >> \definetwopasslist{test} > >> \starttext > >> bla > >> \savetwopassdata{test}{1}{2} > >> \stoptext > >> > >> Is this normal or a bug? > >> > > > > Hmm... I would have guessed that you will keep on getting infinite > > runs, but apparently texexec decides that two are enough. I need to > > look deeper to see if this is the intended behaviour. I would call it > > a bug, since there can be cases which need more than two runs to > > converge. > > > > > how about > > \savecurrentvalue\SomeVar{someval} I was just copying the way it is done with other macros \lastpage, etc. I will look at \savecurrentvalue also. However, something seems to be wrong in tex.rb Change def processfile .... while ! stoprunning && (texruns < nofruns) && ok do .... end ... end to def processfile .... while ! stoprunning && (texruns < nofruns) && ok do .... report("stoprunning #{stoprunning}") report("texruns=#{texruns}, nofruns=#{nofruns}") report("ok=#{ok}") report("while=#{! stoprunning && (texruns < nofruns) && ok}") end ... end so that we can see what takes us out of the while loop. Take Petar's test file and run it through texexec. I get TeXExec | stoprunning true TeXExec | texruns=2, nofruns=8 TeXExec | ok=counter.tex TeXExec | while=counter.tex Notice that ok=\jobname. Shouldn't ok be a boolean. And the condition for while is a string rather than a boolean. I am not too sure on what ruby does for non boolean conditionals, but the present implementation can break (under some crazy conditions, maybe). How about if in def runtexutil(...) there is a return ok in the end, for example begin logger = Logger.new('TeXUtil') if tu = TeXUtil::Converter.new(logger) and tu.loaded(fname) then ok = tu.processed && tu.saved && tu.finalized end rescue Kpse.runscript('texutil',fname,options) else return ok #<--------- added. end Back to Peter's question, I gave a wrong explaination earlier. texexec just checks if the tui file has changed. If the file did not change from the last run, then it stops processing. So with \savetwopassdata{test}{1}{2} you will get two runs the first time you process the file, and a single run if you reprocess the file. By default, the maximum number of runs that you can have is 8, but you can change this by passing --runs= to texexec Aditya