! @(#)checkdev.prg 17.1.1.2 (ES0-DMD) 02/25/02 17:44:13 !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ !.IDENTIFICATION: checkdev.prg !.PURPOSE: MIDAS procedure checkdev.prg check the hardcopy device !.AUTHOR: R.H. Warmels, ESO - Garching !.USE: @ checkdev p1 ! where p1 is the device name that can a MIDAS logical name or a ! system device name. ! The procedure returns the device and the associated driver in the ! keywords Q1 and Q2. ! The input can be either a MIDAS device name or a system name. ! ! In case the input is a MIDAS local name, it is first converted to ! a system name, using the file /$MIDASHOME/$MIDVERS/monit/devices.sh ! After having obtained the system device name this name is looked ! for in the file /$MIDASHOME/$MIDVERS/systab/ascii/plot/agldevs.dat ! which contains all legal devices for the graphics and their drives, ! and using the MIDAS function M$AGL. ! ! A fatal message will be issued if the device is unknown or missing. ! The file agldevs.dat describes the syntax used internally. ! !.VERSION: 930503 RHW Creation ! ! 020222 last modif ! !---------------------------------------------------------------------------- ! define/parameter p1 LASER c ! get the default device or input from user ! set/format i1 ! ! *** MIDAS Logical names if p1(1:3) .eq. "las" .or. p1(1:3) .eq. "col" then ! default laser define/local psc/c/1/20 " " all ! used for postscript option define/local ind/i/1/1 0 ! used for postscript option ! ind = m$index(p1,".") if ind .gt. 0 then define/local len/i/1/1 0 define/local opt/c/1/1 " " ind = ind-1 psc = m$upper("{p1(1:{ind})}") ind = ind+2 opt = "{p1({ind}:{ind})}" p1 = m$symbol(psc) len = m$len(p1) + 1 write/keyw p1/c/{len}/2 ".{opt}" else if p1(1:3) .eq. "las" then write/keyw psc LASER elseif P1(1:3) .eq. "col" then write/keyw psc COLOUR else psc = m$upper(p1) endif p1 = m$symbol(psc) endif ! elseif p1(1:3) .eq. "sli" then ! default slide writter p1 = m$symbol("SLIDE") ! elseif p1(1:3) .eq. "pen" then ! default penplotter p1 = m$symbol("PENPLOT") ! elseif p1(1:3) .eq. "nul" then ! default null device p1 = "null" endif ! ! *** NOW WE HAVE ALL NAMES CONVERTED INTO DISPLAY or SYSTEM NAMES ! *** They should be listed in MIDASHOME/MIDVERS/systab/ascii/plot/agldevs.dat ! *** lets check that define/local agldev/c/1/40 " " all ! device plus driver define/local device/c/1/20 " " all ! device name define/local driver/c/1/20 " " all ! driver define/local kk/i/1/1/ 0 define/local lowp1/c/1/60 " " all ! lowp1 = m$lower(p1) ! convert to lowercase agldev = m$agl(lowp1) ! get system+driver if agldev(1:1) .eq. " " then write/out "*** FATAL: Unknown device name or device not available;" write/out " consult HELP [PRINTERS]" return/exit endif ! ! *** So, now we have a valid devices name kk = m$index(agldev,":") - 1 ! get the device name write/keyw device/c/1/20 {agldev(1:{kk})} kk = m$index(device,".") if kk .gt. 0 write/keyw device/c/{kk}/3 " " ! kk = m$index(agldev,":") + 1 ! get the device type write/keyw driver/c/1/20 {agldev({kk}:>)} ! return {device} {driver}