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

Prepare code generator for newtypes

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