Commit ccf5d42d authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Support vdm composite types

parent ca562004
...@@ -194,7 +194,8 @@ def vdm_to_swig(vdm, dest, sort, ASN1Swig, ASN1_AST, var=None): ...@@ -194,7 +194,8 @@ def vdm_to_swig(vdm, dest, sort, ASN1Swig, ASN1_AST, var=None):
ptr = ptr[int(split[1])] ptr = ptr[int(split[1])]
def rec(inp, outp, sort): def rec(inp, outp, sort):
''' Recursively fill up the value ''' ''' Recursively fill up the value '''
if sort.kind == 'ReferenceType': kind = sort.kind
if kind == 'ReferenceType':
sort = ASN1_AST[sort.ReferencedTypeName] sort = ASN1_AST[sort.ReferencedTypeName]
kind = sort.type.kind kind = sort.type.kind
if kind in ('SequenceOfType', 'SetOfType'): if kind in ('SequenceOfType', 'SetOfType'):
...@@ -276,9 +277,7 @@ def vdm_to_swig(vdm, dest, sort, ASN1Swig, ASN1_AST, var=None): ...@@ -276,9 +277,7 @@ def vdm_to_swig(vdm, dest, sort, ASN1Swig, ASN1_AST, var=None):
_, params, path = outp.GetState() _, params, path = outp.GetState()
if path: if path:
path = path.strip('.').split('.') path = path.strip('.').split('.')
for field, data in zip(sort.type.Children.viewkeys(), inp['Seq']): for field, data in zip(outp.children_ordered, inp['Seq']):
# Yikes! Ordering of fiels in the Sequence is not guaranteed
# in a normal dict....
outp.Reset() outp.Reset()
for each in path: for each in path:
# Reach the path, including indexes # Reach the path, including indexes
...@@ -293,6 +292,7 @@ def vdm_to_swig(vdm, dest, sort, ASN1Swig, ASN1_AST, var=None): ...@@ -293,6 +292,7 @@ def vdm_to_swig(vdm, dest, sort, ASN1Swig, ASN1_AST, var=None):
reach(path[0], outp) reach(path[0], outp)
else: else:
# Unsupported type # Unsupported type
print 'unsupported type: ', kind
pass pass
rec(var, dest, sort) rec(var, dest, sort)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment