Files
sics/site_ansto/instrument/config/hipadaba/common_hipadaba_configuration.tcl
Ferdi Franceschini 487f370d5e Added extended hmake "xhmake" to make it easier to create long paths.
r1857 | ffr | 2007-04-16 14:44:25 +1000 (Mon, 16 Apr 2007) | 2 lines
2012-11-15 13:14:55 +11:00

92 lines
2.5 KiB
Tcl

# Defines hashes which map SICS device object names to hipadaba paths
InstallHdb
#Usage: xhmake /a/b spy none {type part}
proc xhmake {path priv dtype pKey pVal} {
global pathlist;
if {[info exists pathlist($path)] == 0} {
set basepath "";
foreach p [split [string trimleft $path / ] / ] {
if {[info exists pathlist($basepath/$p)] == 1} {
append basepath /$p;
continue;
}
hmake $basepath/$p $priv $dtype;
hsetprop $basepath/$p $pKey $pVal;
set pathlist($basepath/$p) 1;
append basepath /$p;
}
}
}
hmake /commands spy none
hsetprop /commands type commandset
set pathlist(/commands) 1
#TODO change this to hparts.tcl
source $cfPath(hipadaba)/hpaths.tcl
set instrument [string tolower [SplitReply [Instrument]] ]
hmake /$instrument spy none
hsetprop /$instrument type instrument
set pathlist(/$instrument) 1
# Generate hipadaba nodes for the paths in the hpaths file
foreach hp $hpaths {
hmake /$instrument/$hp spy none;
hsetprop /$instrument/$hp type part;
set pathlist(/$instrument/$hp) 1;
}
#--- admin
hmake /experiment user none
set pathlist(/experiment) 1
hattach /experiment title title
hattach /experiment sample description
hmake /experiment/user spy none
hsetprop /experiment/user type part
set pathlist(/experiment/user) 1
hattach /experiment/user user name
hattach /experiment/user email email
hattach /experiment/user phone phone
hattach /experiment dataFileName datafile
#--- Motors
foreach {type path} $motor_hpath {
if {[info exists pathlist(/$instrument/$path)] == 0} {
hmake /$instrument/$path spy none;
hsetprop /$instrument/$path type part;
set pathlist(/$instrument/$path) 1;
}
}
array set mot_Pdic $motor_hpath;
foreach motor [sicslist type motor] {
if {$motor == "motor"} {continue}
set mpart [SplitReply [$motor part]];
foreach {type group} [split $mpart .] {};
set path $mot_Pdic($type);
if {$group != ""} {
append path /$group;
}
xhmake /$instrument/$path spy none type part;
hattach /$instrument/$path $motor [SplitReply [$motor long_name]];
}
#--- Configurable Virtual Motors
foreach {obj name part master_obj} $cvirtmotor_hpath {
set path /$instrument/$part
hattach $path $obj $name
sicspoll add $path/$name hdb 2
}
#------------- scan command
hsetprop /commands type part
#--- Graphics
hmake /graphics spy none
hsetprop /graphics type graphset
::scancommand::commands_hpath_setup /commands
::scancommand::graphics_hpath_setup /graphics
::scancommand::init
unset pathlist;