%N psdriv %F $MIR/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_science_miriad/miriad/work/miriad-4.3.8/borrow/pgplot/drivers/psdriv.f
%D PGPLOT PostScript drivers
%B
      SUBROUTINE PSDRIV (IFUNC, RBUF, NBUF, CHR, LCHR, MODE)
      INTEGER IFUNC, NBUF, LCHR, MODE
      REAL    RBUF(*)
      CHARACTER*(*) CHR

 PGPLOT driver for PostScript devices.

 Version 1.2  - 1987 Aug  5 - T. J. Pearson.
 Version 1.3  - 1987 Nov 16 - add "bind" commands to prolog - TJP.
 Version 1.4  - 1988 Jan 28 - change dimensions so whole field can be
                              plotted - TJP.
 Version 1.5  - 1988 Oct 27 - make EOF characters optional - TJP.
 Version 1.6  - 1988 Dec 15 - standard Fortran - TJP.
 Version 1.7  - 1989 Jul  5 - change color indices so most colors
                              are black - TJP.
 Version 2.0  - 1990 Sep 10 - parameterize dimensions; correct
                              bounding box; add color support (from
                              D. Meier's CPdriver) - TJP.
 Version 2.1  - 1991 Nov 29 - update Document Structuring Conventions
                              to version 3.0.
 Version 3.0  - 1992 Sep 22 - add marker support; add CPS and VCPS
                              modes - TJP.
 Version 3.1  - 1992 Nov 12 - up to 256 colors.
 Version 3.2  - 1993 May 26 - correct error in marker support.
 Version 4.0  - 1993 Sep 20 - trap Fortran I/O errors.
 Version 4.1  - 1994 Aug  4 - make marker support optional.
 Version 5.0  - 1994 Aug 30 - support for images.
 Version 5.1  - 1994 Sep  7 - support for PGQCR.
 Version 5.2  - 1994 Oct 12 - add IDENT option.
 Version 5.3  - 1995 May  8 - recognise '-' as standard output; keep
                              track of bounding box; use upper case
                              for all defined commands; move
                              showpage outside save/restore.
 Version 5.4  - 1995 Aug 19 - correct usage of PS_BBOX.
 Version 6.0  - 1995 Dec 28 - reject concurrent access.
 Version 6.1  - 1996 Apr 29 - decode environment variables using GRCTOI.
 Version 6.2  - 1996 Oct  7 - correct bounding-box error (K-G Adams);
                              correct error in use of GCTOI (G Gonczi);
                              suppress <0 0 C> commands (R Scharroo);
                              allow arbitrary page size.
 Version 6.3  - 1997 Nov 14 - shorter commands for setrgbcolor and setgray.
 Version 6.4  - 1997 Nov 19 - workaround a Ghostscript bug: split long
                              polylines into shorter segments.
 Version 6.5  - 1998 Feb 23 - support for real linewidth.
 Version 6.6  - 1998 Nov 10 - provide easy way to convert color to grey.
 Version 6.7  - 1998 Dec 12 - added #copies to header.
         6.8?   2006 Jul  7 - fixed PS-Adobe-3.0 header for multipage output

 Supported device: 
   Any printer that accepts the PostScript page description language, 
   eg, the LaserWriter (Apple Computer, Inc.).
   PostScript is a trademark of Adobe Systems Incorporated.

 Device type code: 
   /PS (monochrome landscape mode, long edge of paper horizontal).
   /CPS (color landscape mode, long edge of paper horizontal).
   /VPS (monochrome portrait mode, short edge of paper horizontal).
   /VCPS (color portrait mode, short edge of paper horizontal).

 Default file name:
   pgplot.ps

 Default view surface dimensions:
   10.5 inches horizontal x  7.8 inches vertical (landscape mode),
    7.8 inches horizontal x 10.5 inches vertical (portrait mode).
   These dimensions can be changed with environment variables.

 Resolution:
   The driver uses coordinate increments of 0.001 inch, giving an
   ``apparent'' resolution of 1000 pixels/inch. The true resolution is
   device-dependent; eg, on an Apple LaserWriter it is 300 pixels/inch
   (in both dimensions). 

 Color capability (monochrome mode): 
   Color indices 0-255 are supported. Color index 0 is white (erase
   or background color), indices 1-13 are black, 14 is light grey,
   and 15 is dark grey.

 Color capability (color mode):
   Color indices 0-255 are supported. Color index 0 is white (erase
   or background color), index 1 is black, and indices 2-15 have the
   standard PGPLOT color assignments.

 Input capability: none.

 File format: the file contains variable length records (maximum 132
 characters) containing PostScript commands. The commands use only
 printable ASCII characters, and the file can be examined or modified 
 with a text editor. 

 Obtaining hardcopy: use the operating system print or copy command to
 send the file to a suitable device.

 Environment variables:

  PGPLOT_PS_WIDTH      default  7800
  PGPLOT_PS_HEIGHT     default 10500
  PGPLOT_PS_HOFFSET    default   350
  PGPLOT_PS_VOFFSET    default   250
 These variables tell PGPLOT how big an image to produce. The defaults
 are appropriate for 8.5 x 11-inch paper. The maximum dimensions of
 a PGPLOT image are WIDTH by HEIGHT, with the lower left corner offset
 by HOFFSET horizontally and VOFFSET vertically from the lower left
 corner of the paper. The units are milli-inches. The "top" of the
 paper is the edge that comes out of the printer first.

  PGPLOT_IDENT
 If this variable is set, the user name, date and time are written
 in the bottom right corner of each page.

  PGPLOT_PS_BBOX
 If this variable has value MAX, PGPLOT puts standard (full-page)
 bounding-box information in the header of the PostScript file. If
 the variable is unset or has some other value, PGPLOT puts the
 correct (smallest) bounding box information in the trailer of the
 PostScript file.

  PGPLOT_PS_EOF
 Normally the output file does not contain special end-of-file
 characters. But if environment variable PGPLOT_PS_EOF is defined
 (with any value) PGPLOT writes a control-D job-separator character at 
 the beginning and at the end of the file. This is appropriate for
 Apple LaserWriters using the serial interface, but it may not be 
 appropriate for other PostScript devices.

  PGPLOT_PS_MARKERS
 Specify "NO" to suppress use of a PostScript font for the graph
 markers; markers are then emulated by line-drawing. 

 Document Structuring Conventions:

  The PostScript files conform to Version 3.0 of the Adobe Document 
  Structuring Conventions (see ref.3) and to version 3.0 of the
  encapsulated PostScript file (EPSF) format. This should allow
  the files to be read by other programs that accept the EPSF format.
  Note, though, that multi-page plots are not valid EPSF files. The
  files do not contain a screen preview section.

 References:

 (1) Adobe Systems, Inc.: PostScript Language Reference Manual.
 Addison-Wesley, Reading, Massachusetts, 1985.
 (2) Adobe Systems, Inc.: PostScript Language Tutorial and Cookbook.
 Addison-Wesley, Reading, Massachusetts, 1985.
 (3) Adobe Systems, Inc.: PostScript Language Reference Manual, Second 
 Edition. Addison-Wesley, Reading, Massachusetts, 1990.
