Commit | Line | Data |
---|---|---|
ec0d17b5 WJ |
1 | % Copyright (C) 1989, 1992 Aladdin Enterprises. All rights reserved. |
2 | % Distributed by Free Software Foundation, Inc. | |
3 | % | |
4 | % This file is part of Ghostscript. | |
5 | % | |
6 | % Ghostscript is distributed in the hope that it will be useful, but | |
7 | % WITHOUT ANY WARRANTY. No author or distributor accepts responsibility | |
8 | % to anyone for the consequences of using it or for whether it serves any | |
9 | % particular purpose or works at all, unless he says so in writing. Refer | |
10 | % to the Ghostscript General Public License for full details. | |
11 | % | |
12 | % Everyone is granted permission to copy, modify and redistribute | |
13 | % Ghostscript, but only under the conditions described in the Ghostscript | |
14 | % General Public License. A copy of this license is supposed to have been | |
15 | % given to you along with Ghostscript so you can know your rights and | |
16 | % responsibilities. It should be in a file named COPYING. Among other | |
17 | % things, the copyright notice and this notice must be preserved on all | |
18 | % copies. | |
19 | ||
20 | % Initialization file for Ghostscript. | |
21 | % When this is run, systemdict is still writable. | |
22 | ||
23 | % Acquire the debugging flags. | |
24 | currentdict /DEBUG known /DEBUG exch def | |
25 | /VMDEBUG | |
26 | DEBUG {{print vmstatus pop ( ) cvs print pop ( ) print | |
27 | systemdict length ( ) cvs print (\n) print flush}} | |
28 | {{pop}} ifelse | |
29 | def | |
30 | currentdict /ASCIIOUT known /ASCIIOUT exch def | |
31 | currentdict /DISKFONTS known /DISKFONTS exch def | |
32 | currentdict /NODISPLAY known not /DISPLAYING exch def | |
33 | currentdict /NOBIND known { /.bind /bind load def /bind { } def } if | |
34 | currentdict /NOCACHE known /NOCACHE exch def | |
35 | currentdict /NOPAUSE known /NOPAUSE exch def | |
36 | currentdict /QUIET known ASCIIOUT or /QUIET exch def | |
37 | currentdict /WRITESYSTEMDICT known /WRITESYSTEMDICT exch def | |
38 | ||
39 | % Acquire environment variables. | |
40 | currentdict /DEVICE known not | |
41 | { (GS_DEVICE) getenv { /DEVICE exch def } if } if | |
42 | ||
43 | QUIET not { (Initializing... ) print flush } if | |
44 | ||
45 | % Acquire systemdict and userdict. | |
46 | % Note that the dictionary stack only has 1 element at this point! | |
47 | /systemdict currentdict def | |
48 | /userdict 200 dict def | |
49 | userdict begin % 2 elements now | |
50 | systemdict begin | |
51 | ||
52 | (START ) VMDEBUG | |
53 | ||
54 | % Define true and false. | |
55 | /true 0 0 eq def | |
56 | /false 0 1 eq def | |
57 | ||
58 | % Acquire the standard files. | |
59 | /.stdin (%stdin) (r) file def | |
60 | /.stdout (%stdout) (w) file def | |
61 | /.stderr (%stderr) (w) file def | |
62 | ||
63 | % Turn on array packing for the rest of initialization. | |
64 | true setpacking | |
65 | ||
66 | % Define a special version of def for making operator procedures. | |
67 | /odef | |
68 | {1 index exch makeoperator def} bind def | |
69 | ||
70 | % Define predefined procedures substituting for operators, | |
71 | % in alphabetical order. | |
72 | ||
73 | userdict /#copies 1 put | |
74 | /[ /mark load def | |
75 | /] {counttomark array astore exch pop} odef | |
76 | /abs {dup 0 lt {neg} if} odef | |
77 | /copypage | |
78 | { 1 false .outputpage | |
79 | (>>copypage, press <return> to continue<<\n) .confirm | |
80 | } odef | |
81 | /defaultmatrix | |
82 | {currentdevice exch deviceinitialmatrix} odef | |
83 | /.echo /echo load def | |
84 | userdict /.echo.mode true put | |
85 | /echo {dup /.echo.mode exch store .echo} odef | |
86 | % <file> <dict> .eexec | |
87 | /.eexec | |
88 | { exch 55665 .filtereexecDecode | |
89 | cvx systemdict begin exch begin stopped end end | |
90 | $error /newerror get and {handleerror} if | |
91 | } bind def | |
92 | /eexec | |
93 | { systemdict .eexec | |
94 | } odef | |
95 | /executive | |
96 | { { prompt (%statementedit) (r) file | |
97 | dup bytesavailable 0 lt | |
98 | { .stdin bytesavailable 0 lt {closefile exit} if } | |
99 | if cvx execute | |
100 | } loop | |
101 | } odef | |
102 | /framedevice | |
103 | {.stderr (Warning: framedevice is an obsolete operator.\n) writestring | |
104 | .stderr flushfile | |
105 | pop pop pop setmatrix initclip} odef | |
106 | % The "revision" is the Ghostscript release number x 100 + the sub-release. | |
107 | /gsrevision 241 def | |
108 | /gsrevisiondate | |
109 | (4/21/92) def | |
110 | /handleerror | |
111 | {errordict /handleerror get exec} bind def | |
112 | /identmatrix | |
113 | {{1.0 0.0 0.0 1.0 0.0 0.0} cvlit exch copy} odef | |
114 | /initgraphics | |
115 | {initmatrix newpath initclip 1 setlinewidth 0 setlinecap 0 setlinejoin | |
116 | [] 0 setdash 0 setgray 10 setmiterlimit} odef | |
117 | /initmatrix | |
118 | {.tempmatrix defaultmatrix setmatrix} odef | |
119 | /matrix {6 array identmatrix} odef | |
120 | /prompt {flush flushpage | |
121 | (GS) print count 0 ne | |
122 | {(<) print count =only} | |
123 | if (>) print flush} bind def | |
124 | /pstack {0 1 count 3 sub {index ==} for} def | |
125 | /quit {0 .quit} odef | |
126 | /revision gsrevision def | |
127 | /run {dup type /filetype eq | |
128 | { true } | |
129 | { findlibfile { exch pop true } { false } ifelse } | |
130 | ifelse | |
131 | {cvx execute} | |
132 | {(r) file} % let the error happen | |
133 | ifelse} odef | |
134 | /showpage | |
135 | { #copies true .outputpage | |
136 | (>>showpage, press <return> to continue<<\n) .confirm | |
137 | erasepage initgraphics | |
138 | } odef | |
139 | % Code output by Adobe Illustrator relies on the fact that | |
140 | % `stack' is a procedure, not an operator!!! | |
141 | /stack {0 1 count 3 sub {index =} for} bind def | |
142 | /start { QUIET not | |
143 | {(Ghostscript ) print gsrevision 10 idiv 10 div =only | |
144 | gsrevision 10 mod dup 0 ne { (.) print =only } { pop } ifelse | |
145 | ( \() print gsrevisiondate print (\)\n) print | |
146 | ( Copyright (C) 1990, 1992 Aladdin Enterprises, Menlo Park, CA.\n) print | |
147 | ( All rights reserved.\n) print | |
148 | (Distributed by Free Software Foundation, Inc.\n) print | |
149 | (Ghostscript comes with NO WARRANTY: see the file LICENSE for details.\n) print | |
150 | flush | |
151 | } if | |
152 | executive | |
153 | } def | |
154 | % Ghostscript is compatible with PostScript "version" 54.0 (I think). | |
155 | /version (54.0) def | |
156 | ||
157 | % Provide semi-fake but usable definitions for | |
158 | % the color PostScript extensions (except for colorimage, | |
159 | % which is actually implemented as an operator). | |
160 | /setcmykcolor { | |
161 | 1 exch sub dup dup % C, M, Y, S, S, S | |
162 | 6 -1 roll 1 exch sub mul % M, Y, S, S, red | |
163 | exch 5 -1 roll 1 exch sub mul % Y, S, red, green | |
164 | 4 -2 roll exch 1 exch sub mul % red, green, blue | |
165 | setrgbcolor | |
166 | } odef | |
167 | /currentcmykcolor { | |
168 | currentrgbcolor | |
169 | 3 { 1 exch sub 3 1 roll } repeat | |
170 | 0 | |
171 | } odef | |
172 | /setblackgeneration { | |
173 | pop | |
174 | } odef | |
175 | /currentblackgeneration { | |
176 | {} | |
177 | } odef | |
178 | /setundercolorremoval { | |
179 | pop | |
180 | } odef | |
181 | /currentundercolorremoval { | |
182 | {} | |
183 | } odef | |
184 | /setcolorscreen { | |
185 | setscreen 9 {pop} repeat | |
186 | } odef | |
187 | /currentcolorscreen { | |
188 | currentscreen 3 copy 6 copy | |
189 | } odef | |
190 | ||
191 | % Define the filter dictionary and operator. | |
192 | ||
193 | /.filterdict mark | |
194 | /ASCII85Encode /.filterASCII85Encode | |
195 | /ASCII85Decode /.filterASCII85Decode | |
196 | /ASCIIHexEncode /.filterASCIIHexEncode | |
197 | /ASCIIHexDecode /.filterASCIIHexDecode | |
198 | /eexecDecode /.filtereexecDecode | |
199 | /LZWEncode /.filterLZWEncode | |
200 | /LZWDecode /.filterLZWDecode | |
201 | /NullEncode /.filterNullEncode | |
202 | /PFBDecode /.filterPFBDecode | |
203 | /RunLengthEncode /.filterRunLengthEncode | |
204 | /RunLengthDecode /.filterRunLengthDecode | |
205 | /SubFileDecode /.filterSubFileDecode | |
206 | counttomark 2 idiv | |
207 | dup dict begin | |
208 | { dup where { pop load def } { pop pop } ifelse } repeat | |
209 | pop | |
210 | currentdict end def | |
211 | /filter | |
212 | { //.filterdict exch get exec | |
213 | } odef | |
214 | ||
215 | % Define procedures for getting and setting the current device resolution. | |
216 | ||
217 | /gsgetdeviceprop | |
218 | { 1 index getdeviceprops | |
219 | { 1 index counttomark 1 add index eq { exit } if pop pop } loop | |
220 | dup mark eq % if true, not found | |
221 | { pop dup /undefined signalerror } | |
222 | { counttomark 1 add 1 roll cleartomark exch pop exch pop } | |
223 | ifelse | |
224 | } bind def | |
225 | /gscurrentresolution | |
226 | { currentdevice /HWResolution gsgetdeviceprop | |
227 | } bind def | |
228 | /gssetresolution | |
229 | { 2 array astore mark exch /HWResolution exch | |
230 | currentdevice copy putdeviceprops setdevice | |
231 | } bind def | |
232 | ||
233 | % Define a few Level 2 operators that are needed by other things in | |
234 | % the initialization files. | |
235 | ||
236 | /dicttomark % (the Level 2 >> operator) | |
237 | { counttomark 2 idiv dup dict begin | |
238 | { def } repeat pop currentdict end | |
239 | } bind def | |
240 | ||
241 | (<<) cvn /mark load def | |
242 | (>>) cvn /dicttomark load odef | |
243 | /deviceinfo { getdeviceprops dicttomark } odef | |
244 | ||
245 | % Define simplified versions of the composite font operators | |
246 | % that work with (and only with) non-composite fonts. | |
247 | ||
248 | /.encodingdict 3 dict | |
249 | dup /StandardEncoding /StandardEncoding cvx put | |
250 | dup /ISOLatin1Encoding /ISOLatin1Encoding cvx put | |
251 | dup /SymbolEncoding /SymbolEncoding cvx put | |
252 | def | |
253 | /cshow | |
254 | { exch 1 string | |
255 | { dup 0 4 index put stringwidth 3 -1 roll exec } | |
256 | /exec cvx 4 array astore cvx | |
257 | forall | |
258 | } odef | |
259 | /findencoding | |
260 | { //.encodingdict exch get exec } odef | |
261 | /rootfont | |
262 | { currentfont } odef | |
263 | /setcachedevice2 | |
264 | { pop pop pop pop setcachdevice } odef | |
265 | ||
266 | % Define some additional built-in procedures (beyond the ones defined by | |
267 | % the PostScript Language Reference Manual). | |
268 | ||
269 | /concatprocs | |
270 | { exch cvlit exch cvlit % proc1 proc2 | |
271 | dup length 2 index length add array % proc1 proc2 newproc | |
272 | dup 0 4 index putinterval | |
273 | dup 3 index length 3 index putinterval | |
274 | exch pop exch pop cvx | |
275 | } bind def | |
276 | /concatstrings | |
277 | { 1 index length 1 index length add string | |
278 | 2 index 1 index copy pop | |
279 | dup 3 index length 3 index length getinterval | |
280 | 2 index exch copy pop | |
281 | exch pop exch pop | |
282 | } bind def | |
283 | /copyarray | |
284 | { dup length array copy } bind def | |
285 | /copystring | |
286 | { dup length string copy } bind def | |
287 | /defaultdevice | |
288 | { systemdict /DEVICE known | |
289 | { systemdict /DEVICE get finddevice } | |
290 | { 0 getdevice } | |
291 | ifelse | |
292 | } bind def | |
293 | /finddevice | |
294 | { systemdict /devicedict get exch get } bind def | |
295 | /selectdevice | |
296 | { finddevice setdevice } bind def | |
297 | /signalerror % object errorname | |
298 | { errordict exch get exec } bind def | |
299 | ||
300 | % Define auxiliary procedures needed for the above. | |
301 | /shellarguments % -> shell_arguments true (or) false | |
302 | { /ARGUMENTS where | |
303 | { /ARGUMENTS get dup type /arraytype eq | |
304 | { aload pop /ARGUMENTS null store true } | |
305 | { pop false } | |
306 | ifelse } | |
307 | { false } ifelse | |
308 | } bind def | |
309 | /.confirm | |
310 | {DISPLAYING NOPAUSE not and | |
311 | {% Print a message and wait for the user to type something. | |
312 | % If the user just types a newline, flush it. | |
313 | print flush | |
314 | .echo.mode false echo | |
315 | .stdin dup read | |
316 | {dup (\n) 0 get eq {pop pop} {unread} ifelse} {pop} ifelse | |
317 | echo} | |
318 | {pop} ifelse} bind def | |
319 | /.identmatrix % a read-only identity matrix | |
320 | matrix readonly def | |
321 | /.tempmatrix % a temporary matrix | |
322 | matrix def | |
323 | ||
324 | % Define the procedure used by the C executive for executing user input, | |
325 | % and also by the run operator. | |
326 | % This is called with a procedure or file on the operand stack. | |
327 | /execute | |
328 | {stopped $error /newerror get and {handleerror} if} odef | |
329 | ||
330 | % Define a special version of `run' that aborts on errors. | |
331 | /run0 | |
332 | { dup /.currentfilename exch def | |
333 | { findlibfile not { stop } if } | |
334 | stopped | |
335 | { (Can't find initialization file ) print | |
336 | .currentfilename = flush 1 .quit | |
337 | } if | |
338 | exch pop cvx stopped | |
339 | { (While reading ) print .currentfilename print (:\n) print flush | |
340 | handleerror 1 .quit | |
341 | } if | |
342 | } bind def | |
343 | % Temporarily substitute it for the real `run'. | |
344 | /.run /run load def | |
345 | /run /run0 load def | |
346 | ||
347 | % If the user asked for ASCII output, read in the patches now. | |
348 | ASCIIOUT { (gs_2asc.ps) run } if | |
349 | ||
350 | % Create the error handling machinery. | |
351 | % The interpreter has created the ErrorNames array. | |
352 | % Define $error. | |
353 | /$error 11 dict def % newerror, errorname, command, errorinfo, | |
354 | % ostack, estack, dstack, recordstacks, | |
355 | % binary, .inerror, position | |
356 | $error begin | |
357 | /newerror false def | |
358 | /recordstacks true def | |
359 | /binary false def | |
360 | /.inerror false def | |
361 | end | |
362 | % Define errordict. It has one entry per error name, plus handleerror. | |
363 | /errordict ErrorNames length 1 add dict def | |
364 | % Define the standard error handlers. When they are invoked, | |
365 | % the top element of the o-stack is the error name; | |
366 | % the next element is the offending command. | |
367 | errordict begin | |
368 | { //$error /.inerror get .instopped not or | |
369 | { (Unrecoverable error: ) print =only flush | |
370 | ( in ) print = flush | |
371 | count 0 gt | |
372 | { (Operand stack:\n ) print | |
373 | 0 1 count 3 sub { ( ) print index =only flush } for | |
374 | (\n) print flush | |
375 | } if | |
376 | 1 .quit | |
377 | } if % detect error recursion | |
378 | $error /.inerror true put | |
379 | $error /newerror true put | |
380 | $error exch /errorname exch put | |
381 | $error exch /command exch put | |
382 | $error /dstack undef | |
383 | $error /estack undef | |
384 | $error /ostack undef | |
385 | $error /recordstacks get $error /errorname get /VMerror ne and | |
386 | { $error /dstack countdictstack array dictstack put | |
387 | $error /estack countexecstack array execstack put | |
388 | count array astore dup $error exch /ostack exch put | |
389 | aload pop | |
390 | } if | |
391 | $error /.inerror false put | |
392 | stop | |
393 | } bind | |
394 | ErrorNames | |
395 | { [ 1 index 3 index /exec load ] cvx def | |
396 | } forall | |
397 | pop | |
398 | end | |
399 | % Define the standard handleerror. | |
400 | errordict begin | |
401 | /handleerror | |
402 | { (Error: ) print | |
403 | $error begin | |
404 | errorname ==only flush | |
405 | ( in ) print | |
406 | /command load ==only flush | |
407 | currentdict /ostack known | |
408 | { (\nOperand stack:\n ) print ostack { ( ) print ==only } forall | |
409 | } if | |
410 | currentdict /estack known | |
411 | { (\nExecution stack:\n ) print estack { ( ) print =only } forall | |
412 | } if | |
413 | currentdict /dstack known | |
414 | { (\nDictionary stack:\n ) print dstack | |
415 | { dup ( ) print length =only (/) print maxlength =only } forall | |
416 | } if | |
417 | (\n) print | |
418 | errorname /VMerror eq | |
419 | { (VM status:) print mark vmstatus | |
420 | counttomark { ( ) print counttomark -1 roll dup =only } repeat | |
421 | cleartomark (\n) print | |
422 | } if | |
423 | /newerror false def | |
424 | end | |
425 | currentdict /position known | |
426 | { (Current file position is ) print position = } | |
427 | if | |
428 | flush | |
429 | .instopped {stop} if | |
430 | } bind def | |
431 | end | |
432 | ||
433 | % Define the =[only] procedures. Also define =print and =string, | |
434 | % which are used by some P*stScr*pt programs even though | |
435 | % they aren't documented anywhere. | |
436 | /=print {=only} def | |
437 | /=string 128 string def | |
438 | /= {=only (\n) print} bind def | |
439 | 4 dict begin | |
440 | /.buf =string def | |
441 | ||
442 | {dup type currentdict exch known | |
443 | {dup type exec} {.buf cvs print} ifelse | |
444 | } bind def | |
445 | /stringtype | |
446 | {dup rcheck not {pop (--nostringval--)} if print} bind def | |
447 | /nametype | |
448 | {dup length .buf length gt | |
449 | {dup length string} | |
450 | {.buf} | |
451 | ifelse cvs print} bind def | |
452 | {0 begin .print end} copyarray dup 0 currentdict put | |
453 | cvx bind | |
454 | end | |
455 | /=only exch def | |
456 | ||
457 | % Define the [write]==[only] procedures. | |
458 | /== {==only (\n) print} bind def | |
459 | /==only {.stdout exch write==only} bind def | |
460 | /write== | |
461 | {2 copy write==only pop (\n) writestring} bind def | |
462 | /.dict 18 dict dup | |
463 | begin def | |
464 | /.buf 128 string def | |
465 | /.cvp {.buf cvs .p} bind def | |
466 | % /.f {the_output_file} def | |
467 | /.nop {(-) .p type .cvp (-) .p} bind def | |
468 | /.p {.f exch writestring} bind def | |
469 | /.p1 {.f exch write} bind def | |
470 | ||
471 | {dup type .dict exch known | |
472 | {dup type exec} {.nop} ifelse | |
473 | } bind def | |
474 | /integertype /.cvp load def | |
475 | /nulltype { pop (null) .p } bind def | |
476 | /realtype /.cvp load def | |
477 | /booleantype /.cvp load def | |
478 | /nametype | |
479 | {dup xcheck not {(/) .p} if | |
480 | dup length .buf length gt | |
481 | {dup length string} | |
482 | {.buf} | |
483 | ifelse cvs .p} bind def | |
484 | /arraytype | |
485 | {dup rcheck | |
486 | {dup xcheck {(})({)} {(])([)} ifelse .p | |
487 | exch () exch | |
488 | {exch .p .print ( )} forall pop .p} | |
489 | {.nop} | |
490 | ifelse} bind def | |
491 | /operatortype | |
492 | {(--) .p .cvp (--) .p} bind def | |
493 | /packedarraytype /arraytype load def | |
494 | /stringtype | |
495 | {dup rcheck | |
496 | {(\() .p | |
497 | {/.ch exch def | |
498 | .ch 32 lt .ch 127 ge or | |
499 | {(\\) .p .ch 8#1000 add 8 .buf cvrs 1 3 getinterval .p} | |
500 | {.ch 40 eq .ch 41 eq or .ch 92 eq or | |
501 | {(\\) .p} if | |
502 | .ch .p1} | |
503 | ifelse} | |
504 | forall (\)) .p} | |
505 | {.nop} | |
506 | ifelse} bind def | |
507 | {0 begin exch cvlit /.f exch def .print end} copyarray dup 0 .dict put | |
508 | bind cvx | |
509 | end | |
510 | /write==only exch def | |
511 | ||
512 | (END PROCS ) VMDEBUG | |
513 | ||
514 | % Define the font directory. | |
515 | % Make it big to leave room for transformed fonts. | |
516 | /FontDirectory 100 dict def | |
517 | ||
518 | % Define the standard encoding vector. | |
519 | /StandardEncoding | |
520 | % \00x | |
521 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
522 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
523 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
524 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
525 | % \04x | |
526 | /space /exclam /quotedbl /numbersign | |
527 | /dollar /percent /ampersand /quoteright | |
528 | /parenleft /parenright /asterisk /plus | |
529 | /comma /hyphen /period /slash | |
530 | /zero /one /two /three | |
531 | /four /five /six /seven | |
532 | /eight /nine /colon /semicolon | |
533 | /less /equal /greater /question | |
534 | % \10x | |
535 | /at /A /B /C /D /E /F /G | |
536 | /H /I /J /K /L /M /N /O | |
537 | /P /Q /R /S /T /U /V /W | |
538 | /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore | |
539 | % \14x | |
540 | /quoteleft /a /b /c /d /e /f /g | |
541 | /h /i /j /k /l /m /n /o | |
542 | /p /q /r /s /t /u /v /w | |
543 | /x /y /z /braceleft /bar /braceright /asciitilde /.notdef | |
544 | % \20x | |
545 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
546 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
547 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
548 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
549 | % \24x | |
550 | /.notdef /exclamdown /cent /sterling | |
551 | /fraction /yen /florin /section | |
552 | /currency /quotesingle /quotedblleft /guillemotleft | |
553 | /guilsinglleft /guilsinglright /fi /fl | |
554 | /.notdef /endash /dagger /daggerdbl | |
555 | /periodcentered /.notdef /paragraph /bullet | |
556 | /quotesinglbase /quotedblbase /quotedblright /guillemotright | |
557 | /ellipsis /perthousand /.notdef /questiondown | |
558 | % \30x | |
559 | /.notdef /grave /acute /circumflex /tilde /macron /breve /dotaccent | |
560 | /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron | |
561 | /emdash /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
562 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
563 | % \34x | |
564 | /.notdef /AE /.notdef /ordfeminine /.notdef /.notdef /.notdef /.notdef | |
565 | /Lslash /Oslash /OE /ordmasculine /.notdef /.notdef /.notdef /.notdef | |
566 | /.notdef /ae /.notdef /.notdef /.notdef /dotlessi /.notdef /.notdef | |
567 | /lslash /oslash /oe /germandbls /.notdef /.notdef /.notdef /.notdef | |
568 | 256 packedarray def | |
569 | ||
570 | % Define the ISO Latin-1 encoding vector. | |
571 | % The first half is the same as the standard encoding. | |
572 | /ISOLatin1Encoding | |
573 | StandardEncoding 0 128 getinterval aload pop | |
574 | %*** NOTE: the following are missing in the Adobe documentation, | |
575 | %*** but appear in the displayed table: | |
576 | %*** macron at 225, dieresis at 230, cedilla at 233, space at 240. | |
577 | % \20x | |
578 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
579 | /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef | |
580 | /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent | |
581 | /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron | |
582 | % \24x | |
583 | /space /exclamdown /cent /sterling | |
584 | /currency /yen /brokenbar /section | |
585 | /dieresis /copyright /ordfeminine /guillemotleft | |
586 | /logicalnot /hyphen /registered /macron | |
587 | /degree /plusminus /twosuperior /threesuperior | |
588 | /acute /mu /paragraph /periodcentered | |
589 | /cedilla /onesuperior /ordmasculine /guillemotright | |
590 | /onequarter /onehalf /threequarters /questiondown | |
591 | % \30x | |
592 | /Agrave /Aacute /Acircumflex /Atilde | |
593 | /Adieresis /Aring /AE /Ccedilla | |
594 | /Egrave /Eacute /Ecircumflex /Edieresis | |
595 | /Igrave /Iacute /Icircumflex /Idieresis | |
596 | /Eth /Ntilde /Ograve /Oacute | |
597 | /Ocircumflex /Otilde /Odieresis /multiply | |
598 | /Oslash /Ugrave /Uacute /Ucircumflex | |
599 | /Udieresis /Yacute /Thorn /germandbls | |
600 | % \34x | |
601 | /agrave /aacute /acircumflex /atilde | |
602 | /adieresis /aring /ae /ccedilla | |
603 | /egrave /eacute /ecircumflex /edieresis | |
604 | /igrave /iacute /icircumflex /idieresis | |
605 | /eth /ntilde /ograve /oacute | |
606 | /ocircumflex /otilde /odieresis /divide | |
607 | /oslash /ugrave /uacute /ucircumflex | |
608 | /udieresis /yacute /thorn /ydieresis | |
609 | 256 packedarray def | |
610 | ||
611 | % Define a stub for the Symbol encoding. | |
612 | userdict begin | |
613 | /SymbolEncoding | |
614 | { userdict begin (sym__enc.ps) run /SymbolEncoding load end | |
615 | } bind def | |
616 | end | |
617 | ||
618 | (END FONTDIR/ENCS ) VMDEBUG | |
619 | ||
620 | % Construct a dictionary of all available devices. | |
621 | mark | |
622 | % Loop until the getdevice gets a rangecheck. | |
623 | 0 { {dup getdevice exch 1 add} loop} stopped pop | |
624 | dict /devicedict exch def | |
625 | devicedict begin % 2nd copy of count is on stack | |
626 | { dup /Name gsgetdeviceprop cvn dup 3 -1 roll def | |
627 | counttomark 1 roll | |
628 | } repeat | |
629 | end | |
630 | ] /devicenames exch def | |
631 | $error /newerror false put % remove error indication | |
632 | ||
633 | (END DEVS ) VMDEBUG | |
634 | ||
635 | % Define statusdict, for the benefit of programs | |
636 | % that think they are running on a LaserWriter or similar printer. | |
637 | (gs_statd.ps) run | |
638 | ||
639 | (END STATD ) VMDEBUG | |
640 | ||
641 | % Load the initialization files for optional features. | |
642 | systemdict /INITFILES known | |
643 | { INITFILES { run } forall | |
644 | } | |
645 | if | |
646 | ||
647 | % Establish a default upper limit in the character cache, | |
648 | % namely, 10 times the average expected character size. | |
649 | mark | |
650 | cachestatus 5 index 10 mul 2 index 1 max idiv % bmax, cmax | |
651 | mark exch dup 10 idiv exch setcacheparams | |
652 | cleartomark | |
653 | % Conditionally disable the character cache. | |
654 | NOCACHE { 1 setcachelimit } if | |
655 | ||
656 | (END CONFIG ) VMDEBUG | |
657 | ||
658 | % Load the standard font environment. | |
659 | (gs_fonts.ps) run | |
660 | ||
661 | (END GS_FONTS ) VMDEBUG | |
662 | ||
663 | % Create a null font. This is the initial font. | |
664 | 7 dict dup begin | |
665 | /FontMatrix [ 1 0 0 1 0 0 ] def | |
666 | /FontType 3 def | |
667 | /FontName () def | |
668 | /Encoding StandardEncoding def | |
669 | /FontBBox { 0 0 0 0 } def % executable is bogus, but customary ... | |
670 | /BuildChar { pop pop 0 0 setcharwidth } bind def | |
671 | end | |
672 | /NullFont exch definefont setfont | |
673 | % Define NullFont as the font, but remove it from FontDirectory. | |
674 | /NullFont currentfont def | |
675 | FontDirectory /NullFont undef | |
676 | ||
677 | (END FONTS ) VMDEBUG | |
678 | ||
679 | % Restore the real definition of run. | |
680 | /run /.run load def | |
681 | currentdict /.run undef | |
682 | ||
683 | % Bind all the operators defined as procedures. | |
684 | % Temporarily disable the typecheck error. | |
685 | errordict /typecheck get | |
686 | errordict /typecheck { pop } put % pop the command | |
687 | systemdict | |
688 | { dup type /operatortype eq | |
689 | { % This might be a real operator, so bind might cause a typecheck, | |
690 | % but we've made the error a no-op temporarily. | |
691 | bind | |
692 | } | |
693 | if pop pop | |
694 | } forall | |
695 | errordict /typecheck 3 -1 roll put | |
696 | ||
697 | % Close up systemdict. | |
698 | end | |
699 | WRITESYSTEMDICT not { systemdict readonly pop } if | |
700 | ||
701 | % Define a procedure for skipping over an unneeded section of code. | |
702 | % This avoids allocating space for the skipped procedures. | |
703 | /.skipeof % string -> | |
704 | { { dup currentfile =string readline pop eq { exit } if } loop pop | |
705 | } bind def | |
706 | ||
707 | % Establish a default environment. | |
708 | ||
709 | DISPLAYING not | |
710 | { nulldevice (%END DISPLAYING) .skipeof | |
711 | } if | |
712 | systemdict /DEVICE known | |
713 | { devicedict DEVICE known not | |
714 | { (Unknown device: ) print DEVICE = | |
715 | flush 1 .quit | |
716 | } | |
717 | if | |
718 | } | |
719 | if | |
720 | defaultdevice | |
721 | systemdict /DEVICEWIDTH known | |
722 | systemdict /DEVICEHEIGHT known or | |
723 | systemdict /DEVICEXRESOLUTION known or | |
724 | systemdict /DEVICEYRESOLUTION known or | |
725 | not { (%END DEVICE) .skipeof } if | |
726 | % Adjust the device parameters per the command line. | |
727 | getdeviceprops dicttomark begin | |
728 | 6 dict begin | |
729 | /dw HWSize 0 get def | |
730 | /dh HWSize 1 get def | |
731 | /dmat InitialMatrix def | |
732 | /dxres HWResolution 0 get def | |
733 | /dyres HWResolution 1 get def | |
734 | /DEVICEXRESOLUTION where | |
735 | { pop /drq DEVICEXRESOLUTION dxres div def | |
736 | 0 2 4 | |
737 | { dup | |
738 | dmat exch get drq mul | |
739 | dmat 3 1 roll put | |
740 | } | |
741 | for | |
742 | dw drq mul cvi /dw exch def | |
743 | /dxres DEVICEXRESOLUTION def | |
744 | } | |
745 | if | |
746 | /DEVICEYRESOLUTION where | |
747 | { pop /drq DEVICEYRESOLUTION dyres div def | |
748 | 1 2 5 | |
749 | { dup | |
750 | dmat exch get drq mul | |
751 | dmat 3 1 roll put | |
752 | } | |
753 | for | |
754 | dh drq mul cvi /dh exch def | |
755 | /dyres DEVICEYRESOLUTION def | |
756 | } | |
757 | if | |
758 | /DEVICEWIDTH where | |
759 | { pop /dw DEVICEWIDTH def } | |
760 | if | |
761 | /DEVICEHEIGHT where | |
762 | { pop /dh DEVICEHEIGHT def | |
763 | } | |
764 | if | |
765 | mark | |
766 | /HWSize [ dw dh ] /HWResolution [ dxres dyres ] /InitialMatrix dmat | |
767 | defaultdevice putdeviceprops | |
768 | end end | |
769 | %END DEVICE | |
770 | systemdict /OUTPUTFILE known | |
771 | { mark /OutputFile OUTPUTFILE 4 -1 roll putdeviceprops | |
772 | } | |
773 | if | |
774 | setdevice % does an erasepage | |
775 | %END DISPLAYING | |
776 | ||
777 | 1 setflat % initgraphics doesn't set this | |
778 | { } settransfer % ditto | |
779 | ||
780 | 72 72 dtransform abs exch abs min % min(|dpi x|,|dpi y|) | |
781 | dup 150 lt systemdict /DITHERPPI known not and | |
782 | { % Low-res device, use ordered dither spot function | |
783 | % The following 'ordered dither' spot function was contributed by | |
784 | % Gregg Townsend. Thanks, Gregg! | |
785 | 16.001 div 0 % not 16: avoids rounding problems | |
786 | { 1 add 7.9999 mul cvi exch 1 add 7.9999 mul cvi 16 mul add < | |
787 | 0E 8E 2E AE 06 86 26 A6 0C 8C 2C AC 04 84 24 A4 | |
788 | CE 4E EE 6E C6 46 E6 66 CC 4C EC 6C C4 44 E4 64 | |
789 | 3E BE 1E 9E 36 B6 16 96 3C BC 1C 9C 34 B4 14 94 | |
790 | FE 7E DE 5E F6 76 D6 56 FC 7C DC 5C F4 74 D4 54 | |
791 | 01 81 21 A1 09 89 29 A9 03 83 23 A3 0B 8B 2B AB | |
792 | C1 41 E1 61 C9 49 E9 69 C3 43 E3 63 CB 4B EB 6B | |
793 | 31 B1 11 91 39 B9 19 99 33 B3 13 93 3B BB 1B 9B | |
794 | F1 71 D1 51 F9 79 D9 59 F3 73 D3 53 FB 7B DB 5B | |
795 | 0D 8D 2D AD 05 85 25 A5 0F 8F 2F AF 07 87 27 A7 | |
796 | CD 4D ED 6D C5 45 E5 65 CF 4F EF 6F C7 47 E7 67 | |
797 | 3D BD 1D 9D 35 B5 15 95 3F BF 1F 9F 37 B7 17 97 | |
798 | FD 7D DD 5D F5 75 D5 55 FF 7F DF 5F F7 77 D7 57 | |
799 | 02 82 22 A2 0A 8A 2A AA 00 80 20 A0 08 88 28 A8 | |
800 | C2 42 E2 62 CA 4A EA 6A C0 40 E0 60 C8 48 E8 68 | |
801 | 32 B2 12 92 3A BA 1A 9A 30 B0 10 90 38 B8 18 98 | |
802 | F2 72 D2 52 FA 7A DA 5A F0 70 D0 50 F8 78 D8 58 | |
803 | > exch get 256 div } bind | |
804 | } | |
805 | { % Hi-res device, use dot spot function | |
806 | % The following 'Niksula dither' was contributed by Hannu Aronsson | |
807 | % (haa@cs.hut.fi). It is a better dither for most hi-res printers. | |
808 | % 32.5 is the best value of DITHERPPI for the 400 dpi Sony NWP533 | |
809 | % printer. | |
810 | pop systemdict /DITHERPPI known { DITHERPPI } { 32.5 } ifelse | |
811 | 0 | |
812 | { exch abs exch abs 2 copy le { exch } if | |
813 | exch 1 sub dup mul exch dup mul add 1 exch sub | |
814 | } bind | |
815 | } ifelse | |
816 | setscreen | |
817 | initgraphics | |
818 | % The interpreter relies on there being at least 2 entries | |
819 | % on the graphics stack. Establish the second one now. | |
820 | gsave | |
821 | ||
822 | % Define control-D as a no-op. This is a hack to get around problems | |
823 | % in some common PostScript-generating applications. | |
824 | (\004) cvn { } def | |
825 | (\004\004) cvn { } def | |
826 | ||
827 | % Turn off array packing for interactive use. | |
828 | false setpacking | |
829 | ||
830 | (END INIT ) VMDEBUG | |
831 | ||
832 | QUIET not { (done.\n) print flush } if | |
833 | ||
834 | % The interpreter will run the initial procedure (start). |