Article View: comp.lang.postscript
Article #994Re: Case statements in Postscript
From: Emil Rainero
Date: Thu, 31 Aug 1989 18:09
Date: Thu, 31 Aug 1989 18:09
49 lines
1334 bytes
1334 bytes
Try this
/case
{
% (in case) ==
/printnextproc 0 def
/proc exch def
/obj exch def
{
/proc load dup
length 0 eq {pop exit} if
dup 0 get
dup type /arraytype eq printnextproc 1 eq and {dup exec /printnextproc 2 def} if
dup /Default eq printnextproc 0 eq and {/printnextproc 1 def} if
/obj load eq {/printnextproc 1 def} if
dup length 1 sub 1 exch getinterval
/proc exch def
} loop
} bind def
% EXAMPLE 1
0 1 20
{
dup ( ) cvs print ( ) print
{
1 {(is 1) =}
2 {(is 2) =}
3 4 {(is 3,4) =}
5 7 {(is 5,7) =}
8 {(is 8) =}
/Default {(other) =}
} case
} for
% EXAMPLE 2
{A B C D E}
{
dup ( ) cvs print ( ) print
{
/B {(is B) =}
/Default {(other) =}
} case
} forall
Technical Details
Message-ID:
<199@spot.wbst128.xerox.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!brutus.cs.uiuc.edu!wuarchive!udel!rochester!spot!prism!raineroReferences:
<7573@cg-atla.UUCP> <MONTNARO.89Aug30092917@sprite.crd.ge.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!brutus.cs.uiuc.edu!wuarchive!udel!rochester!spot!prism!rainero From: rainero@prism.wbst128.xerox.com (Emil Rainero) Newsgroups: comp.lang.postscript Subject: Re: Case statements in Postscript Message-ID: <199@spot.wbst128.xerox.com> Date: 31 Aug 89 18:09:52 GMT References: <7573@cg-atla.UUCP> <MONTNARO.89Aug30092917@sprite.crd.ge.com> Sender: news@spot.wbst128.xerox.com Reply-To: rainero@prism.UUCP (Emil Rainero) Distribution: comp Organization: WRC, XEROX Lines: 49