From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/43999 Path: news.gmane.org!not-for-mail From: "luigi scarso" Newsgroups: gmane.comp.tex.context Subject: Re: ifdim ... or ... else ... Date: Sun, 14 Sep 2008 16:30:14 +0200 Message-ID: References: <20080910121547.GH8552@atos.labs.wmid.amu.edu.pl> <48C7BE10.2060300@wxs.nl> <115224fb0809100712v30b54f07qc179319a4474c297@mail.gmail.com> <48C7E480.7020805@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: ger.gmane.org 1221402708 14131 80.91.229.12 (14 Sep 2008 14:31:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Sep 2008 14:31:48 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Sun Sep 14 16:32:44 2008 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 1KeseY-0005Yd-W8 for gctc-ntg-context-518@m.gmane.org; Sun, 14 Sep 2008 16:32:43 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 55F761FEB8; Sun, 14 Sep 2008 16:31:40 +0200 (CEST) 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 15080-04-6; Sun, 14 Sep 2008 16:30:52 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D5CD31FEA8; Sun, 14 Sep 2008 16:30:51 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 479FB1FEA8 for ; Sun, 14 Sep 2008 16:30:50 +0200 (CEST) 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 02365-01-3 for ; Sun, 14 Sep 2008 16:30:16 +0200 (CEST) Original-Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.172]) by ronja.ntg.nl (Postfix) with ESMTP id 460611FE9F for ; Sun, 14 Sep 2008 16:30:16 +0200 (CEST) Original-Received: by wf-out-1314.google.com with SMTP id 27so1538296wfd.5 for ; Sun, 14 Sep 2008 07:30:15 -0700 (PDT) Original-Received: by 10.143.31.4 with SMTP id i4mr2280194wfj.87.1221402614973; Sun, 14 Sep 2008 07:30:14 -0700 (PDT) Original-Received: by 10.142.165.8 with HTTP; Sun, 14 Sep 2008 07:30:14 -0700 (PDT) In-Reply-To: Content-Disposition: inline X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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:43999 Archived-At: On Sat, Sep 13, 2008 at 2:18 PM, Wolfgang Schuster wrote: > > Am 10.09.2008 um 17:15 schrieb Hans Hagen: > >> newspeak would be using an attribute and postprocessing the node >> list -) > > How could I write this in newspeak: > > \newsignal\yesnosignal > > \def\yesno{\scratchdimen\lastskip\ifdim\scratchdimen=\yesnosignal YES > \else NO\fi} > > \starttext > > text \hskip\yesnosignal \yesno\ text \hskip\yesnosignal text \yesno\ > text > > \stoptext > It's no mkiv way (aka "newspeak") . I worked to something like this at Bohinj (I don't know why '25' in an.number==25 ) . I'm not sure that it works, If i have time I will check it . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def\StudyBox#1#2#3{% \startluacode nodes = nodes or {} local traverse_id = node.traverse_id local head = tex.box[#1].list local m = 0 local hlist, vlist, whatsit,glue = node.id('hlist'), node.id('vlist'), node.id('whatsit'),node.id('glue') local attribute = node.id('attribute') local attributeList = node.id('attribute_list') texio.write_nl(' ** SigStartC='..tostring(tex.count['SignalStartC'])..' SigStopC='..tostring(tex.count['SignalStopC'])..'\n') local SigStartC = #2 or 0 local SigStopC = #3 or 0 local function searchrecursive(head) %%-- if node.type(head.id)== 'rule' then attlist = head.attr %%print("==>",tostring(nodes.serialize(nodes.totable(head)))) for an in node.traverse(attlist) do if node.has_field(an, 'number') and node.has_field(an, 'value') and an.number==25 and an.value==101 then texio.write_nl('SigStartC INCRESEAD'..'\n') SigStartC = SigStartC +1 end if node.has_field(an, 'number') and node.has_field(an, 'value') and an.number==25 and an.value==111 then texio.write_nl('SigStop decresead'..'\n') SigStopC = SigStopC +1 end end %%-- end if node.has_field(head,'list') then %%-- print("ok") for n in node.traverse(head.list) do %%-- print(tostring(n)) searchrecursive(n) end end end texio.write_nl('SigStartC='..SigStartC..' SigStopC='..SigStopC..'\n') searchrecursive(tex.box[#1]) texio.write_nl('SigStartC='..SigStartC..' SigStopC='..SigStopC..'\n') tex.setcount('SignalStartC',SigStartC) tex.setcount('SignalStopC',SigStopC) \stopluacode} \global\newcount\SignalStartC \global\newcount\SignalStopC \defineattribute[SigStart] \def\SignalStart{\hbox attr\dogetattributeid{SigStart}=101 to 0sp {\vrule width 0sp height0sp depth0sp}} \def\SignalStop{\hbox attr\dogetattributeid{SigStart}=111 to 0sp {\vrule width 0sp height0sp depth0sp}} \starttext \setbox100=\vbox{ \nobreak\SignalStart\nobreak Some text . \nobreak\SignalStop\nobreak } \StudyBox{100}{\the\SignalStartC}{\the\SignalStopC}% end \stoptext %%%%%%%%%%%%%%%% See log and output for some -- luigi ___________________________________________________________________________________ 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 ___________________________________________________________________________________