Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Helge Blischke Newsgroups: comp.lang.postscript Subject: Re: What is the best way to work with a dictionary Followup-To: comp.lang.postscript Date: Sat, 13 Jul 2013 22:32:50 +0200 Lines: 63 Message-ID: References: <87zjtqdxrl.fsf@Aspire.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: individual.net NhCmD2IP3W1NsMWmwt6Beg32v9Ucjs7blwba0BN0+iIASJHxN7 Cancel-Lock: sha1:O8MNf52aEBjCM2yBZ7cw6xJ//dE= User-Agent: KNode/0.99.01 Xref: csiph.com comp.lang.postscript:1424 Cecil Westerhof wrote: > Until now I wrote functions like: > /ellipse { % x y unitX unitY colour > 5 dict begin > /colour exch def > /unitY exch def > /unitX exch def > /y exch def > /x exch def > > gsave > newpath > colour setrgbcolor > x y translate > unitX unitY scale > 1 1 1 0 360 arc closepath fill > stroke > grestore > end > } def > > I just saw in ‘PostScript Drawing: An Economist's Guide’ that it also > should be possible to do it in the following way: > /ellipse { % x y unitX unitY colour > << > /colour exch % operand stack at this point: % x y unitX unitY color /color mark > def > /unitY exch def > /unitX exch def > /y exch def > /x exch def > >> begin > gsave > newpath > colour setrgbcolor > x y translate > unitX unitY scale > 1 1 1 0 360 arc closepath fill > stroke > grestore > end > } def > > Which of the two is the better one and why? I think I like the second > one more. > The only problem is that it does not work. I get: > Error: /unmatchedmark in -->>-- > > I am using: > GPL Ghostscript 9.06 > You see that the name /color gets associated with the object mark, i. e. the --<<--, which is equivalent to --mark--, gets consumed and therefore is missing at the time -->>-- is executed. Think about it. Helge