From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/16311 Path: main.gmane.org!not-for-mail From: Nikolai Weibull Newsgroups: gmane.comp.tex.context Subject: Re: verbatim pseudo-code Date: Wed, 1 Sep 2004 03:50:58 +0200 Sender: ntg-context-bounces@ntg.nl Message-ID: <20040901015058.GD3077@puritan.pcp.ath.cx> References: <20040831135454.GA17162@puritan.pcp.ath.cx> <20040831151957.GB17162@puritan.pcp.ath.cx> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="PEIAKu/WMn1b1Hv9" X-Trace: sea.gmane.org 1094003474 8339 80.91.224.253 (1 Sep 2004 01:51:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Sep 2004 01:51:14 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Wed Sep 01 03:51:05 2004 Return-path: Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C2KHB-0006h0-00 for ; Wed, 01 Sep 2004 03:51:05 +0200 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CC47A1278A; Wed, 1 Sep 2004 03:51:03 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 01532-02; Wed, 1 Sep 2004 03:51:00 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CC80512783; Wed, 1 Sep 2004 03:50:59 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5FB2D12783 for ; Wed, 1 Sep 2004 03:50:58 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 01255-07 for ; Wed, 1 Sep 2004 03:50:57 +0200 (CEST) Original-Received: from mxfep02.bredband.com (unknown [195.54.107.73]) by ronja.ntg.nl (Postfix) with ESMTP id A6D9F1277B for ; Wed, 1 Sep 2004 03:50:57 +0200 (CEST) Original-Received: from puritan.pcp.ath.cx ([213.112.43.242] [213.112.43.242]) by mxfep02.bredband.com with ESMTP id <20040901015057.MRKI345.mxfep02.bredband.com@puritan.pcp.ath.cx> for ; Wed, 1 Sep 2004 03:50:57 +0200 Original-Received: by puritan.pcp.ath.cx (Postfix, from userid 1000) id BCA3CAE041; Wed, 1 Sep 2004 03:50:58 +0200 (CEST) Original-To: NTG-context List Content-Disposition: inline In-Reply-To: <20040831151957.GB17162@puritan.pcp.ath.cx> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: by amavisd-new at ntg.nl Xref: main.gmane.org gmane.comp.tex.context:16311 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:16311 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Nikolai Weibull [Aug 31, 2004 17:20]: > What I really need to know now (I got a small implementation I want to > try out) is how to install the verbatim environment and then how to try > it out. OK. Here's a preliminary implementation. Perhaps using a verbatim environment complicates matters unnecessarily. Anyway, set up with [palet=,style=\rm,icommand=\bf,ccommand=\rm] it looks kind of nice. Suggestions for other solutions are welcome. But I need to start writing down some algorithms soon, so... nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} --PEIAKu/WMn1b1Hv9 Content-Type: application/x-tex Content-Disposition: attachment; filename="verb-pseudo.tex" Content-Transfer-Encoding: quoted-printable \writestatus{loading}{Pretty Pseudo Code Verbatim}=0A=0A\unprotect=0A=0A\gd= ef\PSEUDOsetcontrols%=0A {\saveprettycontrols=0A \everyprettyend=0A = {\endPSEUDOsix}%=0A \def\obeyedspace%=0A {\endPSEUDOtypefour=0A = \oldobeyedspace}%=0A \def\flushrestofverbatimline%=0A {\endPSEUDOtype= four}%=0A \let\obeytabs=3D\ignoretabs}=0A=0A\gdef\setupprettyPSEUDOtype%= =0A {\def\prettyidentifier{PSEUDO}%=0A \PSEUDOsetvariables=0A \PSEUDOs= etcontrols=0A \PSEUDOsethandlers=0A \PSEUDOsetspecials}=0A=0A\gdef\PSEU= DOsetvariables%=0A {\global\let\PSEUDOsequence=3D\empty}=0A=0A\gdef\PSEUDO= setspecials%=0A {\setpretty`\%=3D1=0A \setpretty`\$=3D3 \setpretty`\{=3D= 3 \setpretty`\}=3D3 \setpretty`\[=3D3=0A \setpretty`\]=3D3 \setpretty`\(= =3D3 \setpretty`\)=3D3 \setpretty`\=3D=3D3=0A \setpretty`\<=3D3 \setprett= y`\>=3D3 \setpretty`\"=3D3 \setpretty`\-=3D3=0A \setpretty`\+=3D3 \setpre= tty`\/=3D3 \setpretty`\|=3D3 \setpretty`\'=3D3=0A \setpretty`\`=3D3 \setp= retty`\_=3D3 \setpretty`\&=3D3 \setpretty`\~=3D3=0A \setpretty`\.=3D3 \se= tpretty`\,=3D3 \setpretty`\:=3D3 \setpretty`\;=3D3=0A \setpretty`\*=3D3 \= setpretty`\\=3D3 \setpretty`\^=3D3 \setpretty`\#=3D5=0A \setpretty`\1=3D3= \setpretty`\2=3D3 \setpretty`\3=3D3 \setpretty`\3=3D3=0A \setpretty`\5= =3D3 \setpretty`\6=3D3 \setpretty`\7=3D3 \setpretty`\8=3D3=0A \setpretty`= \9=3D3 \setpretty`\0=3D3=0A \setpretty`\A=3D3 \setpretty`\B=3D3 \setprett= y`\C=3D3 \setpretty`\D=3D3=0A \setpretty`\E=3D3 \setpretty`\F=3D3 \setpre= tty`\G=3D3 \setpretty`\H=3D3 =0A \setpretty`\I=3D3 \setpretty`\J=3D3 \set= pretty`\K=3D3 \setpretty`\L=3D3=0A \setpretty`\M=3D3 \setpretty`\N=3D3 \s= etpretty`\O=3D3 \setpretty`\P=3D3=0A \setpretty`\Q=3D3 \setpretty`\R=3D3 = \setpretty`\S=3D3 \setpretty`\T=3D3=0A \setpretty`\U=3D3 \setpretty`\V=3D= 3 \setpretty`\W=3D3 \setpretty`\X=3D3 =0A \setpretty`\Y=3D3 \setpretty`\Z= =3D3=0A \setpretty`\a=3D4 \setpretty`\b=3D4 \setpretty`\c=3D4 \setpretty`= \d=3D4 =0A \setpretty`\e=3D4 \setpretty`\f=3D4 \setpretty`\g=3D4 \setpret= ty`\h=3D4=0A \setpretty`\i=3D4 \setpretty`\j=3D4 \setpretty`\k=3D4 \setpr= etty`\l=3D4=0A \setpretty`\m=3D4 \setpretty`\n=3D4 \setpretty`\o=3D4 \set= pretty`\p=3D4=0A \setpretty`\q=3D4 \setpretty`\r=3D4 \setpretty`\s=3D4 \s= etpretty`\t=3D4=0A \setpretty`\u=3D4 \setpretty`\v=3D4 \setpretty`\w=3D4 = \setpretty`\x=3D4 =0A \setpretty`\y=3D4 \setpretty`\z=3D4 \setpretty`\?= =3D4 \setpretty`\!=3D4}=0A=0A\gdef\PSEUDOsethandlers%=0A {\installprettyha= ndler 1 \PSEUDOtypeone=0A \installprettyhandler 2 \PSEUDOtypetwo=0A \in= stallprettyhandler 3 \PSEUDOtypethree=0A \installprettyhandler 4 \PSEUDOt= ypefour}=0A=0A\gdef\PSEUDOtypeone#1%=0A {\ifnaturaltextext=0A \let\nex= t\naturaltextext=0A \else=0A \disableprettytrue\disableprettyafterwar= ds=0A \def\next%=0A {\beginofpretty[\!!prettytwo]%=0A {\pr= ettyidentifierfont comment}%=0A \endofpretty}%=0A \fi=0A \next}= =0A=0A\gdef\PSEUDOtypetwo#1%=0A {\endPSEUDOtypefour=0A \beginofpretty[\!= !prettyone]\getpretty{#1}\endofpretty}=0A=0A\gdef\PSEUDOtypethree#1%=0A {\= endPSEUDOtypefour=0A \getpretty{#1}}=0A=0A\gdef\endPSEUDOtypefour%=0A {\= ifx\PSEUDOsequence\empty\else=0A \doifprettyidentifierelse{\PSEUDOseque= nce}{\PSEUDOidentifiers}=0A {\beginofpretty[\!!prettytwo]%=0A = {\prettyidentifierfont\PSEUDOsequence}%=0A \endofpretty}=0A = {\PSEUDOsequence}%=0A \global\let\PSEUDOsequence=3D\empty=0A \fi}=0A= =0A\gdef\PSEUDOtypefour#1%=0A {\xdef\PSEUDOsequence{\PSEUDOsequence\getpre= tty{#1}}}=0A=0A\gdef\PSEUDOmath#1%=0A {\naturaltextext\mathematics{#1}\rel= ax}=0A=0A\gdef\PSEUDOtex#1%=0A {\naturaltextext #1\relax}=0A=0A\useprettyi= dentifiers \PSEUDOidentifiers \PSEUDOsetspecials=0A for to do if then else= while foreach=0A=0A\definetyping[PSEUDO][\c!optie=3DPSEUDO]=0A=0A\installp= rettytype [PSEUDO] [PSEUDO]=0A\installnewpretty U {\setupprettiesintype{PSE= UDO}\setupprettytype}=0A=0A\definepalet[PSEUDOcolorpretty] [colorpretty]=0A= \definepalet[PSEUDOgraypretty] [graypretty]=0A=0A\installprettyescape [PSEU= DO] $ \PSEUDOmath% $=0A\installprettyescape [PSEUDO] - \PSEUDOtex=0A=0A\pro= tect=0A=0A\endinput=0A=0A% arch-tag: 10671de6-4b01-4b08-a438-34d99bbb6661= =0A% vim: set et sts=3D2 sw=3D2:=0A --PEIAKu/WMn1b1Hv9 Content-Type: application/x-tex Content-Disposition: attachment; filename="test.tex" Content-Transfer-Encoding: quoted-printable %\input verb-ini=0A\usemodule[nath]=0A\setupcolors[state=3Dstart]=0A\setupt= yping[palet=3D,style=3D\rm,icommand=3D\bf,ccommand=3D\rm]=0A\input verb-pse= udo=0A\starttext=0A\startPSEUDO=0Afor $i \gets 0$ to $n$ do=0A if $i =3D 0= $ then=0A $S_i \gets \{s_0\}$=0A else=0A $S_i \gets \cup_{s \in S_{i= - 1}}\delta(s, a_i)$=0A % $S_i$ has not yet reached its final value.=0A = % It now corresponds to the set $T_i$ mentioned above.=0A mark each $t$ in= $S_i$ -\quotation{considered}-=0A mark each $t$ in $S - S_i$ -\quotation{= unconsidered}-=0A $`queue \gets S_i$=0A while $`queue \not=3D \emptyset$ = do=0A find and delete $t$, the first element of $`queue$=0A foreach $= u \in \delta(t, \epsilon)$ do=0A if $u$ is -\quotation{unconsidered}- = then=0A mark $u$ -\quotation{considered}-=0A $`queue \gets `q= ueue \cup \{u\}$=0A $S_i \gets S_i \cup \{u\}$=0A\stopPSEUDO=0A=0A\d= efinestartstop[PSE][before=3D\startlines\setups{myPSE},after=3D\stoplines]= =0A=0A\startsetups[myPSE]=0A \obeyspaces=0A \def\for{{\bf for}}=0A \def\= to{{\bf to}}=0A \def\do{{\bf do}}=0A \def\If{{\bf if}}=0A \def\then{{\bf= then}}=0A \def\Else{{\bf else}}=0A \def\while{{\bf while}}=0A\stopsetups= =0A=0A\startPSE=0A\for\ $i \gets 0$ \to\ $n$ \do=0A \If $i =3D 0$ then=0A = $S_i \gets \{s_0\}$=0A \Else=0A $S_i \gets \cup_{s \in S_{i - 1}}\de= lta(s, a_i)$=0A\stopPSE=0A=0A\stoptext=0A --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --PEIAKu/WMn1b1Hv9--