Commit 462ee1e0 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix external procedure support

parent b3878576
......@@ -1300,9 +1300,11 @@ def _inner_procedure(proc):
local_decl.append(pi_header + ';')
# Generate the code for the procedure itself (unless it's external):
# local variables and code of the START transition
if not proc.external:
if proc.external:
local_decl.append('pragma import(C, {});'.format(proc.inputString))
else:
# Generate the code for the procedure itself
# local variables and code of the START transition
# Recursively generate the code for inner-defined procedures
for inner_proc in proc.content.inner_procedures:
inner_code, inner_local = generate(inner_proc)
......
......@@ -371,7 +371,6 @@ def check_and_fix_op_params(op_name, expr_list, context):
param_type = type_name(signature[idx].get('type'))
# Retrieve the type (or None if it is a sepecial operator)
dataview_entry = types().get(param_type) or UNKNOWN_TYPE
#dataview_type = dataview_entry.type # XXX
if dataview_entry is not UNKNOWN_TYPE:
dataview_type = new_ref_type(param_type)
else:
......@@ -383,6 +382,10 @@ def check_and_fix_op_params(op_name, expr_list, context):
expr.right = param
fix_expression_types(expr, context)
expr_list[idx] = expr.right
if signature[idx].get('direction') != 'in' \
and not isinstance(expr.right, ogAST.PrimVariable):
raise TypeError('OUT parameter "{}" is not a variable'
.format(expr.right.inputString))
def check_type_compatibility(primary, typeRef, context):
......
PROCESS challenge;
/* CIF TEXT (243, 91), (298, 113) */
/* CIF TEXT (587, 91), (298, 120) */
dcl count, actual_count CountTab;
dcl pow_value T_UInt32 := 0;
dcl check T_UInt8;
......@@ -8,39 +8,48 @@ dcl bitwise SeqBit;
dcl bitwise2 SeqBit2;
dcl boolwise t_Boolean;
/* CIF ENDTEXT */
/* CIF START (94, 14), (68, 37) */
/* CIF TEXT (-187, 64), (254, 104) */
procedure test;
fpar in first t_UInt8,
in/out second t_boolean;
external;
dcl testvalue t_boolean := true;
/* CIF ENDTEXT */
/* CIF START (337, 14), (68, 37) */
START;
/* CIF TASK (37, 66), (182, 68) */
/* CIF TASK (278, 66), (184, 72) */
TASK for x in count:
count(x) := count_max
actual_count(x) := 0
endfor;
/* CIF NEXTSTATE (93, 149), (70, 35) */
/* CIF NEXTSTATE (336, 153), (70, 35) */
NEXTSTATE Wait;
/* CIF STATE (290, 11), (65, 35) */
/* CIF STATE (585, 11), (68, 35) */
STATE Wait;
ENDSTATE;
/* CIF STATE (93, 149), (70, 35) */
/* CIF STATE (336, 153), (70, 35) */
STATE Wait;
/* CIF INPUT (93, 204), (70, 35) */
/* CIF INPUT (336, 208), (70, 35) */
INPUT run;
/* CIF PROCEDURECALL (45, 254), (166, 35) */
/* CIF PROCEDURECALL (287, 258), (166, 35) */
CALL writeln('Computing');
/* CIF TASK (-76, 304), (409, 188) */
/* CIF TASK (164, 308), (412, 216) */
TASK for x in range(exceed_nb):
for n in range(nb_bit):
call pow(2, n, pow_value);
check := if val_max - x>0 and pow_value>0 then 1 else 0 fi
bitwise := bitwise and bitwise
bitwise2 := bitwise2 and {true, false}
bitwise2 := bitwise2 xor {true, false}
bitwise2 := bitwise2 and bitwise2
boolwise := boolwise and boolwise
check := if (check=0) and pow_value>1 then 1 else 0 fi
count(n) := count(n) - check
call test(n+1, testvalue);
endfor
endfor;
/* CIF NEXTSTATE (93, 507), (70, 35) */
/* CIF NEXTSTATE (336, 539), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
ENDPROCESS challenge;
\ 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