home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / gs403osk.tgz / gs403osk.tar / gs_statd.ps < prev    next >
Text File  |  1996-10-20  |  11KB  |  271 lines

  1. %    Copyright (C) 1989, 1996 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' is an anomaly.  It is apparently supposed to use a 540x720 region
  39. % centered on a 612x792 page, with (0,0) at the lower left corner of the
  40. % 612x792 page, but we have no way to represent this.  In order to avoid
  41. % clipping the image, we define note as equivalent to letter.
  42. %/note {540 720 //.setpagesize exec} bind def
  43.  /note /letter load def
  44.  /legal {612 1008 //.setpagesize exec} bind def
  45.  /a0 {2380 3368 //.setpagesize exec} bind def  % ISO standard
  46.  /a1 {1684 2380 //.setpagesize exec} bind def  % ISO standard
  47.  /a2 {1190 1684 //.setpagesize exec} bind def  % ISO standard
  48.  /a3 {842 1190 //.setpagesize exec} bind def  % ISO standard
  49.  /a4 {595 842 //.setpagesize exec} bind def  % ISO standard
  50.  /a5 {421 595 //.setpagesize exec} bind def  % ISO standard
  51.  /a6 {297 421 //.setpagesize exec} bind def  % ISO standard
  52.  /a7 {210 297 //.setpagesize exec} bind def  % ISO standard
  53.  /a8 {148 210 //.setpagesize exec} bind def  % ISO standard
  54.  /a9 {105 148 //.setpagesize exec} bind def  % ISO standard
  55.  /a10 {74 105 //.setpagesize exec} bind def  % ISO standard
  56.  /b0 {2836 4008 //.setpagesize exec} bind def  % ISO standard
  57.  /b1 {2004 2836 //.setpagesize exec} bind def  % ISO standard
  58.  /b2 {1418 2004 //.setpagesize exec} bind def  % ISO standard
  59.  /b3 {1002 1418 //.setpagesize exec} bind def  % ISO standard
  60.  /b4 {709 1002 //.setpagesize exec} bind def  % ISO standard
  61.  /b5 {501 709 //.setpagesize exec} bind def  % ISO standard
  62.  /archE {2592 3456 //.setpagesize exec} bind def % U.S. CAD std
  63.  /archD {1728 2592 //.setpagesize exec} bind def % U.S. CAD std
  64.  /archC {1296 1728 //.setpagesize exec} bind def % U.S. CAD std
  65.  /archB {864 1296 //.setpagesize exec} bind def  % U.S. CAD std
  66.  /archA {648 864 //.setpagesize exec} bind def  % U.S. CAD std
  67.  /flsa {612 936 //.setpagesize exec} bind def  % U.S. foolscap
  68.  /flse {612 936 //.setpagesize exec} bind def  % European foolscap
  69.  /halfletter {396 612 //.setpagesize exec} bind def
  70.  /11x17 {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
  71. % /tabloid {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
  72.  /ledger {1224 792 //.setpagesize exec} bind def  % 11x17 landscape
  73. % /csheet {1224 1584 //.setpagesize exec} bind def % ANSI C 17x22
  74. % /dsheet {1584 2448 //.setpagesize exec} bind def % ANSI D 22x34
  75. % /esheet {2448 3168 //.setpagesize exec} bind def % ANSI E 34x44
  76. end
  77. currentdict /.setpagesize .undef
  78.  
  79. statusdict begin
  80.  
  81. % Define the pagetype values for the known page formats.
  82. % The values for all but letter and note are arbitrary.
  83. /.pagetypenames
  84.  { /letter /note /legal 
  85.    /a0 /a1 /a2 /a3 /a4 /a5 /a6 /a7 /a8 /a9 /a10
  86.    /b0 /b1 /b2 /b3 /b4 /b5 /archE /archD /archC /archB /archA
  87.    /flsa /flse /halfletter /11x17 /ledger
  88.  } cvlit readonly def
  89.  
  90. %%%%%% The following items were suggested by a user as useful.
  91.  
  92. % Permanent definitions
  93.  
  94. /ramsize         4194304 def
  95. /hardwareiomode        0 def
  96.     /sethardwareiomode     {pop} bind def
  97. /softwareiomode        0 def
  98.     /setsoftwareiomode     {pop} bind def
  99. /dosysstart        false def
  100.     /setdosysstart         {pop} bind def
  101. /allowjobreset      true def
  102.     /setallowjobreset      {pop} bind def
  103. /defaultpaperfamily    0 def
  104.     /setdefaultpaperfamily {pop} bind def
  105. /defaultpapertray      0 def
  106.     /setdefaultpapertray   {pop} bind def
  107. /defaulttrayswitch false def
  108.     /setdefaulttrayswitch  {pop} bind def
  109.  
  110. % Tray and format selection
  111.  
  112.  /11x17tray userdict /11x17 get def
  113.  /a3tray userdict /a3 get def
  114.  /a4tray userdict /a4 get def
  115.  /a5tray userdict /a5 get def
  116.  /a6tray userdict /a6 get def
  117.  /b4tray userdict /b4 get def
  118.  /flsatray userdict /flsa get def
  119.  /flsetray userdict /flse get def
  120.  /halflettertray userdict /halfletter get def
  121.  /ledgertray userdict /ledger get def
  122.  /legaltray userdict /legal get def
  123.  /lettertray userdict /letter get def
  124.  
  125. % Per-job parameters
  126.  
  127. /paperfamily 0 def  % 0 is US, 1 is European
  128. /papertray 1 def
  129.     /setpapertray {statusdict exch /papertray exch put} bind def 
  130. /trayswitch false def   % paperout feeds from another tray
  131. % We don't implement the (undocumented by Adobe) papersize 'operator',
  132. % because it's very awkward to make it interact properly with all the
  133. % different ways of setting the paper size.
  134. %/papersize {/letter true} bind def % <name of paper size>, <short-edge-first-p>
  135. /appletalktype (LaserWriter) def
  136.  
  137. %%%%%% The following items are defined in the PostScript Language
  138. %%%%%% Reference Manual, First Edition, and subsequent 'compatibility'
  139. %%%%%% documentation from Adobe.
  140.  
  141.  /checkpassword {statusdict begin .password eq end} bind def
  142.  /defaulttimeouts {statusdict begin .timeouts aload pop end} bind def
  143. %/dostartpage
  144.  /eescratch {pop 0} bind def
  145.  /idlefonts {statusdict begin mark .idlefonts aload pop end} bind def
  146.  /jobname () def
  147. %/jobtimeout
  148.  /manualfeed false def
  149.  /manualfeedtimeout 60 def
  150.  /margins {statusdict begin .topmargin .leftmargin end} bind def
  151.  /pagecount {4711} bind def
  152.  /pagestackorder {false} bind def
  153.  /pagetype 0 def
  154.  /prefeed false def
  155.  /printererror {pop pop} bind def
  156.  /printername {statusdict /.printername get exch copy} bind def
  157.  /processcolors /processcolors load def     % defined in systemdict
  158.  /product product def       % product is defined in systemdict
  159.  /revision revision def     % revision is defined in systemdict
  160.  /sccbatch {pop 9600 0} bind def
  161.  /sccinteractive {pop 9600 0} bind def
  162.  /setdefaulttimeouts {statusdict begin .timeouts astore pop end} bind def
  163.  /setdostartpage {statusdict exch /dostartpage exch put} bind def
  164.  /setduplexmode {mark /Duplex 3 -1 roll currentdevice putdeviceprops} bind def
  165.  /seteescratch {pop pop} bind def
  166.  /setidlefonts {] statusdict exch /.idlefonts exch put} bind def
  167.  /setjobtimeout {statusdict exch /jobtimeout exch put} bind def
  168.  /setmargins
  169.   { statusdict begin
  170.     /.leftmargin exch def /.topmargin exch def
  171.     end
  172.   } bind def
  173.  
  174. % The following compatibility operators are only documented by Adobe in a
  175. % supplement to the Red Book.
  176. %
  177. %   - pagemargin <offset>
  178. %   - pageparams <width> <height> <offset> <orientation>
  179. %   <width> <height> <orientation> setpage -
  180. %   <offset> setpagemargin -
  181. %   <width> <height> <offset> <orientation> setpageparams -
  182. %
  183. % width and height are in default units (and if orientation is odd, are
  184. % exchanged!).  offset is the x margin, also in default units.
  185. % Unfortunately, because orientation is relative to the device paper feed,
  186. % it does not have a consistent meaning in terms of image orientation.
  187. % We follow the convention that ORIENT1 determines the orientation value
  188. % that means portait: false means 0, true means 1.
  189.  
  190.  /pagemargin { 0 } bind def
  191.  /pageparams
  192.   { currentdevice 1 dict dup /.MediaSize dup put .getdeviceparams
  193.     exch pop exch pop aload pop 0 ORIENT1 { 1 } { 0 } ifelse
  194.   } bind def
  195.  /setpage
  196.   { ORIENT1 { 1 } { 0 } ifelse ne {exch} if
  197.     statusdict /.setpagesize get exec
  198.   } bind def
  199.  /setpagemargin {pop} bind def  % can't do better without setpagedevice
  200.  /setpageparams
  201.   { exch pop ORIENT1 { 1 } { 0 } ifelse ne {exch} if
  202.     statusdict /.setpagesize get exec
  203.   } bind def
  204.  /setpagetype
  205.   { statusdict begin
  206.       dup .pagetypenames exch get //systemdict exch get exec
  207.       /pagetype exch def
  208.     end
  209.   } bind def
  210.  /setpassword
  211.   {exch checkpassword
  212.     {statusdict exch /.password exch put true}
  213.     {pop false}
  214.    ifelse} bind def
  215.  /setprintername
  216.   {dup length string copy statusdict exch /.printername exch put} bind def
  217.  
  218. % setresolution is not documented by Adobe, but some applications
  219. % use it anyway, without testing whether or not it is present.
  220. %
  221. %   <pixels_per_inch> setresolution -
  222. %
  223. % sets the resolution of the device.
  224.  
  225.  /setresolution
  226.   { mark /HWResolution [ 4 -1 roll dup ] currentdevice putdeviceprops pop
  227.     initmatrix erasepage
  228.   } bind def
  229.  /setsccbatch {pop pop pop} bind def
  230.  /setsccinteractive {pop pop pop} bind def
  231.  /settumble {pop} bind def
  232.  /waittimeout 300 def
  233.  
  234. %%%%%% End of documented items.
  235.  
  236. /.setpagesize
  237.  { mark /HWSize [
  238.      4 index 4 index matrix defaultmatrix dtransform
  239.      abs ceiling cvi exch abs ceiling cvi exch
  240.    ] currentdevice putdeviceprops pop pop pop
  241.    initmatrix initclip erasepage
  242.  } bind def
  243. /.password 0 def
  244. /.timeouts [0 60 30] def
  245. true setdostartpage
  246. mark setidlefonts
  247. 0 setjobtimeout
  248. 0 0 setmargins
  249. product setprintername
  250.  
  251. end % statusdict
  252.  
  253. % The following contents of serverdict are a complete guess,
  254. % based on some observed LaserWriter boilerplate.
  255.  
  256. serverdict begin
  257.  
  258.  /execjob { } bind def
  259. % The Red Book implies that something like the following is
  260. % an appropriate definition of exitserver.
  261.  /exitserver { clear stop } bind def
  262. % However, this interacts badly with our standard error handler,
  263. % so we override it with the following less appropriate definition.
  264.  /exitserver { 0 ne { clear cleardictstack } if } bind def
  265.  /setrealdevice { } bind def
  266.  
  267. end % serverdict
  268.