! @(#)check.telescope	17.1.1.1 (ESO-IPG) 01/25/02 17:46:03
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
!  procedure `check.telescope' to check Midas (devices) 
!                              at a telescope in La Silla
!  K. Banse	ESO - IPG, Garching
!  950405
! 
!  execute via @ check.telescope 
! 
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
assign/defaults
! 
! check tapedrive
! 
define/local tpdat/i/1/1 0
define/local tapedev/c/1/8 "tapedat " 
define/local ic/i/1/2 0,0
open/file MID_MONIT:devices.sh read ic
! 
read_loop:
write/keyw inputc/c/1/80 " " all
read/file {ic(1)} inputc
if ic(2) .ne. -1 then
   if inputc(1:7) .eq. "tapedat" then
      tpdat(1) = 1
      if inputc(8:8) .eq. "0" then
         tapedev(8:8) = "0"
         goto close_it
      elseif inputc(8:8) .eq. "1" then
         tapedev(8:8) = "1"
         goto close_it
      endif
   endif
   goto read_loop
endif
! 
close_it:
close/file {ic(1)}
! 
if tpdat(1) .eq. 0 then			!no DAT tape
   write/out "no DAT tape drive, so we create" artificial image `veri0001.bdf'
   create/image veri0001 2,512,512 ? gauss 256,256,256,256
else
   write/out "we use DAT drive: {tapedev}," please, -
             "enter a tape containing a 2-dim file in FITS format"
   write/out "and hit RETURN, when you're ready"
   inquire/keyw inputc "or type NO, if you do not want the tape input"
   if inputc(1:2) .eq. "NO" then
      write/out "O.K. we create" artificial image `veri0001.bdf'
      create/image veri0001 2,512,512 ? gauss 256,256,256,256
   else
      intape/fits 1 veri {tapedev}
   endif
endif
read/descr veri0001 *
! 
! check printer + PRINT commands
! 
write/out 
write/out "we check ASCII printing via the" "command: print/image veri0001"
write/out 
print/image veri0001
! 
! check Postscript jobs
!
write/out 
write/out "we display the image + check Postscript printing "
write/out "via the" "command: copy/display"
write/out 
create/display
load/image veri0001
copy/display LASER
! 
write/out 
write/out "we plot the 1. row of the image + send graph to printer "
write/out "via the" "command: copy/graphics"
write/out 
create/graphics
plot/row veri0001
copy/graph LASER
! 
delete/image veri0001 no
