home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 6.img / SUPPORT4.LIB / ACADPSI.PS < prev    next >
Encoding:
Text File  |  1992-03-16  |  29.7 KB  |  821 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. %
  21. %  ***********************************************************************
  22. %  *                                                                     *
  23. %  *    M   M    OOO    DDDD     III    FFFFF    III    EEEEE   DDDD     *
  24. %  *    MM MM   O   O   D   D     I     F         I     E       D   D    *
  25. %  *    M M M   O   O   D   D     I     F         I     E       D   D    *
  26. %  *    M   M   O   O   D   D     I     FFF       I     EEE     D   D    *
  27. %  *    M   M   O   O   D   D     I     F         I     E       D   D    *
  28. %  *    M   M   O   O   D   D     I     F         I     E       D   D    *
  29. %  *    M   M    OOO    DDDD     III    F        III    EEEEE   DDDD     *
  30. %  *                                                                     *
  31. %  *                                                                     *
  32. %  *                   FFFFF    III    L       EEEEE                     *
  33. %  *                   F         I     L       E                         *
  34. %  *                   F         I     L       E                         *
  35. %  *                   FFF       I     L       EEE                       *
  36. %  *                   F         I     L       E                         *
  37. %  *                   F         I     L       E                         *
  38. %  *                   F        III    LLLLL   EEEEE                     *
  39. %  *                                                                     *
  40. %  ***********************************************************************
  41. %
  42. %                              .-------------.
  43. %                              |      /\     |
  44. %                              |     /  \    |
  45. %                              |    / /\ \   |
  46. %                              |   / /  \ \  |
  47. %                              |  / / /\ \ \ |
  48. %                              | / / /  \ \ \|
  49. %                              `-------------'  (R)
  50. %                               Autodesk, Inc.
  51. %                   Tools For the Golden Age of Engineering
  52. %
  53. %   In  keeping with subparagraph 2a of the Gnu General Public License
  54. %   (Version 1, February 1989):
  55. %
  56. %   2.  You may modify your copy or  copies  of  the  Program  or  any
  57. %   portion  of  it,  and copy and distribute such modifications under
  58. %   the terms of Paragraph 1 above, provided  that  you  also  do  the
  59. %   following:
  60. %
  61. %      a)  cause the modified files to carry prominent notices stating
  62. %          that you changed the files and the date of any change; and...
  63. %
  64. %   the  following  is  a  summary of the changes to this file made by
  65. %   Autodesk, Inc. in August 1991 in order to adapt Ghostscript to run
  66. %   as  an  ADS  application  and  thereby  to  perform  rendering  of
  67. %   PostScript files within AutoCAD.
  68. %
  69. %
  70. %   ACADPSI.PS      I implemented a new procedure, "arun", which  is  used
  71. %                   by  the  (PSGEN)  function  to run PostScript programs
  72. %                   included  with the PSIN command.  "Arun" is a somewhat
  73. %                   more intelligent version of "run"  which  accommodates
  74. %                   variants  of  PostScript one encounters, especially on
  75. %                   MS-DOS machines.   If  the  binary  "EPSF"  header  is
  76. %                   present,  used  by  desktop  publishing programs which
  77. %                   append a bitmap of the PostScript image to  the  file,
  78. %                   arun  recognises the sentinel, extracts the pointer to
  79. %                   the  bitmap  from  the  header,  and  uses   the   new
  80. %                   setsubfilelimit  operator  to  logically  truncate the
  81. %                   file at that point.  A setfileposition is then done to
  82. %                   skip the header.  To allow processing files with a few
  83. %                   bytes of garbage before the "%!" sentinel, arun  reads
  84. %                   through the file searching for "%!", ignoring anything
  85. %                   it finds before the sentinel.
  86. %
  87. %                   Ghostscript   master   initialisation   file.   Called
  88. %                   GS_INIT.PS in standard Ghostscript.   I  added  a  new
  89. %                   "acadpsversion"  operator  to return the local version
  90. %                   of ACADPS ("2.2-ACADPS:Q001-JW1" in this release).   I
  91. %                   extended error handling to call "flagerrorhappened" so
  92. %                   that the error code can be returned to the  caller  of
  93. %                   (PSGEN).   I  changed  the file name references to the
  94. %                   ACADPSx.PS conventions and integrated the  local  code
  95. %                   for  ARUN, etc., from the version based on Ghostscript
  96. %                   2.1.1.  I used the new NOPAUSE  variable  to  suppress
  97. %                   the  pause  in  "copypage"  and "showpage" rather than
  98. %                   commenting out the user prompt as before.  (New file.)
  99. %
  100. %
  101. % ************************************************************************
  102.  
  103. % Initialization file for Ghostscript.
  104. % When this is run, systemdict is still writable.
  105.  
  106. % Acquire the debugging flags.
  107. currentdict /DEBUG known   /DEBUG exch def
  108.   /VMDEBUG
  109.     DEBUG {{vmstatus pop (      ) cvs print pop ( ) print
  110.             systemdict length (      ) cvs print (\n) print flush}}
  111.           {{}} ifelse
  112.   def
  113. currentdict /NODISPLAY known   not /DISPLAYING exch def
  114. currentdict /NOBIND known { /.bind /bind load def   /bind { } def } if
  115. currentdict /NOCACHE known   /NOCACHE exch def
  116. currentdict /NOPAUSE known   /NOPAUSE exch def
  117. currentdict /QUIET known   /QUIET exch def
  118.  
  119. QUIET not { (Initializing... ) print flush } if
  120.  
  121. % Acquire systemdict and userdict.
  122. % Note that the dictionary stack only has 1 element at this point!
  123. /systemdict currentdict def
  124. /userdict 200 dict def
  125. userdict begin          % 2 elements now
  126. systemdict begin
  127.  
  128. VMDEBUG
  129.  
  130. % Define true and false.
  131. /true 0 0 eq def
  132. /false 0 1 eq def
  133.  
  134. % Turn on array packing for the rest of initialization.
  135. true setpacking
  136.  
  137. % Acquire the standard files.
  138. /.stdin (%stdin) (r) file def
  139. /.stdout (%stdout) (w) file def
  140. /.stderr (%stderr) (w) file def
  141.  
  142. % Define a special version of def for making operator procedures.
  143. /odef
  144.         {1 index exch makeoperator def} bind def
  145.  
  146. % Define predefined procedures substituting for operators,
  147. % in alphabetical order.
  148. /[      /mark load def
  149. /]      {counttomark array astore exch pop} odef
  150. /abs    {dup 0 lt {neg} if} odef
  151. /cleardictstack
  152.         {countdictstack 2 sub {end} repeat} odef
  153. /.copypage /copypage load def
  154. /copypage
  155.         {.copypage
  156.          (>>copypage, press <return> to continue<<\n) .confirm} odef
  157. /defaultmatrix
  158.         {currentdevice exch deviceparams pop pop
  159.          counttomark 1 add 1 roll cleartomark} odef
  160. /.echo /echo load def
  161. userdict /.echo.mode true put
  162. /echo   {dup /.echo.mode exch store .echo} odef
  163. /eexec  {55665 exch type1decryptfile
  164.          cvx systemdict begin stopped end
  165.          $error /newerror get and {handleerror} if} odef
  166. /executive
  167.         { { prompt (%statementedit) (r) file
  168.             dup bytesavailable 0 lt
  169.              { .stdin bytesavailable 0 lt {closefile exit} if }
  170.             if cvx execute
  171.           } loop
  172.         } odef
  173. /framedevice
  174.         {.stderr (Warning: framedevice is an obsolete operator.\n) writestring
  175.          .stderr flushfile
  176.          pop pop pop setmatrix initclip} odef
  177. /handleerror
  178.         {errordict /handleerror get exec} bind def
  179. /identmatrix
  180.         {{1.0 0.0 0.0 1.0 0.0 0.0} cvlit exch copy} odef
  181. /initgraphics
  182.         {initmatrix newpath initclip 1 setlinewidth 0 setlinecap 0 setlinejoin
  183.          [] 0 setdash 0 setgray 10 setmiterlimit} odef
  184. /initmatrix
  185.         {.tempmatrix defaultmatrix setmatrix} odef
  186. /matrix {6 array identmatrix} odef
  187. /prompt {flush flushpage
  188.          (GS) print count 0 ne
  189.           {(<) print count =only}
  190.          if (>) print flush} bind def
  191. /pstack {0 1 count 3 sub {index ==} for} odef
  192. /run    {dup type /filetype eq { true } { findlibfile } ifelse
  193.           {cvx execute}
  194.           {(r) file}            % let the error happen
  195.          ifelse} odef
  196. /selectfont
  197.         { exch findfont exch
  198.           dup type /arraytype eq { makefont } { scalefont } ifelse
  199.           setfont
  200.         } odef
  201. /showpage
  202.         {.copypage (>>showpage, press <return> to continue<<\n) .confirm
  203.          erasepage initgraphics} odef
  204. /stack  {0 1 count 3 sub {index =} for} odef
  205. /start  { QUIET not
  206.           {(Ghostscript ) print .version print
  207.            (  Copyright (C) 1990, 1991 Aladdin Enterprises,\n) print
  208.            (   Menlo Park, CA.  All rights reserved.\n) print
  209.            (Distributed by Free Software Foundation, Inc.\n) print
  210.            (Ghostscript comes with NO WARRANTY: see the file COPYING for details.\n) print
  211.            flush
  212.           } if
  213.           executive
  214.         } def
  215. % Define version so it prints a warning once, for programs that think that
  216. % they are going to get an Adobe interpreter version.
  217. /version
  218.         { <00>          % Flag to make sure we only do this once
  219.           dup 0 get 0 eq
  220.            { .stderr (Warning -- Ghostscript version #s are not the same as Adobe version #s.\n) writestring
  221.              .stderr flushfile
  222.              0 1 put
  223.            }
  224.            { pop }
  225.           ifelse .version
  226.         } odef
  227. /.version
  228.         (2.2) def
  229.  
  230. %   ACADPS version string, including base Ghostscript version
  231. /acadpsversion
  232.         (2.2-ACADPS:Q001-JW1) def
  233.  
  234. % Provide semi-fake but usable definitions for
  235. % the color PostScript extensions (except for colorimage,
  236. % which is actually implemented as an operator).
  237. /setcmykcolor {
  238.         1 exch sub dup dup              % C, M, Y, S, S, S
  239.         6 -1 roll 1 exch sub mul        % M, Y, S, S, red
  240.         exch 5 -1 roll 1 exch sub mul   % Y, S, red, green
  241.         4 -2 roll exch 1 exch sub mul   % red, green, blue
  242.         setrgbcolor
  243. } odef
  244. /currentcmykcolor {
  245.         currentrgbcolor
  246.         3 { 1 exch sub 3 1 roll } repeat
  247.         0
  248. } odef
  249. /setblackgeneration {
  250.         pop
  251. } odef
  252. /currentblackgeneration {
  253.         {}
  254. } odef
  255. /setundercolorremoval {
  256.         pop
  257. } odef
  258. /currentundercolorremoval {
  259.         {}
  260. } odef
  261. /setcolorscreen {
  262.         setscreen 9 {pop} repeat
  263. } odef
  264. /currentcolorscreen {
  265.         currentscreen 3 copy 6 copy
  266. } odef
  267.  
  268. % Define some additional built-in procedures (beyond the ones defined by
  269. % the PostScript Language Reference Manual).
  270. /concatprocs
  271.         { exch cvlit exch cvlit         % proc1 proc2
  272.           dup length 2 index length add array   % proc1 proc2 newproc
  273.           dup 0 4 index putinterval
  274.           dup 3 index length 3 index putinterval
  275.           exch pop exch pop cvx
  276.         } bind def
  277. /concatstrings
  278.         { 1 index length 1 index length add string
  279.           2 index 1 index copy pop
  280.           dup 3 index length 3 index length getinterval
  281.           2 index exch copy pop
  282.           exch pop exch pop
  283.         } bind def
  284. /copyarray
  285.         { dup length array copy } bind def
  286. /copystring
  287.         { dup length string copy } bind def
  288. /defaultdevice
  289.         { systemdict /DEVICE known
  290.            { systemdict /DEVICE get finddevice }
  291.            { 0 getdevice }
  292.           ifelse
  293.         } bind def
  294. /finddevice
  295.         { systemdict /devicedict get exch get } bind def
  296. /rgbcolor
  297.         { gsave setrgbcolor currentgscolor grestore } bind def
  298. /selectdevice
  299.         { finddevice setdevice } bind def
  300. /signalerror            % object errorname
  301.         { errordict exch get exec } bind def
  302.  
  303. % Define auxiliary procedures needed for the above.
  304. /shellarguments         % -> shell_arguments true (or) false
  305.         { /ARGUMENTS where
  306.            { /ARGUMENTS get dup type /arraytype eq
  307.               { aload pop /ARGUMENTS null store true }
  308.               { pop false }
  309.              ifelse }
  310.            { false } ifelse
  311.         } bind def
  312. /.confirm
  313.         {DISPLAYING NOPAUSE not and
  314.           {% Print a message and wait for the user to type something.
  315.            % If the user just types a newline, flush it.
  316.            print flush
  317.            .echo.mode false echo
  318.              .stdin dup read
  319.              {dup (\n) 0 get eq {pop pop} {unread} ifelse} {pop} ifelse
  320.            echo}
  321.           {pop} ifelse} bind def
  322. /.identmatrix           % a read-only identity matrix
  323.         matrix readonly def
  324. /.tempmatrix            % a temporary matrix
  325.         matrix def
  326.  
  327. % Define the procedure used by the C executive for executing user input,
  328. % and also by the run operator.
  329. % This is called with a procedure or file on the operand stack.
  330. /execute
  331.         {stopped $error /newerror get and {handleerror} if} odef
  332.  
  333. % Create the error handling machinery.
  334. % The interpreter has created the ErrorNames array.
  335. % Define $error.
  336. /$error 11 dict def             % newerror, errorname, command, errorinfo,
  337.                                 % ostack, estack, dstack, recordstacks,
  338.                                 % binary, .inerror, position
  339. $error begin
  340.   /newerror false def
  341.   /recordstacks true def
  342.   /binary false def
  343.   /.inerror false def
  344. end
  345. % Define errordict.  It has one entry per error name, plus handleerror.
  346. /errordict ErrorNames length 1 add dict def
  347. % Define the standard error handlers.  When they are invoked,
  348. % the top element of the o-stack is the error name;
  349. % the next element is the offending command.
  350. errordict begin
  351.   { //$error /.inerror get .instopped not or
  352.      { (Unrecoverable error: ) print =only flush
  353.        ( in ) print = flush
  354.        count 0 gt
  355.         { (Operand stack:\n  ) print
  356.           0 1 count 3 sub { (  ) print index =only flush } for
  357.           (\n) print flush
  358.         } if
  359.        quit
  360.      } if       % detect error recursion
  361.     $error /.inerror true put
  362.     $error /newerror true put
  363.     $error exch /errorname exch put
  364.     $error exch /command exch put
  365.     $error /dstack undef
  366.     $error /estack undef
  367.     $error /ostack undef
  368.     $error /recordstacks get $error /errorname get /VMerror ne and
  369.      { $error /dstack countdictstack array dictstack put
  370.        $error /estack countexecstack array execstack put
  371.        count array astore dup $error exch /ostack exch put
  372.          aload pop
  373.      } if
  374.     $error /.inerror false put
  375.     stop
  376.   } bind
  377.   ErrorNames
  378.    { [ 1 index 3 index /exec load ] cvx def
  379.    } forall
  380.   pop
  381. end
  382. % Define the standard handleerror.
  383. errordict 
  384. begin
  385.     /handleerror
  386.     { 
  387.     $error 
  388.     begin
  389.         errorname (interrupt) eq
  390.         { 
  391.         % Do not print out error messages and stack traces
  392.         % for interrupts; PSIN, if anyone, has that job.
  393.         }
  394.         {
  395.         (Error: ) print
  396.         errorname ==only flush
  397.         ( in ) print
  398.         /command load ==only flush
  399.         currentdict /ostack known
  400.         { 
  401.             (\nOperand stack:\n  ) print ostack { 
  402.             (  ) print ==only 
  403.             } forall
  404.         } if
  405.         currentdict /estack known
  406.         { 
  407.             (\nExecution stack:\n  ) print estack { 
  408.             (  ) print =only 
  409.             } forall
  410.         } if
  411.         currentdict /dstack known
  412.         { 
  413.             (\nDictionary stack:\n  ) print dstack
  414.             { 
  415.             dup (  ) print length =only (/) print maxlength =only 
  416.             } forall
  417.         } if
  418.         (\n) print
  419.         } ifelse
  420.         flagerrorhappened
  421.         /newerror false def
  422.     end
  423.     currentdict /position known
  424.     { 
  425.         (Current file position is ) print position = 
  426.     }
  427.     if
  428.     flush
  429.     .instopped {
  430.         stop
  431.     } if
  432.     } bind def
  433. end
  434.  
  435. % Define the =[only] procedures.  Also define =print and =string,
  436. % which are used by some P*stScr*pt programs even though
  437. % they aren't documented anywhere.
  438. /=print {=only} def
  439. /=string 128 string def
  440. /=      {=only (\n) print} bind def
  441. 4 dict begin
  442.   /.buf =string def
  443.   /.print
  444.         {dup type currentdict exch known
  445.          {dup type exec} {.buf cvs print} ifelse
  446.         } bind def
  447.   /stringtype
  448.         {dup rcheck not {pop (--nostringval--)} if print} bind def
  449.   /nametype
  450.         {dup length .buf length gt
  451.          {dup length string}
  452.          {.buf}
  453.         ifelse cvs print} bind def
  454. {0 begin .print end} copyarray dup 0 currentdict put
  455.   cvx bind
  456. end
  457. /=only exch def
  458.  
  459. % Define the [write]==[only] procedures.
  460. /==     {==only (\n) print} bind def
  461. /==only {.stdout exch write==only} bind def
  462. /write==
  463.         {2 copy write==only pop (\n) writestring} bind def
  464. /.dict 17 dict dup
  465. begin def
  466.   /.buf 128 string def
  467.   /.cvp {.buf cvs .p} bind def
  468. % /.f {the_output_file} def
  469.   /.nop {(-) .p type .cvp (-) .p} bind def
  470.   /.p {.f exch writestring} bind def
  471.   /.p1 {.f exch write} bind def
  472.   /.print
  473.         {dup type .dict exch known
  474.          {dup type exec} {.nop} ifelse
  475.         } bind def
  476.   /integertype /.cvp load def
  477.   /realtype /.cvp load def
  478.   /booleantype /.cvp load def
  479.   /nametype
  480.         {dup xcheck not {(/) .p} if
  481.          dup length .buf length gt
  482.           {dup length string}
  483.           {.buf}
  484.          ifelse cvs .p} bind def
  485.   /arraytype
  486.         {dup rcheck
  487.           {dup xcheck {(})({)} {(])([)} ifelse .p
  488.            exch () exch
  489.            {exch .p .print ( )} forall pop .p}
  490.           {.nop}
  491.          ifelse} bind def
  492.   /operatortype
  493.         {(--) .p .cvp (--) .p} bind def
  494.   /packedarraytype /arraytype load def
  495.   /stringtype
  496.         {dup rcheck
  497.           {(\() .p
  498.            {/.ch exch def
  499.             .ch 32 lt .ch 127 ge or
  500.             {(\\) .p .ch 8#1000 add 8 .buf cvrs 1 3 getinterval .p}
  501.             {.ch 40 eq .ch 41 eq or .ch 92 eq or
  502.              {(\\) .p} if
  503.              .ch .p1}
  504.             ifelse}
  505.            forall (\)) .p}
  506.           {.nop}
  507.          ifelse} bind def
  508. {0 begin exch cvlit /.f exch def .print end} copyarray dup 0 .dict put
  509.   bind cvx
  510. end
  511. /write==only exch def
  512.  
  513. VMDEBUG
  514.  
  515. % Define the font directory.
  516. % Make it big to leave room for transformed fonts.
  517. /FontDirectory 100 dict def
  518.  
  519. % Define the standard encoding vector.
  520. /StandardEncoding
  521. % \00x
  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.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  526. % \04x
  527.     /space /exclam /quotedbl /numbersign
  528.         /dollar /percent /ampersand /quoteright
  529.     /parenleft /parenright /asterisk /plus
  530.         /comma /hyphen /period /slash
  531.     /zero /one /two /three
  532.         /four /five /six /seven
  533.     /eight /nine /colon /semicolon
  534.         /less /equal /greater /question
  535. % \10x
  536.     /at /A /B /C /D /E /F /G
  537.     /H /I /J /K /L /M /N /O
  538.     /P /Q /R /S /T /U /V /W
  539.     /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
  540. % \14x
  541.     /quoteleft /a /b /c /d /e /f /g
  542.     /h /i /j /k /l /m /n /o
  543.     /p /q /r /s /t /u /v /w
  544.     /x /y /z /braceleft /bar /braceright /asciitilde /.notdef
  545. % \20x
  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.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  550. % \24x
  551.     /.notdef /exclamdown /cent /sterling
  552.         /fraction /yen /florin /section
  553.     /currency /quotesingle /quotedblleft /guillemotleft
  554.         /guilsinglleft /guilsinglright /fi /fl
  555.     /.notdef /endash /dagger /daggerdbl
  556.         /periodcentered /.notdef /paragraph /bullet
  557.     /quotesinglbase /quotedblbase /quotedblright /guillemotright
  558.         /ellipsis /perthousand /.notdef /questiondown
  559. % \30x
  560.     /.notdef /grave /acute /circumflex /tilde /macron /breve /dotaccent
  561.     /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
  562.     /emdash /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  563.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  564. % \34x
  565.     /.notdef /AE /.notdef /ordfeminine /.notdef /.notdef /.notdef /.notdef
  566.     /Lslash /Oslash /OE /ordmasculine /.notdef /.notdef /.notdef /.notdef
  567.     /.notdef /ae /.notdef /.notdef /.notdef /dotlessi /.notdef /.notdef
  568.     /lslash /oslash /oe /germandbls /.notdef /.notdef /.notdef /.notdef
  569. 256 packedarray def
  570.  
  571. % Define the ISO Latin-1 encoding vector.
  572. % The first half is the same as the standard encoding.
  573. /ISOLatin1Encoding
  574. StandardEncoding 0 128 getinterval aload pop
  575. %****** NOTE: the following are missing in the Adobe documentation,
  576. %****** but appear in the displayed table:
  577. %****** macron at 225, dieresis at 230, cedilla at 233, space at 240.
  578. % \20x
  579.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  580.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  581.     /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
  582.     /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
  583. % \24x
  584.     /space /exclamdown /cent /sterling
  585.         /currency /yen /brokenbar /section
  586.     /dieresis /copyright /ordfeminine /guillemotleft
  587.         /logicalnot /hyphen /registered /macron
  588.     /degree /plusminus /twosuperior /threesuperior
  589.         /acute /mu /paragraph /periodcentered
  590.     /cedilla /onesuperior /ordmasculine /guillemotright
  591.         /onequarter /onehalf /threequarters /questiondown
  592. % \30x
  593.     /Agrave /Aacute /Acircumflex /Atilde
  594.         /Adieresis /Aring /AE /Ccedilla
  595.     /Egrave /Eacute /Ecircumflex /Edieresis
  596.         /Igrave /Iacute /Icircumflex /Idieresis
  597.     /Eth /Ntilde /Ograve /Oacute
  598.         /Ocircumflex /Otilde /Odieresis /multiply
  599.     /Oslash /Ugrave /Uacute /Ucircumflex
  600.         /Udieresis /Yacute /Thorn /germandbls
  601. % \34x
  602.     /agrave /aacute /acircumflex /atilde
  603.         /adieresis /aring /ae /ccedilla
  604.     /egrave /eacute /ecircumflex /edieresis
  605.         /igrave /iacute /icircumflex /idieresis
  606.     /eth /ntilde /ograve /oacute
  607.         /ocircumflex /otilde /odieresis /divide
  608.     /oslash /ugrave /uacute /ucircumflex
  609.         /udieresis /yacute /thorn /ydieresis
  610. 256 packedarray def
  611.  
  612. % Define a stub for the Symbol encoding.
  613. userdict begin
  614.   /SymbolEncoding
  615.    { userdict begin (acadpss.ps) run /SymbolEncoding load end
  616.    } bind def
  617. end
  618.  
  619. % Construct a dictionary of all available devices.
  620. mark
  621.         % Loop until the getdevice gets a rangecheck.
  622.   0 { {dup getdevice exch 1 add} loop} stopped pop
  623.   dict /devicedict exch def
  624.   devicedict begin              % 2nd copy of count is on stack
  625.    { dup devicename cvn dup 3 -1 roll def
  626.      counttomark 1 roll
  627.    } repeat
  628.   end
  629. ] /devicenames exch def
  630. $error /newerror false put              % remove error indication
  631.  
  632. % Define a special version of `run' that aborts on errors.
  633. /run0
  634.         { dup /.currentfilename exch def
  635.            { findlibfile not { stop } if } stopped
  636.            { pop (Can't find initialization file ) print = flush quit } if
  637.           cvx stopped
  638.            { (While reading ) print .currentfilename print (:\n) print flush
  639.              handleerror quit
  640.            } if
  641.         } bind def
  642.  
  643. %   Internal  procedure  used  by  ARUN to read a 32 bit word in Intel
  644. %   byte order.  Not fast, but squeaky-clean PostScript wise.   Leaves
  645. %   the file positioned after the value read.
  646.  
  647. /.arunRlong {                         % fileid -- integer
  648.     dup read pop
  649.     1 index read pop 8 bitshift or
  650.     1 index read pop 16 bitshift or
  651.     1 index read pop 24 bitshift or
  652.     exch pop
  653. } bind def
  654.  
  655. %   Pseudo-intelligent  version  of RUN.  This version accepts all the
  656. %   odd crypto-PostScript files one sees in the real world.  It  knows
  657. %   about  positioning  over  the  binary  EPSF  header  tacked on for
  658. %   PostScript annotated with bitmap images, and if all else fails  it
  659. %   will scan over garbage in a file until it finds the file sentinel.
  660.  
  661. /arun   {dup type /filetype eq { true } { findlibfile } ifelse
  662.  
  663.             % Test for the EPSF binary sentinel
  664.  
  665.             { dup .arunRlong 16#C6D3D0C5 eq
  666.                 {
  667.                     % Matched binary sentinel.  Position past it
  668. % (Position past binary EPSF header\n) print flush
  669.                     dup .arunRlong      % PostScript code start address
  670.                     1 index .arunRlong  % PostScript code length
  671.                     1 index add         % Calculate end of PostScript text
  672.                     2 index exch setsubfilelimit % Set logical EOF at text end
  673.                     1 index exch setfileposition % Seek to start of PostScript
  674.                     true
  675.                 }
  676.                 {
  677.                     % This is not actually a binary EPSF sentinel.  Seek
  678.                     % back to the start of the file.
  679. % (No EPSF Header\n) print flush
  680.                       dup 0 setfileposition
  681.                       false
  682.                 }
  683.                 ifelse
  684.             not
  685.             {
  686. % (Searching for %!\n) print flush
  687.                     {   dup read
  688.                         { 37 eq { dup read { 33 eq
  689.                             { dup dup fileposition 2 sub setfileposition exit }
  690.                             { unread } } { exit} ifelse
  691.                             ifelse } if }
  692.                         { exit } ifelse
  693.                     } loop
  694.  
  695.             } if
  696.             cvx execute
  697.             }
  698.             {(r) file}            % let the error happen
  699.            ifelse
  700. } bind def
  701.  
  702. % Define statusdict, for the benefit of programs
  703. % that think they are running on a LaserWriter or similar printer.
  704. (acadpsd.ps) run0
  705.  
  706. % Load the initialization files for optional features.
  707. [ (acadpsc.ps) run0 ]                   % a list of file names
  708.  { run0 } forall
  709.  
  710. % Establish a default upper limit in the character cache,
  711. % namely, 10 times the average expected character size.
  712. mark
  713.  cachestatus 5 index 10 mul 2 index 1 max idiv          % bmax, cmax
  714.   mark exch dup 10 idiv exch setcacheparams
  715. cleartomark
  716. % Conditionally disable the character cache.
  717. NOCACHE { 1 setcachelimit } if
  718.         
  719. VMDEBUG
  720.  
  721. % Load the standard font environment.
  722. (acadpsf.ps) run0
  723.  
  724. % Create a null font.  This is the initial font.
  725. 7 dict dup begin
  726.   /FontMatrix [ 1 0 0 1 0 0 ] def
  727.   /FontType 3 def
  728.   /FontName () def
  729.   /Encoding StandardEncoding def
  730.   /FontBBox [ 0 0 0 0 ] cvx def         % cvx is bogus, but customary ...
  731.   /BuildChar { pop pop 0 0 setcharwidth } bind def
  732. end
  733. /NullFont exch definefont setfont
  734. % Define NullFont as the font, but remove it from FontDirectory.
  735. /NullFont currentfont def
  736. FontDirectory /NullFont undef
  737.  
  738. % Bind all the operators defined as procedures.
  739. systemdict
  740.  { dup type /operatortype eq
  741.     { % This might be a real operator, so bind might cause a typecheck.
  742.       { bind } stopped pop
  743.       $error /newerror false put                % remove error indication
  744.     }
  745.    if pop pop
  746.  } forall
  747.  
  748. % Close up systemdict.
  749. end
  750. systemdict readonly pop
  751.  
  752. % Establish a default environment.
  753. DISPLAYING
  754.  { defaultdevice
  755.    systemdict /DEVICEWIDTH known systemdict /DEVICEHEIGHT known or
  756.     { matrix deviceparams
  757.       exch /DEVICEWIDTH where
  758.        { pop pop DEVICEWIDTH }
  759.       if
  760.       exch /DEVICEHEIGHT where
  761.        { pop pop DEVICEHEIGHT
  762.          % Replace the Y translation if the Y axis is inverted
  763.          2 index 5 get 0 gt
  764.           { 2 index 5 2 index put
  765.           }
  766.          if
  767.        }
  768.       if
  769.       defaultdevice 4 1 roll makedevice
  770.       counttomark 1 add 1 roll cleartomark
  771.     }
  772.    if setdevice         % does an erasepage
  773.  }
  774.  { nulldevice
  775.  }
  776. ifelse
  777. 1 setflat               % initgraphics doesn't set this
  778. { } settransfer         % ditto
  779. % The following 'ordered dither' spot function was contributed by
  780. % Gregg Townsend.  Thanks, Gregg!
  781.   72 72 dtransform abs exch abs min     % min(|dpi x|,|dpi y|)
  782.   16.001 div 0                  % not 16: avoids rounding problems
  783.    { 1 add 7.9999 mul cvi exch 1 add 7.9999 mul cvi 16 mul add <
  784.         0E 8E 2E AE 06 86 26 A6 0C 8C 2C AC 04 84 24 A4
  785.         CE 4E EE 6E C6 46 E6 66 CC 4C EC 6C C4 44 E4 64
  786.         3E BE 1E 9E 36 B6 16 96 3C BC 1C 9C 34 B4 14 94
  787.         FE 7E DE 5E F6 76 D6 56 FC 7C DC 5C F4 74 D4 54
  788.         01 81 21 A1 09 89 29 A9 03 83 23 A3 0B 8B 2B AB
  789.         C1 41 E1 61 C9 49 E9 69 C3 43 E3 63 CB 4B EB 6B
  790.         31 B1 11 91 39 B9 19 99 33 B3 13 93 3B BB 1B 9B
  791.         F1 71 D1 51 F9 79 D9 59 F3 73 D3 53 FB 7B DB 5B
  792.         0D 8D 2D AD 05 85 25 A5 0F 8F 2F AF 07 87 27 A7
  793.         CD 4D ED 6D C5 45 E5 65 CF 4F EF 6F C7 47 E7 67
  794.         3D BD 1D 9D 35 B5 15 95 3F BF 1F 9F 37 B7 17 97
  795.         FD 7D DD 5D F5 75 D5 55 FF 7F DF 5F F7 77 D7 57
  796.         02 82 22 A2 0A 8A 2A AA 00 80 20 A0 08 88 28 A8
  797.         C2 42 E2 62 CA 4A EA 6A C0 40 E0 60 C8 48 E8 68
  798.         32 B2 12 92 3A BA 1A 9A 30 B0 10 90 38 B8 18 98
  799.         F2 72 D2 52 FA 7A DA 5A F0 70 D0 50 F8 78 D8 58
  800.    > exch get 256 div } bind setscreen
  801. initgraphics
  802. % The interpreter relies on there being at least 2 entries
  803. % on the graphics stack.  Establish the second one now.
  804. gsave
  805.  
  806. VMDEBUG
  807.  
  808. % Define control-D as a no-op.  This is a hack to get around problems
  809. % in some common P*stScr*pt-generating applications.
  810. (\004) cvn { } def
  811.  
  812. % Turn off array packing for interactive use.
  813. false setpacking
  814.  
  815. QUIET not { (done.\n) print flush } if
  816.  
  817. %   Set no pause on copypage and showpage
  818. /NOPAUSE true def
  819.  
  820. % The interpreter will run the initial procedure (start).
  821.