[comp.lang.idl-pvwave] Fixes for LN03 procedure under VMS

rivers@bnlls1.nsls.bnl.gov (Mark Rivers) (01/24/91)

The LN03 procedure (which routes Tektronix output to a file so it can be sent
to an LN03+ printer does not correctly work in PV-WAVE Version 3.x under VMS. 
The following changes will fix the problems.


;
; $Id: ln03.pro,v 1.1 90/01/23 16:43:18 wave Exp $
;
; This file was modified by Mark L. Rivers, to fix
; two bugs under VMS. 
;
; The /NONE qualifier was added to the OPENW call to set the RMS 
; carriagecontrol options to NONE.
;
; Also when closing the file the line:
;   device, /tek4014, plot_to = 0
; must come BEFORE the line
;   printf, OLUN, esc+'[?38l'
; so these two lines were switched. (otherwise the printer is taken out of
; Tektronix mode before the driver buffer is flushed.)
;
pro LN03, filename

;  NAME:
;        LN03
;  PURPOSE:
;  Procedure to open or close an output file for LN03 graphics output.
;  To open an output file for the LN03:
;      LN03, 'filename'
;  where filename is the output file to be written. 
;  To close the output file, type:
;      LN03

common SAVE, OLUN, DEV
;
esc = string(27B)
NP = n_params (dummy)
;
if NP eq 1 then begin
   ckstr = size (filename)
   if ckstr(1) ne 7 then begin
      print, 'Parameter to LN03 must be a filename of type string.'
      return
   endif
endif
;
CLOSE = 0
if NP lt 1 then CLOSE = 1
;
if CLOSE eq 0 then begin
   DEV = !D
   get_lun, OLUN
   openw, OLUN, filename, /none
   set_plot, 'tek'
   device, /tek4014, plot_to = OLUN
   printf, OLUN, esc+'[?38h'
endif else begin
   device, /tek4014, plot_to = 0
   printf, OLUN, esc+'[?38l'
   free_lun, OLUN
   set_plot,DEV.NAME
endelse
;
return
end
Mark Rivers                              (516) 282-7708 or 5626
Building 815                             rivers@bnlx26.nsls.bnl.gov (Internet) 
Brookhaven National Laboratory           rivers@bnl (Bitnet)                   
Upton, NY 11973                          BNLX26::RIVERS  (Physnet)