Commit 28c52dd0 authored by bouazizrahma's avatar bouazizrahma
Browse files

read value from an input port + put value in an output port and send it

parent 537ed289
......@@ -31,12 +31,15 @@
package Ocarina.Backends.C_Common.BA is
function Map_C_Behavior_Variables (S : Node_Id) return List_Id;
procedure Map_C_Behavior_Variables (S : Node_Id;
Declarations : List_Id);
-- This function maps variables declared in the BA variables
-- section to variables in the corresponding genereted C-subprogram
-- having the same identifiers. It returns the declarations list of
-- the generated C-subprogram.
function Map_C_Behavior_Actions (S : Node_Id) return List_Id;
procedure Map_C_Behavior_Actions (S : Node_Id;
Declarations : List_Id;
Statements : List_Id);
end Ocarina.Backends.C_Common.BA;
......@@ -2932,10 +2932,13 @@ package body Ocarina.Backends.C_Common.Mapping is
-- To C-statements in the generated C-subprogram
-- Map_C_Behavior_Variables (S,Declarations);
CCBA.Map_C_Behavior_Variables (S, Declarations);
CCBA.Map_C_Behavior_Actions (S, Declarations, Statements);
return CTU.Make_Function_Implementation
CCBA.Map_C_Behavior_Variables (S),
CCBA.Map_C_Behavior_Actions (S));
when others =>
......@@ -1195,6 +1195,9 @@ package body Ocarina.Backends.C_Common.Subprograms is
N : Node_Id;
Def_Idt : Node_Id;
Parameter_List : constant List_Id := New_List (CTN.K_List_Id);
Declarations : constant List_Id :=
New_List (CTN.K_Declaration_List);
Statements : constant List_Id := New_List (CTN.K_Statement_List);
if Has_In_Ports (E) then
Feature := First_Node (Features (E));
......@@ -1255,10 +1258,13 @@ package body Ocarina.Backends.C_Common.Subprograms is
Parameters => Parameter_List,
Return_Type => New_Node (CTN.K_Void));
Map_C_Behavior_Variables (E, Declarations);
Map_C_Behavior_Actions (E, Declarations, Statements);
N := Make_Function_Implementation
(Specification => N,
Declarations => Map_C_Behavior_Variables (E),
Statements => Map_C_Behavior_Actions (E));
Declarations => Declarations,
Statements => Statements);
Append_Node_To_List (N, CTN.Declarations (Current_File));
end if;
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