ps-prin0.ps 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. % === BEGIN ps-print prologue 0
  2. % version: 6.0
  3. % Copyright (C) 2000-2012 Free Software Foundation, Inc.
  4. % This file is part of GNU Emacs.
  5. % GNU Emacs is free software: you can redistribute it and/or modify
  6. % it under the terms of the GNU General Public License as published by
  7. % the Free Software Foundation, either version 3 of the License, or
  8. % (at your option) any later version.
  9. % GNU Emacs is distributed in the hope that it will be useful,
  10. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. % GNU General Public License for more details.
  13. % You should have received a copy of the GNU General Public License
  14. % along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  15. % As a special exception, the copyright holders of this module give
  16. % you permission to include the module in a Postscript file generated
  17. % by Emacs or other free software together with the result of
  18. % converting text to be printed, regardless of the license terms of
  19. % that text, and to use under terms of your choice the page images
  20. % resulting from formatting said combination. If you modify this
  21. % module, you may extend this exception to your version of the module
  22. % but you are not obligated to do so. If you do not wish to do so,
  23. % delete this exception statement from your version.
  24. %%BeginProcSet: ErrorHandler
  25. % Downloaded Error Break-page handler
  26. % Adapted from:
  27. % PostScript Language Program Design,
  28. % Adobe Systems Incorporated.
  29. % Appendix A, pages 217-219
  30. /ps$brkpage where{pop}
  31. {
  32. /ps$brkpage 64 dict def
  33. ps$brkpage begin
  34. /tx 0 def/ty 0 def/toy 0 def/tox 0 def
  35. /prnt{
  36. dup type/stringtype ne{=string cvs}if
  37. dup length 6 mul
  38. /tx exch def/ty 10 def
  39. currentpoint/toy exch def/tox exch def
  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{
  53. dup length cp add rmargin gt{nl/cp 0 def}if
  54. dup length cp add/cp exch def
  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
  86. /courier/Courier findfont 10 scalefont def
  87. /OLDhandleerror errordict/handleerror get def
  88. end %ps$brkpage
  89. /handleerror{
  90. systemdict begin $error begin ps$brkpage begin
  91. newerror
  92. {/newerror false store vmstatus pop pop 0 ne{grestoreall}if
  93. initgraphics
  94. ErrorMessage 1 and 0 ne{ % print on paper
  95. courier setfont lmargin 720 moveto
  96. (# ERROR: )prnt errorname prnt nl
  97. (# OFFENDING COMMAND: )prnt/command load prnt
  98. $error/ostack known
  99. {nl nl(# STACK:)prnt nl nl $error/ostack get aload length{==}repeat}if
  100. $error/errorinfo known
  101. {nl nl(# ERRORINFO:)prnt nl nl $error/errorinfo get aload length{==}repeat}if
  102. systemdict/showpage get exec}if
  103. ErrorMessage 2 and 0 ne{ % send back to printing system
  104. (\%\%[ Error: )print errorname =print
  105. (; OffendingCommand: )print/command load =print
  106. $error/errorinfo known
  107. {(; ErrorInfo:)print $error/errorinfo get aload length{( )=print =print}repeat}if
  108. ( ]\%\%)= flush
  109. (\%\%[ Rest of job is ignored ]\%\%)= flush}if
  110. /newerror true store}if
  111. end end end
  112. stop
  113. } % handleerror
  114. dup 0 systemdict put % replace name by actual dict object
  115. dup 4 ps$brkpage put % replace name by dict object
  116. bind readonly
  117. errordict 3 1 roll put % put proc in errordict as /handleerror
  118. }ifelse
  119. %%EndProcSet
  120. % operators for language level 2 only
  121. (<<)cvn where % << operator
  122. {pop/BMark(<<)cvn load def}
  123. {/BMark{mark}bind def}ifelse
  124. (>>)cvn where % >> operator
  125. {pop/EMark(>>)cvn load def}
  126. {/EMark{counttomark 2 idiv dup dict begin{def}repeat pop currentdict end}bind def}ifelse
  127. /setpagedevice where % setpagedevice
  128. {pop}
  129. {/setpagedevice{pop}bind def}ifelse
  130. /packedarray where % packedarray
  131. {pop}
  132. {/packedarray{array astore readonly}bind def}ifelse
  133. % device dependent operators
  134. /DefOp{
  135. dup where{pop pop pop}
  136. {exch dup where{pop}{pop/pop}ifelse load def}ifelse}def
  137. /duplexmode/setduplexmode DefOp
  138. /tumble/settumble DefOp
  139. % === END ps-print prologue 0