From: das@voodoo.boeing.com (Deb Schwartz)
Newsgroups: comp.lang.postscript
Subject: Re: PostScript error handler
Date: 28 Aug 92 06:12:03 GMT
Distribution: usa
Organization: Yet Another Graphics Project, Bellevue, WA

In article <1992Aug27.133928.66270@Cookie.secapl.com> ckw@Cookie.secapl.com (Kirk Woerner) writes:
>>
>I also would be very interested in this.  If someone has the program (and
>its not too long) a post would be great.

I copied this off the net a while back, and like it better than the
vanilla Adobe version - it prints out more information.    

-------------------------cut here---------------------------------------------
%!
% behandler.ps, v1.3, Mar 23 1990, a modified version of Adobe's ehandler.ps
% Original program copyright (c) 1986 Adobe Systems Incorporated
% Modified by Fredric Ihren, for support contact fred@nada.kth.se or write to
%   Fredric Ihren; Moerbydalen 17; S-182 32 D-RYD; Sweden
% Adobe will not keep maintenance of this program.
% Distributed with permission from Adobe Systems Incorporated

0000 % serverloop password
/$brkpage where not {
  dup serverdict begin statusdict begin checkpassword
    { (Error Handler downloaded.\n) print flush exitserver }
    { pop (Bad Password on loading error handler.\n) print flush stop }
  ifelse
} {
  pop pop (Error Handler in place - not loaded again\n) print flush stop
} ifelse
/$brkpage 64 dict def
$brkpage begin
  /== { /cp 0 def typeprint nl } def
  /printpage {
    /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
    /doshowpage systemdict /showpage get def
  } def
  /printonly {
    /nl { (\n) print } def
    /prnt { dup type /stringtype ne { =string cvs } if print } def
    /doshowpage null cvx def
  } def
  printpage
  /typeprint { dup type dup currentdict exch known
    { exec } { unknowntype } ifelse
  } 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
  } def
  /cvsprint { =string cvs tprint( ) tprint } def
  /unknowntype { exch pop cvlit (??) tprint cvsprint } def
  /integertype { cvsprint } def
  /realtype { cvsprint } def
  /booleantype { cvsprint } def
  /operatortype { (//) tprint cvsprint } def
  /marktype { pop (-mark- ) tprint } def
  /dicttype { pop (-dictionary- ) tprint } def
  /nulltype { pop (-null- ) tprint } def
  /filetype { pop (-filestream- ) tprint } def
  /savetype { pop (-savelevel- ) tprint } def
  /fonttype { pop (-fontid- ) tprint } def
  /nametype { dup xcheck not { (/) tprint } if cvsprint } def
  /stringtype {
    dup rcheck
      { (\() tprint tprint (\)) tprint }
      { pop (-string- ) tprint }
    ifelse
  } def
  /arraytype {
    dup rcheck { dup xcheck
      { ({) tprint { typeprint } forall (}) tprint }
      { ([) tprint { typeprint } forall (]) tprint }
    ifelse } { pop (-array- ) tprint } ifelse
  } def
  /packedarraytype {
    dup rcheck { dup xcheck
      { ({) tprint { typeprint } forall (}) tprint }
      { ([) tprint { typeprint } forall (]) tprint }
    ifelse } { pop (-packedarray- ) tprint } ifelse
  } def
  /stackmax 10 def
  /execmax 5 def
  /filemax 5 def
  /courier /Courier findfont 10 scalefont def
  /OLDhandleerror errordict /handleerror get def
end %$brkpage
errordict /handleerror {
  systemdict begin $error begin $brkpage begin newerror {
    {
      /newerror false store
      vmstatus pop pop 0 ne { grestoreall } if initgraphics courier setfont
      lmargin 750 moveto
      statusdict /jobname get dup null ne
        { (Jobname: ) prnt prnt nl } { pop } ifelse
      (Error: ) prnt errorname prnt nl
      (Command: ) prnt /command load ==
      $error /ostack known {
        $error /ostack get dup length 0 ne {
          (Stack \() prnt
          aload length dup prnt (\):) prnt nl
          /i 0 def
          { /i i 1 add def i stackmax le { == } { pop } ifelse }
          repeat
        } { pop } ifelse
      } if
      $error /estack known {
        $error /estack get dup dup length 1 sub get type /filetype ne {
          (Execstack \() prnt
          aload length dup prnt (\):) prnt nl
          /i 0 def
          { /i i 1 add def dup type /filetype eq { /i 99 def } if
            i execmax le { == } { pop } ifelse
          } repeat
        } { pop } ifelse
      } if
      (%stdin) (r) file
      dup =string readline {
        (File:) prnt nl prnt nl
        filemax 1 sub { dup =string readline { prnt nl } { exit } ifelse }
        repeat
      } if pop
      userdict /debug known {
        (Debug:) prnt nl
        userdict /debug get stopped pop nl
      } if
    } stopped pop
    doshowpage
    /newerror true store
    /OLDhandleerror load end end end exec
  } { end end end }
  ifelse
} dup 0 systemdict put dup 4 $brkpage put bind put
--------------------cut here--------------------------------------------

Debbie Schwartz // das@voodoo.boeing.com  // or uunet!bcstec!voodoo!das 
Newsgroups: comp.lang.postscript