%!ps % Google Drive PS Error Reporter GDerror1a.psl % ============================================================== % Copyright c 2019 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 1.1 % This code gives one approach to PostScript error reporting on Google Drive. % When an error occurs, a red page and report is appended to the .PDF % file being generated. A stack dump is possible but not yet included. % Error reporting module -- paste in to any .ps or .psl program where needed. % Some errors have not yet been verified, but likely will work. % Note: allowing a "broken" program to continue is appallingly bad practics. % An alternate method should be sought out as an "official" solution. % In some cases, many thousands of new errors will result. These all % should be ignored. And likely will only negligibly add to processing time. errordict begin /VMerror {/VMerror eproc} store % not yet verified /configurationerror {/configurationerror eproc} store % not yet verified /dhandleerror {/dhandleerror eproc} store % not yet verified /dictfull {/dictfull eproc} store % not yet verified /dictstackoverflow {/dictstackoverflow eproc} store % not yet verified /dictstackunderflow {/dictstackunderflow eproc} store % not yet verified /execstackoverflow {/execstackoverflow eproc} store % not yet verified /handleerror {/handleerror eproc} store % not yet verified /interrupt {/interrupt eproc} store % not yet verified /invalidaccess {/invalidaccess eproc} store /invalidfileaccess {/invalidfileaccess eproc} store % not yet verified /invalidfont {/invalidfont eproc} store % not yet verified /invalidrestore {/invalidrestore eproc} store % not yet verified /ioerror {/ioerror eproc} store % not yet verified /limitcheck {/limitcheck eproc} store % not yet verified /nocurrentpoint {/nocurrentpoint eproc} store /rangecheck {/rangecheck eproc} store /stackoverflow {/stackoverflow eproc} store % not yet verified /stackunderflow {/stackunderflow eproc} store /syntaxerror {dup length 25 gt {0 25 getinterval} if /syntaxerror eproc} store /typecheck {/typecheck eproc} store /timeout {/timeout eproc} store % not yet verified /undefined {/undefined eproc} store /undefinedfilename {/undefinedfilename eproc} store /undefinedresult {/undefinedresult eproc} store /unmatchedmark {/unmatchedmark eproc} store /undefinedresource {/undefinedresource eproc} store % not yet verified /unregistered {/unregistered eproc} store % not yet verified end % these must go into an active dictionary, not errordict! /firsterr true store % report only first error /eproc { firsterr {/firsterr false store eproc1} {/firsterr false store pop pop} ifelse % ignore subsequent errors } store /eproc1 { /err1 exch 200 string cvs store % save errpr name /val1 exch 200 string cvs store % save errpr cause showpage % show real program so far 1 0.5 0.5 setrgbcolor % start new red page 0 0 moveto 1000 0 rlineto 0 1000 rlineto -1000 0 rlineto closepath fill 0 0 0 setrgbcolor % report first error /font1 {/Courier findfont 12 scalefont setfont} store /font2 {/Courier-Bold findfont 12 scalefont setfont} store 10 200 moveto font1 ( A first )show font2 err1 show font1( error involving ) show font2 val1 show font1 ( was found.) show font1 10 150 moveto ( A stack dump could eventually go here!) show showpage % end of composite doc } store %%%%%%%%%%%%%%%%%%%%%%%%% begin demo here %%%%%%%%%%%%%%%%%%%%% 0 0 moveto 1000 1000 rlineto stroke % a fake "real" program % uncomment for a specific error demo ( many still need entered ) % 1 0 div % undefinedresult check % (1234) 6 get % rangecheck check % (qweqwe) show % nocurrentpoint check % (snarfggg} % syntax error check % 1234 internaldict % invalidaccess check % 123 print % nocurrentpoint check % ] % unmatchedmark check % (snorf) run % invalidfilename check glotz woof bark bowwow % multiple undefined check % EOF