From 2517f71c67cc81570a2e1037710901898350d639 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Wed, 28 May 2014 12:24:20 +1000 Subject: [PATCH] Improve handling and logging for xxx_simulation case --- site_ansto/instrument/util/gen_sct.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 969c641d..baae4a10 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -1266,7 +1266,7 @@ def put_group(MyDriver, MyGroup): txt += [' hsetprop ${scobj_hpath} %s "%s"' % (key, MyGroup['GroupProperty'][key])] if readable_or_writeable: txt += [''] - txt += [' if {[SplitReply [%s]]=="false"} {' % MyDriver['simulation_group']] + txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']] for var in sorted(MyGroup['Vars']): MyVar = MyGroup['Vars'][var] nodename = groupname + MyVar['name'] @@ -1284,6 +1284,8 @@ def put_group(MyDriver, MyGroup): # Generate __ at runtime for driveable driveable = '${name}_' + make_path(MyVar) txt += [' ansto_makesctdrive %s ${scobj_hpath}/%s ${scobj_hpath}/%s ${sct_controller}' % (driveable, nodename, MyVar['driveable'])] + txt += [' } else {'] + txt += [' %s::sics_log 9 "[%s] => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['simulation_group'], MyDriver['name'])] txt += [' }'] for grp in sorted(MyGroup['Groups']): txt += put_group(MyDriver, MyGroup['Groups'][grp]) @@ -1357,7 +1359,7 @@ def put_postamble(MyDriver): txt += [' %s::sics_log 9 "add_%s ${name} ${IP} ${port} %s"' % (MyDriver['namespace'], MyDriver['name'], make_args)] else: txt += [' %s::sics_log 9 "add_%s ${name} ${IP} ${port}"' % (MyDriver['namespace'], MyDriver['name'])] - txt += [' if {[SplitReply [%s]]=="false"} {' % MyDriver['simulation_group']] + txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']] txt += [' if {[string equal -nocase "aqadapter" "${IP}"]} {'] txt += [' %s::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"' % MyDriver['namespace']] txt += [' makesctcontroller sct_${name} aqadapter ${port}'] @@ -1370,6 +1372,8 @@ def put_postamble(MyDriver): txt += [' %s::sics_log 9 "makesctcontroller sct_${name} %s ${IP}:${port}"' % (MyDriver['namespace'], MyDriver['protocol'])] txt += [' makesctcontroller sct_${name} %s ${IP}:${port}' % MyDriver['protocol']] txt += [' }'] + txt += [' } else {'] + txt += [' %s::sics_log 9 "[%s] => No sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['simulation_group'], MyDriver['name'])] txt += [' }'] if 'make_args' in MyDriver: make_args = ' '.join(["${%s}"%arg for arg in MyDriver['make_args'].split()]) @@ -1399,7 +1403,10 @@ def put_read_config(MyDriver): txt += [' if { [dict get $v "driver"] == "%s" } {' % MyDriver['name']] txt += [' if { [dict get $v enabled] } {'] txt += [' set name [dict get $v name]'] - txt += [' if { [dict exists $v "asyncqueue"] } {'] + txt += [' if { ![string equal -nocase [SplitReply [%s]] "false"] } {' % MyDriver['simulation_group']] + txt += [' set asyncqueue "null"'] + txt += [' ${ns}::sics_log 9 "[%s] => using null asyncqueue"' % MyDriver['simulation_group']] + txt += [' } elseif { [dict exists $v "asyncqueue"] } {'] txt += [' set asyncqueue [dict get $v "asyncqueue"]'] txt += [' } else {'] txt += [' if { [dict exists $v "asyncprotocol"] } {']