Commit 1873239f authored by Maxime Perrotin's avatar Maxime Perrotin

Prepare code generator for newtypes

parent 8d181a64
...@@ -365,6 +365,10 @@ LD_LIBRARY_PATH=../lib:. opengeode-simulator ...@@ -365,6 +365,10 @@ LD_LIBRARY_PATH=../lib:. opengeode-simulator
.format(n=var_name, .format(n=var_name,
sort=type_name(var_type), sort=type_name(var_type),
default=u' := ' + dstr if def_value else u'')) default=u' := ' + dstr if def_value else u''))
for sort in process.user_defined_types:
# TODO: declare array types....
print "Need to declare type ", sort
context_decl.append('end record;') context_decl.append('end record;')
# context is aliased so that the model checker can work with access type # context is aliased so that the model checker can work with access type
......
...@@ -867,6 +867,8 @@ class Process(object): ...@@ -867,6 +867,8 @@ class Process(object):
self.dataview = None self.dataview = None
# Reference to the Python module containing the ASN.1 AST # Reference to the Python module containing the ASN.1 AST
self.DV = None self.DV = None
# user-defined datatypes (using "newtype" SDL keyword)
self.user_defined_types = dict()
# input and output signal lists: # input and output signal lists:
# [{'name': str, 'type': str, 'direction':'in'/'out'}] # [{'name': str, 'type': str, 'direction':'in'/'out'}]
......
...@@ -2895,7 +2895,8 @@ def newtype(root, ta_ast, context): ...@@ -2895,7 +2895,8 @@ def newtype(root, ta_ast, context):
warnings.append( warnings.append(
'Unsupported type definition in newtype, type: ' + 'Unsupported type definition in newtype, type: ' +
str(root.type)) str(root.type))
# STRUCT CASE if isinstance(context, ogAST.Process):
context.user_defined_types = USER_DEFINED_TYPES
return errors, warnings return errors, warnings
......
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