Add wrapper_property and mkWrapper code for SCT wrappers

This commit is contained in:
Douglas Clowes
2014-08-18 11:20:44 +10:00
parent 8541f7cd90
commit da17516491

View File

@ -80,6 +80,7 @@ reserved = {
'DEVICE' : 'DEVICE',
'PROTOCOL' : 'PROTOCOL',
'DRIVER_PROPERTY' : 'DRIVER_PROPERTY',
'WRAPPER_PROPERTY' : 'WRAPPER_PROPERTY',
'CLASS' : 'CLASS',
'SIMULATION_GROUP' : 'SIMULATION_GROUP',
'DEBUG_THRESHOLD' : 'DEBUG_THRESHOLD',
@ -303,6 +304,7 @@ def p_driver_statement(p):
| group
| code
| driver_property
| wrapper_property
'''
p[0] = p[1]
@ -446,6 +448,12 @@ def p_driver_property(p):
'''
p[0] = { 'DriverProperty' : ( p[2], p[4] ) }
def p_wrapper_property(p):
'''
wrapper_property : WRAPPER_PROPERTY id_or_str EQUALS value
'''
p[0] = { 'WrapperProperty' : ( p[2], p[4] ) }
def p_group_property(p):
'''
group_property : GROUP_PROPERTY id_or_str EQUALS value
@ -794,6 +802,11 @@ def build_driver(MyDriver, TheTree):
MyDriver['DriverProperty'] = {}
MyDriver['DriverProperty'][item['DriverProperty'][0]] = item['DriverProperty'][1]
continue
if 'WrapperProperty' in item:
if 'WrapperProperty' not in MyDriver:
MyDriver['WrapperProperty'] = {}
MyDriver['WrapperProperty'][item['WrapperProperty'][0]] = item['WrapperProperty'][1]
continue
for key in item:
MyDriver[key] = item[key]
for item in MyDriver['Permlink']:
@ -1368,6 +1381,12 @@ def put_mkDriver(MyDriver):
txt += [' set ns "[namespace current]"']
txt += [' set catch_status [ catch {']
txt += ['']
func = 'mkWrapper'
if func in MyDriver['Funcs']:
txt += ['# %s hook code starts' % func]
txt += MyDriver['Funcs'][func]['text']
txt += ['# %s hook code ends' % func]
else:
if len(MyDriver['Permlink']) > 0:
if 'make_args' in MyDriver and 'id' in MyDriver['make_args'].split():
pass