Add macros to hdb.

r2114 | ffr | 2007-08-16 14:31:50 +1000 (Thu, 16 Aug 2007) | 2 lines
This commit is contained in:
Ferdi Franceschini
2007-08-16 14:31:50 +10:00
committed by Douglas Clowes
parent 85774be9f9
commit bf8d5e63be

View File

@@ -5,6 +5,7 @@
# subtree/group_path policy: data=parent control=parent nxsave=parent klass=parent # subtree/group_path policy: data=parent control=parent nxsave=parent klass=parent
# type=macro & klass=command -> kind=command # type=macro & klass=command -> kind=command
# type=macro & klass!=command -> kind=script # type=macro & klass!=command -> kind=script
# kind=script must have access property (read_only, read_write) and dtype and dlen
source $cfPath(hipadaba)/instdict_specification.tcl source $cfPath(hipadaba)/instdict_specification.tcl
source $cfPath(hipadaba)/common_instrument_dictionary.tcl source $cfPath(hipadaba)/common_instrument_dictionary.tcl
@@ -157,8 +158,26 @@ proc add_node {basePath args} {
} }
script { script {
# A r/w pair of scripts, node = a node path # A r/w pair of scripts, node = a node path
set node_path $basePath/$node_name set node_path $basePath/[getatt $node_name long_name]
hmakescript $node_path $arg_array(rscript) $arg_array(wscript) $arg_array(dtype) $arg_array(dlen) array set attribute [attlist $node_name]
set data_type [getatt $node_name dtype]
set data_length [getatt $node_name dlen]
if {[getatt $node_name access] == "read_only"} {
hmakescript $node_path $node_name hdbReadOnly $data_type $data_length
} else {
hmakescript $node_path $node_name $node_name $data_type $data_length
}
hsetprop $node_path sicsdev $node_name
hsetprop $node_path nxalias $node_name
hsetprop $node_path data true
hsetprop $node_path control false
hsetprop $node_path klass [getatt $node_name klass]
hsetprop $node_path sdsinfo [getatt $node_name sdsinfo]
hsetprop $node_path savecmd [getatt $node_name savecmd]
if {[info exists attribute(units)]} {
hsetprop $node_path units $attribute(units)
}
#hmakescript $node_path $arg_array(rscript) $arg_array(wscript) $arg_array(dtype) $arg_array(dlen)
} }
} }
if {[info exists arg_array(prop_list)]} { if {[info exists arg_array(prop_list)]} {
@@ -239,6 +258,7 @@ proc getsobjatt {sicsobj attribute} {
proc sobjadd {hpath sobj args} { proc sobjadd {hpath sobj args} {
array unset sobjatt array unset sobjatt
array set sobjatt [attlist $sobj] array set sobjatt [attlist $sobj]
sicslist setatt $sobj id $sobj
switch $sobjatt(type) { switch $sobjatt(type) {
motor - configurablevirtualmotor { motor - configurablevirtualmotor {
if {[info exists sobjatt(group)]} { if {[info exists sobjatt(group)]} {
@@ -259,6 +279,7 @@ proc sobjadd {hpath sobj args} {
} }
} }
macro { macro {
# access attribute = ro,rw
if {[info exists sobjatt(group)]} { if {[info exists sobjatt(group)]} {
set hpath [add_hpath $hpath $sobjatt(group)] set hpath [add_hpath $hpath $sobjatt(group)]
hsetprop $hpath type part hsetprop $hpath type part
@@ -266,7 +287,7 @@ proc sobjadd {hpath sobj args} {
if {[lsearch [hlist $hpath] $sobjatt(long_name)] != -1} { if {[lsearch [hlist $hpath] $sobjatt(long_name)] != -1} {
clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error clientput "ERROR: $hpath/$sobjatt(long_name) for $sobj exists" error
} else { } else {
add_node $hpath kind $sobjatt(kind) node $sobj dtype $sobjatt(type) priv $sobjatt(privilege) add_node $hpath kind $sobjatt(kind) node $sobj priv $sobjatt(privilege)
} }
} }
sicsvariable { sicsvariable {