Commit f091911c authored by yoogx's avatar yoogx

Merge branch 'master' of https://github.com/OpenAADL/ocarina

parents 54911b76 01f81597
......@@ -31,10 +31,9 @@
with Ada.Unchecked_Deallocation;
with GNAT.Table;
with GNAT.OS_Lib;
with GNAT.Directory_Operations;
with GNAT.OS_Lib;
with GNAT.Table;
with Ocarina.Namet;
with Ocarina.Output;
......@@ -306,6 +305,9 @@ package body Ocarina.Backends.Build_Utils is
Current_Process : Node_Id := No_Node;
Appli_Name : Name_Id := No_Name;
-- Denotes the application name, derived from the AADL root system name
type Makefile_Rec is record
Appli_Name : Name_Id;
-- The distributed application name
......@@ -314,7 +316,7 @@ package body Ocarina.Backends.Build_Utils is
-- The node name (in lower case)
Execution_Platform : Supported_Execution_Platform := Platform_None;
Execution_Platform_Name : Name_Id := No_Name;
Execution_Platform_Name : Name_Id := No_Name;
-- The execution platform of the processor the current node
-- is bound to.
......@@ -924,7 +926,6 @@ package body Ocarina.Backends.Build_Utils is
procedure Visit_Process_Instance (E : Node_Id) is
C : Node_Id;
S : constant Node_Id := Parent_Subcomponent (E);
A : constant Node_Id := Parent_Component (Parent_Subcomponent (E));
M : constant Makefile_Type := new Makefile_Rec;
SC : Node_Id;
Current_Device : Node_Id;
......@@ -945,7 +946,7 @@ package body Ocarina.Backends.Build_Utils is
Makefiles.Set (E, M);
M.Appli_Name := Normalize_Name (Name (Identifier (A)));
M.Appli_Name := Appli_Name;
M.Node_Name := Normalize_Name (Name (Identifier (S)));
M.Use_Transport := False;
M.Use_Simulink := False;
......@@ -1075,6 +1076,15 @@ package body Ocarina.Backends.Build_Utils is
S : Node_Id;
begin
if Appli_Name = No_Name then
-- We need a unique application name, derived from the
-- root system. The application name is used to derive
-- the name of the root directory in which files are
-- generated.
Appli_Name := Normalize_Name (Name (Identifier (E)));
end if;
-- Visit all the subcomponents of the system
if not AAU.Is_Empty (Subcomponents (E)) then
......@@ -1382,13 +1392,16 @@ package body Ocarina.Backends.Build_Utils is
Fd : File_Descriptor;
begin
if Is_Directory (Get_Name_String (Dir_Name)) then
-- Create the file
Enter_Directory (Dir_Name);
Fd := Create_File ("Makefile", Text);
-- We create a makefile iff. the current system is the
-- root system. In the case of ther system, e.g. case
-- of a deep hierarchy with systems inside systems, no
-- source has been generated.
Write_Eol;
Enter_Directory (Dir_Name);
Fd := Create_File ("Makefile", Text);
if Fd = Invalid_FD then
raise Program_Error;
end if;
......@@ -1410,33 +1423,18 @@ package body Ocarina.Backends.Build_Utils is
Write_Line
("###################################################");
Write_Eol;
Write_Str ("SUBDIRS = ");
if not AAU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
if AAU.Is_Process (Corresponding_Instance (S)) then
Write_Name (Normalize_Name (Name (Identifier (S))));
Write_Str (" ");
-- Corresponding_Instance (S)))));
end if;
S := Next_Node (S);
end loop;
end if;
Write_Str ("SUBDIRS = $(filter-out Makefile, $(wildcard *))");
Write_Eol;
Write_Line ("all:");
Write_Line
(ASCII.HT &
"set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done");
"set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d ; done");
Write_Eol;
Write_Line ("clean:");
Write_Line
(ASCII.HT &
" set -e; for d in $(SUBDIRS); do $(MAKE) " &
"clean -C $$d ; done");
"set -e; for d in $(SUBDIRS); do $(MAKE) " &
"clean -C $$d ; done");
-- Close the file
......
......@@ -999,11 +999,14 @@ package body Ocarina.Backends.C_Common.Types is
-- (see ocarina-backends-po_hi_c-request.adb) are used.
elsif AINU.Is_Process (Corresponding_Instance (C)) then
S := First_Node (Subcomponents (Corresponding_Instance (C)));
while Present (S) loop
Visit_Component_Instance (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
if Present (Subcomponents (Corresponding_Instance (C))) then
S := First_Node
(Subcomponents (Corresponding_Instance (C)));
while Present (S) loop
Visit_Component_Instance (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
end if;
end if;
C := Next_Node (C);
end loop;
......
......@@ -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-2016 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- --
......@@ -150,7 +150,6 @@ package body Ocarina.Backends.PO_HI_C.Naming is
Pop_Entity;
Pop_Entity;
end Visit_Process_Instance;
---------------------------
......@@ -158,11 +157,18 @@ package body Ocarina.Backends.PO_HI_C.Naming is
---------------------------
procedure Visit_System_Instance (E : Node_Id) is
A : constant Node_Id := Map_Distributed_Application (E);
A : Node_Id;
C : Node_Id;
S : Node_Id;
begin
C_Root := A;
if No (C_Root) then
-- In the case of deep hierarchy of systems, we store in
-- C_Root the root of the C trees, and reuse it for other
-- systems.
C_Root := Map_Distributed_Application (E);
end if;
A := C_Root;
Push_Entity (A);
-- Verify the consistency of the distributed application
......
......@@ -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-2016 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- --
......@@ -398,16 +398,12 @@ package body Ocarina.Backends.PO_HI_C is
procedure Visit_Process_Instance (E : Node_Id) is
S : constant Node_Id := AAN.Parent_Subcomponent (E);
A : constant Node_Id :=
AAN.Parent_Component (AAN.Parent_Subcomponent (E));
Fd : File_Descriptor;
Rpath : constant String := Get_Runtime_Path ("polyorb-hi-c");
begin
Enter_Directory (Normalize_Name (AAN.Name (AAN.Identifier (A))));
Enter_Directory (Normalize_Name (AAN.Name (AAN.Identifier (S))));
Fd := Create_File ("doxygen.cfg", Text);
if Fd = Invalid_FD then
raise Program_Error;
end if;
......@@ -460,15 +456,12 @@ package body Ocarina.Backends.PO_HI_C is
Write_Line ("DIRECTORY_GRAPH = YES");
Write_Line ("DOT_GRAPH_MAX_NODES = 50");
Write_Line ("MAX_DOT_GRAPH_DEPTH = 0");
Write_Eol;
Close (Fd);
Set_Standard_Output;
Leave_Directory;
Leave_Directory;
end Visit_Process_Instance;
---------------------------
......@@ -478,6 +471,13 @@ package body Ocarina.Backends.PO_HI_C is
procedure Visit_System_Instance (E : Node_Id) is
S : Node_Id;
begin
if not Present (AAN.Parent_Subcomponent (E)) then
-- We jump one directory iff the current system denotes
-- the root system, other systems do not lead to
-- generated code, they are silent.
Enter_Directory (Normalize_Name (AAN.Name (AAN.Identifier (E))));
end if;
-- Visit all the subcomponents of the system
if not AAU.Is_Empty (AAN.Subcomponents (E)) then
......@@ -490,7 +490,12 @@ package body Ocarina.Backends.PO_HI_C is
S := AAN.Next_Node (S);
end loop;
end if;
if not Present (AAN.Parent_Subcomponent (E)) then
Leave_Directory;
end if;
end Visit_System_Instance;
begin
Visit (My_System);
end Generate_Doxygen_Configuration;
......@@ -503,9 +508,8 @@ package body Ocarina.Backends.PO_HI_C is
Instance_Root : Node_Id;
Success : Boolean := True;
procedure Generate_PolyORB_HI_C_Makefile is new Build_Utils.Makefiles
.Generate
(PolyORB_HI_C_Makefile);
procedure Generate_PolyORB_HI_C_Makefile is
new Build_Utils.Makefiles.Generate (PolyORB_HI_C_Makefile);
begin
-- Instantiate the AADL tree
......@@ -677,6 +681,8 @@ package body Ocarina.Backends.PO_HI_C is
procedure Visit_Architecture_Instance (E : Node_Id) is
begin
-- Generate header files
Naming.Header_File.Visit (E);
C_Common.Types.Header_File.Visit (E, C_Root);
Deployment.Header_File.Visit (E);
......@@ -685,6 +691,8 @@ package body Ocarina.Backends.PO_HI_C is
C_Common.Subprograms.Header_File.Visit (E, C_Root);
Activity.Header_File.Visit (E);
-- Generate source files
C_Common.Types.Source_File.Visit (E, C_Root);
Request.Source_File.Visit (E);
Marshallers.Source_File.Visit (E);
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2016 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- --
......@@ -63,7 +63,7 @@ package Ocarina.Backends.PO_HI_C is
-- wants the ASN1 deployment information.
private
C_Root : Node_Id;
C_Root : Node_Id := No_Node;
-- The root of the C trees
end Ocarina.Backends.PO_HI_C;
......@@ -186,15 +186,11 @@ package Ocarina.Backends.Utils is
H_Ada_Helpers_Spec,
H_Ada_Marshallers_Body,
H_Ada_Marshallers_Spec,
H_Ada_Namespaces_Body,
H_Ada_Namespaces_Spec,
H_Ada_Subprogram_Body,
H_Ada_Subprogram_Spec,
H_Ada_Type_Body,
H_Ada_Type_Default_Value,
H_Ada_Type_Spec,
H_Add_Case_Alternative_Internals_Spec,
H_Add_Case_Alternative_SSRA_Body,
H_C_Marshall_Body,
H_C_Marshall_Spec,
H_C_Stub_Body,
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2016 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- --
......@@ -226,11 +226,24 @@ package body Ocarina.Instances.Components.Connections is
New_Instance),
Destinations (AIN.Item (AIN.Last_Node (AIN.Path (Connection_Src)))));
Append_Node_To_List
(Make_Node_Container
(AIN.Item (AIN.Last_Node (AIN.Path (Connection_Src))),
New_Instance),
Sources (AIN.Item (AIN.Last_Node (AIN.Path (Connection_Dst)))));
if AIN.Kind
(AIN.Item (AIN.Last_Node
(AIN.Path (Connection_Dst)))) = K_Subcomponent_Instance
then
Append_Node_To_List
(Make_Node_Container
(AIN.Item (AIN.Last_Node (AIN.Path (Connection_Src))),
New_Instance),
Destinations (AIN.Item
(AIN.Last_Node (AIN.Path (Connection_Dst)))));
else
Append_Node_To_List
(Make_Node_Container
(AIN.Item (AIN.Last_Node (AIN.Path (Connection_Src))),
New_Instance),
Sources (AIN.Item (AIN.Last_Node (AIN.Path (Connection_Dst)))));
end if;
-- Set the connection type
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2009 Telecom ParisTech, 2010-2016 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- --
......@@ -2792,8 +2792,8 @@ package body Ocarina.Analyzer.AADL.Links is
List_Node : Node_Id;
Corresponding_Container : Node_Id;
Type_Designator : Node_Id;
begin
begin
case Kind (Node) is
when K_Component_Classifier_Term =>
Pop_Scope;
......
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