File: gs_statd.ps

package info (click to toggle)
gs 3.33-7
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 7,436 kB
  • ctags: 15,511
  • sloc: ansic: 92,150; asm: 684; sh: 486; makefile: 91
file content (237 lines) | stat: -rw-r--r-- 8,984 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
%    Copyright (C) 1989, 1995 Aladdin Enterprises.  All rights reserved.
% 
% This file is part of GNU Ghostscript.
% 
% GNU Ghostscript is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility to
% anyone for the consequences of using it or for whether it serves any
% particular purpose or works at all, unless he says so in writing.  Refer
% to the GNU Ghostscript General Public License for full details.
% 

% This file provides statusdict, serverdict, and assorted LaserWriter
% operators, mostly for the benefit of poorly designed PostScript programs
% that 'know' they are running on a LaserWriter.

systemdict begin
	% We make statusdict a little larger for Level 2 stuff.
	% Note that it must be allocated in local VM.
 .currentglobal false .setglobal
 /statusdict 89 dict def
	% To support the Level 2 job control features,
	% serverdict must also be in local VM.
 /serverdict 10 dict def		% ditto
 .setglobal
end

% Define various paper formats.  The Adobe documentation defines only these:
% 11x17, a3, a4, a4small, b5, ledger, legal, letter, lettersmall, note.
% These procedures are also accessed as data structures during initialization,
% so the page dimensions must be the first two elements of the procedure.

