# PS_open.pro

At APS this program is installed in the /usr/local/epics/extensions/bin/$HOST_ARCH directory. This is a utility program for supporting PostScript plot.

# List of Routines

- OS_INIT
- PS_CLOSE
- PS_ENSCRIPT
- PS_OPEN
- PS_PRINT
- PS_PRINTER

# Routine Descriptions

## OS_INIT

[Next Routine] [List of Routines]

     NAME:
    	OS_INIT

     PURPOSE:
           Defines the structure of main operating system variables. All the
           operating system dependent varibles used in data catcher are
           assembled in this routine.

     CATEGORY:
           Global System Variables !os.

     CALLING SEQUENCE:
           OS_INIT

     PARAMETER FIELDS:
           ARCH:           IDL detected operating system architecture
           OS:             IDL detected operating system
           OS_FAMILY:      IDL detected operating system family
           RELEASE:        IDL release number
           FONT:           Bold font used in highlight label in dialog
           DEVICE:         Default output device
           FILE_SEP:       Operating sytem file separator, '/' for unix '\' for W95
           CHMOD:          Command change file permission mode, 'chmod'
           MV:             Command rename file, 'mv' for unix, 'rename' for W95
           CP:             Command copy file, 'cp' for unix, 'copy' for W95
           RM:             Command remove file, 'rm' for unix, 'del' for W95
           LPR:            Command print PS file, 'lpr' for unix, 'print' for W95
           PRT:            Command print text file, 'enscript' for unix, 'print' for W95
           PRINTER:        Default printer name, ''
           WC:             Command return line count, 'wc' for unix

     COMMON BLOCKS:
           COMMON SYSTEM_BLOCK

     SIDE EFFECTS:
           This routine defines the OS_SYSTEM structure and the global
           system variable !os. All the system dependent varialbes used in
           data catcher and data viewer are kept in this routine.

     RESTRICTIONS:
           Current version works for Unix and W95 operating system.

     PROCEDURE:
           Porting to other operating system, the corresponding
           fields in 'os.init' may need to be modified accordingly.

     EXAMPLE:

                   OS_INIT

     MODIFICATION HISTORY:
           Written by:     Ben-chin K. Cha, 6-01-97.
           xx-xx-xx iii  - comment

(See PS_open.pro)

## PS_CLOSE

[Previous Routine] [Next Routine] [List of Routines]

     NAME:
           PS_CLOSE

     PURPOSE:
           This routine closes the PostScript output device and resets the
           the original system graphic device as the output plot device.

     CALLING SEQUENCE:
           PS_CLOSE

     INPUTS:
           None.

     OUTPUTS:
           None.

     KEYWORD PARAMETERS:
           None.

     COMMON BLOCKS:
           COMMON SYSTEM_BLOCK
           COMMON COLORS

     RESTRICTIONS:
           The program 'PS_open.pro' must be loaded into IDL prior calling
           this routine.

     EXAMPLE:

            PS_OPEN, 'myfile.ps'
            tvscl,scan
            PS_CLOSE

     MODIFICATION HISTORY:
           Written by:     Ben-chin K. Cha, 03-23-95.

           07-28-97   bkc  Add the support for reverse PostScript color scheme.
                           Add handling capability for different operating system

(See PS_open.pro)

## PS_ENSCRIPT

[Previous Routine] [Next Routine] [List of Routines]

     NAME:
           PS_ENSCRIPT

     PURPOSE:
           This routine uses the system printing command to print
           an ASCII text file. On unix operating system the command
           'enscript -r' is used.

     CALLING SEQUENCE:
           PS_ENSCRIPT, 'filename'

     INPUTS:
           filename : Specifies the ASCII filename to be printed.

     OUTPUTS:
           A copy of the specified file is sent to the user selected
           printer.

     KEYWORD PARAMETERS:

     COMMON BLOCKS:
           COMMON SYSTEM_BLOCK

     RESTRICTIONS:
           The program 'PS_open.pro' must be loaded into IDL prior calling
           this routine.

     EXAMPLE:

            PS_ENSCRIPT, 'myfile'

     MODIFICATION HISTORY:
           Written by:     Ben-chin K. Cha, 03-23-95.

           07-28-97   bkc  Add handling capability for different operating system

