Add wrapper_property and mkWrapper code for SCT wrappers
This commit is contained in:
@ -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,45 +1381,51 @@ def put_mkDriver(MyDriver):
|
||||
txt += [' set ns "[namespace current]"']
|
||||
txt += [' set catch_status [ catch {']
|
||||
txt += ['']
|
||||
if len(MyDriver['Permlink']) > 0:
|
||||
if 'make_args' in MyDriver and 'id' in MyDriver['make_args'].split():
|
||||
pass
|
||||
else:
|
||||
txt += [' set permlink_device_number [format "%02d" [incr ::scobj::permlink_device_counter]]']
|
||||
txt += ['']
|
||||
if 'sobj_priv_type' in MyDriver:
|
||||
priv_type = MyDriver['sobj_priv_type'].split()
|
||||
ms_line = ' MakeSICSObj ${name} SCT_OBJECT %s %s' % (priv_type[0], priv_type[1])
|
||||
else:
|
||||
ms_line = ' MakeSICSObj ${name} SCT_OBJECT'
|
||||
txt += [ms_line]
|
||||
txt += ['']
|
||||
txt += [' sicslist setatt ${name} klass %s' % MyDriver['class']]
|
||||
txt += [' sicslist setatt ${name} long_name ${name}']
|
||||
if 'DriverProperty' in MyDriver:
|
||||
for key in MyDriver['DriverProperty']:
|
||||
txt += [' sicslist setatt ${name} %s "%s"' % (key, MyDriver['DriverProperty'][key])]
|
||||
txt += ['']
|
||||
txt += [' set scobj_hpath /sics/${name}']
|
||||
|
||||
for group in sorted(MyDriver['Groups']):
|
||||
txt += put_group(MyDriver, MyDriver['Groups'][group])
|
||||
|
||||
txt += [' hsetprop ${scobj_hpath} klass %s' % MyDriver['class']]
|
||||
txt += [' hsetprop ${scobj_hpath} data true']
|
||||
txt += [' hsetprop ${scobj_hpath} debug_threshold %s' % str(MyDriver['debug_threshold'])]
|
||||
if len(MyDriver['Deferred']) > 0:
|
||||
txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']]
|
||||
for line in MyDriver['Deferred']:
|
||||
txt += [' ' + line]
|
||||
txt += [' }']
|
||||
func = 'mkDriver'
|
||||
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:
|
||||
txt += ['# %s hook code goes here' % func]
|
||||
if len(MyDriver['Permlink']) > 0:
|
||||
if 'make_args' in MyDriver and 'id' in MyDriver['make_args'].split():
|
||||
pass
|
||||
else:
|
||||
txt += [' set permlink_device_number [format "%02d" [incr ::scobj::permlink_device_counter]]']
|
||||
txt += ['']
|
||||
if 'sobj_priv_type' in MyDriver:
|
||||
priv_type = MyDriver['sobj_priv_type'].split()
|
||||
ms_line = ' MakeSICSObj ${name} SCT_OBJECT %s %s' % (priv_type[0], priv_type[1])
|
||||
else:
|
||||
ms_line = ' MakeSICSObj ${name} SCT_OBJECT'
|
||||
txt += [ms_line]
|
||||
txt += ['']
|
||||
txt += [' sicslist setatt ${name} klass %s' % MyDriver['class']]
|
||||
txt += [' sicslist setatt ${name} long_name ${name}']
|
||||
if 'DriverProperty' in MyDriver:
|
||||
for key in MyDriver['DriverProperty']:
|
||||
txt += [' sicslist setatt ${name} %s "%s"' % (key, MyDriver['DriverProperty'][key])]
|
||||
txt += ['']
|
||||
txt += [' set scobj_hpath /sics/${name}']
|
||||
|
||||
for group in sorted(MyDriver['Groups']):
|
||||
txt += put_group(MyDriver, MyDriver['Groups'][group])
|
||||
|
||||
txt += [' hsetprop ${scobj_hpath} klass %s' % MyDriver['class']]
|
||||
txt += [' hsetprop ${scobj_hpath} data true']
|
||||
txt += [' hsetprop ${scobj_hpath} debug_threshold %s' % str(MyDriver['debug_threshold'])]
|
||||
if len(MyDriver['Deferred']) > 0:
|
||||
txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']]
|
||||
for line in MyDriver['Deferred']:
|
||||
txt += [' ' + line]
|
||||
txt += [' }']
|
||||
func = 'mkDriver'
|
||||
if func in MyDriver['Funcs']:
|
||||
txt += ['# %s hook code starts' % func]
|
||||
txt += MyDriver['Funcs'][func]['text']
|
||||
txt += ['# %s hook code ends' % func]
|
||||
else:
|
||||
txt += ['# %s hook code goes here' % func]
|
||||
txt += [' } catch_message ]']
|
||||
txt += [' handle_exception ${catch_status} ${catch_message}']
|
||||
txt += ['}']
|
||||
|
Reference in New Issue
Block a user