home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / gspm25.zip / gs_init.ps < prev    next >
Text File  |  1992-09-24  |  29KB  |  932 lines

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