(See PS_open.pro)

## PS_OPEN

[Previous Routine] [Next Routine] [List of Routines]

     NAME:
           PS_OPEN

     PURPOSE:
           This routine sets the current graphics device to PostScript.
           and saves plot in a user specified PostScript file.

     CALLING SEQUENCE:
           PS_OPEN, 'myfile.ps' [,/TV]

     INPUTS:
           myfile.ps:  Specifies the PostScript filename to be saved.

     OUTPUTS:
           The PostScript graphic output is saved which can be sent to
           any PostScript printer or viewer.

     KEYWORD PARAMETERS:
           TV:       Specifies whether reverse color video to be used in PS.

     COMMON BLOCKS:
           COMMON PRINTER_BLOCK
           COMMON COLORS

     RESTRICTIONS:
           The program 'PS_open.pro' must be loaded into IDL first before
           calling this routine.

     EXAMPLE:

            PS_OPEN, 'myfile.ps'
            tvscl,scan
            PS_CLOSE

     MODIFICATION HISTORY:
           Written by:     Ben-chin K. Cha, 03-23-95.

           07-28-97   bkc  Add the support for color PostScript
                           Add the support for reverse video
                           Add handling capability for different operating system
           05-15-98   bkc  Change the reverse video to reverse legend color for
                           2D TV plot, to get reverse video use the xloadct's
                           option, reverse feature

(See PS_open.pro)

## PS_PRINT

[Previous Routine] [Next Routine] [List of Routines]

     NAME:
           PS_PRINT

     PURPOSE:
           This routine uses the system printing command to print
           a PostScript or ASCII text file. On the unix operating
           system the command 'lpr' is used.

     CALLING SEQUENCE:
           PS_PRINT, 'myfile.ps'

     INPUTS:
           myfile:    Specifies either the PostScript or ASCII text filename
                      to be printed.

     OUTPUTS:
           A copy of the specified file is sent to the user selected
           printer.

     KEYWORD PARAMETERS:

     COMMON BLOCKS:
           COMMON SYSTEM_BLOCK

     RESTRICTIONS:
           The program 'PS_open.pro' must be loaded into IDL prior calling
           this routine.

     EXAMPLE:

            PS_PRINT, 'myfile.ps'

     MODIFICATION HISTORY:
           Written by:     Ben-chin K. Cha, 03-23-95.

           07-28-97   bkc  Add handling capability for different operating system
           05-14-98   bkc  Add the checking for unreadable color on the PS plot
                           On unix if the color is too light use the gv to preview
    			pops up setup printer and info dialog

(See PS_open.pro)

## PS_PRINTER

[Previous Routine] [List of Routines]

     NAME:
    	PS_PRINTER

     PURPOSE:
           This widget dialog allows the user to set up PostScript printer
           and printer name to be used by the IDL session. Default setting
           is color PS using default printer.

     CATEGORY:
           Widgets.

     CALLING SEQUENCE:
           PS_PRINTER [,GROUP=Group]

     INPUTS:
           None.

     KEYWORD PARAMETERS:
           GROUP:  The widget ID of the group leader of the widget. If this
                   keyword is specified, the death of the group leader results in
                   the death of PS_PRINTER.

     OUTPUTS:

     COMMON BLOCKS:
           COMMON PRINTER_BLOCK

     SIDE EFFECTS:
           Initially the system printer is set to the user's default
           printer. If a null printer name is specified, whatever the
           system printer was previously set will be used.

     RESTRICTIONS:
           The program 'PS_open.pro' must be loaded into IDL prior calling
           this routine.

     PROCEDURE:

     EXAMPLE:

                   PS_PRINTER

     MODIFICATION HISTORY:
           Written by:     Ben-chin K. Cha, 6-01-97.
           10-15-97 bkc  - Add droplist Y/N for reverse color option
                           Now it defaults to non reverse color option.
           05-14-98 bkc  - Remove the B/W option, use the xloadct to select B/W
                           Change reverse video to reverse legeng color if legend
                           is in white color

(See PS_open.pro)