Remove superfluous trailing white space from TCL files
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# This file contains all the scripted commands to make a SICS-TAS look
|
||||
# almost like a MAD-TAS.
|
||||
# almost like a MAD-TAS.
|
||||
#
|
||||
# This version is special to RITA-2!!
|
||||
#
|
||||
# Mark Koennecke, September 2005
|
||||
#
|
||||
# The specialities for RITA have been separated and this is controlled
|
||||
# by testing the instrument name. This way I can use the same version for
|
||||
# The specialities for RITA have been separated and this is controlled
|
||||
# by testing the instrument name. This way I can use the same version for
|
||||
# TASP, RITA-2 and EIGER
|
||||
#
|
||||
#
|
||||
# Mark Koennecke, November 2010
|
||||
#------------------------------------------------------------------------
|
||||
# quite often we need to split a SICS answer of the form x = y and
|
||||
# quite often we need to split a SICS answer of the form x = y and
|
||||
# extract the y. This is done here.
|
||||
#-----------------------------------------------------------------------
|
||||
proc tasSplit {text} {
|
||||
@@ -152,7 +152,7 @@ if { [info exists tasubinit] == 0 } {
|
||||
}
|
||||
#------------------------------------------------------------------------
|
||||
# TASMAD relies on the order of variables in memory in order to interpret
|
||||
# scan or drive commands. In the new syntax motor order is only preserved
|
||||
# scan or drive commands. In the new syntax motor order is only preserved
|
||||
# for the QE motors, not for real motors. This list configures the order.
|
||||
#------------------------------------------------------------------------
|
||||
set tasOrderList [list qh qk ql en]
|
||||
@@ -166,7 +166,7 @@ for {set i 0} {$i < [llength $tasmot]} { incr i } {
|
||||
set tasmap(l$mot) [format "%s softlowerlim " $mot]
|
||||
set tasmap(z$mot) [format "madZero %s " $mot]
|
||||
set tasmap(u$mot) [format "%s softupperlim " $mot]
|
||||
}
|
||||
}
|
||||
set tasmap(ss) "scatSense ss "
|
||||
set tasmap(sa) "scatSense sa "
|
||||
set tasmap(sm) "scatSense sm "
|
||||
@@ -186,7 +186,7 @@ for {set i 0} { $i < 8} { incr i} {
|
||||
# clientput [format " %s = %s" $e $tasmap($e)]
|
||||
#}
|
||||
#----------------------------------------------------------------------
|
||||
# put an angle into 360
|
||||
# put an angle into 360
|
||||
proc circlify {val} {
|
||||
set p $val
|
||||
while {$p > 360.0} {
|
||||
@@ -207,12 +207,12 @@ proc madZero args {
|
||||
set length [llength $args]
|
||||
if { $length < 1} {
|
||||
error "ERROR: expected at least motor name as a parameter to madZero"
|
||||
}
|
||||
}
|
||||
set mot [lindex $args 0]
|
||||
if {$length == 1 } {
|
||||
#inquiry case
|
||||
set zero [tasSplit [$mot softzero]]
|
||||
return [format "madZero = %f " [expr -$zero]]
|
||||
return [format "madZero = %f " [expr -$zero]]
|
||||
} else {
|
||||
# a new value has been given.
|
||||
set val [lindex $args 1]
|
||||
@@ -225,14 +225,14 @@ proc madZero args {
|
||||
$mot softupperlim [circlify [expr $high - $displacement]]
|
||||
$mot softlowerlim [circlify [expr $low - $displacement]]
|
||||
}
|
||||
}
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# This routine throws an error if a bad value for fx is given
|
||||
#--------------------------------------------------------------------------
|
||||
proc fxi { {val UNKNOWN} } {
|
||||
if {[string compare $val UNKNOWN] ==0} {
|
||||
return [format " fx = %2s " [tasSplit [tasub const]] ]
|
||||
}
|
||||
}
|
||||
return [tasub const $val]
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -258,17 +258,17 @@ proc scatSense {par {val -1000} } {
|
||||
error "ERROR: unknown scattering sense $par"
|
||||
}
|
||||
}
|
||||
#-------- inquiry case
|
||||
#-------- inquiry case
|
||||
if { $val == -1000 } {
|
||||
switch $par {
|
||||
sm {
|
||||
return [format "sm = %d" [tasSplit [tasub mono ss]]]
|
||||
return [format "sm = %d" [tasSplit [tasub mono ss]]]
|
||||
}
|
||||
ss {
|
||||
return [format "ss = %d" [tasSplit [tasub ss]]]
|
||||
return [format "ss = %d" [tasSplit [tasub ss]]]
|
||||
}
|
||||
sa {
|
||||
return [format "sa = %d" [tasSplit [tasub ana ss]]]
|
||||
return [format "sa = %d" [tasSplit [tasub ana ss]]]
|
||||
}
|
||||
default {
|
||||
error "Unknown scattering sense requested"
|
||||
@@ -325,9 +325,9 @@ proc scatSense {par {val -1000} } {
|
||||
madZero $mot $newzero
|
||||
$mot softupperlim $newupper
|
||||
$mot softlowerlim $newlower
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
# The output command
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -350,11 +350,11 @@ proc ou args {
|
||||
# typeATokenizer extracts tokens from a command string. Tokens can be
|
||||
# either variable names or - indicating a series of variables.
|
||||
# Returns the token value or END if the end of the string text is
|
||||
# reached. Uses and updates a variable pos which indicates the current
|
||||
# reached. Uses and updates a variable pos which indicates the current
|
||||
# position in the string.
|
||||
#---------------------------------------------------------------------------
|
||||
proc typeATokenizer {text pos} {
|
||||
upvar pos p
|
||||
upvar pos p
|
||||
set l [string length $text]
|
||||
#------- check for end
|
||||
if {$p >= $l} {
|
||||
@@ -408,7 +408,7 @@ proc cl args {
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
#------ trying to clear individual fixed motors
|
||||
set command [join $args]
|
||||
set command [string tolower $command]
|
||||
@@ -438,10 +438,10 @@ proc cl args {
|
||||
error [format "ERROR: %s is no motor" $e]
|
||||
} else {
|
||||
clientput [format "%s unfixed" $e]
|
||||
}
|
||||
}
|
||||
if {[string compare $e $stop] == 0 } {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#------ should be a single motor here
|
||||
@@ -451,7 +451,7 @@ proc cl args {
|
||||
error [format "ERROR: %s is no motor" $token]
|
||||
} else {
|
||||
clientput [format "%s unfixed" $token]
|
||||
}
|
||||
}
|
||||
}
|
||||
#------- do not forget to proceed
|
||||
set token [typeATokenizer $command $pos]
|
||||
@@ -478,7 +478,7 @@ proc fi args {
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
#------ parse motors to fix
|
||||
set command [join $args]
|
||||
set command [string tolower $command]
|
||||
@@ -508,10 +508,10 @@ proc fi args {
|
||||
error [format "ERROR: %s is no motor" $e]
|
||||
} else {
|
||||
clientput [format "%s fixed" $e]
|
||||
}
|
||||
}
|
||||
if {[string compare $e $stop] == 0 } {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#------ should be a single motor here
|
||||
@@ -521,7 +521,7 @@ proc fi args {
|
||||
error [format "ERROR: %s is no motor" $token]
|
||||
} else {
|
||||
clientput [format "%s fixed" $token]
|
||||
}
|
||||
}
|
||||
}
|
||||
#------- do not forget to proceed
|
||||
set token [typeATokenizer $command $pos]
|
||||
@@ -532,7 +532,7 @@ proc fi args {
|
||||
# handles pos as in type A syntax above.
|
||||
#--------------------------------------------------------------------------
|
||||
proc varToken {text pos} {
|
||||
upvar pos p
|
||||
upvar pos p
|
||||
set l [string length $text]
|
||||
#------- check for end
|
||||
if {$p >= $l} {
|
||||
@@ -565,7 +565,7 @@ proc varToken {text pos} {
|
||||
# varSet parses a string containing MAD variable statements and sets the
|
||||
# variables. Thereby it has to take care of mappings and special variables
|
||||
# which have to be set by special functions. The only format allowed here
|
||||
# are name value pairs.
|
||||
# are name value pairs.
|
||||
#--------------------------------------------------------------------------
|
||||
proc varSet { command } {
|
||||
global tasmap
|
||||
@@ -580,7 +580,7 @@ proc varSet { command } {
|
||||
[string compare $token local] == 0 } {
|
||||
eval $command
|
||||
return
|
||||
}
|
||||
}
|
||||
if { [string compare $token out] == 0 || \
|
||||
[string compare $token ou] == 0 } {
|
||||
append txt $token " " [string range $command $pos end]
|
||||
@@ -597,37 +597,37 @@ proc varSet { command } {
|
||||
if { [info exists tasmap($token)] == 1} {
|
||||
set ret [catch {eval $tasmap($token) $value} msg]
|
||||
if { $ret != 0} {
|
||||
error [format "ERROR: > %s < while setting %s" $msg $token]
|
||||
error [format "ERROR: > %s < while setting %s" $msg $token]
|
||||
} else {
|
||||
clientput [format " %s = %s" $token $value]
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
set ret [catch {eval $token $value} msg]
|
||||
if { $ret != 0 } {
|
||||
error [format "ERROR: error %s while setting %s" $msg $token]
|
||||
error [format "ERROR: error %s while setting %s" $msg $token]
|
||||
} else {
|
||||
clientput [format " %s = %s" $token $value]
|
||||
}
|
||||
}
|
||||
}
|
||||
set token [varToken $command $pos]
|
||||
set value [varToken $command $pos]
|
||||
}
|
||||
catch {tasub update} msg
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# co for count is the funny MAD count procedure. Please note, that the
|
||||
# co for count is the funny MAD count procedure. Please note, that the
|
||||
# count mode is automatically set through the last MN or TI variable.
|
||||
#--------------------------------------------------------------------------
|
||||
proc coritacount {mode preset nloop} {
|
||||
set rmode [ritamode]
|
||||
set rmode [ritamode]
|
||||
hm countmode $mode
|
||||
hm preset $preset
|
||||
for { set i 0} {$i < $nloop} {incr i} {
|
||||
set ret [catch {eval hm countblock} msg]
|
||||
set ret [catch {eval hm countblock} msg]
|
||||
if {$ret != 0} {
|
||||
error $msg
|
||||
}
|
||||
#----- format output
|
||||
#----- format output
|
||||
set cts [tasSplit [hm sum 0 127 0 127]]
|
||||
set m1 [tasSplit [counter getmonitor 1]]
|
||||
set m2 [tasSplit [counter getmonitor 2]]
|
||||
@@ -642,18 +642,18 @@ proc coritacount {mode preset nloop} {
|
||||
append txt [format " %s = %d" $win [sumPSDWindow $i]]
|
||||
}
|
||||
clientput $txt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#------------------------------------------------------------------------
|
||||
proc conormalcount {mode preset nloop} {
|
||||
counter setmode $mode
|
||||
for { set i 0} {$i < $nloop} {incr i} {
|
||||
set ret [catch {eval counter count $preset } msg]
|
||||
set ret [catch {eval counter count $preset } msg]
|
||||
if {$ret != 0} {
|
||||
error $msg
|
||||
}
|
||||
#----- format output
|
||||
#----- format output
|
||||
set cts [tasSplit [counter getcounts]]
|
||||
set m1 [tasSplit [counter getmonitor 1]]
|
||||
set m2 [tasSplit [counter getmonitor 2]]
|
||||
@@ -664,7 +664,7 @@ proc conormalcount {mode preset nloop} {
|
||||
" Counts = %8d, M1 = %8d, M2 = %8d, M3 = %8d, Time = %8.2f" \
|
||||
$cts $m1 $m2 $m3 $time]
|
||||
}
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
proc co args {
|
||||
global ritaspecial
|
||||
@@ -712,17 +712,17 @@ proc co args {
|
||||
#----------------------------------------------------------------------------
|
||||
proc fm args {
|
||||
#------ do the scan first
|
||||
append com "sc " [ join $args]
|
||||
append com "sc " [ join $args]
|
||||
set ret [catch {eval $com} msg]
|
||||
if { $ret != 0 } {
|
||||
error $msg
|
||||
}
|
||||
}
|
||||
# iscan simscan 15 .3 1000
|
||||
#----- calculate the center
|
||||
set ret [catch {eval peak value} msg]
|
||||
if { $ret != 0 } {
|
||||
error $msg
|
||||
}
|
||||
}
|
||||
if { [string first "WARN" $msg ] >= 0 } {
|
||||
error [format "ERROR: failed to find peak: %s" $msg]
|
||||
}
|
||||
@@ -737,7 +737,7 @@ proc fm args {
|
||||
set ret [catch {eval dr $var $val} msg]
|
||||
if { $ret != 0 } {
|
||||
error $msg
|
||||
}
|
||||
}
|
||||
}
|
||||
#------------------------------------------------------------------------
|
||||
# fz does almost the same as fm, but also sets the current position to be
|
||||
@@ -745,17 +745,17 @@ proc fm args {
|
||||
#------------------------------------------------------------------------
|
||||
proc fz args {
|
||||
#------ do the scan first
|
||||
append com "sc " [ join $args]
|
||||
append com "sc " [ join $args]
|
||||
set ret [catch {eval $com} msg]
|
||||
if { $ret != 0 } {
|
||||
error $msg
|
||||
}
|
||||
}
|
||||
iscan simscan 15 .3 1000
|
||||
#----- calculate the center
|
||||
set ret [catch {eval peak value} msg]
|
||||
if { $ret != 0 } {
|
||||
error $msg
|
||||
}
|
||||
}
|
||||
if { [string first "WARN" $msg ] >= 0 } {
|
||||
error [format "ERROR: failed to find peak: %s" $msg]
|
||||
}
|
||||
@@ -770,7 +770,7 @@ proc fz args {
|
||||
set ret [catch {eval dr $var $val} msg]
|
||||
if { $ret != 0 } {
|
||||
error $msg
|
||||
}
|
||||
}
|
||||
#------- now do zero point
|
||||
set temp [eval $var hardposition]
|
||||
set newZero [tasSplit $temp]
|
||||
@@ -785,16 +785,16 @@ proc pr args {
|
||||
set line [join $args]
|
||||
set line [string tolower $line]
|
||||
set pos 0
|
||||
set token [varToken $line $pos]
|
||||
set token [varToken $line $pos]
|
||||
while { [string compare $token -end] } {
|
||||
#-------- check for mapped values first
|
||||
if { [info exists tasmap($token)] == 1 } {
|
||||
set val [tasSplit [eval $tasmap($token)]]
|
||||
clientput [format " %s = %s" $token $val]
|
||||
clientput [format " %s = %s" $token $val]
|
||||
} else {
|
||||
#------ simple variables go here
|
||||
set val [tasSplit [$token] ]
|
||||
clientput [format " %s = %s" $token $val]
|
||||
clientput [format " %s = %s" $token $val]
|
||||
}
|
||||
set token [varToken $line $pos]
|
||||
}
|
||||
@@ -858,7 +858,7 @@ proc lz args {
|
||||
incr count
|
||||
if { $count == 6 } {
|
||||
append outPut " \n"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $outPut
|
||||
}
|
||||
@@ -962,7 +962,7 @@ proc le args {
|
||||
append output [format "POSN: %s" $val]
|
||||
append output [format "TARG: %s" $val2]
|
||||
|
||||
return $output
|
||||
return $output
|
||||
}
|
||||
#-----------------------------------------------------------------------
|
||||
# fmtMot formats a motors parameters in order to fit the format for
|
||||
@@ -980,7 +980,7 @@ proc fmtMot mot {
|
||||
set txt [format "%-7s%1s %7.2f %7.2f %7.2f" $mot $fix $pos $target \
|
||||
$zero]
|
||||
return $txt
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
# lt --> list targets
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -1011,7 +1011,7 @@ proc lt args {
|
||||
[fmtMot MTL] " " ]
|
||||
append output [format "%s | %s\n" \
|
||||
[fmtMot MTU] " " ]
|
||||
return $output
|
||||
return $output
|
||||
}
|
||||
#--------------------------------------------------------------------
|
||||
# li --> list everything
|
||||
@@ -1044,9 +1044,9 @@ proc log args {
|
||||
if { [ llength $args] == 0 } {
|
||||
if { [string compare $madlog disabled] == 0 } {
|
||||
return "Logging is disabled"
|
||||
} else {
|
||||
} else {
|
||||
return [format "Logging to %s" $madlog]
|
||||
}
|
||||
}
|
||||
}
|
||||
#------args, action according to keyword
|
||||
set key [string tolower [lindex $args 0]]
|
||||
@@ -1070,7 +1070,7 @@ proc log args {
|
||||
append output "\tLog close : stop logging\n"
|
||||
return $output
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
@@ -1080,7 +1080,7 @@ proc sz args {
|
||||
global tasmot
|
||||
set usage "\n Usage: \n\t sz motor newval \n"
|
||||
set line [string tolower [join $args]]
|
||||
set pos 0
|
||||
set pos 0
|
||||
set mot [varToken $line $pos]
|
||||
set val [varToken $line $pos]
|
||||
if { [lsearch $tasmot $mot] < 0 } {
|
||||
@@ -1091,7 +1091,7 @@ proc sz args {
|
||||
}
|
||||
#-------- output, output, output.........
|
||||
append output [format "Values : Lo(hard) Lo(soft) Posn%s" \
|
||||
" Target Hi(soft) Hi(hard) Zero\n"]
|
||||
" Target Hi(soft) Hi(hard) Zero\n"]
|
||||
set zero [tasSplit [madZero $mot]]
|
||||
set loh [tasSplit [eval $mot hardlowerlim]]
|
||||
set loh [expr $loh + $zero]
|
||||
@@ -1134,7 +1134,7 @@ proc pa args {
|
||||
set fil $fil.pal
|
||||
}
|
||||
polfile $fil
|
||||
}
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# on and off for switching spin flippers
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -1148,7 +1148,7 @@ proc checkarg args {
|
||||
return $flipper
|
||||
} else {
|
||||
error [format "%s not a recognized flipper" $flipper]
|
||||
}
|
||||
}
|
||||
}
|
||||
#------------------------------------------------------------------------
|
||||
proc on args {
|
||||
@@ -1198,7 +1198,7 @@ proc syncdrive {mot pos} {
|
||||
}
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# "set posttion" sp to reset the zero-position.
|
||||
# "set posttion" sp to reset the zero-position.
|
||||
# syntax: "SP <axes> <value>" to set the softzero value of <axes>
|
||||
# in a way that the targetposition is set to <value>.
|
||||
# J. Stahn, 10. 2001
|
||||
@@ -1255,7 +1255,7 @@ proc scan {name} {
|
||||
info {
|
||||
set scanvar [findscanvar]
|
||||
append result [tasSplit [iscan np]] ",1," $scanvar
|
||||
append result ,
|
||||
append result ,
|
||||
append result [string trim [tasSplit [iscan getfile]]]
|
||||
return $result
|
||||
}
|
||||
@@ -1291,7 +1291,7 @@ proc dr args {
|
||||
error "ERROR: do not know what to drive to $token"
|
||||
}
|
||||
} else {
|
||||
set lastVar $token
|
||||
set lastVar $token
|
||||
lappend motors $lastVar
|
||||
}
|
||||
set token [varToken $command $pos]
|
||||
@@ -1340,7 +1340,7 @@ proc sc args {
|
||||
set lastVar quarkPhaser
|
||||
set pos 0
|
||||
set state 0
|
||||
# states:
|
||||
# states:
|
||||
# 0 = expectToken, 1 = expectPosition, 2 = continuePosition
|
||||
# 3 = expectIncrement, 4 = continueIncrement
|
||||
|
||||
@@ -1423,7 +1423,7 @@ proc sc args {
|
||||
error "ERROR: nothing to scan"
|
||||
}
|
||||
set __tasdata(qe) 0
|
||||
set qeVars [list qh qk ql ei ef en qm ki kf]
|
||||
set qeVars [list qh qk ql ei ef en qm ki kf]
|
||||
foreach var $scanvars {
|
||||
if {[lsearch -exact $qeVars [string tolower $var]] >= 0} {
|
||||
set __tasdata(qe) 1
|
||||
@@ -1445,7 +1445,7 @@ proc sc args {
|
||||
set start [expr $scanpos($var) - $inc($var) * ($np - 1)/2.]
|
||||
iscan add $var $start $inc($var)
|
||||
}
|
||||
return [iscan run $np $mode $preset]
|
||||
return [iscan run $np $mode $preset]
|
||||
}
|
||||
#---------------------------------------------------------------------
|
||||
proc cell args {
|
||||
@@ -1454,7 +1454,7 @@ proc cell args {
|
||||
#--------------------------------------------------------------------
|
||||
proc ref args {
|
||||
if { [llength $args] == 0} {
|
||||
return [tasub listref]
|
||||
return [tasub listref]
|
||||
}
|
||||
set key [string trim [lindex $args 0]]
|
||||
if { [string compare $key clear] == 0} {
|
||||
@@ -1470,13 +1470,13 @@ proc ref args {
|
||||
} elseif {[string compare $key aux] == 0} {
|
||||
set qpos [lrange $args 1 end]
|
||||
append cmd "tasub addauxref " [join $qpos]
|
||||
return [eval $cmd]
|
||||
return [eval $cmd]
|
||||
} else {
|
||||
return [eval tasub addref $args]
|
||||
}
|
||||
}
|
||||
#--------------------------------------------------------------------
|
||||
proc makeub args {
|
||||
proc makeub args {
|
||||
if { [llength $args] >= 2} {
|
||||
tasub makeub [lindex $args 0] [lindex $args 1]
|
||||
return OK
|
||||
@@ -1485,7 +1485,7 @@ proc makeub args {
|
||||
}
|
||||
}
|
||||
#--------------------------------------------------------------------
|
||||
proc makeauxub {qh qk ql} {
|
||||
proc makeauxub {qh qk ql} {
|
||||
tasub makeauxub $qh $qk $ql
|
||||
}
|
||||
#-------------------------------------------------------------------
|
||||
@@ -1493,18 +1493,18 @@ proc addauxref {qh qk ql} {
|
||||
tasub addauxref $qh $qk $ql
|
||||
}
|
||||
#--------------------------------------------------------------------
|
||||
proc makeubfromcell args {
|
||||
proc makeubfromcell args {
|
||||
return [tasub makeubfromcell]
|
||||
}
|
||||
#---------------------------------------------------------------------
|
||||
proc listub args {
|
||||
proc listub args {
|
||||
append output [tasSplit [tasub cell]]
|
||||
append output "\n"
|
||||
append output [tasub listub]
|
||||
append output [tasub listref]
|
||||
return $output
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
proc sf args {
|
||||
tasscan fast 1
|
||||
set ret [catch {eval sc $args} msg]
|
||||
|
||||
Reference in New Issue
Block a user