SICS-694 Save data with named links on hdb nodes decorated with named links.

Note the use of the Tcl 8.5 {*} expand feature to expand a list into
separate arguments when calling a function.
This commit is contained in:
Ferdi Franceschini
2013-11-13 15:48:44 +11:00
committed by Ferdi Franceschini
parent e9399b6990
commit 5df895cc76

View File

@@ -132,6 +132,19 @@ proc newFileName {idNum postfix} {
return $fmtStr
}
##
# @brief Make a link in the nexus file
# With two arguments the target name = the link name
# With three arguments you can give the target a new name.
# two args: arg0 = target, arg1 = link
# three args: arg0 = target, arg1 = new name, arg2 = link
proc ::nexus::link {args} {
set nargs [llength $args]
switch $nargs {
2 { nxscript makelink [lindex $args 0] [lindex $args 1] }
3 { nxscript makenamedlink [lindex $args 0] [lindex $args 2] [lindex $args 1] }
}
}
proc ::nexus::process_filetype_policy {filetype} {
if [ catch {
if {$filetype == "BEAM_MONITOR"} {
@@ -633,10 +646,10 @@ proc ::nexus::savetree {hpath pt filestatus} {
}
if {$filestatus == "newfile"} {
if {[info exists p_arr(link)] && ($p_arr(link) != "@none")} {
nxscript makelink $p_arr(link) $p_arr(nxalias)
::nexus::link {*}$p_arr(link) $p_arr(nxalias)
}
if {[info exists p_arr(permlink)] && ($p_arr(permlink) != "@none")} {
nxscript makelink $p_arr(permlink) $p_arr(nxalias)
::nexus::link {*}$p_arr(permlink) $p_arr(nxalias)
}
}
}
@@ -888,7 +901,7 @@ proc ::nexus::histmem::save {hm nxalias hpath data_type filestatus args} {
if {$filestatus == "newfile"} {
if [hpropexists $hpath link] {
set link [hgetpropval $hpath link]
nxscript makelink $link $nxalias
::nexus::link {*}$link $nxalias
}
nxscript putattribute $nxalias axes $axes
nxscript putattribute $nxalias signal $signal
@@ -923,7 +936,7 @@ proc ::nexus::motor::save {motor nxalias hpath data_type filestatus args} {
if {$filestatus == "newfile"} {
if [hpropexists $hpath link] {
set link [hgetpropval $hpath link]
nxscript makelink $link $nxalias
::nexus::link {*}$link $nxalias
}
foreach {propName propValue} [hfindprop $hpath @*] {
set attName [string range $propName 1 end]
@@ -984,7 +997,7 @@ proc ::nexus::macro::getset_save {sobj nxalias hpath data_type filestatus args}
if {$filestatus == "newfile"} {
if [hpropexists $hpath link] {
set link [hgetpropval $hpath link]
nxscript makelink $link $nxalias
::nexus::link {*}$link $nxalias
}
foreach {propName propValue} [hfindprop $hpath @*] {
set attName [string range $propName 1 end]
@@ -1033,7 +1046,7 @@ proc ::nexus::environment_controller::save {evc nxalias hpath data_type filestat
if {$filestatus == "newfile"} {
if [hpropexists $hpath link] {
set link [hgetpropval $hpath link]
nxscript makelink $link $nxalias
::nexus::link {*}$link $nxalias
}
foreach {propName propValue} [hfindprop $hpath @*] {
set attName [string range $propName 1 end]
@@ -1092,7 +1105,7 @@ proc ::nexus::sicsvariable::save {svar nxalias hpath data_type filestatus args}
if {$filestatus == "newfile"} {
if [hpropexists $hpath link] {
set link [hgetpropval $hpath link]
nxscript makelink $link $nxalias
::nexus::link {*}$link $nxalias
}
foreach {propName propValue} [hfindprop $hpath @*] {
set attName [string range $propName 1 end]
@@ -1180,7 +1193,7 @@ proc ::nexus::chopperadapter::save {sobj nxalias hpath data_type filestatus args
if {$filestatus == "newfile"} {
if [hpropexists $hpath link] {
set link [hgetpropval $hpath link]
nxscript makelink $link $nxalias
::nexus::link {*}$link $nxalias
}
foreach {propName propValue} [hfindprop $hpath @*] {
set attName [string range $propName 1 end]
@@ -1248,7 +1261,7 @@ proc ::nexus::script::save {script nxalias hpath data_type filestatus args} {
if {$filestatus == "newfile"} {
if [hpropexists $hpath link] {
set link [hgetpropval $hpath link]
nxscript makelink $link $nxalias
::nexus::link {*}$link $nxalias
}
foreach {propName propValue} [hfindprop $hpath @*] {
set attName [string range $propName 1 end]