Commit 976b5af3 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Generate first layout of Ada code

parent 03b9b1c5
...@@ -72,7 +72,35 @@ def parse_input_files(pr_files, ppty_file): ...@@ -72,7 +72,35 @@ def parse_input_files(pr_files, ppty_file):
for each in stop_conditions: for each in stop_conditions:
stmts, string, local_decl = opengeode.AdaGenerator.expression(each) stmts, string, local_decl = opengeode.AdaGenerator.expression(each)
log.info(string) log.info(string)
# For each stop condition create a new Procedure with a boolean return type
process.content.inner_procedures = []
process.procedures = []
process.transitions = []
process.composite_states = []
process.mapping = {}
idx = 0
for each in stop_conditions:
proc = opengeode.ogAST.Procedure()
proc.return_type = opengeode.ogParser.BOOLEAN
proc.inputString = 'property_{}'.format(idx)
proc.global_variables = process.variables
proc.global_timers = process.timers
proc.input_signals = process.input_signals
proc.output_signals = process.output_signals
proc.procedures = process.procedures
proc.operators = process.operators
proc.content.parent = process
start = opengeode.ogAST.Start()
start.transition = opengeode.ogAST.Transition()
proc.content.start = start
decision = opengeode.ogAST.Terminator()
decision.kind = 'return'
decision.return_expr = each
proc.content.start.terminators = [decision]
proc.content.start.transition.terminators = [decision]
process.content.inner_procedures.append(proc)
idx += 1
opengeode.AdaGenerator.generate(process)
def cli(): def cli():
''' Application entry point, when used from the command line ''' ''' Application entry point, when used from the command line '''
......
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