Commit 1152537c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add list of asn1 modules to partition.tmplt

parent d16afe2b
...@@ -30,7 +30,7 @@ begin ...@@ -30,7 +30,7 @@ begin
Model.Preprocessing; Model.Preprocessing;
Model.Add_Concurrency_View; Model.Add_Concurrency_View;
Model.Add_CV_Properties; Model.Add_CV_Properties;
Model.Concurrency_View.Generate_CV; Model.Generate_Concurrency_View;
end if; end if;
Model.Generate_Code; Model.Generate_Code;
......
...@@ -440,6 +440,7 @@ package body TASTE.AADL_Parser is ...@@ -440,6 +440,7 @@ package body TASTE.AADL_Parser is
(Base_Template_Path => Model.Configuration.Binary_Path, (Base_Template_Path => Model.Configuration.Binary_Path,
Base_Output_Path => Model.Configuration.Output_Dir, Base_Output_Path => Model.Configuration.Output_Dir,
Deployment => Model.Deployment_View.Element, Deployment => Model.Deployment_View.Element,
Data_View => Model.Data_View,
Configuration => Model.Configuration, Configuration => Model.Configuration,
others => <>); others => <>);
use String_Vectors; use String_Vectors;
...@@ -780,6 +781,16 @@ package body TASTE.AADL_Parser is ...@@ -780,6 +781,16 @@ package body TASTE.AADL_Parser is
raise Quit_Taste; raise Quit_Taste;
end Generate_Code; end Generate_Code;
procedure Generate_Concurrency_View (Model : TASTE_Model) is
begin
Model.Concurrency_View.Generate_Code;
exception
when Error : Concurrency_View_Error | Ada.IO_Exceptions.Name_Error =>
Put_Error ("Concurrency View : "
& Ada.Exceptions.Exception_Message (Error));
raise Quit_Taste;
end Generate_Concurrency_View;
function Process_Function (F : in out Taste_Terminal_Function) function Process_Function (F : in out Taste_Terminal_Function)
return Function_Maps.Map return Function_Maps.Map
is is
......
...@@ -33,8 +33,8 @@ package TASTE.AADL_Parser is ...@@ -33,8 +33,8 @@ package TASTE.AADL_Parser is
type TASTE_Model is tagged type TASTE_Model is tagged
record record
Interface_View : Complete_Interface_View; Interface_View : Complete_Interface_View;
Deployment_View : Deployment_View_Holder; Deployment_View : aliased Deployment_View_Holder;
Data_View : Taste_Data_View; Data_View : aliased Taste_Data_View;
Concurrency_View : Taste_Concurrency_View; Concurrency_View : Taste_Concurrency_View;
Configuration : Taste_Configuration; Configuration : Taste_Configuration;
end record; end record;
...@@ -68,6 +68,9 @@ package TASTE.AADL_Parser is ...@@ -68,6 +68,9 @@ package TASTE.AADL_Parser is
procedure Dump (Model : TASTE_Model); procedure Dump (Model : TASTE_Model);
procedure Generate_Code (Model : TASTE_Model); procedure Generate_Code (Model : TASTE_Model);
-- Process Templates from the templates/concurrency_view subfolder
procedure Generate_Concurrency_View (Model : TASTE_Model);
private private
procedure Build_TASTE_AST (Model : out TASTE_Model); procedure Build_TASTE_AST (Model : out TASTE_Model);
procedure Find_Shared_Libraries (Model : out TASTE_Model); procedure Find_Shared_Libraries (Model : out TASTE_Model);
......
...@@ -39,38 +39,6 @@ package body TASTE.Backend.Code_Generators is ...@@ -39,38 +39,6 @@ package body TASTE.Backend.Code_Generators is
Prefix_Skeletons : constant String := Prefix & "skeletons/"; Prefix_Skeletons : constant String := Prefix & "skeletons/";
Prefix_Wrappers : constant String := Prefix & "glue/language_wrappers"; Prefix_Wrappers : constant String := Prefix & "glue/language_wrappers";
-- Return a Tag list of ASN.1 Modules for the headers
function Get_Module_List return Tag is
Result : Tag;
begin
for Each of Model.Data_View.ASN1_Files loop
for Module of Each.Modules loop
Result := Result & Module.Name;
end loop;
end loop;
return Result;
end Get_Module_List;
-- Return a Tag list of ASN.1 Files
function Get_ASN1_File_List return Tag is
Result : Tag;
begin
for Each of Model.Data_View.ASN1_Files loop
Result := Result & Each.Path;
end loop;
return Result;
end Get_ASN1_File_List;
-- Return a Tag list of ACN Files
function Get_ACN_File_List return Tag is
Result : Tag;
begin
for Each of Model.Data_View.ACN_Files loop
Result := Result & Each;
end loop;
return Result;
end Get_ACN_File_List;
-- Generate a global Makefile (processing all functions) -- Generate a global Makefile (processing all functions)
-- and a global project file (.pro) for Space Creator -- and a global project file (.pro) for Space Creator
procedure Generate_Global_Makefile is procedure Generate_Global_Makefile is
...@@ -146,9 +114,9 @@ package body TASTE.Backend.Code_Generators is ...@@ -146,9 +114,9 @@ package body TASTE.Backend.Code_Generators is
& Assoc ("Is_FPGA", Is_FPGA_Tag) & Assoc ("Is_FPGA", Is_FPGA_Tag)
& Assoc ("CPU_Platform", CPU_Platform_Tag) & Assoc ("CPU_Platform", CPU_Platform_Tag)
& Assoc ("Unique_Languages", Unique_Languages) & Assoc ("Unique_Languages", Unique_Languages)
& Assoc ("ASN1_Files", Get_ASN1_File_List) & Assoc ("ASN1_Files", Model.Data_View.Get_ASN1_File_List)
& Assoc ("ACN_Files", Get_ACN_File_List) & Assoc ("ACN_Files", Model.Data_View.Get_ACN_File_List)
& Assoc ("ASN1_Modules", Get_Module_List); & Assoc ("ASN1_Modules", Model.Data_View.Get_Module_List);
Put_Debug ("Generating global Makefile"); Put_Debug ("Generating global Makefile");
Create (File => Output_File, Create (File => Output_File,
...@@ -282,8 +250,8 @@ package body TASTE.Backend.Code_Generators is ...@@ -282,8 +250,8 @@ package body TASTE.Backend.Code_Generators is
Function_Makefile_Template Function_Makefile_Template
(Model => Model, (Model => Model,
F => F, F => F,
Modules => Get_Module_List, Modules => Model.Data_View.Get_Module_List,
Files => Get_ASN1_File_List) Files => Model.Data_View.Get_ASN1_File_List)
& Assoc ("List_Of_PIs", List_Of_PIs); & Assoc ("List_Of_PIs", List_Of_PIs);
Make_Path : constant String := Path & "makefile.tmplt"; Make_Path : constant String := Path & "makefile.tmplt";
...@@ -303,8 +271,10 @@ package body TASTE.Backend.Code_Generators is ...@@ -303,8 +271,10 @@ package body TASTE.Backend.Code_Generators is
& Assoc ("Required_Interfaces", & Assoc ("Required_Interfaces",
Process_Interfaces Process_Interfaces
(Func_Tmpl.Required, Path)) (Func_Tmpl.Required, Path))
& Assoc ("ASN1_Modules", Get_Module_List) & Assoc ("ASN1_Modules",
& Assoc ("ASN1_Files", Get_ASN1_File_List); Model.Data_View.Get_Module_List)
& Assoc ("ASN1_Files",
Model.Data_View.Get_ASN1_File_List);
Content : constant String := Content : constant String :=
Parse (Path & "function.tmplt", Func_Map); Parse (Path & "function.tmplt", Func_Map);
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
-- *********************************************************************** -- -- *********************************************************************** --
with Ada.Directories, with Ada.Directories,
Ada.IO_Exceptions,
Ada.Exceptions,
Ada.Characters.Latin_1, Ada.Characters.Latin_1,
-- Ada.Strings.Fixed, -- Ada.Strings.Fixed,
GNAT.Directory_Operations, -- Contains Dir_Name GNAT.Directory_Operations, -- Contains Dir_Name
...@@ -560,6 +558,7 @@ package body TASTE.Concurrency_View is ...@@ -560,6 +558,7 @@ package body TASTE.Concurrency_View is
& Assoc ("Threads", Part_Threads) & Assoc ("Threads", Part_Threads)
& Assoc ("Thread_Names", Thread_Names) & Assoc ("Thread_Names", Thread_Names)
& Assoc ("Thread_Has_Param", Thread_Has_Param) & Assoc ("Thread_Has_Param", Thread_Has_Param)
& Assoc ("ASN1_Modules", CV.Data_View.Get_Module_List)
& Assoc ("Node_Name", Node_Name) & Assoc ("Node_Name", Node_Name)
& Assoc ("Blocks", Blocks) & Assoc ("Blocks", Blocks)
& Assoc ("Block_Names", Block_Names) & Assoc ("Block_Names", Block_Names)
...@@ -1004,14 +1003,4 @@ package body TASTE.Concurrency_View is ...@@ -1004,14 +1003,4 @@ package body TASTE.Concurrency_View is
End_Search (ST); End_Search (ST);
end Generate_Code; end Generate_Code;
procedure Generate_CV (CV : Taste_Concurrency_View) is
begin
CV.Generate_Code;
exception
when Error : Concurrency_View_Error | Ada.IO_Exceptions.Name_Error =>
Put_Error ("Concurrency View : "
& Ada.Exceptions.Exception_Message (Error));
raise Quit_Taste;
end Generate_CV;
end TASTE.Concurrency_View; end TASTE.Concurrency_View;
...@@ -13,7 +13,8 @@ with Ada.Containers.Indefinite_Ordered_Maps, ...@@ -13,7 +13,8 @@ with Ada.Containers.Indefinite_Ordered_Maps,
Templates_Parser, Templates_Parser,
TASTE.Parser_Utils, TASTE.Parser_Utils,
TASTE.Interface_View, TASTE.Interface_View,
TASTE.Deployment_View; TASTE.Deployment_View,
TASTE.Data_View;
use Ada.Containers, use Ada.Containers,
Ada.Strings.Unbounded, Ada.Strings.Unbounded,
...@@ -21,7 +22,8 @@ use Ada.Containers, ...@@ -21,7 +22,8 @@ use Ada.Containers,
Templates_Parser, Templates_Parser,
TASTE.Parser_Utils, TASTE.Parser_Utils,
TASTE.Interface_View, TASTE.Interface_View,
TASTE.Deployment_View; TASTE.Deployment_View,
TASTE.Data_View;
package TASTE.Concurrency_View is package TASTE.Concurrency_View is
...@@ -159,6 +161,7 @@ package TASTE.Concurrency_View is ...@@ -159,6 +161,7 @@ package TASTE.Concurrency_View is
Configuration : Taste_Configuration; Configuration : Taste_Configuration;
Nodes : CV_Nodes.Map; Nodes : CV_Nodes.Map;
Deployment : Complete_Deployment_View; Deployment : Complete_Deployment_View;
Data_View : Taste_Data_View;
Base_Template_Path : String_Holder; Base_Template_Path : String_Holder;
Base_Output_Path : String_Holder; Base_Output_Path : String_Holder;
end record; end record;
...@@ -167,6 +170,6 @@ package TASTE.Concurrency_View is ...@@ -167,6 +170,6 @@ package TASTE.Concurrency_View is
Output : File_Type); Output : File_Type);
-- Generate the concurrency view using templates -- Generate the concurrency view using templates
procedure Generate_CV (CV : Taste_Concurrency_View); procedure Generate_Code (CV : Taste_Concurrency_View);
end TASTE.Concurrency_View; end TASTE.Concurrency_View;
...@@ -195,6 +195,35 @@ package body TASTE.Data_View is ...@@ -195,6 +195,35 @@ package body TASTE.Data_View is
end loop; end loop;
end Debug_Dump; end Debug_Dump;
function Get_Module_List (DV : Taste_Data_View) return Tag is
Result : Tag;
begin
for Each of DV.ASN1_Files loop
for Module of Each.Modules loop
Result := Result & Module.Name;
end loop;
end loop;
return Result;
end Get_Module_List;
function Get_ASN1_File_List (DV : Taste_Data_View) return Tag is
Result : Tag;
begin
for Each of DV.ASN1_Files loop
Result := Result & Each.Path;
end loop;
return Result;
end Get_ASN1_File_List;
function Get_ACN_File_List (DV : Taste_Data_View) return Tag is
Result : Tag;
begin
for Each of DV.ACN_Files loop
Result := Result & Each;
end loop;
return Result;
end Get_ACN_File_List;
procedure Export_ASN1_Files (DV : Taste_Data_View; Output_Path : String) is procedure Export_ASN1_Files (DV : Taste_Data_View; Output_Path : String) is
begin begin
for Idx in DV.ASN1_Files.Iterate loop for Idx in DV.ASN1_Files.Iterate loop
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
with Text_IO, with Text_IO,
Ada.Containers.Indefinite_Ordered_Maps, Ada.Containers.Indefinite_Ordered_Maps,
Ada.Strings.Unbounded, Ada.Strings.Unbounded,
Templates_Parser,
Ocarina, Ocarina,
Ocarina.Types, Ocarina.Types,
TASTE.Parser_Utils; TASTE.Parser_Utils;
...@@ -15,6 +16,7 @@ with Text_IO, ...@@ -15,6 +16,7 @@ with Text_IO,
use Text_IO, use Text_IO,
Ada.Containers, Ada.Containers,
Ada.Strings.Unbounded, Ada.Strings.Unbounded,
Templates_Parser,
Ocarina, Ocarina,
Ocarina.Types, Ocarina.Types,
TASTE.Parser_Utils; TASTE.Parser_Utils;
...@@ -67,6 +69,11 @@ package TASTE.Data_View is ...@@ -67,6 +69,11 @@ package TASTE.Data_View is
procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type); procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type);
-- Functions converting the AST into Templates Parser tags
function Get_Module_List (DV : Taste_Data_View) return Tag;
function Get_ASN1_File_List (DV : Taste_Data_View) return Tag;
function Get_ACN_File_List (DV : Taste_Data_View) return Tag;
-- Make a local copy of ASN.1 files to allow project export -- Make a local copy of ASN.1 files to allow project export
procedure Export_ASN1_Files (DV : Taste_Data_View; Output_Path : String); procedure Export_ASN1_Files (DV : Taste_Data_View; Output_Path : String);
......
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