Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
28c52dd0
Commit
28c52dd0
authored
May 23, 2019
by
bouazizrahma
Browse files
read value from an input port + put value in an output port and send it
parent
537ed289
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
src/backends/ocarina-backends-c_common-ba.adb
View file @
28c52dd0
This diff is collapsed.
Click to expand it.
src/backends/ocarina-backends-c_common-ba.ads
View file @
28c52dd0
...
...
@@ -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
;
src/backends/ocarina-backends-c_common-mapping.adb
View file @
28c52dd0
...
...
@@ -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
(
Spec
,
CCBA
.
Map_C_Behavior_Variables
(
S
)
,
CCBA
.
Map_C_Behavior_Actions
(
S
)
);
Declarations
,
Statements
);
when
others
=>
Display_Located_Error
...
...
src/backends/ocarina-backends-c_common-subprograms.adb
View file @
28c52dd0
...
...
@@ -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
);
begin
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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment