Code cleanup

r2923 | ffr | 2010-05-18 15:08:58 +1000 (Tue, 18 May 2010) | 2 lines
This commit is contained in:
Ferdi Franceschini
2010-05-18 15:08:58 +10:00
committed by Douglas Clowes
parent 08de4efc37
commit 80cc542086

View File

@@ -547,109 +547,6 @@ proc ::nexus::save {{point 0}} {
return -code error "([info level 0]) $message"
}
}
##
# @brief Records that a given data source should be linked to nexus data target.
#
# NOTE: If a link has already been recorded then it does nothing. This allows you to
# override default links set by a command. eg A "count" command may link axis_1 to
# the run number but a "scan" command, which uses the count command, can link axis_1 to
# a scan variable.
#
# Usage:
# data data_set datsource
# Records that /data/data_set should be linked to datsource and sets a data type identifier
# data axis 1|2|3|4 datsource
# Records that /data/axisn should be linked to datsource
# data aux_data 1|2|3|4|5|6|7|8|9 datsource
# Records that /data/aux_datan should be linked to datsource
# data clear
# Clears all link targets and sets the data type identifier to unknown
# data alias <name>, remove alias <name>
# data alias <name> <target>, set <name> as an alias for <target> unless it has already been defined.
proc ::nexus::data_junk {args} {
variable state
variable data_gp_path
if [ catch {
if {[llength $args] == 1} {
set arguments [lindex $args 0]
} else {
set arguments $args
}
set dpath $data_gp_path
set opt [lindex $arguments 0]
set arglist [lrange $arguments 1 end]
switch $opt {
"axis" - "aux_data" {
debug_msg "'axis' case of switch"
set link_target [lindex $arguments 2]
if {[getatt $link_target privilege] == "internal"} {
error "[info level 0], Cannot link $link_target because it doesn't have an hdb node."
}
set axnum [lindex $arguments 1]
if {[string is integer $axnum] == 0} {
error "ERROR: [info level -1]->data, index for data axis should be an integer, not $axnum"
}
if {[getatt $link_target type] == ""} {
error "Unknown link target $link_target"
}
set hp $dpath/${opt}_$axnum
# if {[::utility::hgetplainprop $hp link] == "@none"} {
# hsetprop $hp link [getatt [lindex $arguments 2] id]
hsetprop $hp long_name [getatt [lindex $arguments 2] long_name]
# }
}
"data_set" {
debug_msg "'data_set' case of switch"
set link_target [lindex $arguments 1]
if {[getatt $link_target type] == ""} {
error "Unknown link target $link_target"
}
hsetprop $dpath datatype [lindex [info level -1] 0]
set hp $dpath/data_set
# if {[::utility::hgetplainprop $hp link] == "@none"} {
# hsetprop $hp link [getatt $link_target id]
hsetprop $hp long_name [getatt $link_target long_name]
# }
}
"clear" {
debug_msg "'clear' case of switch"
foreach child [hlist $dpath] {
# hsetprop $dpath/$child link @none
hsetprop $dpath/$child long_name @none
}
}
"alias" {
debug_msg "'alias' case of switch"
set alias_name [lindex $arglist 0]
set alias_target [lindex $arglist 1]
switch $alias_target {
"" {
if {[info exists state(data,alias,$alias_name)]} {
definealias $alias_name
set state(data,alias,$alias_name) @none
}
}
default {
if {[info exists state(data,alias,$alias_name)]} {
if { $state(data,alias,$alias_name) == "@none" } {
definealias $alias_name $alias_target
}
} else {
definealias $alias_name $alias_target
}
}
}
}
default {error "ERROR: [info level -1]->data, Unsupported option $opt"}
}
} message ] {
return -code error "([info level 0]) $message"
}
}
##
# @brief Traverse the hdb subtree from the given path and save the data in the currently open file
@@ -1350,7 +1247,7 @@ set nx_content_release_tag [lindex $tmpstr [expr [llength $tmpstr] - 1]]
sics_release $nx_content_release_tag
sics_release lock
set tmpstr [string map {"$" ""} {$Revision: 1.51.2.11 $}]
set tmpstr [string map {"$" ""} {$Revision: 1.51.2.12 $}]
set nx_content_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
#namespace eval data {