calvin@sequent.UUCP (Calvin Goodrich) (01/07/90)
Hello, I'm new to this newsgroup (actually my first posting) so please keep the flames to a minimum if this question has gone around before. What I need to know is if there is any way to get postscript to print out error messages. It'd be nice to know what went wrong instead of having a printer that just sits there. (btw: I'm using an Apple Laserwriter on a Unix system) tanx, Calvin ":]" Goodrich / Jesus saves .... / "Manual?! 5544 N. Burrage / but Gretsky gets the / What manual?! Portland, Ore 97217 / rebound, he shoots, / This is UNIX son, calvin@sequent.UUCP / he SCORES!!! / you just gotta KNOW!"
woody@rpp386.cactus.org (Woodrow Baker) (01/07/90)
In article <27293@sequent.UUCP>, calvin@sequent.UUCP (Calvin Goodrich) writes: > > What I need to know is if there is any way to get postscript to print out error > messages. It'd be nice to know what went wrong instead of having a printer that > just sits there. (btw: I'm using an Apple Laserwriter on a Unix system) > Certainly. There are several ways. First, get a copy of the erhandlr. It is in the green book, as well as available from the ps-fileserver out at Adobe. Secondly, if you are using a paralell connection, all messages back to the host go outthe 9 pin port at 9600 baud. Thirdly, you can use a serrial communications package that works bi-directionaly PS issues it's error messages out to whatever it has for stdout. Typicaly it is the serial port that you are connected to. If you can send and recieve both over your serial port link, you already have access to the messages. I personaly use the centronics paralell port exclusively, and just download the erhandlr code to the printer. It spits out a page that automaticaly dumps the stack whenever it gets an error I'll try to stick it here: %! % lib/ehandler.ps -- Downloaded Error Break-page handler % Copyright (c) 1984 Adobe Systems, Inc. All Rights Reserved. % assumes serverloop password is the default one /$brkpage where {pop(Error Handler in place - not loaded again\n)print flush stop} {serverdict begin statusdict begin 0 checkpassword {(Error Handler downloaded.\n)print flush 0 exitserver} {(Bad Password on loading error handler!!!\n)print flush}ifelse end%statusdict }ifelse /$brkpage 64 dict def $brkpage begin /prnt {dup type/stringtype ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def currentpoint/toy exch def/tox exch def 1 setgray newpath tox toy 2 sub moveto 0 ty rlineto tx 0 rlineto 0 ty neg rlineto closepath fill tox toy moveto 0 setgray show}bind def /nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def /=={/cp 0 def typeprint nl}def /typeprint{dup type exec}readonly def /lmargin 72 def /rmargin 72 def /tprint {dup length cp add rmargin gt{nl/cp 0 def}if dup length cp add/cp exch def prnt}readonly def /cvsprint{=string cvs tprint( )tprint}readonly def /integertype{cvsprint}readonly def /realtype{cvsprint}readonly def /booleantype{cvsprint}readonly def /operatortype{(--)tprint =string cvs tprint(--)tprint}readonly def /marktype{pop(-mark- )tprint}readonly def /dicttype{pop(-dictionary- )tprint}readonly def /nulltype{pop(-null- )tprint}readonly def /filetype{pop(-filestream- )tprint}readonly def /savetype{pop(-savelevel- )tprint}readonly def /fonttype{pop(-fontid- )tprint}readonly def /nametype{dup xcheck not{(/)tprint}if cvsprint}readonly def /stringtype {dup rcheck{(\()tprint tprint(\))tprint}{pop(-string- )tprint}ifelse }readonly def /arraytype {dup rcheck{dup xcheck {({)tprint{typeprint}forall(})tprint} {([)tprint{typeprint}forall(])tprint}ifelse}{pop(-array- )tprint}ifelse }readonly def /courier/Courier findfont 10 scalefont def end %$brkpage errordict/handleerror {systemdict begin $error begin $brkpage begin newerror {/newerror false store grestoreall initgraphics courier setfont lmargin 720 moveto(ERROR: )prnt errorname prnt nl(OFFENDING COMMAND: )prnt/command load prnt nl nl(STACK:)prnt nl nl $error/ostack get aload length{==}repeat systemdict/showpage get exec(%%[ Error: )print errorname =print(; OffendingCommand: )print/command load =print( ]%%)= flush }if end end end}dup 0 systemdict put dup 4 $brkpage put bind readonly put Try that. It is one of the poorest examples of Postscript coding STYLE that I know of, but the program works, and is relativly fast to download. e Cheers Woody