Ref: 18960006
Title: Changing Postscript Printer Parameters
Date: 03/29/90

Copyright 3Com Corporation, 1991.  All rights reserved.

In 3OPT, when a printer is configured as Postscript, the server will
initialize the printer when the server is booted.  The file
C:\3PLUS\3SHARE\LWPREP contains the printer initialization, including
printer option settings.  The LWPREP file is designed for the Apple
Laserwriter series of printers, but can be modified for other Postscript
printers.

The LWPREP file begins as follows:

 .lt
statusdict begin 25 sccbatch
 7 eq exch 9600 eq and {stop} if
 %!
 0 serverdict begin exitserver
 statusdict begin
 25 9600 version (23.0) ne {7} {3} ifelse setsccbatch
 end
 .el

For Postscript printers, this fragment of the LWPREP file is interpreted
as follows:

statusdict begin - Open the dictionary "statusdict" to issue configuration
commands.

25 sccbatch - Get the current baud rate and options of the printer and push
them onto the Postscript stack.

7 eq - Compare the options byte pushed on the stack by the "sccbatch"
command with 7.  The command pushes the value 7 onto the stack.  "Eq" pops
the top two values off the stack to see if they are equal.  If so, TRUE will
be pushed on the stack; otherwise, FALSE is pushed on the stack.

exch - Exchange the top two elements on the stack.  In this case the top
element is TRUE or FALSE from the previous comparison.  The next value is
the baud rate pushed on the stack by "sccbatch."

9600 eq - Push 9600 on the stack and compare it with the baud rate from the
"sccbatch" command (both elements are popped off the stack).  If the baud
rate is 9600, then TRUE is pushed on the stack; otherwise, FALSE is pushed
on the stack.

and - Pop the two logical operators off the top of the stack.  If both
elements are TRUE, then TRUE is pushed on the stack; otherwise, FALSE is
pushed on the stack.

{stop} if - Push the "stop" procedure onto the stack.  The "if" statement
pops the top two values off the stack.  The procedure that is the top element
will be executed if the second element is TRUE.  In this case, if the baud
rate is 9600, and the options byte is 7, the printer will execute the "stop"
statement.  The "stop" statement will cause the Postscript printer to halt
the execution of this job.  The end of the job is defined by the Ctrl-D
character, which appears in the LWPREP program fragment immediately after
the "end" statement.

0 - Push the value 0 onto the stack.

serverdict begin - Open the dictionary serverdict.  This is where the
"exitserver" command is defined.

exitserver - Pop the top element off the stack and check it against the
Postscript printer's system administrator password.  The default password
is 0 (which was pushed on the stack before "serverdict begin").  "Exitserver"
clears the operand and dictionary stacks.  The Postscript program may change
printer configuration parameters after executing the "exitserver" command up
until the end of file.  When the "exitserver" command is executed, the
printer will print a page with the warning "%%[ exitserver: permanent state
may be changed]%%."

statusdict begin - Open the dictionary "statusdict" again, because
"exitserver" clears the dictionary stack.

25 9600 - Push the values 25 and 9600 onto the stack.

version (23.0) - Push the printer's Postscript version on the
stack.  (23.0) pushes the string "23.0" onto the stack.

ne - Pop the top two elements off the stack and compare them.  If they
are not equal, TRUE is pushed on the stack; otherwise, FALSE is pushed on
the stack.

{7} {3} ifelse - Push the procedures {7} and {3} onto the stack.  "Ifelse"
pops the condition from the "ne" command.  If the condition is TRUE, the
procedure {7} is executed; otherwise, the procedure {3} is executed.
Executing a literal causes the literal to be pushed onto the stack.

setsccbatch - Set the serial communications controller configuration.  The
port (25 or 9 pin, 25 was pushed on the stack), baud rate (9600 was pushed
on the stack), and options (7 or 3 depending on the "ifelse") are set with
"setsccbatch."

end - This "end" matches the "begin" from "statusdict begin."  This closes
the "statusdict" dictionary.


Why does LWPREP check the printer configuration instead of just setting it
with the "setsccbatch" command?  Excessive use of the "setsccbatch" command
wears out the component in the Apple Laserwriter II and II NT that registers
the configuration.  Other Apple Laserwriter printers (including the II NTX)
and other Postscript printers may not experience this problem.

What do the option bytes 7 and 3 mean to an Apple Laserwriter printer?
Option byte 7 sets the printer to use DTR handshake, and 8 bit data (no
parity).  Option byte 3 sets the printer to use XON/XOFF handshake, and 8-bit
data.  The original Apple Laserwriter (Postscript version 23.0) does not
implement DTR handshaking; therefore, XON/XOFF is used with this printer.

To change the option byte, edit LWPREP with any text editor.

 .lt
   Caution:  Make a backup copy before making any changes to the
             LWPREP file!
 .el

Change the option bytes in each occurrence to the option byte you want.
Consult your Postscript printer manual for valid options.  For example, if
you want to use XON/XOFF handshake on a Laserwriter II NT, change LWPREP to
read:

 .lt
 statusdict begin 25 sccbatch
 3 eq exch 9600 eq and {stop} if
 %!
 0 serverdict begin exitserver
 statusdict begin
 25 9600 version (23.0) ne {3} {3} ifelse setsccbatch
 end
 .el


For more information on the Postscript page description language, refer to
the "Postscript Language Reference Manual" from Adobe Systems Incorporated.


