Commit 607e11b5 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Simplified interface to generate templates

parent 2164c999
......@@ -4,39 +4,35 @@ use Text_IO;
with TASTE,
TASTE.AADL_Parser,
TASTE.Templates,
Templates_Parser;
use TASTE.AADL_Parser,
TASTE.Templates,
Templates_Parser;
procedure AADL_Parser is
Model : TASTE_Model;
procedure Dump_With_Templates (Model : TASTE_Model) is
Set : Translate_Set;
Vec : Tag;
begin
Set_Tag_Separators (Start_With => "<",
Stop_With => ">");
Insert (Set,
Assoc ("Interface_View",
Model.Configuration.Interface_View.all));
Insert (Set,
Assoc ("Deployment_View",
Model.Configuration.Deployment_View.all));
Insert (Set, Assoc ("Data_View", Model.Configuration.Data_View.all));
Insert (Set, Assoc ("Output_Dir", Model.Configuration.Output_Dir.all));
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;
Insert (Set, Assoc ("Other_Files", Vec));
Insert (Set, Assoc ("Skeletons", Model.Configuration.Skeletons));
Insert (Set, Assoc ("Glue", Model.Configuration.Glue));
Insert (Set, Assoc ("Use_POHIC", Model.Configuration.Use_POHIC));
Insert (Set, Assoc ("Debug_Flag", Model.Configuration.Debug_Flag));
Insert (Set, Assoc ("Version", Model.Configuration.Version));
Insert (Set, Assoc ("Timer_Resolution",
Model.Configuration.Timer_Resolution));
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 (Parse ("configuration.tmplt", Set));
Put_Line (Generate ("configuration.tmplt"));
end Dump_With_Templates;
begin
Model := Parse_Project;
......
package TASTE.Parser_Version is
Parser_Release : constant String :=
"1275d36 ; Commit Date: Fri Dec 22 10:06:37 2017 ";
"2164c99 ; Commit Date: Wed Dec 27 20:11:27 2017 ";
Ocarina_Version : constant String :=
"Ocarina 2017.x (Working Copy from rd078c54)";
end TASTE.Parser_Version;
\ No newline at end of file
package body TASTE.Templates is
procedure New_Set is
begin
Tmpl_Set := Null_Set;
end New_Set;
procedure Map (Name : String; Value : String) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
procedure Map (Name : String; Value : Boolean) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
procedure Map (Name : String; Value : Unbounded_String) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
procedure Map (Name : String; Value : Integer) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
procedure Map (Name : String; Value : Tag) is
begin
Tmpl_Set := Tmpl_Set & Assoc (Name, Value);
end Map;
function Generate (Template_File : String) return String is
(Parse (Template_File, Tmpl_Set));
begin
Set_Tag_Separators (Start_With => "<",
Stop_With => ">");
end TASTE.Templates;
with Ada.Strings.Unbounded,
Templates_Parser;
use Ada.Strings.Unbounded,
Templates_Parser;
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);
function Generate (Template_File : String) return String;
private
Tmpl_Set : Translate_Set;
end TASTE.Templates;
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