Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!husc6!rice!sun-spots-request From: robert%shangri-la@gatech.edu (Robert Viduya) Newsgroups: comp.sys.sun Subject: Re: another problem on 386i w/ laserwriter II Message-ID: <209@hydra.gatech.EDU> Date: 2 Feb 89 07:57:48 GMT References: <8901191530.AA28425@polaris.wrc.shell.com> Sender: usenet@rice.edu Organization: Office of Computing Services, Georgia Tech Lines: 63 Approved: Sun-Spots@rice.edu Original-Date: 25 Jan 89 17:24:32 GMT X-Sun-Spots-Digest: Volume 7, Issue 133, message 9 of 13 This is the wrong newsgroup for this, but I've seen a number of queries on here about control-D's in PostScript files and how to talk to a PostScript printer over a serial line. I'm getting tired of answering each via mail, so I thought I'd just post the info. Anyway, here's the scoop on ^D in PostScript files being sent over serial lines to a PostScript filter. This information works on an Apple LaserWriter+ and IINTX and I presume it will work with any true Adobe PostScript printer that has a serial interface. Besides the Xon/Xoff flow control protocol, PostScript printers support a "job" protocol. Essentially it's this: o Each job sent to the printer must be terminated with an ascii EOT (that's a control-D to us peasants). This character tells the printer to reclaim all memory and any other resources used by the job, as well as flushing any PostScript operators that were defined by that job. It essentially does a soft-reset in preparation for the next job. o The PostScript printer is NOT necessarily ready to process another incoming job after the ^D has been received. It may still be working on the current job. It is NOT a good idea to start sending another job down the line until the current job has completely finished printing. Doing so sometimes messes up the interpreter. At the very least, it takes away memory from the current job so that the incoming one can be bufferred up. If a job is terminated with a control-D, the printer will echo that control-D back up to the host when it has completely finished processing the current job and is ready to accept the next one. I've gotten a few unix machines around here to talk reliably with LaserWriter+'s and NTX's. I wrote a program that did the following: o Open the tty port and set the tty modes to handle Xon/Xoff flow control, with no other control characters recognized (including the ^D); set proper baudrate, 8-bits, no parity, single-character I/O (cbreak for BSD, VMIN=1/VTIME=0 for SysV). o Fork off a child that does nothing but read the tty port, putting all output into a file. I just print the file as text after each job; some PostScript programs generate messages that the user needs to be notified about. It's also possible to examine these messages looking for "Paper Out" and other such printer error messages. The important thing is that the child does not exit until it sees a control-D. o The parent, in parallel with the child's processing, sends down the PostScript file to the printer, following it with a control-D. It also filters out any imbedded control-D's in the file. When the file has been completely sent, it then waits on the child before terminating and allowing the spooling system to start sending the next job. And that's essentially it. robert -- Robert Viduya robert@shangri-la.gatech.edu Office of Computing Services Georgia Institute of Technology (404) 894-6296 Atlanta, Georgia 30332-0275 [[ I hope we've heard the last of it, as well. You're right: this really isn't the right list. For Usenet people, there is "comp.lang.postscript". Unfortunately, the Internet mailing list "Info-Postscript" isn't running anymore. --wnl ]]