Path: csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 12 Nov 2018 08:12:11 -0600 From: Scott Hemphill Newsgroups: comp.lang.postscript Subject: Re: postscript newbie has questions References: Reply-To: hemphill@alumni.caltech.edu Date: Mon, 12 Nov 2018 09:12:11 -0500 Message-ID: <87bm6ucrlw.fsf@hemphills.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:HHDUwsPVmyc/2WaQNtFgtLo2yR0= MIME-Version: 1.0 Content-Type: text/plain Lines: 45 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-W1tjQ8atciYpLmV+rc4lZvxke3ueaGA0fMwRGx9t5nS+YWKqlq7gjThGDLyTOXQcFFwYrEy1wFAKTIT!xRDR+4Yx2esv81aBv5F0fL4rnlkJS/7Z7+IuFKNUaxq5WxQucNXE6jw= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2482 Xref: csiph.com comp.lang.postscript:3330 Eric Lovejoy writes: > Hello all, I am new to postscript programing, it is my first stack > based programing language, my background is in C/C++, programing > embedded systems. > > > > In any event, I have some basic operations I am trying to utilize, and > things seem to not be working. keep in mind, I am very new to the > postscript language. I am also working on a linux machine, using the > ghostscript interpreter. > > One problem I am having a hard time with is understanding how to > change a variable, after defining it. > > take this example: > > %arc takes x,y,radius,start degree, end degree. > /r 144 def > 0 0 r 0 360 arc > 1 0 1 setrgbcolor > stroke > 4{ r -24 sub r > 0 0 r 0 360 arc > 0 1 0 setrgbcolor > stroke} repeat > > > my goal with this code snippet is to make incrementally smaller > circles by decrimenting variable "r". > This doesnt work, I get one circle. > I have tried a variety of /r -24 sub r, /r -24 sub /r, r -24 sub /r, > etc. but nothing like this works. what Iam I doing wrong? I assume you want to subtract 24 from the value of r. If you subtract -24 from the value of r, you will be adding 24 to its value. So something like this should work: /r r 24 sub def Scott -- Scott Hemphill hemphill@alumni.caltech.edu "This isn't flying. This is falling, with style." -- Buzz Lightyear