home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / clipart / gs22.zip / GS_INIT.PS < prev    next >
Text File  |  1991-05-29  |  21KB  |  648 lines

  1. %    Copyright (C) 1989, 1990, 1991 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 {{vmstatus pop (      ) cvs print pop ( ) print
  27.             systemdict length (      ) cvs print (\n) print flush}}
  28.       {{}} ifelse
  29.   def
  30. currentdict /NODISPLAY known   not /DISPLAYING exch def
  31. currentdict /NOBIND known { /.bind /bind load def   /bind { } def } if
  32. currentdict /NOCACHE known   /NOCACHE exch def
  33. currentdict /NOPAUSE known   /NOPAUSE exch def
  34. currentdict /QUIET known   /QUIET exch def
  35.  
  36. QUIET not { (Initializing... ) print flush } if
  37.  
  38. % Acquire systemdict and userdict.
  39. % Note that the dictionary stack only has 1 element at this point!
  40. /systemdict currentdict def
  41. /userdict 200 dict def
  42. userdict begin        % 2 elements now
  43. systemdict begin
  44.  
  45. VMDEBUG
  46.  
  47. % Define true and false.
  48. /true 0 0 eq def
  49. /false 0 1 eq def
  50.  
  51. % Turn on array packing for the rest of initialization.
  52. true setpacking
  53.  
  54. % Acquire the standard files.
  55. /.stdin (%stdin) (r) file def
  56. /.stdout (%stdout) (w) file def
  57. /.stderr (%stderr) (w) file def
  58.  
  59. % Define a special version of def for making operator procedures.
  60. /odef
  61.     {1 index exch makeoperator def} bind def
  62.  
  63. % Define predefined procedures substituting for operators,
  64. % in alphabetical order.
  65. /[    /mark load def
  66. /]     {counttomark array astore exch pop} odef
  67. /abs    {dup 0 lt {neg} if} odef
  68. /cleardictstack
  69.     {countdictstack 2 sub {end} repeat} odef
  70. /.copypage /copypage load def
  71. /copypage
  72.     {.copypage
  73.      (>>copypage, press <return> to continue<<\n) .confirm} odef
  74. /defaultmatrix
  75.     {currentdevice exch deviceparams pop pop
  76.      counttomark 1 add 1 roll cleartomark} odef
  77. /.echo /echo load def
  78. userdict /.echo.mode true put
  79. /echo    {dup /.echo.mode exch store .echo} odef
  80. /eexec    {55665 exch type1decryptfile
  81.      cvx systemdict begin stopped end
  82.      $error /newerror get and {handleerror} if} odef
  83. /executive
  84.     { { prompt (%statementedit) (r) file
  85.         dup bytesavailable 0 lt
  86.          { .stdin bytesavailable 0 lt {closefile exit} if }
  87.         if cvx execute
  88.       } loop
  89.     } odef
  90. /framedevice
  91.     {.stderr (Warning: framedevice is an obsolete operator.\n) writestring
  92.      .stderr flushfile
  93.      pop pop pop setmatrix initclip} odef
  94. /handleerror
  95.     {errordict /handleerror get exec} bind def
  96. /identmatrix
  97.     {{1.0 0.0 0.0 1.0 0.0 0.0} cvlit exch copy} odef
  98. /initgraphics
  99.     {initmatrix newpath initclip 1 setlinewidth 0 setlinecap 0 setlinejoin
  100.      [] 0 setdash 0 setgray 10 setmiterlimit} odef
  101. /initmatrix
  102.     {.tempmatrix defaultmatrix setmatrix} odef
  103. /matrix    {6 array identmatrix} odef
  104. /prompt    {flush flushpage
  105.      (GS) print count 0 ne
  106.       {(<) print count =only}
  107.      if (>) print flush} bind def
  108. /pstack    {0 1 count 3 sub {index ==} for} odef
  109. /run    {dup type /filetype eq { true } { findlibfile } ifelse
  110.       {cvx execute}
  111.       {(r) file}        % let the error happen
  112.      ifelse} odef
  113. /selectfont
  114.     { exch findfont exch
  115.       dup type /arraytype eq { makefont } { scalefont } ifelse
  116.       setfont
  117.     } odef
  118. /showpage
  119.     {.copypage (>>showpage, press <return> to continue<<\n) .confirm
  120.      erasepage initgraphics} odef
  121. /stack    {0 1 count 3 sub {index =} for} odef
  122. /start    { QUIET not
  123.       {(Ghostscript ) print .version print
  124.        (  Copyright (C) 1990, 1991 Aladdin Enterprises,\n) print
  125.        (   Menlo Park, CA.  All rights reserved.\n) print
  126.        (Distributed by Free Software Foundation, Inc.\n) print
  127.        (Ghostscript comes with NO WARRANTY: see the file COPYING for details.\n) print
  128.        flush
  129.       } if
  130.       executive
  131.     } def
  132. % Define version so it prints a warning once, for programs that think that
  133. % they are going to get an Adobe interpreter version.
  134. /version
  135.     { <00>        % Flag to make sure we only do this once
  136.       dup 0 get 0 eq
  137.        { .stderr (Warning -- Ghostscript version #s are not the same as Adobe version #s.\n) writestring
  138.          .stderr flushfile
  139.          0 1 put
  140.        }
  141.        { pop }
  142.       ifelse .version
  143.     } odef
  144. /.version
  145.     (2.2) def
  146.  
  147. % Provide semi-fake but usable definitions for
  148. % the color PostScript extensions (except for colorimage,
  149. % which is actually implemented as an operator).
  150. /setcmykcolor {
  151.     1 exch sub dup dup        % C, M, Y, S, S, S
  152.     6 -1 roll 1 exch sub mul    % M, Y, S, S, red
  153.     exch 5 -1 roll 1 exch sub mul    % Y, S, red, green
  154.     4 -2 roll exch 1 exch sub mul    % red, green, blue
  155.     setrgbcolor
  156. } odef
  157. /currentcmykcolor {
  158.     currentrgbcolor
  159.     3 { 1 exch sub 3 1 roll } repeat
  160.     0
  161. } odef
  162. /setblackgeneration {
  163.     pop
  164. } odef
  165. /currentblackgeneration {
  166.     {}
  167. } odef
  168. /setundercolorremoval {
  169.     pop
  170. } odef
  171. /currentundercolorremoval {
  172.     {}
  173. } odef
  174. /setcolorscreen {
  175.     setscreen 9 {pop} repeat
  176. } odef
  177. /currentcolorscreen {
  178.     currentscreen 3 copy 6 copy
  179. } odef
  180.  
  181. % Define some additional built-in procedures (beyond the ones defined by
  182. % the PostScript Language Reference Manual).
  183. /concatprocs
  184.     { exch cvlit exch cvlit        % proc1 proc2
  185.       dup length 2 index length add array    % proc1 proc2 newproc
  186.       dup 0 4 index putinterval
  187.       dup 3 index length 3 index putinterval
  188.       exch pop exch pop cvx
  189.     } bind def
  190. /concatstrings
  191.     { 1 index length 1 index length add string
  192.       2 index 1 index copy pop
  193.       dup 3 index length 3 index length getinterval
  194.       2 index exch copy pop
  195.       exch pop exch pop
  196.     } bind def
  197. /copyarray
  198.     { dup length array copy } bind def
  199. /copystring
  200.     { dup length string copy } bind def
  201. /defaultdevice
  202.     { systemdict /DEVICE known
  203.        { systemdict /DEVICE get finddevice }
  204.        { 0 getdevice }
  205.       ifelse
  206.     } bind def
  207. /finddevice
  208.     { systemdict /devicedict get exch get } bind def
  209. /rgbcolor
  210.     { gsave setrgbcolor currentgscolor grestore } bind def
  211. /selectdevice
  212.     { finddevice setdevice } bind def
  213. /signalerror        % object errorname
  214.     { errordict exch get exec } bind def
  215.  
  216. % Define auxiliary procedures needed for the above.
  217. /shellarguments        % -> shell_arguments true (or) false
  218.     { /ARGUMENTS where
  219.        { /ARGUMENTS get dup type /arraytype eq
  220.           { aload pop /ARGUMENTS null store true }
  221.           { pop false }
  222.          ifelse }
  223.        { false } ifelse
  224.     } bind def
  225. /.confirm
  226.     {DISPLAYING NOPAUSE not and
  227.       {% Print a message and wait for the user to type something.
  228.        % If the user just types a newline, flush it.
  229.        print flush
  230.        .echo.mode false echo
  231.          .stdin dup read
  232.          {dup (\n) 0 get eq {pop pop} {unread} ifelse} {pop} ifelse
  233.        echo}
  234.       {pop} ifelse} bind def
  235. /.identmatrix        % a read-only identity matrix
  236.     matrix readonly def
  237. /.tempmatrix        % a temporary matrix
  238.     matrix def
  239.  
  240. % Define the procedure used by the C executive for executing user input,
  241. % and also by the run operator.
  242. % This is called with a procedure or file on the operand stack.
  243. /execute
  244.     {stopped $error /newerror get and {handleerror} if} odef
  245.  
  246. % Create the error handling machinery.
  247. % The interpreter has created the ErrorNames array.
  248. % Define $error.
  249. /$error 11 dict def        % newerror, errorname, command, errorinfo,
  250.                 % ostack, estack, dstack, recordstacks,
  251.                 % binary, .inerror, position
  252. $error begin
  253.   /newerror false def
  254.   /recordstacks true def
  255.   /binary false def
  256.   /.inerror false def
  257. end
  258. % Define errordict.  It has one entry per error name, plus handleerror.
  259. /errordict ErrorNames length 1 add dict def
  260. % Define the standard error handlers.  When they are invoked,
  261. % the top element of the o-stack is the error name;
  262. % the next element is the offending command.
  263. errordict begin
  264.   { //$error /.inerror get .instopped not or
  265.      { (Unrecoverable error: ) print =only flush
  266.        ( in ) print = flush
  267.        count 0 gt
  268.         { (Operand stack:\n  ) print
  269.       0 1 count 3 sub { (  ) print index =only flush } for
  270.       (\n) print flush
  271.     } if
  272.        quit
  273.      } if    % detect error recursion
  274.     $error /.inerror true put
  275.     $error /newerror true put
  276.     $error exch /errorname exch put
  277.     $error exch /command exch put
  278.     $error /dstack undef
  279.     $error /estack undef
  280.     $error /ostack undef
  281.     $error /recordstacks get $error /errorname get /VMerror ne and
  282.      { $error /dstack countdictstack array dictstack put
  283.        $error /estack countexecstack array execstack put
  284.        count array astore dup $error exch /ostack exch put
  285.      aload pop
  286.      } if
  287.     $error /.inerror false put
  288.     stop
  289.   } bind
  290.   ErrorNames
  291.    { [ 1 index 3 index /exec load ] cvx def
  292.    } forall
  293.   pop
  294. end
  295. % Define the standard handleerror.
  296. errordict begin
  297.   /handleerror
  298.    { (Error: ) print
  299.      $error begin
  300.        errorname ==only flush
  301.        ( in ) print
  302.        /command load ==only flush
  303.        currentdict /ostack known
  304.         { (\nOperand stack:\n  ) print ostack { (  ) print ==only } forall
  305.     } if
  306.        currentdict /estack known
  307.         { (\nExecution stack:\n  ) print estack { (  ) print =only } forall
  308.     } if
  309.        currentdict /dstack known
  310.     { (\nDictionary stack:\n  ) print dstack
  311.        { dup (  ) print length =only (/) print maxlength =only } forall
  312.     } if
  313.        (\n) print
  314.        /newerror false def
  315.      end
  316.      currentdict /position known
  317.       { (Current file position is ) print position = }
  318.      if
  319.      flush
  320.      .instopped {stop} if
  321.    } bind def
  322. end
  323.  
  324. % Define the =[only] procedures.  Also define =print and =string,
  325. % which are used by some P*stScr*pt programs even though
  326. % they aren't documented anywhere.
  327. /=print    {=only} def
  328. /=string 128 string def
  329. /=    {=only (\n) print} bind def
  330. 4 dict begin
  331.   /.buf =string def
  332.   /.print
  333.     {dup type currentdict exch known
  334.      {dup type exec} {.buf cvs print} ifelse
  335.     } bind def
  336.   /stringtype
  337.     {dup rcheck not {pop (--nostringval--)} if print} bind def
  338.   /nametype
  339.     {dup length .buf length gt
  340.      {dup length string}
  341.      {.buf}
  342.     ifelse cvs print} bind def
  343. {0 begin .print end} copyarray dup 0 currentdict put
  344.   cvx bind
  345. end
  346. /=only exch def
  347.  
  348. % Define the [write]==[only] procedures.
  349. /==    {==only (\n) print} bind def
  350. /==only    {.stdout exch write==only} bind def
  351. /write==
  352.     {2 copy write==only pop (\n) writestring} bind def
  353. /.dict 17 dict dup
  354. begin def
  355.   /.buf 128 string def
  356.   /.cvp {.buf cvs .p} bind def
  357. % /.f {the_output_file} def
  358.   /.nop {(-) .p type .cvp (-) .p} bind def
  359.   /.p {.f exch writestring} bind def
  360.   /.p1 {.f exch write} bind def
  361.   /.print
  362.     {dup type .dict exch known
  363.      {dup type exec} {.nop} ifelse
  364.     } bind def
  365.   /integertype /.cvp load def
  366.   /realtype /.cvp load def
  367.   /booleantype /.cvp load def
  368.   /nametype
  369.     {dup xcheck not {(/) .p} if
  370.      dup length .buf length gt
  371.       {dup length string}
  372.       {.buf}
  373.      ifelse cvs .p} bind def
  374.   /arraytype
  375.     {dup rcheck
  376.       {dup xcheck {(})({)} {(])([)} ifelse .p
  377.        exch () exch
  378.        {exch .p .print ( )} forall pop .p}
  379.       {.nop}
  380.      ifelse} bind def
  381.   /operatortype
  382.       {(--) .p .cvp (--) .p} bind def
  383.   /packedarraytype /arraytype load def
  384.   /stringtype
  385.     {dup rcheck
  386.       {(\() .p
  387.        {/.ch exch def
  388.         .ch 32 lt .ch 127 ge or
  389.         {(\\) .p .ch 8#1000 add 8 .buf cvrs 1 3 getinterval .p}
  390.         {.ch 40 eq .ch 41 eq or .ch 92 eq or
  391.          {(\\) .p} if
  392.          .ch .p1}
  393.         ifelse}
  394.        forall (\)) .p}
  395.       {.nop}
  396.      ifelse} bind def
  397. {0 begin exch cvlit /.f exch def .print end} copyarray dup 0 .dict put
  398.   bind cvx
  399. end
  400. /write==only exch def
  401.  
  402. VMDEBUG
  403.  
  404. % Define the font directory.
  405. % Make it big to leave room for transformed fonts.
  406. /FontDirectory 100 dict def
  407.  
  408. % Define the standard encoding vector.
  409. /StandardEncoding
  410. % \00x
  411.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  412.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  413.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  414.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  415. % \04x
  416.     /space /exclam /quotedbl /numbersign
  417.     /dollar /percent /ampersand /quoteright
  418.     /parenleft /parenright /asterisk /plus
  419.     /comma /hyphen /period /slash
  420.     /zero /one /two /three
  421.     /four /five /six /seven
  422.     /eight /nine /colon /semicolon
  423.     /less /equal /greater /question
  424. % \10x
  425.     /at /A /B /C /D /E /F /G
  426.     /H /I /J /K /L /M /N /O
  427.     /P /Q /R /S /T /U /V /W
  428.     /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
  429. % \14x
  430.     /quoteleft /a /b /c /d /e /f /g
  431.     /h /i /j /k /l /m /n /o
  432.     /p /q /r /s /t /u /v /w
  433.     /x /y /z /braceleft /bar /braceright /asciitilde /.notdef
  434. % \20x
  435.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  436.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  437.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  438.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  439. % \24x
  440.     /.notdef /exclamdown /cent /sterling
  441.     /fraction /yen /florin /section
  442.     /currency /quotesingle /quotedblleft /guillemotleft
  443.     /guilsinglleft /guilsinglright /fi /fl
  444.     /.notdef /endash /dagger /daggerdbl
  445.     /periodcentered /.notdef /paragraph /bullet
  446.     /quotesinglbase /quotedblbase /quotedblright /guillemotright
  447.     /ellipsis /perthousand /.notdef /questiondown
  448. % \30x
  449.     /.notdef /grave /acute /circumflex /tilde /macron /breve /dotaccent
  450.     /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
  451.     /emdash /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  452.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  453. % \34x
  454.     /.notdef /AE /.notdef /ordfeminine /.notdef /.notdef /.notdef /.notdef
  455.     /Lslash /Oslash /OE /ordmasculine /.notdef /.notdef /.notdef /.notdef
  456.     /.notdef /ae /.notdef /.notdef /.notdef /dotlessi /.notdef /.notdef
  457.     /lslash /oslash /oe /germandbls /.notdef /.notdef /.notdef /.notdef
  458. 256 packedarray def
  459.  
  460. % Define the ISO Latin-1 encoding vector.
  461. % The first half is the same as the standard encoding.
  462. /ISOLatin1Encoding
  463. StandardEncoding 0 128 getinterval aload pop
  464. %****** NOTE: the following are missing in the Adobe documentation,
  465. %****** but appear in the displayed table:
  466. %****** macron at 225, dieresis at 230, cedilla at 233, space at 240.
  467. % \20x
  468.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  469.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  470.     /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
  471.     /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
  472. % \24x
  473.     /space /exclamdown /cent /sterling
  474.     /currency /yen /brokenbar /section
  475.     /dieresis /copyright /ordfeminine /guillemotleft
  476.     /logicalnot /hyphen /registered /macron
  477.     /degree /plusminus /twosuperior /threesuperior
  478.     /acute /mu /paragraph /periodcentered
  479.     /cedilla /onesuperior /ordmasculine /guillemotright
  480.     /onequarter /onehalf /threequarters /questiondown
  481. % \30x
  482.     /Agrave /Aacute /Acircumflex /Atilde
  483.     /Adieresis /Aring /AE /Ccedilla
  484.     /Egrave /Eacute /Ecircumflex /Edieresis
  485.     /Igrave /Iacute /Icircumflex /Idieresis
  486.     /Eth /Ntilde /Ograve /Oacute
  487.     /Ocircumflex /Otilde /Odieresis /multiply
  488.     /Oslash /Ugrave /Uacute /Ucircumflex
  489.     /Udieresis /Yacute /Thorn /germandbls
  490. % \34x
  491.     /agrave /aacute /acircumflex /atilde
  492.     /adieresis /aring /ae /ccedilla
  493.     /egrave /eacute /ecircumflex /edieresis
  494.     /igrave /iacute /icircumflex /idieresis
  495.     /eth /ntilde /ograve /oacute
  496.     /ocircumflex /otilde /odieresis /divide
  497.     /oslash /ugrave /uacute /ucircumflex
  498.     /udieresis /yacute /thorn /ydieresis
  499. 256 packedarray def
  500.  
  501. % Define a stub for the Symbol encoding.
  502. userdict begin
  503.   /SymbolEncoding
  504.    { userdict begin (symbol_e.ps) run /SymbolEncoding load end
  505.    } bind def
  506. end
  507.  
  508. % Construct a dictionary of all available devices.
  509. mark
  510.     % Loop until the getdevice gets a rangecheck.
  511.   0 { {dup getdevice exch 1 add} loop} stopped pop
  512.   dict /devicedict exch def
  513.   devicedict begin        % 2nd copy of count is on stack
  514.    { dup devicename cvn dup 3 -1 roll def
  515.      counttomark 1 roll
  516.    } repeat
  517.   end
  518. ] /devicenames exch def
  519. $error /newerror false put        % remove error indication
  520.  
  521. % Define a special version of `run' that aborts on errors.
  522. /run0
  523.     { dup /.currentfilename exch def
  524.        { findlibfile not { stop } if } stopped
  525.        { pop (Can't find initialization file ) print = flush quit } if
  526.       cvx stopped
  527.        { (While reading ) print .currentfilename print (:\n) print flush
  528.          handleerror quit
  529.        } if
  530.     } bind def
  531.  
  532. % Define statusdict, for the benefit of programs
  533. % that think they are running on a LaserWriter or similar printer.
  534. (gs_statd.ps) run0
  535.  
  536. % Load the initialization files for optional features.
  537. [ (gconfig.ps) run0 ]            % a list of file names
  538.  { run0 } forall
  539.  
  540. % Establish a default upper limit in the character cache,
  541. % namely, 10 times the average expected character size.
  542. mark
  543.  cachestatus 5 index 10 mul 2 index 1 max idiv        % bmax, cmax
  544.   mark exch dup 10 idiv exch setcacheparams
  545. cleartomark
  546. % Conditionally disable the character cache.
  547. NOCACHE { 1 setcachelimit } if
  548.     
  549. VMDEBUG
  550.  
  551. % Load the standard font environment.
  552. (gs_fonts.ps) run0
  553.  
  554. % Create a null font.  This is the initial font.
  555. 7 dict dup begin
  556.   /FontMatrix [ 1 0 0 1 0 0 ] def
  557.   /FontType 3 def
  558.   /FontName () def
  559.   /Encoding StandardEncoding def
  560.   /FontBBox [ 0 0 0 0 ] cvx def        % cvx is bogus, but customary ...
  561.   /BuildChar { pop pop 0 0 setcharwidth } bind def
  562. end
  563. /NullFont exch definefont setfont
  564. % Define NullFont as the font, but remove it from FontDirectory.
  565. /NullFont currentfont def
  566. FontDirectory /NullFont undef
  567.  
  568. % Bind all the operators defined as procedures.
  569. systemdict
  570.  { dup type /operatortype eq
  571.     { % This might be a real operator, so bind might cause a typecheck.
  572.       { bind } stopped pop
  573.       $error /newerror false put        % remove error indication
  574.     }
  575.    if pop pop
  576.  } forall
  577.  
  578. % Close up systemdict.
  579. end
  580. systemdict readonly pop
  581.  
  582. % Establish a default environment.
  583. DISPLAYING
  584.  { defaultdevice
  585.    systemdict /DEVICEWIDTH known systemdict /DEVICEHEIGHT known or
  586.     { matrix deviceparams
  587.       exch /DEVICEWIDTH where
  588.        { pop pop DEVICEWIDTH }
  589.       if
  590.       exch /DEVICEHEIGHT where
  591.        { pop pop DEVICEHEIGHT
  592.          % Replace the Y translation if the Y axis is inverted
  593.      2 index 5 get 0 gt
  594.       { 2 index 5 2 index put
  595.       }
  596.      if
  597.        }
  598.       if
  599.       defaultdevice 4 1 roll makedevice
  600.       counttomark 1 add 1 roll cleartomark
  601.     }
  602.    if setdevice        % does an erasepage
  603.  }
  604.  { nulldevice
  605.  }
  606. ifelse
  607. 1 setflat        % initgraphics doesn't set this
  608. { } settransfer        % ditto
  609. % The following 'ordered dither' spot function was contributed by
  610. % Gregg Townsend.  Thanks, Gregg!
  611.   72 72 dtransform abs exch abs min    % min(|dpi x|,|dpi y|)
  612.   16.001 div 0            % not 16: avoids rounding problems
  613.    { 1 add 7.9999 mul cvi exch 1 add 7.9999 mul cvi 16 mul add <
  614.     0E 8E 2E AE 06 86 26 A6 0C 8C 2C AC 04 84 24 A4
  615.     CE 4E EE 6E C6 46 E6 66 CC 4C EC 6C C4 44 E4 64
  616.     3E BE 1E 9E 36 B6 16 96 3C BC 1C 9C 34 B4 14 94
  617.     FE 7E DE 5E F6 76 D6 56 FC 7C DC 5C F4 74 D4 54
  618.     01 81 21 A1 09 89 29 A9 03 83 23 A3 0B 8B 2B AB
  619.     C1 41 E1 61 C9 49 E9 69 C3 43 E3 63 CB 4B EB 6B
  620.     31 B1 11 91 39 B9 19 99 33 B3 13 93 3B BB 1B 9B
  621.     F1 71 D1 51 F9 79 D9 59 F3 73 D3 53 FB 7B DB 5B
  622.     0D 8D 2D AD 05 85 25 A5 0F 8F 2F AF 07 87 27 A7
  623.     CD 4D ED 6D C5 45 E5 65 CF 4F EF 6F C7 47 E7 67
  624.     3D BD 1D 9D 35 B5 15 95 3F BF 1F 9F 37 B7 17 97
  625.     FD 7D DD 5D F5 75 D5 55 FF 7F DF 5F F7 77 D7 57
  626.     02 82 22 A2 0A 8A 2A AA 00 80 20 A0 08 88 28 A8
  627.     C2 42 E2 62 CA 4A EA 6A C0 40 E0 60 C8 48 E8 68
  628.     32 B2 12 92 3A BA 1A 9A 30 B0 10 90 38 B8 18 98
  629.     F2 72 D2 52 FA 7A DA 5A F0 70 D0 50 F8 78 D8 58
  630.    > exch get 256 div } bind setscreen
  631. initgraphics
  632. % The interpreter relies on there being at least 2 entries
  633. % on the graphics stack.  Establish the second one now.
  634. gsave
  635.  
  636. VMDEBUG
  637.  
  638. % Define control-D as a no-op.  This is a hack to get around problems
  639. % in some common P*stScr*pt-generating applications.
  640. (\004) cvn { } def
  641.  
  642. % Turn off array packing for interactive use.
  643. false setpacking
  644.  
  645. QUIET not { (done.\n) print flush } if
  646.  
  647. % The interpreter will run the initial procedure (start).
  648.