Commit 45138252 authored by yoogx's avatar yoogx
Browse files

* Add support for fully qualified name passed to the -r flag

        For issue #36
parent c77bf46d
...@@ -173,8 +173,12 @@ package body Ocarina.Instances is ...@@ -173,8 +173,12 @@ package body Ocarina.Instances is
if Root_System_Name /= No_Name then if Root_System_Name /= No_Name then
List_Node := Root_Systems.First; List_Node := Root_Systems.First;
while Present (List_Node) loop while Present (List_Node) loop
exit when ATE.Get_Name_Of_Entity (List_Node, False) = exit when
Root_System_Name; (ATE.Get_Name_Of_Entity (List_Node, False) = Root_System_Name
or else
ATE.Get_Name_Of_Entity (List_Node, False, True)
= Root_System_Name);
List_Node := ATN.Next_Entity (List_Node); List_Node := ATN.Next_Entity (List_Node);
end loop; end loop;
...@@ -188,7 +192,8 @@ package body Ocarina.Instances is ...@@ -188,7 +192,8 @@ package body Ocarina.Instances is
List_Node := Root_Systems.First; List_Node := Root_Systems.First;
while Present (List_Node) loop while Present (List_Node) loop
Error_Loc (1) := ATN.Loc (List_Node); Error_Loc (1) := ATN.Loc (List_Node);
Error_Name (1) := ATE.Get_Name_Of_Entity (List_Node); Error_Name (1) := ATE.Get_Name_Of_Entity
(List_Node, False, True);
DE ("%"); DE ("%");
List_Node := ATN.Next_Entity (List_Node); List_Node := ATN.Next_Entity (List_Node);
end loop; end loop;
......
...@@ -120,9 +120,11 @@ package body Ocarina.ME_AADL.AADL_Tree.Entities is ...@@ -120,9 +120,11 @@ package body Ocarina.ME_AADL.AADL_Tree.Entities is
function Get_Name_Of_Entity function Get_Name_Of_Entity
(Entity : Ocarina.Types.Node_Id; (Entity : Ocarina.Types.Node_Id;
Get_Display_Name : Boolean := True) return Ocarina.Types.Name_Id Get_Display_Name : Boolean := True;
Fully_Qualified : Boolean := False) return Ocarina.Types.Name_Id
is is
use Ocarina.ME_AADL.AADL_Tree.Nodes; use Ocarina.ME_AADL.AADL_Tree.Nodes;
use Ocarina.Namet;
use Ocarina.Types; use Ocarina.Types;
pragma Assert pragma Assert
...@@ -153,32 +155,52 @@ package body Ocarina.ME_AADL.AADL_Tree.Entities is ...@@ -153,32 +155,52 @@ package body Ocarina.ME_AADL.AADL_Tree.Entities is
or else Kind (Entity) = K_Annex_Subclause or else Kind (Entity) = K_Annex_Subclause
or else Kind (Entity) = K_Annex_Library or else Kind (Entity) = K_Annex_Library
or else DNKE (Entity)); or else DNKE (Entity));
use Ocarina.ME_AADL.AADL_Tree.Debug;
Entity_Name : Name_Id := No_Name;
Package_Name : Name_Id;
Name_Of_Entity : Name_Id := No_Name;
begin begin
if Kind (Entity) /= K_AADL_Specification if Kind (Entity) /= K_AADL_Specification
and then Identifier (Entity) /= No_Node and then Identifier (Entity) /= No_Node
then then
if Get_Display_Name then if Get_Display_Name then
return Display_Name (Identifier (Entity)); Entity_Name := Display_Name (Identifier (Entity));
else else
return Name (Identifier (Entity)); Entity_Name := Name (Identifier (Entity));
end if; end if;
else else
return No_Name; return No_Name;
end if; end if;
end Get_Name_Of_Entity;
------------------------ if Fully_Qualified then
-- Get_Name_Of_Entity -- Package_Name :=
------------------------ Display_Name (Identifier (Namespace (Entity)));
Set_Str_To_Name_Buffer ("");
Set_Str_To_Name_Buffer
(Get_Name_String (Package_Name) &
"::" &
Get_Name_String (Entity_Name));
Name_Of_Entity := Name_Find;
else
Name_Of_Entity := Entity_Name;
end if;
return Name_Of_Entity;
end Get_Name_Of_Entity;
function Get_Name_Of_Entity function Get_Name_Of_Entity
(Entity : Ocarina.Types.Node_Id; (Entity : Ocarina.Types.Node_Id;
Get_Display_Name : Boolean := True) return String Get_Display_Name : Boolean := True;
Fully_Qualified : Boolean := False) return String
is is
use Ocarina.Types; use Ocarina.Types;
use Ocarina.Namet; use Ocarina.Namet;
Name : constant Name_Id := Get_Name_Of_Entity (Entity, Get_Display_Name); Name : constant Name_Id := Get_Name_Of_Entity
(Entity, Get_Display_Name, Fully_Qualified);
begin begin
if Name /= No_Name then if Name /= No_Name then
return Get_Name_String (Name); return Get_Name_String (Name);
...@@ -532,7 +554,7 @@ package body Ocarina.ME_AADL.AADL_Tree.Entities is ...@@ -532,7 +554,7 @@ package body Ocarina.ME_AADL.AADL_Tree.Entities is
end Package_Has_Private_Declarations_Or_Properties; end Package_Has_Private_Declarations_Or_Properties;
-- --
-- This following section is relative to Entities MEssages -- This following section is relative to Entities Messages
-- --
----------------------------- -----------------------------
-- Display_Node_Kind_Error -- -- Display_Node_Kind_Error --
......
...@@ -44,11 +44,13 @@ package Ocarina.ME_AADL.AADL_Tree.Entities is ...@@ -44,11 +44,13 @@ package Ocarina.ME_AADL.AADL_Tree.Entities is
function Get_Name_Of_Entity function Get_Name_Of_Entity
(Entity : Ocarina.Types.Node_Id; (Entity : Ocarina.Types.Node_Id;
Get_Display_Name : Boolean := True) return Ocarina.Types.Name_Id; Get_Display_Name : Boolean := True;
Fully_Qualified : Boolean := False) return Ocarina.Types.Name_Id;
function Get_Name_Of_Entity function Get_Name_Of_Entity
(Entity : Ocarina.Types.Node_Id; (Entity : Ocarina.Types.Node_Id;
Get_Display_Name : Boolean := True) return String; Get_Display_Name : Boolean := True;
Fully_Qualified : Boolean := False) return String;
function Get_Name_Of_Entity_Reference function Get_Name_Of_Entity_Reference
(Entity_Ref : Ocarina.Types.Node_Id; (Entity_Ref : Ocarina.Types.Node_Id;
......
...@@ -287,5 +287,6 @@ tests/github/issue_10/test.aadl ...@@ -287,5 +287,6 @@ tests/github/issue_10/test.aadl
tests/github/issue_10/test2.aadl tests/github/issue_10/test2.aadl
tests/github/issue_22/p.aadl tests/github/issue_22/p.aadl
tests/github/issue_35/test.aadl tests/github/issue_35/test.aadl
tests/github/issue_36/test.aadl
tests/root_system/test.aadl tests/root_system/test.aadl
AADL_VERSION=-aadlv2
OCARINA_FLAGS=-i -r test::s.i
package test
public
system s
end s;
system implementation s.i
end s.i;
system implementation s.i2
end s.i2;
end test;
\ No newline at end of file
ocarina: Please select a root system among ocarina: Please select a root system among
test.aadl:13:01: r2.i test.aadl:13:01: p1::r2.i
test.aadl:7:01: r1.i test.aadl:7:01: p1::r1.i
Cannot instantiate AADL model Cannot instantiate AADL model
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