Commit 307b2398 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Move template test to proper Dump function

parent fdfcaa93
with GNAT.OS_Lib, Text_IO;
use Text_IO;
with TASTE,
TASTE.AADL_Parser,
TASTE.Templates;
use TASTE.AADL_Parser,
TASTE.Templates;
with Templates_Parser;
use Templates_Parser;
with GNAT.OS_Lib,
TASTE,
TASTE.AADL_Parser;
use TASTE.AADL_Parser;
procedure AADL_Parser is
Model : TASTE_Model;
procedure Dump_With_Templates (Model : TASTE_Model) is
Vec : Tag;
begin
New_Set;
Map ("Interface_View", Model.Configuration.Interface_View.all);
Map ("Deployment_View", Model.Configuration.Deployment_View.all);
Map ("Data_View", Model.Configuration.Data_View.all);
Map ("Output_Dir", Model.Configuration.Output_Dir.all);
for Each of Model.Configuration.Other_Files loop
Vec := Vec & Each;
end loop;
Map ("Other_Files", Vec);
Map ("Skeletons", Model.Configuration.Skeletons);
Map ("Glue", Model.Configuration.Glue);
Map ("Use_POHIC", Model.Configuration.Use_POHIC);
Map ("Debug_Flag", Model.Configuration.Debug_Flag);
Map ("Version", Model.Configuration.Version);
Map ("Timer_Resolution", Model.Configuration.Timer_Resolution);
Put_Line ("=== Template-generated debug output ===");
Put_Line (Generate (Model.Configuration.Binary_Path.all
& "templates/configuration.tmplt"));
end Dump_With_Templates;
begin
Model := Parse_Project;
-- Model.Dump;
Dump_With_Templates (Model);
Model.Dump;
exception
when TASTE.Quit_TASTE =>
GNAT.OS_Lib.OS_Exit (1);
......
......@@ -7,11 +7,13 @@ with Ada.Text_IO,
GNAT.Directory_Operations,
GNAT.OS_Lib,
GNAT.Command_Line,
Templates_Parser,
Ocarina.AADL_Values,
Ocarina.Configuration,
Ocarina.FE_AADL.Parser,
Ocarina.Instances.Queries,
TASTE.Parser_Version;
TASTE.Parser_Version,
TASTE.Templates;
package body TASTE.Parser_Utils is
......@@ -19,8 +21,10 @@ package body TASTE.Parser_Utils is
GNAT.Directory_Operations,
GNAT.OS_Lib,
GNAT.Command_Line,
Templates_Parser,
Ocarina.Instances.Queries,
Ocarina.ME_AADL;
Ocarina.ME_AADL,
TASTE.Templates;
procedure Banner is
The_Banner : constant String :=
......@@ -92,8 +96,9 @@ package body TASTE.Parser_Utils is
end Parse_Command_Line;
procedure Debug_Dump (Config : Taste_Configuration) is
Vec : Tag;
begin
Put_Line ("Command line:");
Put_Line ("Command line (raw dump):");
Put_Line (" |_ Interface View : " & Config.Interface_View.all);
Put_Line (" |_ Deployment View : " & Config.Deployment_View.all);
Put_Line (" |_ Data View : " & Config.Data_View.all);
......@@ -107,6 +112,25 @@ package body TASTE.Parser_Utils is
for Each of Config.Other_Files loop
Put_Line (" |_ Other file : " & Each);
end loop;
Put_Line ("Dump generated from a template file:");
New_Set;
Tmpl_Map ("Interface_View", Config.Interface_View.all);
Tmpl_Map ("Deployment_View", Config.Deployment_View.all);
Tmpl_Map ("Data_View", Config.Data_View.all);
Tmpl_Map ("Output_Dir", Config.Output_Dir.all);
for Each of Config.Other_Files loop
Vec := Vec & Each;
end loop;
Tmpl_Map ("Other_Files", Vec);
Tmpl_Map ("Skeletons", Config.Skeletons);
Tmpl_Map ("Glue", Config.Glue);
Tmpl_Map ("Use_POHIC", Config.Use_POHIC);
Tmpl_Map ("Debug_Flag", Config.Debug_Flag);
Tmpl_Map ("Version", Config.Version);
Tmpl_Map ("Timer_Resolution", Config.Timer_Resolution);
Put_Line (Generate (Config.Binary_Path.all
& "templates/configuration.tmplt"));
end Debug_Dump;
-----------------------
......
package TASTE.Parser_Version is
Parser_Release : constant String :=
"e9c639e ; Commit Date: Mon Jan 1 17:22:01 2018 ";
"fdfcaa9 ; Commit Date: Tue Jan 2 11:03:26 2018 ";
Ocarina_Version : constant String :=
"Ocarina 2017.x (Working Copy from rd078c54)";
end TASTE.Parser_Version;
\ No newline at end of file
......@@ -5,30 +5,30 @@ package body TASTE.Templates is
Tmpl_Set := Null_Set;
end New_Set;
procedure Map (Name : String; Value : String) is
procedure Tmpl_Map (Name : String; Value : String) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
end Tmpl_Map;
procedure Map (Name : String; Value : Boolean) is
procedure Tmpl_Map (Name : String; Value : Boolean) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
end Tmpl_Map;
procedure Map (Name : String; Value : Unbounded_String) is
procedure Tmpl_Map (Name : String; Value : Unbounded_String) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
end Tmpl_Map;
procedure Map (Name : String; Value : Integer) is
procedure Tmpl_Map (Name : String; Value : Integer) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
end Tmpl_Map;
procedure Map (Name : String; Value : Tag) is
procedure Tmpl_Map (Name : String; Value : Tag) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
end Tmpl_Map;
function Generate (Template_File : String) return String is
(Parse (Template_File, Tmpl_Set));
......
......@@ -7,11 +7,11 @@ package TASTE.Templates is
procedure New_Set;
procedure Map (Name : String; Value : String);
procedure Map (Name : String; Value : Boolean);
procedure Map (Name : String; Value : Unbounded_String);
procedure Map (Name : String; Value : Integer);
procedure Map (Name : String; Value : Tag);
procedure Tmpl_Map (Name : String; Value : String);
procedure Tmpl_Map (Name : String; Value : Boolean);
procedure Tmpl_Map (Name : String; Value : Unbounded_String);
procedure Tmpl_Map (Name : String; Value : Integer);
procedure Tmpl_Map (Name : String; Value : Tag);
function Generate (Template_File : String) return String;
private
......
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