Commit d77188d2 authored by yoogx's avatar yoogx
Browse files

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

parents 0192de4d 5bcaae76
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2011-2015 ESA & ISAE. -- -- Copyright (C) 2011-2016 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -36,11 +36,11 @@ with Ocarina.AADL_Values; ...@@ -36,11 +36,11 @@ with Ocarina.AADL_Values;
with Ocarina.ME_AADL; with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Tree.Nodes; with Ocarina.ME_AADL.AADL_Tree.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities; with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.XML_Tree.Nodes; with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils; with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.AADL_XML.Mapping; with Ocarina.Backends.AADL_XML.Mapping;
with Ocarina.Backends.Utils;
package body Ocarina.Backends.AADL_XML.Main is package body Ocarina.Backends.AADL_XML.Main is
...@@ -49,14 +49,14 @@ package body Ocarina.Backends.AADL_XML.Main is ...@@ -49,14 +49,14 @@ package body Ocarina.Backends.AADL_XML.Main is
use Ocarina.ME_AADL.AADL_Instances.Entities; use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.XML_Tree.Nutils; use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.AADL_XML.Mapping; use Ocarina.Backends.AADL_XML.Mapping;
use Ocarina.Backends.Utils;
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes; package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes; package XTN renames Ocarina.Backends.XML_Tree.Nodes;
use type ATN.Node_Kind; use type ATN.Node_Kind;
procedure Visit_Component (E : Node_Id); procedure Visit_Component (E : Node_Id);
procedure Visit_Subcomponents_Of (E : Node_Id); procedure Visit_Subcomponents_Of is new Visit_Subcomponents_Of_G (Visit);
function Map_Component (E : Node_Id) return Node_Id; function Map_Component (E : Node_Id) return Node_Id;
...@@ -126,24 +126,6 @@ package body Ocarina.Backends.AADL_XML.Main is ...@@ -126,24 +126,6 @@ package body Ocarina.Backends.AADL_XML.Main is
return N; return N;
end Map_Component; end Map_Component;
----------------------------
-- Visit_Subcomponents_Of --
----------------------------
procedure Visit_Subcomponents_Of (E : Node_Id) is
S : Node_Id;
begin
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
Visit (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
end if;
end Visit_Subcomponents_Of;
Root_System_Node : Node_Id := No_Node; Root_System_Node : Node_Id := No_Node;
AADL_XML_Node : Node_Id := No_Node; AADL_XML_Node : Node_Id := No_Node;
Current_XML_Node : Node_Id := No_Node; Current_XML_Node : Node_Id := No_Node;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2014-2015 ESA & ISAE. -- -- Copyright (C) 2014-2016 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -126,8 +126,8 @@ package body Ocarina.Backends.Alloy is ...@@ -126,8 +126,8 @@ package body Ocarina.Backends.Alloy is
(Get_Name_String (Get_Name_String
(Normalize_Name (Fully_Qualified_Instance_Name (E)))) & (Normalize_Name (Fully_Qualified_Instance_Name (E)))) &
" extends Component{}{"); " extends Component{}{");
else else
Put_Line (Kind (E)'Img);
Root_System_Name := Normalize_Name (Display_Name (Identifier (E))); Root_System_Name := Normalize_Name (Display_Name (Identifier (E)));
Put_Line Put_Line
...@@ -135,7 +135,6 @@ package body Ocarina.Backends.Alloy is ...@@ -135,7 +135,6 @@ package body Ocarina.Backends.Alloy is
"one sig " & "one sig " &
To_Lower (Get_Name_String (Root_System_Name)) & To_Lower (Get_Name_String (Root_System_Name)) &
" extends Component{}{"); " extends Component{}{");
end if; end if;
Put_Line Put_Line
...@@ -172,7 +171,7 @@ package body Ocarina.Backends.Alloy is ...@@ -172,7 +171,7 @@ package body Ocarina.Backends.Alloy is
Put_Line (FD, "none"); Put_Line (FD, "none");
end if; end if;
-- Rule#3: list properties -- Rule #3: list properties
Put (FD, ASCII.HT & "properties="); Put (FD, ASCII.HT & "properties=");
if Present (AIN.Properties (E)) then if Present (AIN.Properties (E)) then
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2010-2015 ESA & ISAE. -- -- Copyright (C) 2010-2016 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
with Ocarina.ME_AADL; with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities; with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.XML_Tree.Nodes; with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils; with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.Cheddar.Mapping; with Ocarina.Backends.Cheddar.Mapping;
with Ocarina.Backends.Utils;
package body Ocarina.Backends.Cheddar.Main is package body Ocarina.Backends.Cheddar.Main is
...@@ -44,8 +44,8 @@ package body Ocarina.Backends.Cheddar.Main is ...@@ -44,8 +44,8 @@ package body Ocarina.Backends.Cheddar.Main is
use Ocarina.ME_AADL.AADL_Instances.Entities; use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.XML_Tree.Nutils; use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.Cheddar.Mapping; use Ocarina.Backends.Cheddar.Mapping;
use Ocarina.Backends.Utils;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes; package XTN renames Ocarina.Backends.XML_Tree.Nodes;
procedure Visit_Component (E : Node_Id); procedure Visit_Component (E : Node_Id);
...@@ -54,26 +54,7 @@ package body Ocarina.Backends.Cheddar.Main is ...@@ -54,26 +54,7 @@ package body Ocarina.Backends.Cheddar.Main is
procedure Visit_Thread (E : Node_Id); procedure Visit_Thread (E : Node_Id);
procedure Visit_Process (E : Node_Id); procedure Visit_Process (E : Node_Id);
procedure Visit_Data (E : Node_Id); procedure Visit_Data (E : Node_Id);
procedure Visit_Subcomponents_Of is new Visit_Subcomponents_Of_G (Visit);
----------------------------
-- Visit_Subcomponents_Of --
----------------------------
procedure Visit_Subcomponents_Of (E : Node_Id);
procedure Visit_Subcomponents_Of (E : Node_Id) is
S : Node_Id;
begin
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
Visit (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
end if;
end Visit_Subcomponents_Of;
Root_System_Node : Node_Id := No_Node; Root_System_Node : Node_Id := No_Node;
Cheddar_Node : Node_Id := No_Node; Cheddar_Node : Node_Id := No_Node;
......
...@@ -3868,9 +3868,9 @@ package body Ocarina.Backends.Utils is ...@@ -3868,9 +3868,9 @@ package body Ocarina.Backends.Utils is
return False; return False;
end Process_Use_Defaults_Sockets; end Process_Use_Defaults_Sockets;
-------------------------- -------------------------
-- Get_Associated_Bus -- -- Get_Associated_Bus --
-------------------------- -------------------------
function Get_Associated_Bus (Port : Node_Id) return Node_Id is function Get_Associated_Bus (Port : Node_Id) return Node_Id is
C : Node_Id; C : Node_Id;
...@@ -4048,4 +4048,24 @@ package body Ocarina.Backends.Utils is ...@@ -4048,4 +4048,24 @@ package body Ocarina.Backends.Utils is
return Core_Id; return Core_Id;
end Get_Core_Id; end Get_Core_Id;
------------------------------
-- Visit_Subcomponents_Of_G --
------------------------------
procedure Visit_Subcomponents_Of_G (E : Node_Id) is
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
S : Node_Id;
begin
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
Visit (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
end if;
end Visit_Subcomponents_Of_G;
end Ocarina.Backends.Utils; end Ocarina.Backends.Utils;
...@@ -35,6 +35,15 @@ package Ocarina.Backends.Utils is ...@@ -35,6 +35,15 @@ package Ocarina.Backends.Utils is
type Browsing_Kind is (By_Source, By_Destination, Default); type Browsing_Kind is (By_Source, By_Destination, Default);
------------------
-- AST visitor --
------------------
generic
with procedure Visit (E : Node_Id);
procedure Visit_Subcomponents_Of_G (E : Node_Id);
-- Visit the component instance corresponding to the subcomponents of E
-------------------------- --------------------------
-- Directory Operations -- -- Directory Operations --
-------------------------- --------------------------
......
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