/.setpagesize { //systemdict /statusdict get begin .setpagesize end } bind def
userdict begin
 /letter {612 792 //.setpagesize exec} bind def
 /note {540 720 //.setpagesize exec} bind def
 /legal {612 1008 //.setpagesize exec} bind def
 /a0 {2380 3368 //.setpagesize exec} bind def  % ISO standard
 /a1 {1684 2380 //.setpagesize exec} bind def  % ISO standard
 /a2 {1190 1684 //.setpagesize exec} bind def  % ISO standard
 /a3 {842 1190 //.setpagesize exec} bind def  % ISO standard
 /a4 {595 842 //.setpagesize exec} bind def  % ISO standard
 /a5 {421 595 //.setpagesize exec} bind def  % ISO standard
 /a6 {297 421 //.setpagesize exec} bind def  % ISO standard
 /a7 {210 297 //.setpagesize exec} bind def  % ISO standard
 /a8 {148 210 //.setpagesize exec} bind def  % ISO standard
 /a9 {105 148 //.setpagesize exec} bind def  % ISO standard
 /a10 {74 105 //.setpagesize exec} bind def  % ISO standard
 /b0 {2836 4008 //.setpagesize exec} bind def  % ISO standard
 /b1 {2004 2836 //.setpagesize exec} bind def  % ISO standard
 /b2 {1418 2004 //.setpagesize exec} bind def  % ISO standard
 /b3 {1002 1418 //.setpagesize exec} bind def  % ISO standard
 /b4 {709 1002 //.setpagesize exec} bind def  % ISO standard
 /b5 {501 709 //.setpagesize exec} bind def  % ISO standard
 /archE {2592 3456 //.setpagesize exec} bind def % U.S. CAD std
 /archD {1728 2592 //.setpagesize exec} bind def % U.S. CAD std
 /archC {1296 1728 //.setpagesize exec} bind def % U.S. CAD std
 /archB {864 1296 //.setpagesize exec} bind def  % U.S. CAD std
 /archA {648 864 //.setpagesize exec} bind def  % U.S. CAD std
 /flsa {612 936 //.setpagesize exec} bind def  % U.S. foolscap
 /flse {612 936 //.setpagesize exec} bind def  % European foolscap
 /halfletter {396 612 //.setpagesize exec} bind def
 /11x17 {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
 /ledger {1224 792 //.setpagesize exec} bind def  % 11x17 landscape
end
currentdict /.setpagesize undef

statusdict begin

% Define the pagetype values for the known page formats.
% The values for all but letter and note are arbitrary.
/.pagetypenames
 { /letter /note /legal 
   /a0 /a1 /a2 /a3 /a4 /a5 /a6 /a7 /a8 /a9 /a10
   /b0 /b1 /b2 /b3 /b4 /b5 /archE /archD /archC /archB /archA
   /flsa /flse /halfletter /11x17 /ledger
 } cvlit readonly def

%%%%%% The following items were suggested by a user as useful.

% Permanent definitions

/ramsize         4194304 def
/hardwareiomode        0 def
	/sethardwareiomode     {pop} bind def
/softwareiomode        0 def
	/setsoftwareiomode     {pop} bind def
/dosysstart        false def
	/setdosysstart         {pop} bind def
/allowjobreset      true def
	/setallowjobreset      {pop} bind def
/defaultpaperfamily    0 def
	/setdefaultpaperfamily {pop} bind def
/defaultpapertray      0 def
	/setdefaultpapertray   {pop} bind def
/defaulttrayswitch false def
	/setdefaulttrayswitch  {pop} bind def

% Tray and format selection

 /11x17tray userdict /11x17 get def
 /a3tray userdict /a3 get def
 /a4tray userdict /a4 get def
 /a5tray userdict /a5 get def
 /a6tray userdict /a6 get def
 /b4tray userdict /b4 get def
 /flsatray userdict /flsa get def
 /flsetray userdict /flse get def
 /halflettertray userdict /halfletter get def
 /ledgertray userdict /ledger get def
 /legaltray userdict /legal get def
 /lettertray userdict /letter get def

% Per-job parameters

/paperfamily 0 def	% 0 is US, 1 is European
/papertray 1 def
	/setpapertray {statusdict exch /papertray exch put} bind def 
/trayswitch false def	% paperout feeds from another tray
/papersize {/letter true} bind def	% <name of paper size>, <short-edge-first-p>
/appletalktype (LaserWriter) def

%%%%%% The following items are defined in the PostScript Language
%%%%%% Reference Manual, First Edition, and subsequent 'compatibility'
%%%%%% documentation from Adobe.

 /checkpassword {statusdict begin .password eq end} bind def
 /defaulttimeouts {statusdict begin .timeouts aload pop end} bind def
%/dostartpage
 /eescratch {pop 0} bind def
 /idlefonts {statusdict begin mark .idlefonts aload pop end} bind def
 /jobname () def
%/jobtimeout
 /manualfeed false def
 /manualfeedtimeout 60 def
 /margins {statusdict begin .topmargin .leftmargin end} bind def
 /pagecount {4711} bind def
 /pagestackorder {false} bind def
 /pagetype 0 def
 /prefeed false def
 /printererror {pop pop} bind def
 /printername {statusdict /.printername get exch copy} bind def
 /processcolors /processcolors load def		% defined in systemdict
 /product product def		% product is defined in systemdict
 /revision revision def		% revision is defined in systemdict
 /sccbatch {pop 9600 0} bind def
 /sccinteractive {pop 9600 0} bind def
 /setdefaulttimeouts {statusdict begin .timeouts astore pop end} bind def
 /setdostartpage {statusdict exch /dostartpage exch put} bind def
 /setduplexmode {mark /Duplex 3 -1 roll currentdevice putdeviceprops} bind def
 /seteescratch {pop pop} bind def
 /setidlefonts {] statusdict exch /.idlefonts exch put} bind def
 /setjobtimeout {statusdict exch /jobtimeout exch put} bind def
 /setmargins
  { statusdict begin
    /.leftmargin exch def /.topmargin exch def
    end
  } bind def

% setpage and setpageparams aren't properly documented by Adobe.
%
%	<width> <height> <orientation> setpage -
%	<width> <height> <offset> <orientation> setpageparams -
%
% width and height are in default units (and if orientation is 1, are
% exchanged!).  offset is the x margin, also in default units.
% Unfortunately, because orientation is relative to the device paper feed,
% it does not have a consistent meaning in terms of image orientation.
% We follow the convention that ORIENT1 determines the orientation value
% that means portait: false means 0, true means 1.

 /setpage {ORIENT1 { 1 } { 0 } ifelse ne {exch} if .setpagesize} bind def
 /setpageparams {exch pop ORIENT1 { 1 } { 0 } ifelse ne {exch} if .setpagesize} bind def
 /setpagetype
  { statusdict begin
      dup .pagetypenames exch get systemdict exch get exec
      /pagetype exch def
    end
  } bind def
 /setpassword
  {exch checkpassword
    {statusdict exch /.password exch put true}
    {pop false}
   ifelse} bind def
 /setprintername
  {dup length string copy statusdict exch /.printername exch put} bind def
	% setresolution is not documented by Adobe, but some applications
	% use it anyway, without testing whether or not it is present.

% setresolution is not documented by Adobe.
%
%	<pixels_per_inch> setresolution -
%
% sets the resolution of the device.

 /setresolution
  { mark /HWResolution [ 4 -1 roll dup ] currentdevice putdeviceprops pop
    initmatrix erasepage
  } bind def
 /setsccbatch {pop pop pop} bind def
 /setsccinteractive {pop pop pop} bind def
 /settumble {pop} bind def
 /waittimeout 300 def

%%%%%% End of documented items.

/.setpagesize
 { mark /HWSize [
     4 index 4 index matrix defaultmatrix dtransform
     abs ceiling cvi exch abs ceiling cvi exch
   ] currentdevice putdeviceprops pop pop pop
   initmatrix initclip erasepage
 } bind def
/.password 0 def
/.timeouts [0 60 30] def
true setdostartpage
mark setidlefonts
0 setjobtimeout
0 0 setmargins
product setprintername

end	% statusdict

% The following contents of serverdict are a complete guess,
% based on some observed LaserWriter boilerplate.

serverdict begin

 /execjob { } bind def
% The Red Book implies that something like the following is
% an appropriate definition of exitserver.
 /exitserver { clear stop } bind def
% However, this interacts badly with our standard error handler,
% so we override it with the following less appropriate definition.
 /exitserver { 0 ne { clear cleardictstack } if } bind def
 /setrealdevice { } bind def

end	% serverdict