Commit 840a1f4c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Minor cleanup

parent 9752eae4
...@@ -65,6 +65,7 @@ package body TASTE.Backend.Code_Generators is ...@@ -65,6 +65,7 @@ package body TASTE.Backend.Code_Generators is
Tmplt : constant String := Prefix_Skeletons Tmplt : constant String := Prefix_Skeletons
& "makefile.tmplt"; & "makefile.tmplt";
begin begin
Register_Filter ("COUCOU", My_Custom_Filter'Access);
if not Exists (Tmplt) then if not Exists (Tmplt) then
raise ACG_Error with "Missing makefile.tmplt"; raise ACG_Error with "Missing makefile.tmplt";
end if; end if;
......
...@@ -613,6 +613,7 @@ package body TASTE.Concurrency_View is ...@@ -613,6 +613,7 @@ package body TASTE.Concurrency_View is
end; end;
end loop; end loop;
if Trig_Sys and File_Sys /= "" and Nodes /= "" then if Trig_Sys and File_Sys /= "" and Nodes /= "" then
-- Generate from system.tmplt
Set_Sys := CV.Configuration.To_Template Set_Sys := CV.Configuration.To_Template
& Assoc ("Nodes", Nodes) & Assoc ("Nodes", Nodes)
& Assoc ("Node_Names", Node_Names) & Assoc ("Node_Names", Node_Names)
......
...@@ -61,8 +61,8 @@ package TASTE.Deployment_View is ...@@ -61,8 +61,8 @@ package TASTE.Deployment_View is
type Taste_Bus is type Taste_Bus is
record record
Name : Unbounded_String; Name,
AADL_Package : Unbounded_String; AADL_Package,
Classifier : Unbounded_String; Classifier : Unbounded_String;
Properties : Property_Maps.Map; Properties : Property_Maps.Map;
end record; end record;
...@@ -71,48 +71,29 @@ package TASTE.Deployment_View is ...@@ -71,48 +71,29 @@ package TASTE.Deployment_View is
type Bus_Connection is tagged type Bus_Connection is tagged
record record
Source_Node : Unbounded_String; Source_Node,
Source_Port : Unbounded_String; Source_Port,
Bus_Name : Unbounded_String; Bus_Name,
Dest_Node : Unbounded_String; Dest_Node,
Dest_Port : Unbounded_String; Dest_Port : Unbounded_String;
end record; end record;
function To_Template (B : Bus_Connection) return Translate_Set is
(+Assoc ("Source_Node", B.Source_Node)
& Assoc ("Source_Port", B.Source_Port)
& Assoc ("Bus_Name", B.Bus_Name)
& Assoc ("Dest_Node", B.Dest_Node)
& Assoc ("Dest_Port", B.Dest_Port));
package Bus_Connections is new Indefinite_Vectors (Natural, Bus_Connection); package Bus_Connections is new Indefinite_Vectors (Natural, Bus_Connection);
type Taste_Device_Driver is tagged type Taste_Device_Driver is tagged
record record
Name : Unbounded_String; Name,
Package_Name : Unbounded_String; Package_Name,
Device_Classifier : Unbounded_String; Device_Classifier,
Associated_Processor_Name : Unbounded_String; Associated_Processor_Name,
Device_Configuration : Unbounded_String; Device_Configuration,
Accessed_Bus_Name : Unbounded_String; Accessed_Bus_Name,
Accessed_Port_Name : Unbounded_String; Accessed_Port_Name,
ASN1_Filename : Unbounded_String; ASN1_Filename,
ASN1_Typename : Unbounded_String; ASN1_Typename,
ASN1_Module : Unbounded_String; ASN1_Module : Unbounded_String;
end record; end record;
function To_Template (D : Taste_Device_Driver) return Translate_Set is
(+Assoc ("Name", D.Name)
& Assoc ("Package_Name", D.Package_Name)
& Assoc ("Device_Classifier", D.Device_Classifier)
& Assoc ("Associated_Processor_Name", D.Associated_Processor_Name)
& Assoc ("Device_Configuration", D.Device_Configuration)
& Assoc ("Accessed_Bus_Name", D.Accessed_Bus_Name)
& Assoc ("Accessed_Port_Name", D.Accessed_Port_Name)
& Assoc ("ASN1_Filename", D.ASN1_Filename)
& Assoc ("ASN1_Typename", D.ASN1_Typename)
& Assoc ("ASN1_Module", D.ASN1_Module));
package Taste_Drivers is package Taste_Drivers is
new Indefinite_Vectors (Natural, Taste_Device_Driver); new Indefinite_Vectors (Natural, Taste_Device_Driver);
......
...@@ -44,10 +44,6 @@ package body TASTE.Dump is ...@@ -44,10 +44,6 @@ package body TASTE.Dump is
others => False); others => False);
Output_File : File_Type; Output_File : File_Type;
-- output path will be determined by the templates
-- CV_Out_Dir : constant String :=
-- CV.Base_Output_Path.Element & "/concurrency_view/";
-- Tags that are built over the whole system -- Tags that are built over the whole system
-- and cleant up between each template folder: -- and cleant up between each template folder:
begin begin
...@@ -126,11 +122,13 @@ package body TASTE.Dump is ...@@ -126,11 +122,13 @@ package body TASTE.Dump is
Result : Unbounded_String; Result : Unbounded_String;
begin begin
for I of Interfaces loop for I of Interfaces loop
Result := Result & String'(Parse (IF_Template, I)) & Newline; Result := Result & String'(Parse (IF_Template, I)) & Newline;
end loop; end loop;
return Result; return Result;
end Process_Interfaces; end Process_Interfaces;
begin begin
Document_Template (Prefix, "interfaceview.tmplt", IV_Tags);
if not Check or not Trigger then if not Check or not Trigger then
Put_Info ("Nothing generated from " & Path); Put_Info ("Nothing generated from " & Path);
return; return;
...@@ -251,6 +249,7 @@ package body TASTE.Dump is ...@@ -251,6 +249,7 @@ package body TASTE.Dump is
& Assoc ("Dest_Ports", Dest_Ports); & Assoc ("Dest_Ports", Dest_Ports);
-- Output is made of interface, deployment and data views -- Output is made of interface, deployment and data views
Document_Template (Prefix, "interfaceview.tmplt", IV_Tags);
Output_Tags := +Assoc ("Interface_View", Output_Tags := +Assoc ("Interface_View",
String'(Parse (IV_Template, IV_Tags))) String'(Parse (IV_Template, IV_Tags)))
& Assoc ("Deployment_View", & Assoc ("Deployment_View",
......
...@@ -13,6 +13,7 @@ with Ada.Characters.Latin_1, ...@@ -13,6 +13,7 @@ with Ada.Characters.Latin_1,
GNAT.Strings, GNAT.Strings,
GNAT.Command_Line, GNAT.Command_Line,
Templates_Parser.Utils, Templates_Parser.Utils,
Templates_Parser.Query,
Ocarina.AADL_Values, Ocarina.AADL_Values,
Ocarina.Configuration, Ocarina.Configuration,
Ocarina.FE_AADL.Parser, Ocarina.FE_AADL.Parser,
...@@ -56,6 +57,22 @@ package body TASTE.Parser_Utils is ...@@ -56,6 +57,22 @@ package body TASTE.Parser_Utils is
New_Line; New_Line;
end Banner; end Banner;
-- Generate documentation for a translate set
procedure Document_Template (Source_Folder, Template_Name : String;
T : Translate_Set)
is
procedure Action (Item : Association; Quit : in out Boolean) is
begin
Put_Debug (" " & Templates_Parser.Query.Variable (Item) & " - "
& Templates_Parser.Query.Kind (Item)'Img);
Quit := False;
end Action;
procedure Iterate is new For_Every_Association (Action);
begin
Put_Debug (Template_Name & " (subfolder " & Source_Folder & ")");
Iterate (T);
end Document_Template;
-- Strip function as in Python -- Strip function as in Python
function Strip_String (Input_String : String) return String is function Strip_String (Input_String : String) return String is
use Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
...@@ -66,6 +83,14 @@ package body TASTE.Parser_Utils is ...@@ -66,6 +83,14 @@ package body TASTE.Parser_Utils is
return Ada.Strings.Fixed.Trim (Input_String, Strip_Set, Strip_Set); return Ada.Strings.Fixed.Trim (Input_String, Strip_Set, Strip_Set);
end Strip_String; end Strip_String;
function My_Custom_Filter
(Value, Parameters : String;
dummy_Context : Filter_Context) return String is
begin
Put_Debug (Parameters & " - " & Value);
return Value;
end My_Custom_Filter;
procedure Parse_Command_Line (Result : out Taste_Configuration) is procedure Parse_Command_Line (Result : out Taste_Configuration) is
Config : Command_Line_Configuration; Config : Command_Line_Configuration;
Version : aliased Boolean := False; Version : aliased Boolean := False;
......
...@@ -75,6 +75,14 @@ package TASTE.Parser_Utils is ...@@ -75,6 +75,14 @@ package TASTE.Parser_Utils is
package String_Holders is new Indefinite_Holders (String); package String_Holders is new Indefinite_Holders (String);
function My_Custom_Filter
(Value, Parameters : String;
dummy_Context : Filter_Context) return String;
-- Generate documentation for a translate set
procedure Document_Template (Source_Folder, Template_Name : String;
T : Translate_Set);
AADL_Parser_Error : exception; AADL_Parser_Error : exception;
function Get_APLC_Binding (E : Node_Id) return List_Id; function Get_APLC_Binding (E : Node_Id) return List_Id;
......
...@@ -55,7 +55,7 @@ subcomponents ...@@ -55,7 +55,7 @@ subcomponents
@@TABLE'ALIGN_ON(":")@@ @@TABLE'ALIGN_ON(":")@@
@_Thread_Names_@ : thread @_Thread_Names_@_Thread::@_Thread_Names_@.others; @_Thread_Names_@ : thread @_Thread_Names_@_Thread::@_Thread_Names_@.others;
@@END_TABLE@@ @@END_TABLE@@
@@IF@@ @_In_Port_Names'Length_@ > 0 @@-- Add poller thread to map AIR ports to POHIC ports @@IF@@ @_In_Port_Names'Length_@ > 0 and @_VP_Platform_@ = PLATFORM_AIR @@-- Add poller thread to map AIR ports to POHIC ports
Poll_Port : thread Port_Poller.i; Poll_Port : thread Port_Poller.i;
@@END_IF@@ @@END_IF@@
@@IF@@ @_Thread_Src_Name'Length_@ > 0 or @_In_Port_Names'Length_@ > 0 or @_Out_Port_Names'Length_@ > 0 @@IF@@ @_Thread_Src_Name'Length_@ > 0 or @_In_Port_Names'Length_@ > 0 or @_Out_Port_Names'Length_@ > 0
...@@ -71,4 +71,6 @@ connections ...@@ -71,4 +71,6 @@ connections
port @_Connected_Threads_@.OUTPORT_@_Part_Out_Port_Name_@ -> OUTPORT_@_Part_Out_Port_Name_@; port @_Connected_Threads_@.OUTPORT_@_Part_Out_Port_Name_@ -> OUTPORT_@_Part_Out_Port_Name_@;
@@END_TABLE@@ @@END_TABLE@@
@@END_IF@@ @@END_IF@@
@@-- CHECKME: There are no connections to the protected object data and it does not seem to matter
@@-- (check buildsupport output for the difference)
end @_CAPITALIZE:Name_@.final; end @_CAPITALIZE:Name_@.final;
...@@ -56,7 +56,7 @@ properties ...@@ -56,7 +56,7 @@ properties
end TASTE_Protected.Object; end TASTE_Protected.Object;
@@END_IF@@ @@END_IF@@
@@IF@@ @_Partition_Names'Length_@ > 0 @@-- AIR : we need a port polling threads @@IF@@ @_Partition_VP'Length_@ > 0 @@-- AIR : we need a port polling threads
-- Required by AIR to allow inter-partition communications -- Required by AIR to allow inter-partition communications
subprogram do_ports_polling subprogram do_ports_polling
properties properties
...@@ -64,7 +64,6 @@ properties ...@@ -64,7 +64,6 @@ properties
Source_Name => "user_ports_polling"; Source_Name => "user_ports_polling";
Source_Text => ("air_polling.c"); Source_Text => ("air_polling.c");
end do_ports_polling; end do_ports_polling;
thread Port_Poller thread Port_Poller
end Port_Poller; end Port_Poller;
......
...@@ -68,8 +68,4 @@ clean: ...@@ -68,8 +68,4 @@ clean:
rm -rf *_adainit deploymentview_final rm -rf *_adainit deploymentview_final
@@END_TABLE@@ @@END_TABLE@@
@@INLINE(.PHONY: )( )()@@ .PHONY: @_REPLACE_ALL(,/):LOWER:Block_Names_@
@@TABLE@@
@_LOWER:Block_Names_@
@@END_TABLE@@
@@END_INLINE@@
...@@ -24,7 +24,7 @@ test-parse-ada: clean-ada ...@@ -24,7 +24,7 @@ test-parse-ada: clean-ada
test-parse-c: clean-c test-parse-c: clean-c
$(KAZOO) -p --gw \ $(KAZOO) -p --gw \
-o output.pohic \ -o output.pohic \
--glue --glue --debug
buildsupport_pohic: buildsupport_pohic:
buildsupport -o output.buildsupport.pohic -p --aadlv2 --glue -i InterfaceView.aadl -c DeploymentView.aadl -d DataView.aadl ../common/ocarina_components.aadl ../common/TASTE_IV_Properties.aadl ../common/TASTE_DV_Properties.aadl buildsupport -o output.buildsupport.pohic -p --aadlv2 --glue -i InterfaceView.aadl -c DeploymentView.aadl -d DataView.aadl ../common/ocarina_components.aadl ../common/TASTE_IV_Properties.aadl ../common/TASTE_DV_Properties.aadl
......
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