PostScript Level 2: Doesn‘t Check for Device-Specific Operators



I upgraded from a LaserWriter IINTX to a LaserWriter IIg, to print jobs
made by Sun workstations. Files that printed on the LaserWriter IINTX now
fail to print on the LaserWriter IIg. The problem file generates a
calendar for 1992. Examining a log shows that the "load" command isn't
finding a key entry and causes the error. This is somewhere in the
following PostScript extract:

"/a4 [ [300 72 div 0 0 -300 72 div -72 3436 ] 292 3365
{statusdict /jobstate (printing) put 0 setblink
margins exch 142 add exch 256 add 8 div round cvi frametoroket
statusdict /jobstate (busy) put 1 setblink} /framedevice load
60 45 {dup mul exch dup mul add 1.0 exch sub} /setscreen load
{} /settransfer load /initgraphics load /erasepage load ] cvx
statusdict begin bind end readonly def"

Is the software that creates the Postscript doing "unapproved" things to
the statusdict dictionary? Or are the problems due to a change from Level
1 to Level 2 Postscript in the LaserWriter IIf and IIg?

After a quick look at the CAL code, we noticed at least a couple of device-
specific operators.

The first, framedevice, is the one causing the failure on your LaserWriter
IIg. The framedevice operator no longer exists in PostScript Level 2
implementations. It wasn't included in a number of Level 1 implementations
either. Nearly every mention of the operator in Adobe documentation warns
about its use, all pointing out that the code should definitely understand
the environment it's used on. It's interesting that an application is
generating code that uses it without first verifying its existence on the
printer.

The second problem operator is setblink. It actually occurs first in the
code, but is in a deferred procedure and therefore doesn't get a chance to
cause problems because it's never executed. (More on this later.) It's
also device-specific to some printers that allow program control over the
user indicator panel.

Finally, both of the problem operators are in a definition of the a4 paper
size. This is the same segment you included in your question. What's
almost humorous is that nothing in the rest of the code refers to this
definition. It isn't used. (That's why the setblink operator never has a
chance to fail.) Commenting out the a4 definition doesn't affect the
program's operation or output. Also, a4 is already defined in many
PostScript implementations. It certainly doesn't need to be redefined for
the LaserWriter IIg. If the Sun generated this by a "prep" file, you
should be able to comment it out to prevent causing further problems with
other files.

In any case, the program that generated the PostScript should have first
checked for the existence of these operators. The problem is showing up
because of changes from PostScript Level 1 to Level 2, but the real culprit
is the PostScript code itself. It fails to test adequately the environment
it's running in.


Published Date: Feb 18, 2012