home *** CD-ROM | disk | FTP | other *** search
/ jppd.dyndns.org / jppd.dyndns.org.tar / jppd.dyndns.org / QUERYPRO / Impressora_PDF / converter.exe / GPLGS / gs_statd.ps < prev    next >
Text File  |  2004-02-14  |  14KB  |  375 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.  /flsa {612 936 //.setpagesize exec} bind def  % U.S. foolscap
  105.  /flse {612 936 //.setpagesize exec} bind def  % European foolscap
  106.  /halfletter {396 612 //.setpagesize exec} bind def
  107.     % minimum of a4 and letter (a4 width, letter length)
  108.  /pa4 {595 792 //.setpagesize exec} bind def
  109. % /tabloid {792 1224 //.setpagesize exec} bind def  % 11x17 portrait
  110. % /csheet {1224 1584 //.setpagesize exec} bind def % ANSI C 17x22
  111. % /dsheet {1584 2448 //.setpagesize exec} bind def % ANSI D 22x34
  112. % /esheet {2448 3168 //.setpagesize exec} bind def % ANSI E 34x44
  113. %END SIZES
  114. end
  115. currentdict /.setpagesize .undef
  116.  
  117. statusdict begin
  118.  
  119. % Define the pagetype values for the known page formats.
  120. % The values for all but letter and note are arbitrary.
  121. /.pagetypenames
  122.  [ /letter /note    %do not change this line, needed by 'setpagetype'
  123.    /legal /lettersmall
  124.    /11x17 /ledger
  125.    /a4small /a3 /a4
  126. STRICT { (%END SIZES) .skipeof } if
  127.    /a0 /a1 /a2 /a5 /a6 /a7 /a8 /a9 /a10
  128.    /archA /archB /archC /archD /archE
  129.    /b0 /b1 /b2 /b3 /b4 /b5 /b6
  130.    /c0 /c1 /c2 /c3 /c4 /c5 /c6
  131.    /flsa /flse /halfletter
  132.    /isob0 /isob1 /isob2 /isob3 /isob4 /isob5 /isob6
  133.    /jisb0 /jisb1 /jisb2 /jisb3 /jisb4 /jisb5 /jisb6
  134.    /pa4
  135. %END SIZES
  136.  ] cvlit readonly def
  137.  
  138. %%%%%% The following items were suggested by a user as useful.
  139.  
  140. % Permanent definitions
  141.  
  142. /ramsize         4194304 def
  143. /hardwareiomode        0 def
  144.     /sethardwareiomode     {pop} bind def
  145. /softwareiomode        0 def
  146.     /setsoftwareiomode     {pop} bind def
  147. /dosysstart        false def
  148.     /setdosysstart         {pop} bind def
  149. /allowjobreset      true def
  150.     /setallowjobreset      {pop} bind def
  151. /defaultpaperfamily    0 def
  152.     /setdefaultpaperfamily {pop} bind def
  153. /defaultpapertray      0 def
  154.     /setdefaultpapertray   {pop} bind def
  155. /defaulttrayswitch false def
  156.     /setdefaulttrayswitch  {pop} bind def
  157.  
  158. % Tray and format selection
  159.  
  160.  /11x17tray {/11x17 .uservar exec} bind def
  161.  /a3tray {/a3 .uservar exec} bind def
  162.  /a4tray {/a4 .uservar exec} bind def
  163.  /a5tray {/a5 .uservar exec} bind def
  164.  /a6tray {/a6 .uservar exec} bind def
  165.  /b4tray {/b4 .uservar exec} bind def
  166.  /b5tray {/b5 .uservar exec} bind def
  167.  /flsatray {/flsa .uservar exec} bind def
  168.  /flsetray {/flse .uservar exec} bind def
  169.  /halflettertray {/halfletter .uservar exec} bind def
  170.  /ledgertray {/ledger .uservar exec} bind def
  171.  /legaltray {/legal .uservar exec} bind def
  172.  /lettertray {/letter .uservar exec} bind def
  173.  
  174. % Per-job parameters
  175.  
  176. /paperfamily 0 def    % 0 is US, 1 is European
  177. /papertray 1 def
  178.     /setpapertray {statusdict exch /papertray exch put} bind def 
  179. /trayswitch false def    % paperout feeds from another tray
  180. % We don't implement the (undocumented by Adobe) papersize 'operator',
  181. % because it's very awkward to make it interact properly with all the
  182. % different ways of setting the paper size.
  183. %/papersize {/letter true} bind def    % <name of paper size>, <short-edge-first-p>
  184. /appletalktype (LaserWriter) def
  185.  
  186. %%%%%% The following items are defined in the PostScript Language
  187. %%%%%% Reference Manual, First Edition, and subsequent 'compatibility'
  188. %%%%%% documentation from Adobe.
  189.  
  190.  /checkpassword {statusdict begin .password eq end} bind def
  191.  /defaulttimeouts {statusdict begin .timeouts aload pop end} bind def
  192.  /diskonline {
  193.     false (%disk*%) { pop not exit } 8192 string /IODevice resourceforall
  194.  } bind def
  195.  /diskstatus {10240 2097152 } bind odef %  - diskstatus <free> <total> (in 1024 byte pages)
  196.  
  197. %/dostartpage
  198.  /eescratch {pop 0} bind def
  199.  /idlefonts {statusdict begin mark .idlefonts aload pop end} bind def
  200.  /jobname () def
  201. %/jobtimeout
  202.  /manualfeed false def
  203.  /manualfeedtimeout 60 def
  204.  /margins {statusdict begin .topmargin .leftmargin end} bind def
  205.  /pagecount {4711} bind def
  206.  /pagestackorder {false} bind def
  207.  /pagetype 0 def
  208.  /prefeed false def
  209.  /printererror {pop pop} bind def
  210.  /printername {statusdict /.printername get exch copy} bind def
  211.  /processcolors /processcolors load def        % defined in systemdict
  212.  /product product def        % product is defined in systemdict
  213.  /revision revision def        % revision is defined in systemdict
  214.  /sccbatch {pop 9600 0} bind def
  215.  /sccinteractive {pop 9600 0} bind def
  216.  /setdefaulttimeouts {statusdict begin .timeouts astore pop end} bind def
  217.  /setdostartpage {statusdict exch /dostartpage exch put} bind def
  218.  /setduplexmode {mark /Duplex 3 -1 roll currentdevice putdeviceprops} bind def
  219.  /seteescratch {pop pop} bind def
  220.  /setidlefonts {] statusdict exch /.idlefonts exch put} bind def
  221.  /setjobtimeout {statusdict exch /jobtimeout exch put} bind def
  222.  /setmargins
  223.   { statusdict begin
  224.     /.leftmargin exch def /.topmargin exch def
  225.     end
  226.   } bind def
  227.  
  228. % The following compatibility operators are only documented by Adobe in a
  229. % supplement to the Red Book.
  230. %
  231. %    - pagemargin <offset>
  232. %    - pageparams <width> <height> <offset> <orientation>
  233. %    <width> <height> <orientation> setpage -
  234. %    <offset> setpagemargin -
  235. %    <width> <height> <offset> <orientation> setpageparams -
  236. %
  237. % width and height are in default units (and if orientation is odd, are
  238. % exchanged!).  offset is the x margin, also in default units.
  239. % Unfortunately, because orientation is relative to the device paper feed,
  240. % it does not have a consistent meaning in terms of image orientation.
  241. % We follow the convention that ORIENT1 determines the orientation value
  242. % that means portait: false means 0, true means 1.
  243.  
  244.  /pagemargin { 0 } bind def
  245.  /pageparams
  246.   { currentdevice 1 dict dup /.MediaSize dup put .getdeviceparams
  247.     exch pop exch pop aload pop 0 ORIENT1 { 1 } { 0 } ifelse
  248.   } bind def
  249.  /setpage
  250.   { ORIENT1 { 1 } { 0 } ifelse ne {exch} if
  251.     statusdict /.setpagesize get exec
  252.   } bind def
  253.  /setpagemargin {pop} bind def    % can't do better without setpagedevice
  254.  /setpageparams
  255.   { exch pop ORIENT1 { 1 } { 0 } ifelse ne {exch} if
  256.     statusdict /.setpagesize get exec
  257.   } bind def
  258.  /setpagetype
  259.   { statusdict begin
  260.         % The Adobe documentation only defines setpagetype
  261.         % (a Level 1 operator) as accepting the values 0 and 1,
  262.         % so we do too.
  263.       dup .pagetypenames 0 2 getinterval exch get
  264.       //systemdict /userdict get exch get cvx exec
  265.       /pagetype exch def
  266.     end
  267.   } bind def
  268.  /setpassword
  269.   {exch checkpassword
  270.     {statusdict exch /.password exch put true}
  271.     {pop false}
  272.    ifelse} bind def
  273.  /setprintername
  274.   {dup length string copy statusdict exch /.printername exch put} bind def
  275.  
  276. % setresolution is not documented by Adobe, but some applications
  277. % use it anyway, without testing whether or not it is present.
  278. %
  279. %    <pixels_per_inch> setresolution -
  280. %
  281. % sets the resolution of the device.
  282.  
  283.  /setresolution
  284.   { mark /HWResolution [ 4 -1 roll dup ] currentdevice putdeviceprops pop
  285.     initmatrix erasepage
  286.   } bind def
  287.  /setsccbatch {pop pop pop} bind def
  288.  /setsccinteractive {pop pop pop} bind def
  289.  /settumble {pop} bind def
  290.  /waittimeout 300 def
  291.  
  292. %%%%%% End of documented items.
  293.  
  294. /.setpagesize
  295.  { mark /HWSize [
  296.      4 index 4 index matrix defaultmatrix dtransform
  297.      abs ceiling cvi exch abs ceiling cvi exch
  298.    ] currentdevice putdeviceprops pop pop pop
  299.    initmatrix initclip erasepage
  300.  } bind def
  301. /.password 0 def
  302. /.timeouts [0 60 30] def
  303. true setdostartpage
  304. mark setidlefonts
  305. 0 setjobtimeout
  306. 0 0 setmargins
  307. product setprintername
  308.  
  309. end    % statusdict
  310.  
  311. %%%%%% The following documented compatibility "operators" are in systemdict,
  312. %%%%%% not in statusdict.
  313.  
  314. systemdict begin
  315. .currentglobal true .setglobal
  316.  
  317. /devformat true def
  318. /devforall {        % <pattern> <proc> <scratch> devforall -
  319.   exch {
  320.     1 index currentdevparams
  321.     /Type .knownget { /FileSystem eq } { false } ifelse
  322.     { exec } { pop pop } ifelse
  323.   } /exec load 3 packedarray cvx exch
  324.   (*) 3 1 roll /IODevice resourceforall
  325. } odef
  326.  
  327. /devstatus {        % <(%disk*%)> devstatus <searchable> <writable>
  328.             %   <hasNames> <mounted> <removable> <searchOrder>
  329.             %   <freePages> <size> true
  330.             % <string> devstatus false
  331.   dup length 5 ge {
  332.     dup 0 5 getinterval (%disk) eq {
  333.       dup /IODevice resourcestatus {
  334.     pop pop dup currentdevparams
  335.     dup /Searchable get
  336.     exch dup /Writeable get
  337.     exch dup /HasNames get
  338.     exch dup /Mounted get
  339.     exch dup /Removable get
  340.     exch dup /SearchOrder get
  341.     exch dup /Free get
  342.     exch /LogicalSize get
  343.     9 -1 roll pop true
  344.       } {
  345.     pop false
  346.       } ifelse
  347.     } {
  348.       pop false
  349.     } ifelse
  350.   } {
  351.     pop false
  352.   } ifelse
  353. } odef
  354.  
  355. .setglobal end    % systemdict
  356.  
  357. % The following contents of serverdict are a complete guess,
  358. % based on some observed LaserWriter boilerplate.
  359.  
  360. serverdict begin
  361.  
  362.  /execjob { } bind def
  363. % The Red Book implies that something like the following is
  364. % an appropriate definition of exitserver.
  365.  /exitserver { clear stop } bind def
  366. % However, this interacts badly with our standard error handler,
  367. % so we override it with the following less appropriate definition.
  368.  /exitserver { 0 ne { clear cleardictstack } if } bind def
  369.  /setrealdevice { } bind def
  370.  
  371. end    % serverdict
  372.