Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!natinst!rpp386!woody From: woody@rpp386.cactus.org (Woodrow Baker) Newsgroups: comp.lang.postscript Subject: Re: Postscript idiot needed help (and got it) Summary: there are ways,m Message-ID: <17867@rpp386.cactus.org> Date: 5 Feb 90 13:21:11 GMT References: <17807@rpp386.cactus.org> <9002040147.AA16999@en.ecn.purdue.edu> Organization: River Parishes Programming, Plano, TX Lines: 53 In article <9002040147.AA16999@en.ecn.purdue.edu>, bevis@EE.ECN.PURDUE.EDU (Jeff Bevis) writes: > arguments in variables? Is that my only hope? Here's more code: > > /black {0 setgray} def > /white {1 setgray} def > > /donut > { /rad1 exch def % puke-O > /rad2 exch def % save all the arguments > /yval exch def % in variables > /xval exch def > > black xval yval rad2 0 360 arc fill % draw black circle > white xval yval rad1 0 360 arc fill % then white one on top > } def > My personal bias on this, is that the above is the way to do it. I nearly always like to put things in variables. There is another philosophy that says, leave them on the stack, but to me it is more difficult to debug that way. You could do it several ways, for example, you could rotat the stack until x is on the top, dup it, rotate it until y is on the top dup it, then rotate the top elements of the stack to get x y rad2 x y rad1 then do 0 360 arc... I assume that you have defined black and white to set the appropriate gray shades as needed... I don't have my red book handy, so am not going to take the time to write the stack rotations and duplications, but you can work that out. As always, it is a trade-off between time, codespace and variable space usage. It might be more eff. codewise to save into variables, but slower execution wise. Cheers Woody p.s. You should also get the GREEN book. It has a LOT of things to say about this and other topics. It really is a philosophy book about programming. Glenn did an excellent job on it. However, I don't recommend following his brace style, as it is a bit hard to read. Line up your opening and closing braces verticaly, like you would in 'C' (or should) and like the BEGIN/END in Pascal. It is much easier to follow stuff{ asdfasdfasdff asdfasdfsadf } def ^^^^^^^^^^^^^^^^^^NONO. stuff { asdfasdfasfd asdfasdfffdadsf } def ^^^^^^^^^^^^^^^^^^^Much easier to see. You are started on the right format.