Commit e1e20ecd authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Use dictionaries to store interfaces

parent b775161f
...@@ -671,9 +671,11 @@ package body Parser_Utils is ...@@ -671,9 +671,11 @@ package body Parser_Utils is
Iface := Parse_Interface (PI_Or_RI); Iface := Parse_Interface (PI_Or_RI);
Iface.Parent_Function := Result.Name; Iface.Parent_Function := Result.Name;
if AIN.Is_Provided (PI_Or_RI) then if AIN.Is_Provided (PI_Or_RI) then
Result.Provided := Result.Provided & Iface; Result.Provided.Insert (Key => To_String (Iface.Name),
New_Item => Iface);
else else
Result.Required := Result.Required & Iface; Result.Required.Insert (Key => To_String (Iface.Name),
New_Item => Iface);
end if; end if;
PI_Or_RI := AIN.Next_Node (PI_Or_RI); PI_Or_RI := AIN.Next_Node (PI_Or_RI);
end loop; end loop;
...@@ -761,6 +763,7 @@ package body Parser_Utils is ...@@ -761,6 +763,7 @@ package body Parser_Utils is
V1 : Remote_Entities.Vector := Empty_Vector; V1 : Remote_Entities.Vector := Empty_Vector;
V2 : Remote_Entities.Vector := Empty_Vector; V2 : Remote_Entities.Vector := Empty_Vector;
Corr : Taste_Terminal_Function; Corr : Taste_Terminal_Function;
PI : Taste_Interface;
begin begin
Put (" ... RI " & To_String (RI.Name) & " ---> "); Put (" ... RI " & To_String (RI.Name) & " ---> ");
Put (To_String (Remote.Function_Name) & "."); Put (To_String (Remote.Function_Name) & ".");
...@@ -769,14 +772,11 @@ package body Parser_Utils is ...@@ -769,14 +772,11 @@ package body Parser_Utils is
V1 := RI.Remote_Interfaces.Value_Or (V1); V1 := RI.Remote_Interfaces.Value_Or (V1);
V1.Append (Remote); V1.Append (Remote);
Corr := Functions.Element (To_String (Remote.Function_Name)); Corr := Functions.Element (To_String (Remote.Function_Name));
for PI of Corr.Provided loop -- TODO: replace with a Map PI := Corr.Provided.Element
if PI.Name = Remote.Interface_Name then (To_String (Remote.Interface_Name));
V2 := PI.Remote_Interfaces.Value_Or (V2); V2 := PI.Remote_Interfaces.Value_Or (V2);
V2.Append (Remote_Entity'(Function_Name => Each.Name, V2.Append (Remote_Entity'(Function_Name => Each.Name,
Interface_Name => RI.Name)); Interface_Name => RI.Name));
end if;
exit when PI.Name = Remote.Interface_Name;
end loop;
end if; end if;
end; end;
end loop; end loop;
......
...@@ -153,6 +153,8 @@ package Parser_Utils is ...@@ -153,6 +153,8 @@ package Parser_Utils is
end record; end record;
package Interfaces is new Indefinite_Vectors (Natural, Taste_Interface); package Interfaces is new Indefinite_Vectors (Natural, Taste_Interface);
package Interfaces_Maps is new Indefinite_Ordered_Maps (String,
Taste_Interface);
type Context_Parameter is type Context_Parameter is
record record
...@@ -175,8 +177,8 @@ package Parser_Utils is ...@@ -175,8 +177,8 @@ package Parser_Utils is
Context_Params : Ctxt_Params.Vector; Context_Params : Ctxt_Params.Vector;
User_Properties : Property_Maps.Map; User_Properties : Property_Maps.Map;
Timers : String_Vectors.Vector; Timers : String_Vectors.Vector;
Provided : Interfaces.Vector; Provided : Interfaces_Maps.Map;
Required : Interfaces.Vector; Required : Interfaces_Maps.Map;
end record; end record;
-- package Functions is new Indefinite_Vectors (Natural, -- package Functions is new Indefinite_Vectors (Natural,
......
Supports Markdown
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