diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index b4199ab4..ced9a7e5 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -1162,14 +1162,14 @@ def put_group(MyDriver, MyGroup): txt += [' hsetprop ${scobj_hpath}/%s oldval UNKNOWN' % nodename] for key in sorted(MyVar['Property']): txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (nodename, key, MyVar['Property'][key])] + # Generated at runtime __ for nxalias and driveable + path = MyVar['path'] + if len(path) > 0: + path = path.replace('/', '_') + '_' + path += MyVar['name'] + #print "Path: %s" % MyVar['path'] + nxalias = '${name}_' + path if 'nxalias' not in MyVar['Property']: - # TODO: generated at runtime __ - path = MyVar['path'] - if len(path) > 0: - path = path.replace('/', '_') + '_' - path += MyVar['name'] - #print "Path: %s" % MyVar['path'] - nxalias = '${name}_' + path txt += [' hsetprop ${scobj_hpath}/%s nxalias "%s"' % (nodename, nxalias)] if not MyGroup['name']: if 'GroupProperty' in MyGroup: @@ -1193,7 +1193,7 @@ def put_group(MyDriver, MyGroup): if MyVar['writeable'] > 0 or MyVar['driveable']: txt += [' ${sct_controller} write ${scobj_hpath}/%s' % nodename] if MyVar['driveable']: - txt += [' ansto_makesctdrive ${name}_%s ${scobj_hpath}/%s ${scobj_hpath}/%s ${sct_controller}' % (MyVar['name'], nodename, MyVar['driveable'])] + txt += [' ansto_makesctdrive %s ${scobj_hpath}/%s ${scobj_hpath}/%s ${sct_controller}' % (nxalias, nodename, MyVar['driveable'])] txt += [' }'] for grp in sorted(MyGroup['Groups']): txt += put_group(MyDriver, MyGroup['Groups'][grp]) @@ -1206,7 +1206,15 @@ def put_mk_sct_driver(MyDriver): else: line = 'proc %s::mk_sct_%s { sct_controller name } {' % (MyDriver['namespace'], MyDriver['name']) txt += [line] - txt += [' debug_log 1 "mk_sct_%s for ${name}"' % MyDriver['name']] + if 'make_args' in MyDriver: + make_args = '' + for arg in MyDriver['make_args'].split(): + if len(make_args) > 0: + make_args += ' ' + make_args += '${' + arg + '}' + txt += [' debug_log 1 "mk_sct_%s ${sct_controller} ${name} %s"' % (MyDriver['name'], make_args)] + else: + txt += [' debug_log 1 "mk_sct_%s for ${name}"' % MyDriver['name']] txt += [' set ns "[namespace current]"'] txt += [' set catch_status [ catch {'] txt += [''] @@ -1249,7 +1257,15 @@ def put_postamble(MyDriver): txt += [line] txt += [' set catch_status [ catch {'] txt += [' set ns "%s"' % MyDriver['namespace']] - txt += [' ${ns}::debug_log 1 "add_%s ${name} ${IP} ${port}"' % MyDriver['name']] + if 'make_args' in MyDriver: + make_args = '' + for arg in MyDriver['make_args'].split(): + if len(make_args) > 0: + make_args += ' ' + make_args += '${' + arg + '}' + txt += [' ${ns}::debug_log 1 "add_%s ${name} ${IP} ${port} %s"' % (MyDriver['name'], make_args)] + else: + txt += [' ${ns}::debug_log 1 "add_%s ${name} ${IP} ${port}"' % MyDriver['name']] txt += [' if {[SplitReply [%s]]=="false"} {' % MyDriver['simulation_group']] txt += [' if {[string equal -nocase "aqadapter" "${IP}"]} {'] txt += [' ${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"'] @@ -1264,8 +1280,8 @@ def put_postamble(MyDriver): txt += [' makesctcontroller sct_${name} %s ${IP}:${port}' % MyDriver['protocol']] txt += [' }'] txt += [' }'] - make_args = '' if 'make_args' in MyDriver: + make_args = '' for arg in MyDriver['make_args'].split(): if len(make_args) > 0: make_args += ' ' @@ -1291,8 +1307,8 @@ def put_standard_code(MyDriver): for func in sorted(MyDriver['Funcs']): theFunc = MyDriver['Funcs'][func] # Don't generate functions which are not referenced - if theFunc['reference_count'] == 0: - continue + #if theFunc['reference_count'] == 0: + # continue if theFunc['type'] == 'read_function': put_read_function(MyDriver, func); elif theFunc['type'] == 'write_function':