Reduce spurious differences in generated code

This commit is contained in:
Douglas Clowes
2014-11-06 16:37:46 +11:00
parent f1595151cd
commit 6bed30d5d4

View File

@ -1310,7 +1310,7 @@ def put_checkstatus_function(MyDriver, func):
txt += [' set sp "[sct target]"'] txt += [' set sp "[sct target]"']
txt += [' if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {'] txt += [' if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {']
txt += [' set pv "${sp}"'] txt += [' set pv "${sp}"']
txt += [' hset ${tc_root}/[sct driveable] ${sp}'] txt += [' hupdateif ${tc_root}/[sct driveable] ${sp}']
txt += [' }'] txt += [' }']
txt += [' set pv "[hval ${tc_root}/[sct driveable]]"'] txt += [' set pv "[hval ${tc_root}/[sct driveable]]"']
txt += [' }'] txt += [' }']
@ -1396,7 +1396,7 @@ def put_pid_function(MyDriver, func):
def put_var(MyDriver, MyGroup, MyVar): def put_var(MyDriver, MyGroup, MyVar):
readable_or_writeable = False readable_or_writeable = False
txt = [' # Start of var: ' + MyVar['name']] txt = []
postfix = [] postfix = []
if MyGroup['name']: if MyGroup['name']:
nodename = MyGroup['path'] + '/' + MyVar['name'] nodename = MyGroup['path'] + '/' + MyVar['name']
@ -1553,10 +1553,9 @@ def put_group(MyDriver, MyGroup):
dfr = [] dfr = []
if MyGroup['name']: if MyGroup['name']:
txt += [''] txt += ['']
txt += [' # Start of named group: ' + MyGroup['path']]
txt += [' hfactory ${scobj_hpath}/%s plain spy none' % MyGroup['path']] txt += [' hfactory ${scobj_hpath}/%s plain spy none' % MyGroup['path']]
else: else:
txt += [' # Start of unnamed group'] pass
for var in sorted(MyGroup['Vars']): for var in sorted(MyGroup['Vars']):
txt += [''] txt += ['']
@ -1569,13 +1568,11 @@ def put_group(MyDriver, MyGroup):
if 'GroupProperty' in MyGroup: if 'GroupProperty' in MyGroup:
for key in sorted(MyGroup['GroupProperty']): for key in sorted(MyGroup['GroupProperty']):
txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (MyGroup['path'], key, MyGroup['GroupProperty'][key])] txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (MyGroup['path'], key, MyGroup['GroupProperty'][key])]
txt += [' # End of named group: ' + MyGroup['path']]
else: else:
if 'GroupProperty' in MyGroup: if 'GroupProperty' in MyGroup:
txt += [''] txt += ['']
for key in sorted(MyGroup['GroupProperty']): for key in sorted(MyGroup['GroupProperty']):
txt += [' hsetprop ${scobj_hpath} %s "%s"' % (key, MyGroup['GroupProperty'][key])] txt += [' hsetprop ${scobj_hpath} %s "%s"' % (key, MyGroup['GroupProperty'][key])]
txt += [' # End of unnamed group']
for grp in sorted(MyGroup['Groups']): for grp in sorted(MyGroup['Groups']):
txt += put_group(MyDriver, MyGroup['Groups'][grp]) txt += put_group(MyDriver, MyGroup['Groups'][grp])
@ -2087,7 +2084,7 @@ def main():
parser.add_argument("-m", "--move", help="generate move commands", parser.add_argument("-m", "--move", help="generate move commands",
action="store_true") action="store_true")
parser.add_argument("--sct", help="where to put the sct in the filename", parser.add_argument("--sct", help="where to put the sct in the filename",
choices=["before", "after"], default="after") choices=["before", "after"], default="before")
parser.add_argument("-v", "--verbose", help="verbose output", parser.add_argument("-v", "--verbose", help="verbose output",
action="store_true") action="store_true")
parser.add_argument("driver_source", help="driver source file", nargs="*") parser.add_argument("driver_source", help="driver source file", nargs="*")