Commit 1c30910c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Update Ada generator

parent 489f848e
...@@ -1956,11 +1956,12 @@ def _transition(tr, **kwargs): ...@@ -1956,11 +1956,12 @@ def _transition(tr, **kwargs):
if tr.terminator.next_is_aggregation: # XXX add to C generator if tr.terminator.next_is_aggregation: # XXX add to C generator
code.append(u'-- Entering state aggregation {}' code.append(u'-- Entering state aggregation {}'
.format(tr.terminator.inputString)) .format(tr.terminator.inputString))
# Call the START function of the state aggregation
code.append(u'{};'.format(tr.terminator.next_id)) code.append(u'{};'.format(tr.terminator.next_id))
code.append(u'{ctxt}.state := {nextState};' code.append(u'{ctxt}.state := {nextState};'
.format(ctxt=LPREFIX, .format(ctxt=LPREFIX,
nextState=tr.terminator.inputString)) nextState=tr.terminator.inputString))
code.append(u'trId := -1;') # CHECKME code.append(u'trId := -1;')
elif tr.terminator.inputString.strip() != '-': elif tr.terminator.inputString.strip() != '-':
code.append(u'trId := ' + code.append(u'trId := ' +
unicode(tr.terminator.next_id) + u';') unicode(tr.terminator.next_id) + u';')
...@@ -1977,14 +1978,22 @@ def _transition(tr, **kwargs): ...@@ -1977,14 +1978,22 @@ def _transition(tr, **kwargs):
sep=UNICODE_SEP, sep=UNICODE_SEP,
nextState=tr.terminator.inputString)) nextState=tr.terminator.inputString))
else: else:
# "nextstate -": switch case to re-run the entry transition
# in case of a composite state or state aggregation
if any(next_id if any(next_id
for next_id in tr.terminator.candidate_id.viewkeys() for next_id in tr.terminator.candidate_id.viewkeys()
if next_id != -1): if next_id != -1):
code.append('case {}.state is'.format(LPREFIX)) code.append('case {}.state is'.format(LPREFIX))
for nid, sta in tr.terminator.candidate_id.viewitems(): for nid, sta in tr.terminator.candidate_id.viewitems():
print nid.encode('utf-8'), sta
if nid != -1: if nid != -1:
for each in sta: #if any(each for each in sta
code.extend([u'when {} =>'.format(each), # if each in parallel_states):
# pass
#else:
#for each in sta:
code.extend([u'when {} =>'
.format(u'|'.join(sta)),
u'trId := {};'.format(nid)]) u'trId := {};'.format(nid)])
code.extend(['when others =>', code.extend(['when others =>',
......
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