Commit | Line | Data |
---|---|---|
81c7ca69 | 1 | % === BEGIN ps-print prologue 0 |
a7f4e1b4 | 2 | % version: 6.0 |
81c7ca69 GM |
3 | |
4 | %%BeginProcSet: ErrorHandler | |
5 | % Downloaded Error Break-page handler | |
6 | % Adapted from: | |
7 | % PostScript Language Program Design, | |
8 | % Adobe Systems Incorporated. | |
9 | % Appendix A, pages 217-219 | |
10 | ||
11 | /ps$brkpage where{pop} | |
12 | { | |
13 | /ps$brkpage 64 dict def | |
14 | ps$brkpage begin | |
14c122ec | 15 | /tx 0 def/ty 0 def/toy 0 def/tox 0 def |
81c7ca69 | 16 | /prnt{ |
14c122ec | 17 | dup type/stringtype ne{=string cvs}if |
81c7ca69 | 18 | dup length 6 mul |
14c122ec GM |
19 | /tx exch def/ty 10 def |
20 | currentpoint/toy exch def/tox exch def | |
81c7ca69 GM |
21 | 1 setgray newpath |
22 | tox toy 2 sub moveto | |
23 | 0 ty rlineto tx 0 rlineto | |
24 | 0 ty neg rlineto | |
25 | closepath fill | |
26 | tox toy moveto 0 setgray show | |
27 | }bind def | |
28 | /nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def | |
29 | /=={/cp 0 def typeprint nl}def | |
30 | /typeprint{dup type dup currentdict exch known{exec}{unknowntype}ifelse}readonly def | |
31 | /lmargin 72 def | |
32 | /rmargin 72 def | |
33 | /tprint{ | |
14c122ec GM |
34 | dup length cp add rmargin gt{nl/cp 0 def}if |
35 | dup length cp add/cp exch def | |
81c7ca69 GM |
36 | prnt |
37 | }readonly def | |
38 | /cvsprint{=string cvs tprint( )tprint}readonly def | |
39 | /unknowntype{exch pop cvlit(??)tprint cvsprint}readonly def | |
40 | /integertype{cvsprint}readonly def | |
41 | /realtype{cvsprint}readonly def | |
42 | /booleantype{cvsprint}readonly def | |
43 | /operatortype{(//)tprint cvsprint}readonly def | |
44 | /marktype{pop(-mark-)tprint}readonly def | |
45 | /dicttype{pop(-dictionary-)tprint}readonly def | |
46 | /nulltype{pop(-null-)tprint}readonly def | |
47 | /filetype{pop(-filestream-)tprint}readonly def | |
48 | /savetype{pop(-savelevel-)tprint}readonly def | |
49 | /fonttype{pop(-fontid-)tprint}readonly def | |
50 | /nametype{dup xcheck not{(/)tprint}if cvsprint}readonly def | |
51 | /stringtype{ | |
52 | dup rcheck | |
53 | {(\()tprint tprint(\))tprint} | |
54 | {pop(-string-)tprint}ifelse}readonly def | |
55 | /arraytype{ | |
56 | dup rcheck | |
57 | {dup xcheck | |
58 | {({)tprint{typeprint}forall(})tprint} | |
59 | {([)tprint{typeprint}forall(])tprint}ifelse} | |
60 | {pop(-array-)tprint}ifelse}readonly def | |
61 | /packedarraytype{ | |
62 | dup rcheck | |
63 | {dup xcheck | |
64 | {({)tprint{typeprint}forall(})tprint} | |
65 | {([)tprint{typeprint}forall(])tprint}ifelse} | |
66 | {pop(-packedarray-)tprint}ifelse}readonly def | |
14c122ec GM |
67 | /courier/Courier findfont 10 scalefont def |
68 | /OLDhandleerror errordict/handleerror get def | |
81c7ca69 GM |
69 | end %ps$brkpage |
70 | ||
71 | /handleerror{ | |
72 | systemdict begin $error begin ps$brkpage begin | |
73 | newerror | |
74 | {/newerror false store vmstatus pop pop 0 ne{grestoreall}if | |
75 | initgraphics | |
76 | ErrorMessage 1 and 0 ne{ % print on paper | |
77 | courier setfont lmargin 720 moveto | |
78 | (# ERROR: )prnt errorname prnt nl | |
14c122ec GM |
79 | (# OFFENDING COMMAND: )prnt/command load prnt |
80 | $error/ostack known | |
81 | {nl nl(# STACK:)prnt nl nl $error/ostack get aload length{==}repeat}if | |
82 | $error/errorinfo known | |
83 | {nl nl(# ERRORINFO:)prnt nl nl $error/errorinfo get aload length{==}repeat}if | |
84 | systemdict/showpage get exec}if | |
81c7ca69 GM |
85 | ErrorMessage 2 and 0 ne{ % send back to printing system |
86 | (\%\%[ Error: )print errorname =print | |
87 | (; OffendingCommand: )print/command load =print | |
14c122ec GM |
88 | $error/errorinfo known |
89 | {(; ErrorInfo:)print $error/errorinfo get aload length{( )=print =print}repeat}if | |
81c7ca69 GM |
90 | ( ]\%\%)= flush |
91 | (\%\%[ Rest of job is ignored ]\%\%)= flush}if | |
92 | /newerror true store}if | |
93 | end end end | |
94 | stop | |
95 | } % handleerror | |
96 | dup 0 systemdict put % replace name by actual dict object | |
97 | dup 4 ps$brkpage put % replace name by dict object | |
98 | bind readonly | |
99 | ||
100 | errordict 3 1 roll put % put proc in errordict as /handleerror | |
101 | }ifelse | |
102 | %%EndProcSet | |
103 | ||
57cb56f5 GM |
104 | |
105 | % operators for language level 2 only | |
106 | ||
107 | (<<)cvn where % << operator | |
108 | {pop/BMark(<<)cvn load def} | |
109 | {/BMark{mark}bind def}ifelse | |
110 | (>>)cvn where % >> operator | |
111 | {pop/EMark(>>)cvn load def} | |
112 | {/EMark{counttomark 2 idiv dup dict begin{def}repeat pop currentdict end}bind def}ifelse | |
113 | /setpagedevice where % setpagedevice | |
114 | {pop} | |
115 | {/setpagedevice{pop}bind def}ifelse | |
116 | /packedarray where % packedarray | |
117 | {pop} | |
118 | {/packedarray{array astore readonly}bind def}ifelse | |
119 | ||
81c7ca69 | 120 | |
510bec66 GM |
121 | % device dependent operators |
122 | ||
392a704f GM |
123 | /DefOp{ |
124 | dup where{pop pop pop} | |
125 | {exch dup where{pop}{pop/pop}ifelse load def}ifelse}def | |
81c7ca69 | 126 | |
14c122ec GM |
127 | /duplexmode/setduplexmode DefOp |
128 | /tumble/settumble DefOp | |
81c7ca69 GM |
129 | |
130 | % === END ps-print prologue 0 |