Wrap generated driver code in 'catch' and handle_exception blocks

This commit is contained in:
Douglas Clowes
2014-03-18 12:42:56 +11:00
parent 7269776484
commit 94e2e06f22
3 changed files with 408 additions and 333 deletions

View File

@ -7,67 +7,79 @@ namespace eval ::scobj::shutters {
} }
proc ::scobj::shutters::debug_log {debug_level debug_string} { proc ::scobj::shutters::debug_log {debug_level debug_string} {
if {${debug_level} >= ${::scobj::shutters::debug_threshold}} { set catch_status [ catch {
set fd [open "/tmp/shutters.log" "a"] if {${debug_level} >= ${::scobj::shutters::debug_threshold}} {
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set fd [open "/tmp/shutters.log" "a"]
puts ${fd} "${line}" set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
close ${fd} puts ${fd} "${line}"
} close ${fd}
}
} catch_message ]
} }
# check function for hset change # check function for hset change
proc ::scobj::shutters::checkrange {tc_root} { proc ::scobj::shutters::checkrange {tc_root} {
debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]" set catch_status [ catch {
set setpoint [sct target] debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
if { [hpropexists [sct] lowerlimit] } { set setpoint [sct target]
set lolimit [sct lowerlimit] if { [hpropexists [sct] lowerlimit] } {
} else { set lolimit [sct lowerlimit]
# lowerlimit not set, use target } else {
set lolimit [sct target] # lowerlimit not set, use target
} set lolimit [sct target]
if { [hpropexists [sct] upperlimit] } { }
set hilimit [sct upperlimit] if { [hpropexists [sct] upperlimit] } {
} else { set hilimit [sct upperlimit]
# upperlimit not set, use target } else {
set hilimit [sct target] # upperlimit not set, use target
} set hilimit [sct target]
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { }
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
} error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
return OK }
return OK
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to request the read of a parameter on a device # function to request the read of a parameter on a device
proc ::scobj::shutters::getValue {tc_root nextState cmd_str} { proc ::scobj::shutters::getValue {tc_root nextState cmd_str} {
debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" set catch_status [ catch {
if { [hpropexists [sct] geterror] } { debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
hdelprop [sct] geterror if { [hpropexists [sct] geterror] } {
} hdelprop [sct] geterror
set cmd "${cmd_str}" }
debug_log 1 "getValue sct send ${cmd}" set cmd "${cmd_str}"
sct send "${cmd}" debug_log 1 "getValue sct send ${cmd}"
return ${nextState} sct send "${cmd}"
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to check the write parameter on a device # function to check the write parameter on a device
proc ::scobj::shutters::noResponse {tc_root} { proc ::scobj::shutters::noResponse {tc_root} {
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" set catch_status [ catch {
return "idle" debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
return "idle"
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to parse the read of a parameter on a device # function to parse the read of a parameter on a device
proc ::scobj::shutters::read_switch_pair {tc_root} { proc ::scobj::shutters::read_switch_pair {tc_root} {
debug_log 1 "read_switch_pair tc_root=${tc_root} sct=[sct] result=[sct result]" set catch_status [ catch {
if { [hpropexists [sct] geterror] } { debug_log 1 "read_switch_pair tc_root=${tc_root} sct=[sct] result=[sct result]"
hdelprop [sct] geterror if { [hpropexists [sct] geterror] } {
} hdelprop [sct] geterror
set data [sct result] }
set nextState "idle" set data [sct result]
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { set nextState "idle"
# the protocol driver has reported an error if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
sct geterror "${data}" # the protocol driver has reported an error
return -code error "[sct geterror]" sct geterror "${data}"
} error "[sct geterror]"
}
# hook code starts # hook code starts
if { [string equal -nocase -length 1 "${data}" "?"] } { if { [string equal -nocase -length 1 "${data}" "?"] } {
sct geterror "Galil error in: '${data}'" sct geterror "Galil error in: '${data}'"
@ -91,47 +103,53 @@ proc ::scobj::shutters::read_switch_pair {tc_root} {
} }
} }
# hook code ends # hook code ends
if { [hpropexists [sct] geterror] } { if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]" debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]" error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
} }
return ${nextState} if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to write a parameter value on a device # function to write a parameter value on a device
proc ::scobj::shutters::setValue {tc_root nextState cmd_str} { proc ::scobj::shutters::setValue {tc_root nextState cmd_str} {
debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" set catch_status [ catch {
if { [hpropexists [sct] geterror] } { debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
hdelprop [sct] geterror if { [hpropexists [sct] geterror] } {
} hdelprop [sct] geterror
set par [sct target]
set cmd "${cmd_str}${par}"
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
} }
} set par [sct target]
debug_log 1 "setValue sct send ${cmd}" set cmd "${cmd_str}${par}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { if { [hpropexists [sct] driving] } {
sct send "${cmd}" if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
} sct driving 1
return ${nextState} }
}
debug_log 1 "setValue sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to write a parameter value on a device # function to write a parameter value on a device
proc ::scobj::shutters::write_switch {tc_root nextState cmd_str} { proc ::scobj::shutters::write_switch {tc_root nextState cmd_str} {
debug_log 1 "write_switch tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" set catch_status [ catch {
if { [hpropexists [sct] geterror] } { debug_log 1 "write_switch tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
hdelprop [sct] geterror if { [hpropexists [sct] geterror] } {
} hdelprop [sct] geterror
set par [sct target] }
set cmd "${cmd_str}${par}" set par [sct target]
set cmd "${cmd_str}${par}"
# hook code starts # hook code starts
if { [string equal -nocase -length 2 "${par}" "in"] } { if { [string equal -nocase -length 2 "${par}" "in"] } {
set cmd "SB${cmd_str}" set cmd "SB${cmd_str}"
@ -141,20 +159,22 @@ proc ::scobj::shutters::write_switch {tc_root nextState cmd_str} {
sct geterror "Value error: '${par}' not in ('in', 'out')" sct geterror "Value error: '${par}' not in ('in', 'out')"
} }
# hook code ends # hook code ends
if { [hpropexists [sct] geterror] } { if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]" debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]" error "[sct geterror]"
}
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
} }
} if { [hpropexists [sct] driving] } {
debug_log 1 "write_switch sct send ${cmd}" if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct driving 1
sct send "${cmd}" }
} }
return ${nextState} debug_log 1 "write_switch sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::shutters::mk_sct_shutters { sct_controller name } { proc ::scobj::shutters::mk_sct_shutters { sct_controller name } {
@ -230,7 +250,7 @@ proc ::scobj::shutters::mk_sct_shutters { sct_controller name } {
# hook code starts # hook code starts
# hook code ends # hook code ends
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} "in ${ns}::mk_sct_shutters" handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::shutters { namespace eval ::scobj::shutters {
@ -239,20 +259,23 @@ namespace eval ::scobj::shutters {
} }
proc add_shutters {name IP port} { proc add_shutters {name IP port} {
set ns "::scobj::shutters" set catch_status [ catch {
${ns}::debug_log 1 "add_shutters ${name} ${IP} ${port}" set ns "::scobj::shutters"
if {[SplitReply [motor_simulation]]=="false"} { ${ns}::debug_log 1 "add_shutters ${name} ${IP} ${port}"
if {[string equal -nocase "aqadapter" "${IP}"]} { if {[SplitReply [motor_simulation]]=="false"} {
${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}" if {[string equal -nocase "aqadapter" "${IP}"]} {
makesctcontroller sct_${name} aqadapter ${port} ${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"
} else { makesctcontroller sct_${name} aqadapter ${port}
${ns}::debug_log 1 "makesctcontroller sct_${name} dmc2280 ${IP}:${port}" } else {
makesctcontroller sct_${name} dmc2280 ${IP}:${port} ${ns}::debug_log 1 "makesctcontroller sct_${name} dmc2280 ${IP}:${port}"
makesctcontroller sct_${name} dmc2280 ${IP}:${port}
}
} }
} ${ns}::debug_log 1 "mk_sct_shutters sct_${name} ${name}"
${ns}::debug_log 1 "mk_sct_shutters sct_${name} ${name}" ${ns}::mk_sct_shutters sct_${name} ${name}
${ns}::mk_sct_shutters sct_${name} ${name} close ${fd}
close ${fd} } catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
puts stdout "file evaluation of sct_shutters.tcl" puts stdout "file evaluation of sct_shutters.tcl"

View File

@ -7,67 +7,79 @@ namespace eval ::scobj::tank {
} }
proc ::scobj::tank::debug_log {debug_level debug_string} { proc ::scobj::tank::debug_log {debug_level debug_string} {
if {${debug_level} >= ${::scobj::tank::debug_threshold}} { set catch_status [ catch {
set fd [open "/tmp/tank.log" "a"] if {${debug_level} >= ${::scobj::tank::debug_threshold}} {
set line "[clock format [clock seconds] -format "%T"] ${debug_string}" set fd [open "/tmp/tank.log" "a"]
puts ${fd} "${line}" set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
close ${fd} puts ${fd} "${line}"
} close ${fd}
}
} catch_message ]
} }
# check function for hset change # check function for hset change
proc ::scobj::tank::checkrange {tc_root} { proc ::scobj::tank::checkrange {tc_root} {
debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]" set catch_status [ catch {
set setpoint [sct target] debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
if { [hpropexists [sct] lowerlimit] } { set setpoint [sct target]
set lolimit [sct lowerlimit] if { [hpropexists [sct] lowerlimit] } {
} else { set lolimit [sct lowerlimit]
# lowerlimit not set, use target } else {
set lolimit [sct target] # lowerlimit not set, use target
} set lolimit [sct target]
if { [hpropexists [sct] upperlimit] } { }
set hilimit [sct upperlimit] if { [hpropexists [sct] upperlimit] } {
} else { set hilimit [sct upperlimit]
# upperlimit not set, use target } else {
set hilimit [sct target] # upperlimit not set, use target
} set hilimit [sct target]
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { }
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
} error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
return OK }
return OK
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to request the read of a parameter on a device # function to request the read of a parameter on a device
proc ::scobj::tank::getValue {tc_root nextState cmd_str} { proc ::scobj::tank::getValue {tc_root nextState cmd_str} {
debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" set catch_status [ catch {
if { [hpropexists [sct] geterror] } { debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
hdelprop [sct] geterror if { [hpropexists [sct] geterror] } {
} hdelprop [sct] geterror
set cmd "${cmd_str}" }
debug_log 1 "getValue sct send ${cmd}" set cmd "${cmd_str}"
sct send "${cmd}" debug_log 1 "getValue sct send ${cmd}"
return ${nextState} sct send "${cmd}"
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to check the write parameter on a device # function to check the write parameter on a device
proc ::scobj::tank::noResponse {tc_root} { proc ::scobj::tank::noResponse {tc_root} {
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" set catch_status [ catch {
return "idle" debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
return "idle"
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to parse the read of a parameter on a device # function to parse the read of a parameter on a device
proc ::scobj::tank::read_switch {tc_root} { proc ::scobj::tank::read_switch {tc_root} {
debug_log 1 "read_switch tc_root=${tc_root} sct=[sct] result=[sct result]" set catch_status [ catch {
if { [hpropexists [sct] geterror] } { debug_log 1 "read_switch tc_root=${tc_root} sct=[sct] result=[sct result]"
hdelprop [sct] geterror if { [hpropexists [sct] geterror] } {
} hdelprop [sct] geterror
set data [sct result] }
set nextState "idle" set data [sct result]
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { set nextState "idle"
# the protocol driver has reported an error if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
sct geterror "${data}" # the protocol driver has reported an error
return -code error "[sct geterror]" sct geterror "${data}"
} error "[sct geterror]"
}
# hook code starts # hook code starts
if { [string equal -nocase -length 1 "${data}" "?"] } { if { [string equal -nocase -length 1 "${data}" "?"] } {
sct geterror "Galil error in: '${data}'" sct geterror "Galil error in: '${data}'"
@ -88,37 +100,42 @@ proc ::scobj::tank::read_switch {tc_root} {
} }
} }
# hook code ends # hook code ends
if { [hpropexists [sct] geterror] } { if { [hpropexists [sct] geterror] } {
debug_log 1 "[sct] error: [sct geterror]" debug_log 1 "[sct] error: [sct geterror]"
return -code error "[sct geterror]" error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
} }
return ${nextState} if { ${data} != [sct oldval] } {
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
# function to write a parameter value on a device # function to write a parameter value on a device
proc ::scobj::tank::setValue {tc_root nextState cmd_str} { proc ::scobj::tank::setValue {tc_root nextState cmd_str} {
debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" set catch_status [ catch {
if { [hpropexists [sct] geterror] } { debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
hdelprop [sct] geterror if { [hpropexists [sct] geterror] } {
} hdelprop [sct] geterror
set par [sct target]
set cmd "${cmd_str}${par}"
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
} }
} set par [sct target]
debug_log 1 "setValue sct send ${cmd}" set cmd "${cmd_str}${par}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { if { [hpropexists [sct] driving] } {
sct send "${cmd}" if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
} sct driving 1
return ${nextState} }
}
debug_log 1 "setValue sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
proc ::scobj::tank::mk_sct_tank { sct_controller name } { proc ::scobj::tank::mk_sct_tank { sct_controller name } {
@ -186,7 +203,7 @@ proc ::scobj::tank::mk_sct_tank { sct_controller name } {
# hook code starts # hook code starts
# hook code ends # hook code ends
} catch_message ] } catch_message ]
handle_exception ${catch_status} ${catch_message} "in ${ns}::mk_sct_tank" handle_exception ${catch_status} ${catch_message}
} }
namespace eval ::scobj::tank { namespace eval ::scobj::tank {
@ -195,20 +212,23 @@ namespace eval ::scobj::tank {
} }
proc add_tank {name IP port} { proc add_tank {name IP port} {
set ns "::scobj::tank" set catch_status [ catch {
${ns}::debug_log 1 "add_tank ${name} ${IP} ${port}" set ns "::scobj::tank"
if {[SplitReply [motor_simulation]]=="false"} { ${ns}::debug_log 1 "add_tank ${name} ${IP} ${port}"
if {[string equal -nocase "aqadapter" "${IP}"]} { if {[SplitReply [motor_simulation]]=="false"} {
${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}" if {[string equal -nocase "aqadapter" "${IP}"]} {
makesctcontroller sct_${name} aqadapter ${port} ${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"
} else { makesctcontroller sct_${name} aqadapter ${port}
${ns}::debug_log 1 "makesctcontroller sct_${name} dmc2280 ${IP}:${port}" } else {
makesctcontroller sct_${name} dmc2280 ${IP}:${port} ${ns}::debug_log 1 "makesctcontroller sct_${name} dmc2280 ${IP}:${port}"
makesctcontroller sct_${name} dmc2280 ${IP}:${port}
}
} }
} ${ns}::debug_log 1 "mk_sct_tank sct_${name} ${name}"
${ns}::debug_log 1 "mk_sct_tank sct_${name} ${name}" ${ns}::mk_sct_tank sct_${name} ${name}
${ns}::mk_sct_tank sct_${name} ${name} close ${fd}
close ${fd} } catch_message ]
handle_exception ${catch_status} ${catch_message}
} }
puts stdout "file evaluation of sct_tank.tcl" puts stdout "file evaluation of sct_tank.tcl"

View File

@ -745,12 +745,14 @@ def put_preamble(MyDriver):
txt += ['}'] txt += ['}']
txt += [''] txt += ['']
txt += ['proc %s::debug_log {debug_level debug_string} {' % MyDriver['namespace']] txt += ['proc %s::debug_log {debug_level debug_string} {' % MyDriver['namespace']]
txt += [' if {${debug_level} >= ${%s::debug_threshold}} {' % MyDriver['namespace']] txt += [' set catch_status [ catch {']
txt += [' set fd [open "/tmp/%s.log" "a"]' % MyDriver['name']] txt += [' if {${debug_level} >= ${%s::debug_threshold}} {' % MyDriver['namespace']]
txt += [' set line "[clock format [clock seconds] -format "%T"] ${debug_string}"'] txt += [' set fd [open "/tmp/%s.log" "a"]' % MyDriver['name']]
txt += [' puts ${fd} "${line}"'] txt += [' set line "[clock format [clock seconds] -format "%T"] ${debug_string}"']
txt += [' close ${fd}'] txt += [' puts ${fd} "${line}"']
txt += [' }'] txt += [' close ${fd}']
txt += [' }']
txt += [' } catch_message ]']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -758,30 +760,33 @@ def put_write_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# function to write a parameter value on a device'] txt += ['# function to write a parameter value on a device']
txt += ['proc %s::%s {tc_root nextState cmd_str} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root nextState cmd_str} {' % (MyDriver['namespace'], func)]
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"' % func] txt += [' set catch_status [ catch {']
txt += [' if { [hpropexists [sct] geterror] } {'] txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"' % func]
txt += [' hdelprop [sct] geterror'] txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' }'] txt += [' hdelprop [sct] geterror']
txt += [' set par [sct target]'] txt += [' }']
txt += [' set cmd "${cmd_str}${par}"'] txt += [' set par [sct target]']
txt += [' set cmd "${cmd_str}${par}"']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if { [hpropexists [sct] geterror] } {'] txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' debug_log 1 "[sct] error: [sct geterror]"'] txt += [' debug_log 1 "[sct] error: [sct geterror]"']
txt += [' return -code error "[sct geterror]"'] txt += [' error "[sct geterror]"']
txt += [' }'] txt += [' }']
txt += [' if { [hpropexists [sct] driving] } {'] txt += [' if { [hpropexists [sct] driving] } {']
txt += [' if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {'] txt += [' if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {']
txt += [' sct driving 1'] txt += [' sct driving 1']
txt += [' }']
txt += [' }'] txt += [' }']
txt += [' }'] txt += [' debug_log 1 "%s sct send ${cmd}"' % func]
txt += [' debug_log 1 "%s sct send ${cmd}"' % func] txt += [' if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {']
txt += [' if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {'] txt += [' sct send "${cmd}"']
txt += [' sct send "${cmd}"'] txt += [' }']
txt += [' }'] txt += [' return ${nextState}']
txt += [' return ${nextState}'] txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -789,12 +794,15 @@ def put_check_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# function to check the write parameter on a device'] txt += ['# function to check the write parameter on a device']
txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)]
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] resp=[sct result]"' % func] txt += [' set catch_status [ catch {']
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] resp=[sct result]"' % func]
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' return "idle"'] txt += [' return "idle"']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -802,22 +810,25 @@ def put_fetch_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# function to request the read of a parameter on a device'] txt += ['# function to request the read of a parameter on a device']
txt += ['proc %s::%s {tc_root nextState cmd_str} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root nextState cmd_str} {' % (MyDriver['namespace'], func)]
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"' % func] txt += [' set catch_status [ catch {']
txt += [' if { [hpropexists [sct] geterror] } {'] txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"' % func]
txt += [' hdelprop [sct] geterror'] txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' }'] txt += [' hdelprop [sct] geterror']
txt += [' set cmd "${cmd_str}"'] txt += [' }']
txt += [' set cmd "${cmd_str}"']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if { [hpropexists [sct] geterror] } {'] txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' debug_log 1 "[sct] error: [sct geterror]"'] txt += [' debug_log 1 "[sct] error: [sct geterror]"']
txt += [' return -code error "[sct geterror]"'] txt += [' error "[sct geterror]"']
txt += [' }'] txt += [' }']
txt += [' debug_log 1 "%s sct send ${cmd}"' % func] txt += [' debug_log 1 "%s sct send ${cmd}"' % func]
txt += [' sct send "${cmd}"'] txt += [' sct send "${cmd}"']
txt += [' return ${nextState}'] txt += [' return ${nextState}']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -825,32 +836,35 @@ def put_read_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# function to parse the read of a parameter on a device'] txt += ['# function to parse the read of a parameter on a device']
txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)]
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] result=[sct result]"' % func] txt += [' set catch_status [ catch {']
txt += [' if { [hpropexists [sct] geterror] } {'] txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] result=[sct result]"' % func]
txt += [' hdelprop [sct] geterror'] txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' }'] txt += [' hdelprop [sct] geterror']
txt += [' set data [sct result]'] txt += [' }']
txt += [' set nextState "idle"'] txt += [' set data [sct result]']
txt += [' if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {'] txt += [' set nextState "idle"']
txt += [' # the protocol driver has reported an error'] txt += [' if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {']
txt += [' sct geterror "${data}"'] txt += [' # the protocol driver has reported an error']
txt += [' return -code error "[sct geterror]"'] txt += [' sct geterror "${data}"']
txt += [' }'] txt += [' error "[sct geterror]"']
txt += [' }']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if { [hpropexists [sct] geterror] } {'] txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' debug_log 1 "[sct] error: [sct geterror]"'] txt += [' debug_log 1 "[sct] error: [sct geterror]"']
txt += [' return -code error "[sct geterror]"'] txt += [' error "[sct geterror]"']
txt += [' }'] txt += [' }']
txt += [' if { ${data} != [sct oldval] } {'] txt += [' if { ${data} != [sct oldval] } {']
txt += [' debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"'] txt += [' debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"']
txt += [' sct oldval ${data}'] txt += [' sct oldval ${data}']
txt += [' sct update ${data}'] txt += [' sct update ${data}']
txt += [' sct utime readtime'] txt += [' sct utime readtime']
txt += [' }'] txt += [' }']
txt += [' return ${nextState}'] txt += [' return ${nextState}']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -858,28 +872,31 @@ def put_checkrange_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# check function for hset change'] txt += ['# check function for hset change']
txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)]
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] target=[sct target]"' % func] txt += [' set catch_status [ catch {']
txt += [' set setpoint [sct target]'] txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] target=[sct target]"' % func]
txt += [' if { [hpropexists [sct] lowerlimit] } {'] txt += [' set setpoint [sct target]']
txt += [' set lolimit [sct lowerlimit]'] txt += [' if { [hpropexists [sct] lowerlimit] } {']
txt += [' } else {'] txt += [' set lolimit [sct lowerlimit]']
txt += [' # lowerlimit not set, use target'] txt += [' } else {']
txt += [' set lolimit [sct target]'] txt += [' # lowerlimit not set, use target']
txt += [' }'] txt += [' set lolimit [sct target]']
txt += [' if { [hpropexists [sct] upperlimit] } {'] txt += [' }']
txt += [' set hilimit [sct upperlimit]'] txt += [' if { [hpropexists [sct] upperlimit] } {']
txt += [' } else {'] txt += [' set hilimit [sct upperlimit]']
txt += [' # upperlimit not set, use target'] txt += [' } else {']
txt += [' set hilimit [sct target]'] txt += [' # upperlimit not set, use target']
txt += [' }'] txt += [' set hilimit [sct target]']
txt += [' }']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {'] txt += [' if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {']
txt += [' error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"'] txt += [' error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"']
txt += [' }'] txt += [' }']
txt += [' return OK'] txt += [' return OK']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -887,29 +904,32 @@ def put_checklimits_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# checklimits function for driveable interface'] txt += ['# checklimits function for driveable interface']
txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)]
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] target=[sct target]"' % func] txt += [' set catch_status [ catch {']
txt += [' set setpoint [sct target]'] txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] target=[sct target]"' % func]
txt += [' if { [hpropexists [sct] lowerlimit] } {'] txt += [' set setpoint [sct target]']
txt += [' set lolimit [sct lowerlimit]'] txt += [' if { [hpropexists [sct] lowerlimit] } {']
txt += [' } else {'] txt += [' set lolimit [sct lowerlimit]']
txt += [' # lowerlimit not set, use target'] txt += [' } else {']
txt += [' set lolimit [sct target]'] txt += [' # lowerlimit not set, use target']
txt += [' }'] txt += [' set lolimit [sct target]']
txt += [' if { [hpropexists [sct] upperlimit] } {'] txt += [' }']
txt += [' set hilimit [sct upperlimit]'] txt += [' if { [hpropexists [sct] upperlimit] } {']
txt += [' } else {'] txt += [' set hilimit [sct upperlimit]']
txt += [' # upperlimit not set, use target'] txt += [' } else {']
txt += [' set hilimit [sct target]'] txt += [' # upperlimit not set, use target']
txt += [' }'] txt += [' set hilimit [sct target]']
txt += [' }']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {'] txt += [' if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {']
txt += [' sct driving 0'] txt += [' sct driving 0']
txt += [' error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"'] txt += [' error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"']
txt += [' }'] txt += [' }']
txt += [' return OK'] txt += [' return OK']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -917,21 +937,24 @@ def put_checkstatus_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# checkstatus function for driveable interface'] txt += ['# checkstatus function for driveable interface']
txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)]
txt += [' set catch_status [ catch {']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if {[sct driving]} {'] txt += [' if {[sct driving]} {']
txt += [' set sp "[sct target]"'] txt += [' set sp "[sct target]"']
txt += [' set pv "[hval ${tc_root}/[sct driveable]]"'] txt += [' set pv "[hval ${tc_root}/[sct driveable]]"']
txt += [' if { ${pv} > ${sp} - [sct tolerance] && ${pv} < ${sp} + [sct tolerance] } {'] txt += [' if { ${pv} > ${sp} - [sct tolerance] && ${pv} < ${sp} + [sct tolerance] } {']
txt += [' sct driving 0'] txt += [' sct driving 0']
txt += [' return "idle"']
txt += [' }']
txt += [' return "busy"']
txt += [' } else {']
txt += [' return "idle"'] txt += [' return "idle"']
txt += [' }'] txt += [' }']
txt += [' return "busy"'] txt += [' } catch_message ]']
txt += [' } else {'] txt += [' handle_exception ${catch_status} ${catch_message}']
txt += [' return "idle"']
txt += [' }']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -939,14 +962,17 @@ def put_halt_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# halt function for driveable interface'] txt += ['# halt function for driveable interface']
txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root} {' % (MyDriver['namespace'], func)]
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] driving=[sct driving]"' % func] txt += [' set catch_status [ catch {']
txt += [' ### TODO hset [sct] [hval [sct]]'] txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] driving=[sct driving]"' % func]
txt += [' ### TODO hset [sct] [hval [sct]]']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' sct driving 0'] txt += [' sct driving 0']
txt += [' return "idle"'] txt += [' return "idle"']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -954,25 +980,28 @@ def put_pid_function(MyDriver, func):
txt = [''] txt = ['']
txt += ['# pid function for PID control'] txt += ['# pid function for PID control']
txt += ['proc %s::%s {tc_root sp pv} {' % (MyDriver['namespace'], func)] txt += ['proc %s::%s {tc_root sp pv} {' % (MyDriver['namespace'], func)]
txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] pv=${pv} sp=${sp}"' % func] txt += [' set catch_status [ catch {']
txt += [' sct pid_error [expr ${sp} - ${pv}]'] txt += [' debug_log 1 "%s tc_root=${tc_root} sct=[sct] pv=${pv} sp=${sp}"' % func]
txt += [' set p_value [expr [sct pid_pvalue] * [sct pid_error]]'] txt += [' sct pid_error [expr ${sp} - ${pv}]']
txt += [' set d_value [expr [sct pid_dvalue] * (${pv} - [sct oldval])]'] txt += [' set p_value [expr [sct pid_pvalue] * [sct pid_error]]']
txt += [' sct pid_deriv [sct pid_error]'] txt += [' set d_value [expr [sct pid_dvalue] * (${pv} - [sct oldval])]']
txt += [' sct pid_integ [expr [sct pid_integ] + [sct pid_error]]'] txt += [' sct pid_deriv [sct pid_error]']
txt += [' if { [sct pid_integ] > [sct pid_imax] } {'] txt += [' sct pid_integ [expr [sct pid_integ] + [sct pid_error]]']
txt += [' sct pid_integ [sct pid_imax]'] txt += [' if { [sct pid_integ] > [sct pid_imax] } {']
txt += [' }'] txt += [' sct pid_integ [sct pid_imax]']
txt += [' if { [sct pid_integ] < -[sct pid_imax] } {'] txt += [' }']
txt += [' sct pid_integ -[sct pid_imax]'] txt += [' if { [sct pid_integ] < -[sct pid_imax] } {']
txt += [' }'] txt += [' sct pid_integ -[sct pid_imax]']
txt += [' set i_value [expr [sct pid_ivalue] * [sct pid_integ]]'] txt += [' }']
txt += [' set pid [expr ${p_value} + ${i_value} + ${d_value}]'] txt += [' set i_value [expr [sct pid_ivalue] * [sct pid_integ]]']
txt += [' set pid [expr ${p_value} + ${i_value} + ${d_value}]']
if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0: if func in MyDriver['Funcs'] and len(MyDriver['Funcs'][func]['text']) > 0:
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' sct pid_output ${pid}'] txt += [' sct pid_output ${pid}']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += [' return ${pid}'] txt += [' return ${pid}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -1134,7 +1163,7 @@ def put_mk_sct_driver(MyDriver):
txt += MyDriver['Funcs']['mkDriver']['text'] txt += MyDriver['Funcs']['mkDriver']['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' } catch_message ]'] txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message} "in ${ns}::mk_sct_%s"' % MyDriver['name']] txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
emit(txt) emit(txt)
@ -1150,37 +1179,40 @@ def put_postamble(MyDriver):
else: else:
line = 'proc add_%s {name IP port} {' % MyDriver['name'] line = 'proc add_%s {name IP port} {' % MyDriver['name']
txt += [line] txt += [line]
txt += [' set ns "%s"' % MyDriver['namespace']] txt += [' set catch_status [ catch {']
txt += [' ${ns}::debug_log 1 "add_%s ${name} ${IP} ${port}"' % MyDriver['name']] txt += [' set ns "%s"' % MyDriver['namespace']]
txt += [' if {[SplitReply [%s]]=="false"} {' % MyDriver['simulation_group']] txt += [' ${ns}::debug_log 1 "add_%s ${name} ${IP} ${port}"' % MyDriver['name']]
txt += [' if {[string equal -nocase "aqadapter" "${IP}"]} {'] txt += [' if {[SplitReply [%s]]=="false"} {' % MyDriver['simulation_group']]
txt += [' ${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"'] txt += [' if {[string equal -nocase "aqadapter" "${IP}"]} {']
txt += [' makesctcontroller sct_${name} aqadapter ${port}'] txt += [' ${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"']
txt += [' } else {'] txt += [' makesctcontroller sct_${name} aqadapter ${port}']
txt += [' } else {']
if 'protocol_args' in MyDriver: if 'protocol_args' in MyDriver:
protocol_args = MyDriver['protocol_args'].replace('\\', '\\\\').replace('"', '\\"') protocol_args = MyDriver['protocol_args'].replace('\\', '\\\\').replace('"', '\\"')
txt += [' ${ns}::debug_log 1 "makesctcontroller sct_${name} %s ${IP}:${port} %s"' % (MyDriver['protocol'], protocol_args)] txt += [' ${ns}::debug_log 1 "makesctcontroller sct_${name} %s ${IP}:${port} %s"' % (MyDriver['protocol'], protocol_args)]
txt += [' makesctcontroller sct_${name} %s ${IP}:${port} %s' % (MyDriver['protocol'], MyDriver['protocol_args'])] txt += [' makesctcontroller sct_${name} %s ${IP}:${port} %s' % (MyDriver['protocol'], MyDriver['protocol_args'])]
else: else:
txt += [' ${ns}::debug_log 1 "makesctcontroller sct_${name} %s ${IP}:${port}"' % MyDriver['protocol']] txt += [' ${ns}::debug_log 1 "makesctcontroller sct_${name} %s ${IP}:${port}"' % MyDriver['protocol']]
txt += [' makesctcontroller sct_${name} %s ${IP}:${port}' % MyDriver['protocol']] txt += [' makesctcontroller sct_${name} %s ${IP}:${port}' % MyDriver['protocol']]
txt += [' }']
txt += [' }'] txt += [' }']
txt += [' }']
make_args = '' make_args = ''
if 'make_args' in MyDriver: if 'make_args' in MyDriver:
for arg in MyDriver['make_args'].split(): for arg in MyDriver['make_args'].split():
if len(make_args) > 0: if len(make_args) > 0:
make_args += ' ' make_args += ' '
make_args += '${' + arg + '}' make_args += '${' + arg + '}'
txt += [' ${ns}::debug_log 1 "mk_sct_%s sct_${name} ${name} %s"' % (MyDriver['name'], make_args)] txt += [' ${ns}::debug_log 1 "mk_sct_%s sct_${name} ${name} %s"' % (MyDriver['name'], make_args)]
txt += [' ${ns}::mk_sct_%s sct_${name} ${name} %s' % (MyDriver['name'], make_args)] txt += [' ${ns}::mk_sct_%s sct_${name} ${name} %s' % (MyDriver['name'], make_args)]
else: else:
txt += [' ${ns}::debug_log 1 "mk_sct_%s sct_${name} ${name}"' % MyDriver['name']] txt += [' ${ns}::debug_log 1 "mk_sct_%s sct_${name} ${name}"' % MyDriver['name']]
txt += [' ${ns}::mk_sct_%s sct_${name} ${name}' % MyDriver['name']] txt += [' ${ns}::mk_sct_%s sct_${name} ${name}' % MyDriver['name']]
# TODO # TODO
#txt += [' ${ns}::debug_log 1 "makesctemon ${name} /sics/${name}/emon/monmode /sics/${name}/emon/isintol /sics/${name}/emon/errhandler"'] #txt += [' ${ns}::debug_log 1 "makesctemon ${name} /sics/${name}/emon/monmode /sics/${name}/emon/isintol /sics/${name}/emon/errhandler"']
# txt += [' makesctemon ${name} /sics/${name}/emon/monmode /sics/${name}/emon/isintol /sics/${name}/emon/errhandler'] # txt += [' makesctemon ${name} /sics/${name}/emon/monmode /sics/${name}/emon/isintol /sics/${name}/emon/errhandler']
txt += [' close ${fd}'] txt += [' close ${fd}']
txt += [' } catch_message ]']
txt += [' handle_exception ${catch_status} ${catch_message}']
txt += ['}'] txt += ['}']
txt += [''] txt += ['']
txt += ['puts stdout "file evaluation of sct_%s.tcl"' % MyDriver['name']] txt += ['puts stdout "file evaluation of sct_%s.tcl"' % MyDriver['name']]