Commit 2d9b6d95 authored by Rahma BOUAZIZ's avatar Rahma BOUAZIZ Committed by yoogx
Browse files

* Support code generation for subprograms with BA subclause

        For openaadl/ocarina#190
parent d22ea2c8
This diff is collapsed.
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . C _ C O M M O N . B A --
-- --
-- S p e c --
-- --
-- Copyright (C) 2019 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. Ocarina is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- Ocarina is maintained by the TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
package Ocarina.Backends.C_Common.BA is
function Map_C_Behavior_Variables (S : Node_Id) return 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;
end Ocarina.Backends.C_Common.BA;
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2019 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -52,6 +52,8 @@ with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.C_Common.BA;
package body Ocarina.Backends.C_Common.Mapping is
use Ocarina.Namet;
......@@ -79,6 +81,7 @@ package body Ocarina.Backends.C_Common.Mapping is
package CTU renames Ocarina.Backends.C_Tree.Nutils;
package PKR renames Ocarina.Backends.POK_C.Runtime;
package PHR renames Ocarina.Backends.PO_HI_C.Runtime;
package CCBA renames Ocarina.Backends.C_Common.BA;
---------------------------
-- Call_Remote_Functions --
......@@ -2916,6 +2919,24 @@ package body Ocarina.Backends.C_Common.Mapping is
Declarations,
Statements);
when Subrogram_With_Behavior_Specification =>
-- 1) Mapping BA variables into local variable declarations
-- in the generated C-subprogram.
-- 2) Mapping BA states, transitions and actions:
-- For an AADL subprogram with BA, we have: a single state
-- as initial final state; a single transition without
-- condition with a Behavior_Action_Block.
-- Thus, we need to map the Behavior_Action_Block
-- To C-statements in the generated C-subprogram
-- Map_C_Behavior_Variables (S,Declarations);
return CTU.Make_Function_Implementation
(Spec,
CCBA.Map_C_Behavior_Variables (S),
CCBA.Map_C_Behavior_Actions (S));
when others =>
Display_Located_Error
(AIN.Loc (S),
......
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