home *** CD-ROM | disk | FTP | other *** search
/ swCHIP 1991 January / swCHIP_95-1.bin / utility / gs333ini / gs3.33 / gs_statd.ps < prev    next >
Text File  |  1995-12-09  |  10KB  |  244 lines

  1. %    Copyright (C) 1989, 1995 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % This file provides statusdict, serverdict, and assorted LaserWriter
  16. % operators, mostly for the benefit of poorly designed PostScript programs
  17. % that 'know' they are running on a LaserWriter.
  18.  
  19. systemdict begin
  20.     % We make statusdict a little larger for Level 2 stuff.
  21.     % Note that it must be allocated in local VM.
  22.  .currentglobal false .setglobal
  23.  /statusdict 89 dict def
  24.     % To support the Level 2 job control features,
  25.     % serverdict must also be in local VM.
  26.  /serverdict 10 dict def        % ditto
  27.  .setglobal
  28. end
  29.  
  30. % Define various paper formats.  The Adobe documentation defines only these:
  31. % 11x17, a3, a4, a4small, b5, ledger, legal, letter, lettersmall, note.
  32. % These procedures are also accessed as data structures during initialization,
  33. % so the page dimensions must be the first two elements of the procedure.
  34.  
  35. /.setpagesize { //systemdict /statusdict get begin .setpagesize end } bind def
  36. userdict begin
  37.  /letter {612 792 //.setpagesize exec} bind def
  38.  /note {540 720 //.setpagesize exec} bind def
  39.  /legal {612 1008 //.setpagesize exec} bind def
  40.  /a0 {2380 3368 //.setpagesize exec} bind def  % ISO standard
  41.  /a1 {1684 2380 //.setpagesize exec} bind def  % ISO standard
  42.  /a2 {1190 1684 //.setpagesize exec} bind def  % ISO standard
  43.  /a3 {842 1190 //.setpagesize exec} bind def  % ISO standard
  44.  /a4 {595 842 //.setpagesize exec} bind def  % ISO standard
  45.  /a5 {421 595 //.setpagesize exec} bind def  % ISO standard
  46.  /a6 {297 421 //.setpagesize exec} bind def  % ISO standard
  47.  /a7 {210 297 //.setpagesize exec} bind def  % ISO standard
  48.  /a8 {148 210 //.setpagesize exec} bind def  % ISO standard
  49.  /a9 {105 148 //.setpagesize exec} bind def  % ISO standard
  50.  /a10 {74 105 //.setpagesize exec} bind def  % ISO standard
  51.  /b0 {2836 4008 //.setpagesize exec} bind def  % ISO standard
  52.  /b1 {2004 2836 //.setpagesize exec} bind def  % ISO standard
  53.  /b2 {1418 2004 //.setpagesize exec} bind def  % ISO standard
  54.  /b3 {1002 1418 //.setpagesize exec} bind def  % ISO standard
  55.  /b4 {709 1002 //.setpagesize exec} bind def  % ISO standard
  56.  /b5 {501 709 //.setpagesize exec} bind def  % ISO standard
  57.  /archE {2592 3456 //.setpagesize exec} bind def % U.S. CAD std
  58.  /archD {1728 2592 //.setpagesize exec} bind def % U.S. CAD std
  59.  /archC {1296 1728 //.setpagesize exec} bind def % U.S. CAD std
  60.  /archB {864 1296 //.setpagesize exec} bind def  % U.S. CAD std
  61.  /archA {648 864 //.setpagesize exec} bind def  % U.S. CAD std
  62.  /flsa {612 936 //.setpagesize exec} bind def  % U.S. foolscap
  63.  /flse {612 936 //.setpagesize exec} bind def  % European foolscap
  64.  /halfletter {396 612 //.setpagesize exec} bind def
  65.  /11x17 {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
  66.  /ledger {1224 792 //.setpagesize exec} bind def  % 11x17 landscape
  67. end
  68. currentdict /.setpagesize undef
  69.  
  70. statusdict begin
  71.  
  72. % Define the pagetype values for the known page formats.
  73. % The values for all but letter and note are arbitrary.
  74. /.pagetypenames
  75.  { /letter /note /legal 
  76.    /a0 /a1 /a2 /a3 /a4 /a5 /a6 /a7 /a8 /a9 /a10
  77.    /b0 /b1 /b2 /b3 /b4 /b5 /archE /archD /archC /archB /archA
  78.    /flsa /flse /halfletter /11x17 /ledger
  79.  } cvlit readonly def
  80.  
  81. %%%%%% The following items were suggested by a user as useful.
  82.  
  83. % Permanent definitions
  84.  
  85. /ramsize         4194304 def
  86. /hardwareiomode        0 def
  87.     /sethardwareiomode     {pop} bind def
  88. /softwareiomode        0 def
  89.     /setsoftwareiomode     {pop} bind def
  90. /dosysstart        false def
  91.     /setdosysstart         {pop} bind def
  92. /allowjobreset      true def
  93.     /setallowjobreset      {pop} bind def
  94. /defaultpaperfamily    0 def
  95.     /setdefaultpaperfamily {pop} bind def
  96. /defaultpapertray      0 def
  97.     /setdefaultpapertray   {pop} bind def
  98. /defaulttrayswitch false def
  99.     /setdefaulttrayswitch  {pop} bind def
  100.  
  101. % Tray and format selection
  102.  
  103.  /11x17tray userdict /11x17 get def
  104.  /a3tray userdict /a3 get def
  105.  /a4tray userdict /a4 get def
  106.  /a5tray userdict /a5 get def
  107.  /a6tray userdict /a6 get def
  108.  /b4tray userdict /b4 get def
  109.  /flsatray userdict /flsa get def
  110.  /flsetray userdict /flse get def
  111.  /halflettertray userdict /halfletter get def
  112.  /ledgertray userdict /ledger get def
  113.  /legaltray userdict /legal get def
  114.  /lettertray userdict /letter get def
  115.  
  116. % Per-job parameters
  117.  
  118. /paperfamily 0 def    % 0 is US, 1 is European
  119. /papertray 1 def
  120.     /setpapertray {statusdict exch /papertray exch put} bind def 
  121. /trayswitch false def    % paperout feeds from another tray
  122. /papersize {/letter true} bind def    % <name of paper size>, <short-edge-first-p>
  123. /appletalktype (LaserWriter) def
  124.  
  125. %%%%%% The following items are defined in the PostScript Language
  126. %%%%%% Reference Manual, First Edition, and subsequent 'compatibility'
  127. %%%%%% documentation from Adobe.
  128.  
  129.  /checkpassword {statusdict begin .password eq end} bind def
  130.  /defaulttimeouts {statusdict begin .timeouts aload pop end} bind def
  131. %/dostartpage
  132.  /eescratch {pop 0} bind def
  133.  /idlefonts {statusdict begin mark .idlefonts aload pop end} bind def
  134.  /jobname () def
  135. %/jobtimeout
  136.  /manualfeed false def
  137.  /manualfeedtimeout 60 def
  138.  /margins {statusdict begin .topmargin .leftmargin end} bind def
  139.  /pagecount {4711} bind def
  140.  /pagestackorder {false} bind def
  141.  /pagetype 0 def
  142.  /prefeed false def
  143.  /printererror {pop pop} bind def
  144.  /printername {statusdict /.printername get exch copy} bind def
  145.  /processcolors /processcolors load def        % defined in systemdict
  146.  /product product def        % product is defined in systemdict
  147.  /revision revision def        % revision is defined in systemdict
  148.  /sccbatch {pop 9600 0} bind def
  149.  /sccinteractive {pop 9600 0} bind def
  150.  /setdefaulttimeouts {statusdict begin .timeouts astore pop end} bind def
  151.  /setdostartpage {statusdict exch /dostartpage exch put} bind def
  152.  /setduplexmode {mark /Duplex 3 -1 roll currentdevice putdeviceprops} bind def
  153.  /seteescratch {pop pop} bind def
  154.  /setidlefonts {] statusdict exch /.idlefonts exch put} bind def
  155.  /setjobtimeout {statusdict exch /jobtimeout exch put} bind def
  156.  /setmargins
  157.   { statusdict begin
  158.     /.leftmargin exch def /.topmargin exch def
  159.     end
  160.   } bind def
  161.  
  162. % setpage and setpageparams aren't properly documented by Adobe.
  163. %
  164. %    <width> <height> <orientation> setpage -
  165. %    <width> <height> <offset> <orientation> setpageparams -
  166. %
  167. % width and height are in default units (and if orientation is 1, are
  168. % exchanged!).  offset is the x margin, also in default units.
  169. % Unfortunately, because orientation is relative to the device paper feed,
  170. % it does not have a consistent meaning in terms of image orientation.
  171. % We follow the convention that ORIENT1 determines the orientation value
  172. % that means portait: false means 0, true means 1.
  173.  
  174.  /setpage {ORIENT1 { 1 } { 0 } ifelse ne {exch} if .setpagesize} bind def
  175.  /setpageparams {exch pop ORIENT1 { 1 } { 0 } ifelse ne {exch} if .setpagesize} bind def
  176.  /setpagetype
  177.   { statusdict begin
  178.       dup .pagetypenames exch get systemdict exch get exec
  179.       /pagetype exch def
  180.     end
  181.   } bind def
  182.  /setpassword
  183.   {exch checkpassword
  184.     {statusdict exch /.password exch put true}
  185.     {pop false}
  186.    ifelse} bind def
  187.  /setprintername
  188.   {dup length string copy statusdict exch /.printername exch put} bind def
  189.     % setresolution is not documented by Adobe, but some applications
  190.     % use it anyway, without testing whether or not it is present.
  191.  
  192. % setresolution is not documented by Adobe.
  193. %
  194. %    <pixels_per_inch> setresolution -
  195. %
  196. % sets the resolution of the device.
  197.  
  198.  /setresolution
  199.   { mark /HWResolution [ 4 -1 roll dup ] currentdevice putdeviceprops pop
  200.     initmatrix erasepage
  201.   } bind def
  202.  /setsccbatch {pop pop pop} bind def
  203.  /setsccinteractive {pop pop pop} bind def
  204.  /settumble {pop} bind def
  205.  /waittimeout 300 def
  206.  
  207. %%%%%% End of documented items.
  208.  
  209. /.setpagesize
  210.  { mark /HWSize [
  211.      4 index 4 index matrix defaultmatrix dtransform
  212.      abs ceiling cvi exch abs ceiling cvi exch
  213.    ] currentdevice putdeviceprops pop pop pop
  214.    initmatrix initclip erasepage
  215.  } bind def
  216. /.password 0 def
  217. /.timeouts [0 60 30] def
  218. true setdostartpage
  219. mark setidlefonts
  220. 0 setjobtimeout
  221. 0 0 setmargins
  222. product setprintername
  223.  
  224. end    % statusdict
  225.  
  226. % The following contents of serverdict are a complete guess,
  227. % based on some observed LaserWriter boilerplate.
  228.  
  229. serverdict begin
  230.  
  231.  /execjob { } bind def
  232. % The Red Book implies that something like the following is
  233. % an appropriate definition of exitserver.
  234.  /exitserver { clear stop } bind def
  235. % However, this interacts badly with our standard error handler,
  236. % so we override it with the following less appropriate definition.
  237.  /exitserver { 0 ne { clear cleardictstack } if } bind def
  238.  /setrealdevice { } bind def
  239.  
  240. end    % serverdict
  241.