home *** CD-ROM | disk | FTP | other *** search
/ Mixa 155: Dogs / MIXA 155: Dogs.iso / pc / Viewer / BROWSER(W) / フィルタ / PDF / LIB / gs_statd.ps < prev    next >
Encoding:
Text File  |  2002-10-29  |  12.4 KB  |  347 lines

  1. %    Copyright (C) 1989, 2000 Aladdin Enterprises.  All rights reserved.
  2. % This software is licensed to a single customer by Artifex Software Inc.
  3. % under the terms of a specific OEM agreement.
  4.  
  5. % $RCSfile: gs_statd.ps,v $ $Revision: 1.9 $
  6. % This file provides statusdict, serverdict, and assorted LaserWriter
  7. % operators, mostly for the benefit of poorly designed PostScript programs
  8. % that 'know' they are running on a LaserWriter.
  9.  
  10. systemdict begin
  11.     % We make statusdict a little larger for Level 2 stuff.
  12.     % Note that it must be allocated in local VM.
  13.  .currentglobal false .setglobal
  14.  /statusdict 89 dict .forcedef        % statusdict is local, sys'dict global
  15.     % To support the Level 2 job control features,
  16.     % serverdict must also be in local VM.
  17.  /serverdict 10 dict .forcedef        % serverdict is local, sys'dict global
  18.  .setglobal
  19. end
  20.  
  21. % Define various paper formats.  The Adobe documentation defines only these:
  22. % 11x17, a3, a4, a4small, b5, ledger, legal, letter, lettersmall, note.
  23. % These procedures are also accessed as data structures during initialization,
  24. % so the page dimensions must be the first two elements of the procedure.
  25.  
  26. /.setpagesize { /statusdict .systemvar begin .setpagesize end } bind def
  27. userdict begin
  28.         % Page sizes defined by Adobe documentation
  29.  /11x17 {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
  30.  /a3 {842 1190 //.setpagesize exec} bind def
  31.  /a4 {595 842 //.setpagesize exec} bind def
  32. % a4small should be a4 with an ImagingBBox of [25 25 570 817].
  33.  /a4small /a4 load def
  34. % b5 see below.
  35.  /ledger {1224 792 //.setpagesize exec} bind def  % 11x17 landscape
  36.  /legal {612 1008 //.setpagesize exec} bind def
  37.  /letter {612 792 //.setpagesize exec} bind def
  38. % lettersmall should be letter with an ImagingBBox of [25 25 587 767].
  39.  /lettersmall /letter load def
  40. % note should be letter (or some other size) with the ImagingBBox
  41. % shrunk by 25 units on all 4 sides.
  42.  /note /letter load def
  43.         % End of Adobe-defined page sizes
  44. STRICT { (%END SIZES) .skipeof } if
  45.         % Other page sizes
  46.     % ISO standard paper sizes
  47.  /a0 {2380 3368 //.setpagesize exec} bind def
  48.  /a1 {1684 2380 //.setpagesize exec} bind def
  49.  /a2 {1190 1684 //.setpagesize exec} bind def
  50. % /a3 {842 1190 //.setpagesize exec} bind def    % defined by Adobe
  51. % /a4 {595 842 //.setpagesize exec} bind def    % defined by Adobe
  52.  /a5 {421 595 //.setpagesize exec} bind def
  53.  /a6 {297 421 //.setpagesize exec} bind def
  54.  /a7 {210 297 //.setpagesize exec} bind def
  55.  /a8 {148 210 //.setpagesize exec} bind def
  56.  /a9 {105 148 //.setpagesize exec} bind def
  57.  /a10 {74 105 //.setpagesize exec} bind def
  58. % ISO and JIS B sizes are different....
  59.  /isob0 {2836 4008 //.setpagesize exec} bind def
  60.  /b0 /isob0 load def
  61.  /isob1 {2004 2836 //.setpagesize exec} bind def
  62.  /b1 /isob1 load def
  63.  /isob2 {1418 2004 //.setpagesize exec} bind def
  64.  /b2 /isob2 load def
  65.  /isob3 {1002 1418 //.setpagesize exec} bind def
  66.  /b3 /isob3 load def
  67.  /isob4 {709 1002 //.setpagesize exec} bind def
  68.  /b4 /isob4 load def
  69.  /isob5 {501 709 //.setpagesize exec} bind def
  70.  /b5 /isob5 load def
  71.  /isob6 {354 501 //.setpagesize exec} bind def
  72.  /b6 /isob6 load def
  73.  /jisb0 {2916 4128 //.setpagesize exec} bind def
  74.  /jisb1 {2064 2916 //.setpagesize exec} bind def
  75.  /jisb2 {1458 2064 //.setpagesize exec} bind def
  76.  /jisb3 {1032 1458 //.setpagesize exec} bind def
  77.  /jisb4 {729 1032 //.setpagesize exec} bind def
  78.  /jisb5 {516 729 //.setpagesize exec} bind def
  79.  /jisb6 {363 516 //.setpagesize exec} bind def
  80.  /c0 {2600 3677 //.setpagesize exec} bind def
  81.  /c1 {1837 2600 //.setpagesize exec} bind def
  82.  /c2 {1298 1837 //.setpagesize exec} bind def
  83.  /c3 {918 1298 //.setpagesize exec} bind def
  84.  /c4 {649 918 //.setpagesize exec} bind def
  85.  /c5 {459 649 //.setpagesize exec} bind def
  86.  /c6 {323 459 //.setpagesize exec} bind def
  87.     % U.S. CAD standard paper sizes
  88.  /archE {2592 3456 //.setpagesize exec} bind def
  89.  /archD {1728 2592 //.setpagesize exec} bind def
  90.  /archC {1296 1728 //.setpagesize exec} bind def
  91.  /archB {864 1296 //.setpagesize exec} bind def
  92.  /archA {648 864 //.setpagesize exec} bind def
  93.     % Other paper sizes
  94.  /flsa {612 936 //.setpagesize exec} bind def  % U.S. foolscap
  95.  /flse {612 936 //.setpagesize exec} bind def  % European foolscap
  96.  /halfletter {396 612 //.setpagesize exec} bind def
  97. % /tabloid {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
  98. % /csheet {1224 1584 //.setpagesize exec} bind def % ANSI C 17x22
  99. % /dsheet {1584 2448 //.setpagesize exec} bind def % ANSI D 22x34
  100. % /esheet {2448 3168 //.setpagesize exec} bind def % ANSI E 34x44
  101. %END SIZES
  102. end
  103. currentdict /.setpagesize .undef
  104.  
  105. statusdict begin
  106.  
  107. % Define the pagetype values for the known page formats.
  108. % The values for all but letter and note are arbitrary.
  109. /.pagetypenames
  110.  { /letter /note /legal 
  111.    /a0 /a1 /a2 /a3 /a4 /a5 /a6 /a7 /a8 /a9 /a10
  112.    /b0 /b1 /b2 /b3 /b4 /b5 /b6 /archE /archD /archC /archB /archA
  113.    /flsa /flse /halfletter /11x17 /ledger
  114.  } cvlit readonly def
  115.  
  116. %%%%%% The following items were suggested by a user as useful.
  117.  
  118. % Permanent definitions
  119.  
  120. /ramsize         4194304 def
  121. /hardwareiomode        0 def
  122.     /sethardwareiomode     {pop} bind def
  123. /softwareiomode        0 def
  124.     /setsoftwareiomode     {pop} bind def
  125. /dosysstart        false def
  126.     /setdosysstart         {pop} bind def
  127. /allowjobreset      true def
  128.     /setallowjobreset      {pop} bind def
  129. /defaultpaperfamily    0 def
  130.     /setdefaultpaperfamily {pop} bind def
  131. /defaultpapertray      0 def
  132.     /setdefaultpapertray   {pop} bind def
  133. /defaulttrayswitch false def
  134.     /setdefaulttrayswitch  {pop} bind def
  135.  
  136. % Tray and format selection
  137.  
  138.  /11x17tray {/11x17 .uservar exec} bind def
  139.  /a3tray {/a3 .uservar exec} bind def
  140.  /a4tray {/a4 .uservar exec} bind def
  141.  /a5tray {/a5 .uservar exec} bind def
  142.  /a6tray {/a6 .uservar exec} bind def
  143.  /b4tray {/b4 .uservar exec} bind def
  144.  /b5tray {/b5 .uservar exec} bind def
  145.  /flsatray {/flsa .uservar exec} bind def
  146.  /flsetray {/flse .uservar exec} bind def
  147.  /halflettertray {/halfletter .uservar exec} bind def
  148.  /ledgertray {/ledger .uservar exec} bind def
  149.  /legaltray {/legal .uservar exec} bind def
  150.  /lettertray {/letter .uservar exec} bind def
  151.  
  152. % Per-job parameters
  153.  
  154. /paperfamily 0 def    % 0 is US, 1 is European
  155. /papertray 1 def
  156.     /setpapertray {statusdict exch /papertray exch put} bind def 
  157. /trayswitch false def    % paperout feeds from another tray
  158. % We don't implement the (undocumented by Adobe) papersize 'operator',
  159. % because it's very awkward to make it interact properly with all the
  160. % different ways of setting the paper size.
  161. %/papersize {/letter true} bind def    % <name of paper size>, <short-edge-first-p>
  162. /appletalktype (LaserWriter) def
  163.  
  164. %%%%%% The following items are defined in the PostScript Language
  165. %%%%%% Reference Manual, First Edition, and subsequent 'compatibility'
  166. %%%%%% documentation from Adobe.
  167.  
  168.  /checkpassword {statusdict begin .password eq end} bind def
  169.  /defaulttimeouts {statusdict begin .timeouts aload pop end} bind def
  170.  /diskonline {
  171.     false (%disk*%) { pop not exit } 100 string /IODevice resourceforall
  172.  } bind def
  173. %/dostartpage
  174.  /eescratch {pop 0} bind def
  175.  /idlefonts {statusdict begin mark .idlefonts aload pop end} bind def
  176.  /jobname () def
  177. %/jobtimeout
  178.  /manualfeed false def
  179.  /manualfeedtimeout 60 def
  180.  /margins {statusdict begin .topmargin .leftmargin end} bind def
  181.  /pagecount {4711} bind def
  182.  /pagestackorder {false} bind def
  183.  /pagetype 0 def
  184.  /prefeed false def
  185.  /printererror {pop pop} bind def
  186.  /printername {statusdict /.printername get exch copy} bind def
  187.  /processcolors /processcolors load def        % defined in systemdict
  188.  /product product def        % product is defined in systemdict
  189.  /revision revision def        % revision is defined in systemdict
  190.  /sccbatch {pop 9600 0} bind def
  191.  /sccinteractive {pop 9600 0} bind def
  192.  /setdefaulttimeouts {statusdict begin .timeouts astore pop end} bind def
  193.  /setdostartpage {statusdict exch /dostartpage exch put} bind def
  194.  /setduplexmode {mark /Duplex 3 -1 roll currentdevice putdeviceprops} bind def
  195.  /seteescratch {pop pop} bind def
  196.  /setidlefonts {] statusdict exch /.idlefonts exch put} bind def
  197.  /setjobtimeout {statusdict exch /jobtimeout exch put} bind def
  198.  /setmargins
  199.   { statusdict begin
  200.     /.leftmargin exch def /.topmargin exch def
  201.     end
  202.   } bind def
  203.  
  204. % The following compatibility operators are only documented by Adobe in a
  205. % supplement to the Red Book.
  206. %
  207. %    - pagemargin <offset>
  208. %    - pageparams <width> <height> <offset> <orientation>
  209. %    <width> <height> <orientation> setpage -
  210. %    <offset> setpagemargin -
  211. %    <width> <height> <offset> <orientation> setpageparams -
  212. %
  213. % width and height are in default units (and if orientation is odd, are
  214. % exchanged!).  offset is the x margin, also in default units.
  215. % Unfortunately, because orientation is relative to the device paper feed,
  216. % it does not have a consistent meaning in terms of image orientation.
  217. % We follow the convention that ORIENT1 determines the orientation value
  218. % that means portait: false means 0, true means 1.
  219.  
  220.  /pagemargin { 0 } bind def
  221.  /pageparams
  222.   { currentdevice 1 dict dup /.MediaSize dup put .getdeviceparams
  223.     exch pop exch pop aload pop 0 ORIENT1 { 1 } { 0 } ifelse
  224.   } bind def
  225.  /setpage
  226.   { ORIENT1 { 1 } { 0 } ifelse ne {exch} if
  227.     statusdict /.setpagesize get exec
  228.   } bind def
  229.  /setpagemargin {pop} bind def    % can't do better without setpagedevice
  230.  /setpageparams
  231.   { exch pop ORIENT1 { 1 } { 0 } ifelse ne {exch} if
  232.     statusdict /.setpagesize get exec
  233.   } bind def
  234.  /setpagetype
  235.   { statusdict begin
  236.         % The Adobe documentation only defines setpagetype
  237.         % (a Level 1 operator) as accepting the values 0 and 1,
  238.         % so we do too.
  239.       dup .pagetypenames 0 2 getinterval exch get //systemdict exch get exec
  240.       /pagetype exch def
  241.     end
  242.   } bind def
  243.  /setpassword
  244.   {exch checkpassword
  245.     {statusdict exch /.password exch put true}
  246.     {pop false}
  247.    ifelse} bind def
  248.  /setprintername
  249.   {dup length string copy statusdict exch /.printername exch put} bind def
  250.  
  251. % setresolution is not documented by Adobe, but some applications
  252. % use it anyway, without testing whether or not it is present.
  253. %
  254. %    <pixels_per_inch> setresolution -
  255. %
  256. % sets the resolution of the device.
  257.  
  258.  /setresolution
  259.   { mark /HWResolution [ 4 -1 roll dup ] currentdevice putdeviceprops pop
  260.     initmatrix erasepage
  261.   } bind def
  262.  /setsccbatch {pop pop pop} bind def
  263.  /setsccinteractive {pop pop pop} bind def
  264.  /settumble {pop} bind def
  265.  /waittimeout 300 def
  266.  
  267. %%%%%% End of documented items.
  268.  
  269. /.setpagesize
  270.  { mark /HWSize [
  271.      4 index 4 index matrix defaultmatrix dtransform
  272.      abs ceiling cvi exch abs ceiling cvi exch
  273.    ] currentdevice putdeviceprops pop pop pop
  274.    initmatrix initclip erasepage
  275.  } bind def
  276. /.password 0 def
  277. /.timeouts [0 60 30] def
  278. true setdostartpage
  279. mark setidlefonts
  280. 0 setjobtimeout
  281. 0 0 setmargins
  282. product setprintername
  283.  
  284. end    % statusdict
  285.  
  286. %%%%%% The following documented compatibility "operators" are in systemdict,
  287. %%%%%% not in statusdict.
  288.  
  289. systemdict begin
  290. .currentglobal true .setglobal
  291.  
  292. /devforall {        % <pattern> <proc> <scratch> devforall -
  293.   exch {
  294.     1 index currentdevparams
  295.     /Type .knownget { /FileSystem eq } { false } ifelse
  296.     { exec } { pop pop } ifelse
  297.   } /exec load 3 packedarray cvx exch
  298.   (*) 3 1 roll /IODevice resourceforall
  299. } odef
  300.  
  301. /devstatus {        % <(%disk*%)> devstatus <searchable> <writable>
  302.             %   <hasNames> <mounted> <removable> <searchOrder>
  303.             %   <freePages> <size> true
  304.             % <string> devstatus false
  305.   dup length 5 ge {
  306.     dup 0 5 getinterval (%disk) eq {
  307.       dup /IODevice resourcestatus {
  308.     pop pop dup currentdevparams
  309.     dup /Searchable get
  310.     exch dup /Writeable get
  311.     exch dup /HasNames get
  312.     exch dup /Mounted get
  313.     exch dup /Removable get
  314.     exch dup /SearchOrder get
  315.     exch dup /Free get
  316.     exch /LogicalSize get
  317.     9 -1 roll pop true
  318.       } {
  319.     pop false
  320.       } ifelse
  321.     } {
  322.       pop false
  323.     } ifelse
  324.   } {
  325.     pop false
  326.   } ifelse
  327. } odef
  328.  
  329. .setglobal end    % systemdict
  330.  
  331. % The following contents of serverdict are a complete guess,
  332. % based on some observed LaserWriter boilerplate.
  333.  
  334. serverdict begin
  335.  
  336.  /execjob { } bind def
  337. % The Red Book implies that something like the following is
  338. % an appropriate definition of exitserver.
  339.  /exitserver { clear stop } bind def
  340. % However, this interacts badly with our standard error handler,
  341. % so we override it with the following less appropriate definition.
  342.  /exitserver { 0 ne { clear cleardictstack } if } bind def
  343.  /setrealdevice { } bind def
  344.  
  345. end    % serverdict
  346.