home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / gs-esp / 8.15 / lib / gs_statd.ps < prev    next >
Encoding:
Text File  |  2006-07-06  |  13.8 KB  |  387 lines

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