Files
sics/site_ansto/instrument/TEST_SICS/fakeDMC/loadConfig.tcl
2014-05-16 17:23:58 +10:00

40 lines
1.0 KiB
Tcl

#!/usr/bin/env tclsh
# TODO setup loopback devices for controllers.
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
# Load troubleshooting setup
#source dmc2280_util.tcl
if { $argc > 0 } {
set configFileName [lindex $argv 0]
}
proc loadConfig {fName} {
global ContList
global IPtoContName;
if [info exists ContList] {unset ContList}
# Temporarily define unknown proc to skip undefined procs
rename ::unknown _unknown
proc ::unknown {args} {}
if [catch {uplevel #0 source $fName} errMsg] {
rename ::unknown ""
rename _unknown ::unknown
error $errMsg
} else {
rename ::unknown ""
rename _unknown ::unknown
}
if [catch {set ContList [uplevel #0 info vars dmc2280_controller*]} result] {error $result}
if {[llength $ContList] == 0} {error "Error: There are no dmc2280_controllerN(host/port) arrays in the $fName configuration file"}
#Add the controller to the sics_config namespace
foreach c $ContList {
upvar #0 $c cont;
set IPtoContName($cont(host)) $c;
puts "$c IP:port = $cont(host):$cont(port)";
}
}