Allow conditional groups and vars in sct drivers
This commit is contained in:
@ -117,6 +117,7 @@ reserved = {
|
|||||||
'VAR' : 'VAR',
|
'VAR' : 'VAR',
|
||||||
'PROPERTY' : 'PROPERTY',
|
'PROPERTY' : 'PROPERTY',
|
||||||
'CONTROL' : 'CONTROL',
|
'CONTROL' : 'CONTROL',
|
||||||
|
'CONDITIONAL' : 'CONDITIONAL',
|
||||||
'DATA' : 'DATA',
|
'DATA' : 'DATA',
|
||||||
'NXSAVE' : 'NXSAVE',
|
'NXSAVE' : 'NXSAVE',
|
||||||
'MUTABLE' : 'MUTABLE',
|
'MUTABLE' : 'MUTABLE',
|
||||||
@ -456,6 +457,7 @@ def p_var_typ_ass(p):
|
|||||||
| DATA EQUALS true_false
|
| DATA EQUALS true_false
|
||||||
| NXSAVE EQUALS true_false
|
| NXSAVE EQUALS true_false
|
||||||
| MUTABLE EQUALS true_false
|
| MUTABLE EQUALS true_false
|
||||||
|
| CONDITIONAL EQUALS text_string
|
||||||
'''
|
'''
|
||||||
p[0] = { p[1] : p[3] }
|
p[0] = { p[1] : p[3] }
|
||||||
|
|
||||||
@ -1445,6 +1447,19 @@ def put_var(MyDriver, MyGroup, MyVar):
|
|||||||
txt += [' %s::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['name'])]
|
txt += [' %s::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for %s"' % (MyDriver['namespace'], MyDriver['name'])]
|
||||||
txt += [' }']
|
txt += [' }']
|
||||||
|
|
||||||
|
if 'conditional' in MyVar:
|
||||||
|
for idx, line in enumerate(txt):
|
||||||
|
if len(line) > 0:
|
||||||
|
txt[idx] = ' ' + line
|
||||||
|
txt.insert(0, ' if {%s} {' % MyVar['conditional'])
|
||||||
|
txt.append(' }')
|
||||||
|
if len(postfix) > 0:
|
||||||
|
for idx, line in enumerate(postfix):
|
||||||
|
if len(line) > 0:
|
||||||
|
postfix[idx] = ' ' + line
|
||||||
|
postfix.insert(0, ' if {%s} {' % MyVar['conditional'])
|
||||||
|
postfix.append(' }')
|
||||||
|
|
||||||
return (txt, postfix)
|
return (txt, postfix)
|
||||||
|
|
||||||
def put_group(MyDriver, MyGroup):
|
def put_group(MyDriver, MyGroup):
|
||||||
@ -1478,6 +1493,13 @@ def put_group(MyDriver, MyGroup):
|
|||||||
|
|
||||||
txt += dfr
|
txt += dfr
|
||||||
|
|
||||||
|
if 'conditional' in MyGroup:
|
||||||
|
for idx, line in enumerate(txt):
|
||||||
|
if len(line) > 0:
|
||||||
|
txt[idx] = ' ' + line
|
||||||
|
txt.insert(0, ' if {%s} {' % MyGroup['conditional'])
|
||||||
|
txt.append(' }')
|
||||||
|
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
def put_mkDriver(MyDriver):
|
def put_mkDriver(MyDriver):
|
||||||
|
Reference in New Issue
Block a user