Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!crdgw1!montnaro From: montnaro@sprite.crd.ge.com (Skip Montanaro) Newsgroups: comp.lang.postscript Subject: Re: Case statements in Postscript Message-ID: Date: 30 Aug 89 13:29:17 GMT References: <7573@cg-atla.UUCP> Sender: news@crdgw1.crd.ge.com Reply-To: (Skip Montanaro) Distribution: comp Organization: GE Corporate Research & Development, Schenectady, NY Lines: 24 In-reply-to: kincaid@cg-atla.UUCP's message of 29 Aug 89 17:14:24 GMT Tom Kincaid asked about a case statement for PostScript. Sun wrote just such a beast for NeWS. Perhaps somebody at Sun can make the decision to post it (it is copyrighted). For anybody who might want to go out and write a case function in PostScript, here's a syntax description of Sun's: % A case/switch statement. Takes a key for the case and an array. % Generally the array is executable to avoid evaluating the array % each time case is called: % obj { % key1 {proc1} % key2 key3 {proc2} % key4 {proc3} % /Default {proc4} % } case If somebody at Sun is listening, I think it would be a nice idea to post a number of common functions defined in basics.ps, such as the rectangle and list utilities, /case, /sprintf, and /append. I think this would help reduce incompatible implementations of the same stuff in the future. -- Skip Montanaro (montanaro@sprite.crd.ge.com)