[comp.lang.postscript] 0 0 1 {} for

jeffe@eniac.seas.upenn.edu (George Jefferson ) (12/08/90)

I just discovered this 'illegal' zero increment for loop in someone elses Ps file.

The interesting thing is that the loop is simply ignored by
our LaserWriter and our HP111/PS. (no errors reported and the file prints fine)

I discovered it because it bombs X11/NeWS Pageview.

My question is, is this construction simply undefined (therefore interpreter dependant..)
or is it _supposed_ to be ignored?

By the way, Pageview also chokes on    1 0 1 { } for 
which I think should be a well defined 'null' statement


--
-george   @sol1.lrsm.upenn.edu

flar@bendenweyr.Eng.Sun.COM (Jim Graham) (12/08/90)

The documentation specifies the termination conditions for negative
and positive increments, but it does not specify the termination
conditions for 0 increments (which are neither positive nor negative).

It appears that the Laswerwriter and the DPS on the DecStation treat
0 as a negative increment (terminates when the control variable is
less than the limit), whereas NeWS treats 0 as a positive increment
(terminates when the control variable is greater than the limit).

The redbook should be revised to be explicit about the zero case.

					...jim

flar@bendenweyr.Eng.Sun.COM (Jim Graham) (12/08/90)

From Peter Deutsch:

----- Begin Included Message -----

From: deutsch@parcplace.com (Peter Deutsch)
Subject: 0 0 1 {} for

Please post this for me.  News posting at ParcPlace is broken.

For the record, Ghostscript treats 0 as positive (terminates when the
control variable is greater than the limit).  For those of us who
distinguish "positive" from "strictly positive", there is no ambiguity
about this case.  :-)

		Peter-the-ghost

----- End Included Message -----

My followup to conserve on messages:

Actually, the plot thickens as I discover that the Laserwriter and DPS
both consider "0 0 .1 {} for" an infinite loop, but "0 0 1 {} for" a NULL
statement.  Fancy that.

Reading the description of the exp primitive, it appears that the
redbook considers positive numbers to exclude zero when they use
the term rather than "positive" "non-negative" to mean numbers >= 0.

					...jim