Mercurial > emacs
annotate etc/ps-prin0.ps @ 40630:d56e9757c4c9
Replace presentation-level troff macros that simulate tables with
table markup. From Eric S. Raymond <esr@thyrsus.com>.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Thu, 01 Nov 2001 20:50:40 +0000 |
parents | b5a4db21c424 |
children | e5675426ff4c |
rev | line source |
---|---|
28155 | 1 % === BEGIN ps-print prologue 0 |
31252
cdd489417ae4
Changed comment version (6.0).
Gerd Moellmann <gerd@gnu.org>
parents:
29497
diff
changeset
|
2 % version: 6.0 |
28155 | 3 |
36223 | 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., 59 Temple Place - Suite 330, | |
21 % Boston, MA 02111-1307, USA. | |
22 | |
28155 | 23 %%BeginProcSet: ErrorHandler |
24 % Downloaded Error Break-page handler | |
25 % Adapted from: | |
26 % PostScript Language Program Design, | |
27 % Adobe Systems Incorporated. | |
28 % Appendix A, pages 217-219 | |
29 | |
30 /ps$brkpage where{pop} | |
31 { | |
32 /ps$brkpage 64 dict def | |
33 ps$brkpage begin | |
29497
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
34 /tx 0 def/ty 0 def/toy 0 def/tox 0 def |
28155 | 35 /prnt{ |
29497
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
36 dup type/stringtype ne{=string cvs}if |
28155 | 37 dup length 6 mul |
29497
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
38 /tx exch def/ty 10 def |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
39 currentpoint/toy exch def/tox exch def |
28155 | 40 1 setgray newpath |
41 tox toy 2 sub moveto | |
42 0 ty rlineto tx 0 rlineto | |
43 0 ty neg rlineto | |
44 closepath fill | |
45 tox toy moveto 0 setgray show | |
46 }bind def | |
47 /nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def | |
48 /=={/cp 0 def typeprint nl}def | |
49 /typeprint{dup type dup currentdict exch known{exec}{unknowntype}ifelse}readonly def | |
50 /lmargin 72 def | |
51 /rmargin 72 def | |
52 /tprint{ | |
29497
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
53 dup length cp add rmargin gt{nl/cp 0 def}if |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
54 dup length cp add/cp exch def |
28155 | 55 prnt |
56 }readonly def | |
57 /cvsprint{=string cvs tprint( )tprint}readonly def | |
58 /unknowntype{exch pop cvlit(??)tprint cvsprint}readonly def | |
59 /integertype{cvsprint}readonly def | |
60 /realtype{cvsprint}readonly def | |
61 /booleantype{cvsprint}readonly def | |
62 /operatortype{(//)tprint cvsprint}readonly def | |
63 /marktype{pop(-mark-)tprint}readonly def | |
64 /dicttype{pop(-dictionary-)tprint}readonly def | |
65 /nulltype{pop(-null-)tprint}readonly def | |
66 /filetype{pop(-filestream-)tprint}readonly def | |
67 /savetype{pop(-savelevel-)tprint}readonly def | |
68 /fonttype{pop(-fontid-)tprint}readonly def | |
69 /nametype{dup xcheck not{(/)tprint}if cvsprint}readonly def | |
70 /stringtype{ | |
71 dup rcheck | |
72 {(\()tprint tprint(\))tprint} | |
73 {pop(-string-)tprint}ifelse}readonly def | |
74 /arraytype{ | |
75 dup rcheck | |
76 {dup xcheck | |
77 {({)tprint{typeprint}forall(})tprint} | |
78 {([)tprint{typeprint}forall(])tprint}ifelse} | |
79 {pop(-array-)tprint}ifelse}readonly def | |
80 /packedarraytype{ | |
81 dup rcheck | |
82 {dup xcheck | |
83 {({)tprint{typeprint}forall(})tprint} | |
84 {([)tprint{typeprint}forall(])tprint}ifelse} | |
85 {pop(-packedarray-)tprint}ifelse}readonly def | |
29497
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
86 /courier/Courier findfont 10 scalefont def |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
87 /OLDhandleerror errordict/handleerror get def |
28155 | 88 end %ps$brkpage |
89 | |
90 /handleerror{ | |
91 systemdict begin $error begin ps$brkpage begin | |
92 newerror | |
93 {/newerror false store vmstatus pop pop 0 ne{grestoreall}if | |
94 initgraphics | |
95 ErrorMessage 1 and 0 ne{ % print on paper | |
96 courier setfont lmargin 720 moveto | |
97 (# ERROR: )prnt errorname prnt nl | |
29497
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
98 (# OFFENDING COMMAND: )prnt/command load prnt |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
99 $error/ostack known |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
100 {nl nl(# STACK:)prnt nl nl $error/ostack get aload length{==}repeat}if |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
101 $error/errorinfo known |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
102 {nl nl(# ERRORINFO:)prnt nl nl $error/errorinfo get aload length{==}repeat}if |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
103 systemdict/showpage get exec}if |
28155 | 104 ErrorMessage 2 and 0 ne{ % send back to printing system |
105 (\%\%[ Error: )print errorname =print | |
106 (; OffendingCommand: )print/command load =print | |
29497
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
107 $error/errorinfo known |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
108 {(; ErrorInfo:)print $error/errorinfo get aload length{( )=print =print}repeat}if |
28155 | 109 ( ]\%\%)= flush |
110 (\%\%[ Rest of job is ignored ]\%\%)= flush}if | |
111 /newerror true store}if | |
112 end end end | |
113 stop | |
114 } % handleerror | |
115 dup 0 systemdict put % replace name by actual dict object | |
116 dup 4 ps$brkpage put % replace name by dict object | |
117 bind readonly | |
118 | |
119 errordict 3 1 roll put % put proc in errordict as /handleerror | |
120 }ifelse | |
121 %%EndProcSet | |
122 | |
28764 | 123 |
124 % operators for language level 2 only | |
125 | |
126 (<<)cvn where % << operator | |
127 {pop/BMark(<<)cvn load def} | |
128 {/BMark{mark}bind def}ifelse | |
129 (>>)cvn where % >> operator | |
130 {pop/EMark(>>)cvn load def} | |
131 {/EMark{counttomark 2 idiv dup dict begin{def}repeat pop currentdict end}bind def}ifelse | |
132 /setpagedevice where % setpagedevice | |
133 {pop} | |
134 {/setpagedevice{pop}bind def}ifelse | |
135 /packedarray where % packedarray | |
136 {pop} | |
137 {/packedarray{array astore readonly}bind def}ifelse | |
138 | |
28155 | 139 |
28167
cb25a24ec3e1
Change /setduplexmode, /settumble, add /packedarray.
Gerd Moellmann <gerd@gnu.org>
parents:
28155
diff
changeset
|
140 % device dependent operators |
cb25a24ec3e1
Change /setduplexmode, /settumble, add /packedarray.
Gerd Moellmann <gerd@gnu.org>
parents:
28155
diff
changeset
|
141 |
28427
15c0a66a4a8b
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28265
diff
changeset
|
142 /DefOp{ |
15c0a66a4a8b
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28265
diff
changeset
|
143 dup where{pop pop pop} |
15c0a66a4a8b
Replace gs_languagelevel by languagelevel.
Gerd Moellmann <gerd@gnu.org>
parents:
28265
diff
changeset
|
144 {exch dup where{pop}{pop/pop}ifelse load def}ifelse}def |
28155 | 145 |
29497
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
146 /duplexmode/setduplexmode DefOp |
0763a6ed0743
Insert a version number comment (5.2.2). Indentation fix.
Gerd Moellmann <gerd@gnu.org>
parents:
28764
diff
changeset
|
147 /tumble/settumble DefOp |
28155 | 148 |
149 % === END ps-print prologue 0 |