Commit 3d612be7 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add explicit dereferencing in parameterless calls

Ada: When calling an access procedure with no parameter, it seems
mandatory to add ".all" to the call. Not understood why it is not needed
when the procedure has parameters.
parent ecf274d4
......@@ -192,8 +192,10 @@ def _process(process, simu=False, **kwargs):
if simu:
# Add function allowing to trace current state as a string
process_level_decl.append('function get_state return chars_ptr;')
process_level_decl.append('pragma export(C, get_state, "{}_state");'
process_level_decl.append("function get_state return chars_ptr "
"is (New_String(states'Image(state))) "
"with Export, Convention => C, "
'Link_Name => "{}_state";'
.format(process_name))
# Functions to get gobal variables (length and value)
for var_name, (var_type, _) in process.variables.viewitems():
......@@ -489,15 +491,6 @@ package {process_name} is'''.format(process_name=process_name,
taste_template.append('end runTransition;')
taste_template.append('\n')
if simu:
# Code of the function allowing to trace current state
# Can be used when tracing the execution with MSC
taste_template.append('function get_state return chars_ptr is')
taste_template.append('begin')
taste_template.append("return New_String(states'Image(state));")
taste_template.append('end get_state;')
taste_template.append('\n')
taste_template.extend(start_transition)
taste_template.append('end {process_name};'
.format(process_name=process_name))
......@@ -697,7 +690,10 @@ def _call_external_function(output, **kwargs):
.format(RI=out['outputName'],
params=', '.join(list_of_params)))
else:
code.append(u'{RI};'.format(RI=out['outputName']))
if not SHARED_LIB:
code.append(u'{RI};'.format(RI=out['outputName']))
else:
code.append(u'{RI}.all;'.format(RI=out['outputName']))
else:
# inner procedure call
list_of_params = []
......
......@@ -13,30 +13,38 @@ dcl anInt T_UInt32 :=0;
timer myTimer;
/* CIF ENDTEXT */
/* CIF START (478, 150), (80, 36) */
/* CIF START (621, 150), (80, 36) */
START;
/* CIF NEXTSTATE (483, 201), (68, 34) */
/* CIF NEXTSTATE (626, 201), (68, 34) */
NEXTSTATE Wait;
/* CIF STATE (601, 354), (70, 35) */
/* CIF STATE (826, 354), (70, 35) */
STATE next;
/* CIF INPUT (601, 409), (70, 35) */
/* CIF INPUT (826, 409), (70, 35) */
INPUT *;
/* CIF NEXTSTATE (601, 459), (70, 35) */
/* CIF NEXTSTATE (826, 459), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
/* CIF STATE (483, 201), (68, 34) */
/* CIF STATE (626, 201), (68, 34) */
STATE Wait;
/* CIF INPUT (474, 255), (87, 35) */
/* CIF INPUT (461, 255), (87, 35) */
INPUT pulse(a);
/* CIF PROCEDURECALL (420, 305), (193, 35) */
/* CIF PROCEDURECALL (407, 305), (193, 35) */
CALL externalProc(anint, anint);
/* CIF OUTPUT (460, 355), (114, 35) */
/* CIF OUTPUT (447, 355), (114, 35) */
OUTPUT telemetry(a);
/* CIF OUTPUT (455, 405), (123, 35) */
/* CIF OUTPUT (442, 405), (123, 35) */
OUTPUT peek_list(seq);
/* CIF OUTPUT (444, 455), (145, 35) */
/* CIF OUTPUT (431, 455), (145, 35) */
OUTPUT peek_fixed(fixed);
/* CIF NEXTSTATE (482, 505), (70, 35) */
/* CIF NEXTSTATE (469, 505), (70, 35) */
NEXTSTATE next;
/* CIF INPUT (652, 255), (122, 35) */
INPUT Paramless_TC;
/* CIF PROCEDURECALL (610, 305), (205, 35) */
CALL writeln('Got Paramless TC');
/* CIF OUTPUT (650, 355), (125, 35) */
OUTPUT Paramless_TM;
/* CIF NEXTSTATE (678, 405), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
ENDPROCESS orchestrator;
\ No newline at end of file
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