#!/bin/csh -f #+ # lamps -- turn DEIMOS calibration lamps on/off and show status # # Purpose: # With no arguments, display the current DEIMOS lamp status. With # arguments, turn lamps on or off as requested. # # Usage: # lamp [action] # # Arguments: # action = one of the following options # on = all lamps on (except quartz) # off = all lamps off # kr = turn on Kr lamp # xe = turn on Xe lamp # hg = turn on Hg lamp # ne = turn on Ne lamp # ar = turn on Ar lamp # cd = turn on Cd lamp # zn = turn on Zn lamp # qz = turn on internal Halogen lamp # You can use upper or lower case in these arguments. # # Output: # The resultant lamp settings are printed to stdout # # Restrictions: # # Exit values: # 0 = normal completion # # Examples: # 1) Turn on all line lamps (no Halogen): # lamps on # # 2) Turn off all lamps: # lamps off # # 3) Turn on the Ne and Ar lamps only: # lamps ne ar # #- # Modification history: # Date unknown RWG Original version # 2000-Jul-05 GDW Added documentation # 2001-Mar-12 GDW "on" does not turn on Halogen lamp # 2001-Mar-29 RWG Fixed bug in `tolower $1` -> `tolower $*` # 2001-Apr-12 GDW Modified for new Zn and Cd lamps # 2001-Apr-13 GDW Annotated list # 2002-Nov-22 GDW Adapted for DEIMOS #----------------------------------------------------------------------- set arc_lamps = (Kr Xe Hg Ne Ar Cd Zn) set good_lamps = ($arc_lamps Qz) # no args ==> show only... if ($#argv == 0) then set lamps = ( `show -s deimot -terse lamps` ) set n_on = $#lamps foreach l ( $good_lamps ) set value = OFF @ i=1 while ( $i <= $n_on ) if ( "$lamps[$i]" == "$l" ) then set value = ON endif @ i++ end printf "\t%-2s lamp is %s\n" $l $value end exit endif # initialize lamp status... set lamps = ( ) # loop through the arguments and update the specified lamps... foreach lamp ( $* ) set llamp = `tolower $lamp` if ( "$llamp" == "on" ) then set lamps = ( $arc_lamps ) break endif if ( "$llamp" == "off" ) then set lamps = off break endif set match = 0 foreach l ( $good_lamps ) set ll = `tolower $l` if ( "$llamp" == "$ll" ) then set match = 1 set lamps = ( $lamps $l ) endif end if ( ! $match ) then printf "ERROR: did not understand lamp name '$lamp' -- no action taken\n\n" exit 1 endif end modify -s deimot lamps="$lamps" exit $status