]> code.delx.au - gnu-emacs/blob - etc/ps-prin0.ps
(global-auto-revert-non-file-buffers): Point Info links to the main manual,
[gnu-emacs] / etc / ps-prin0.ps
1 % === BEGIN ps-print prologue 0
2 % version: 6.0
3
4 % Copyright (C) 2000, 2001 Free Software Foundation, Inc.
5 %
6 % This file is part of GNU Emacs.
7 %
8 % GNU Emacs is free software; you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published by
10 % the Free Software Foundation; either version 2, or (at your option)
11 % any later version.
12 %
13 % GNU Emacs is distributed in the hope that it will be useful,
14 % but WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 % GNU General Public License for more details.
17 %
18 % You should have received a copy of the GNU General Public License
19 % along with GNU Emacs; see the file COPYING. If not, write to the
20 % Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 % Boston, MA 02110-1301, USA.
22
23 % As a special exception, the copyright holders of this module give
24 % you permission to include the module in a Postscript file generated
25 % by Emacs or other free software together with the result of
26 % converting text to be printed, regardless of the license terms of
27 % that text, and to use under terms of your choice the page images
28 % resulting from formatting said combination. If you modify this
29 % module, you may extend this exception to your version of the module
30 % but you are not obligated to do so. If you do not wish to do so,
31 % delete this exception statement from your version.
32
33
34 %%BeginProcSet: ErrorHandler
35 % Downloaded Error Break-page handler
36 % Adapted from:
37 % PostScript Language Program Design,
38 % Adobe Systems Incorporated.
39 % Appendix A, pages 217-219
40
41 /ps$brkpage where{pop}
42 {
43 /ps$brkpage 64 dict def
44 ps$brkpage begin
45 /tx 0 def/ty 0 def/toy 0 def/tox 0 def
46 /prnt{
47 dup type/stringtype ne{=string cvs}if
48 dup length 6 mul
49 /tx exch def/ty 10 def
50 currentpoint/toy exch def/tox exch def
51 1 setgray newpath
52 tox toy 2 sub moveto
53 0 ty rlineto tx 0 rlineto
54 0 ty neg rlineto
55 closepath fill
56 tox toy moveto 0 setgray show
57 }bind def
58 /nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def
59 /=={/cp 0 def typeprint nl}def
60 /typeprint{dup type dup currentdict exch known{exec}{unknowntype}ifelse}readonly def
61 /lmargin 72 def
62 /rmargin 72 def
63 /tprint{
64 dup length cp add rmargin gt{nl/cp 0 def}if
65 dup length cp add/cp exch def
66 prnt
67 }readonly def
68 /cvsprint{=string cvs tprint( )tprint}readonly def
69 /unknowntype{exch pop cvlit(??)tprint cvsprint}readonly def
70 /integertype{cvsprint}readonly def
71 /realtype{cvsprint}readonly def
72 /booleantype{cvsprint}readonly def
73 /operatortype{(//)tprint cvsprint}readonly def
74 /marktype{pop(-mark-)tprint}readonly def
75 /dicttype{pop(-dictionary-)tprint}readonly def
76 /nulltype{pop(-null-)tprint}readonly def
77 /filetype{pop(-filestream-)tprint}readonly def
78 /savetype{pop(-savelevel-)tprint}readonly def
79 /fonttype{pop(-fontid-)tprint}readonly def
80 /nametype{dup xcheck not{(/)tprint}if cvsprint}readonly def
81 /stringtype{
82 dup rcheck
83 {(\()tprint tprint(\))tprint}
84 {pop(-string-)tprint}ifelse}readonly def
85 /arraytype{
86 dup rcheck
87 {dup xcheck
88 {({)tprint{typeprint}forall(})tprint}
89 {([)tprint{typeprint}forall(])tprint}ifelse}
90 {pop(-array-)tprint}ifelse}readonly def
91 /packedarraytype{
92 dup rcheck
93 {dup xcheck
94 {({)tprint{typeprint}forall(})tprint}
95 {([)tprint{typeprint}forall(])tprint}ifelse}
96 {pop(-packedarray-)tprint}ifelse}readonly def
97 /courier/Courier findfont 10 scalefont def
98 /OLDhandleerror errordict/handleerror get def
99 end %ps$brkpage
100
101 /handleerror{
102 systemdict begin $error begin ps$brkpage begin
103 newerror
104 {/newerror false store vmstatus pop pop 0 ne{grestoreall}if
105 initgraphics
106 ErrorMessage 1 and 0 ne{ % print on paper
107 courier setfont lmargin 720 moveto
108 (# ERROR: )prnt errorname prnt nl
109 (# OFFENDING COMMAND: )prnt/command load prnt
110 $error/ostack known
111 {nl nl(# STACK:)prnt nl nl $error/ostack get aload length{==}repeat}if
112 $error/errorinfo known
113 {nl nl(# ERRORINFO:)prnt nl nl $error/errorinfo get aload length{==}repeat}if
114 systemdict/showpage get exec}if
115 ErrorMessage 2 and 0 ne{ % send back to printing system
116 (\%\%[ Error: )print errorname =print
117 (; OffendingCommand: )print/command load =print
118 $error/errorinfo known
119 {(; ErrorInfo:)print $error/errorinfo get aload length{( )=print =print}repeat}if
120 ( ]\%\%)= flush
121 (\%\%[ Rest of job is ignored ]\%\%)= flush}if
122 /newerror true store}if
123 end end end
124 stop
125 } % handleerror
126 dup 0 systemdict put % replace name by actual dict object
127 dup 4 ps$brkpage put % replace name by dict object
128 bind readonly
129
130 errordict 3 1 roll put % put proc in errordict as /handleerror
131 }ifelse
132 %%EndProcSet
133
134
135 % operators for language level 2 only
136
137 (<<)cvn where % << operator
138 {pop/BMark(<<)cvn load def}
139 {/BMark{mark}bind def}ifelse
140 (>>)cvn where % >> operator
141 {pop/EMark(>>)cvn load def}
142 {/EMark{counttomark 2 idiv dup dict begin{def}repeat pop currentdict end}bind def}ifelse
143 /setpagedevice where % setpagedevice
144 {pop}
145 {/setpagedevice{pop}bind def}ifelse
146 /packedarray where % packedarray
147 {pop}
148 {/packedarray{array astore readonly}bind def}ifelse
149
150
151 % device dependent operators
152
153 /DefOp{
154 dup where{pop pop pop}
155 {exch dup where{pop}{pop/pop}ifelse load def}ifelse}def
156
157 /duplexmode/setduplexmode DefOp
158 /tumble/settumble DefOp
159
160 % === END ps-print prologue 0