diff --git a/src/taste-backend-code_generators.adb b/src/taste-backend-code_generators.adb index 46c26f2f4bafb5b0b9c41f29416db0b45cf44f14..5865cd804d7f9aa96eb3a41d15d7f6b102a6074a 100644 --- a/src/taste-backend-code_generators.adb +++ b/src/taste-backend-code_generators.adb @@ -65,6 +65,7 @@ package body TASTE.Backend.Code_Generators is Tmplt : constant String := Prefix_Skeletons & "makefile.tmplt"; begin + Register_Filter ("COUCOU", My_Custom_Filter'Access); if not Exists (Tmplt) then raise ACG_Error with "Missing makefile.tmplt"; end if; diff --git a/src/taste-concurrency_view.adb b/src/taste-concurrency_view.adb index b555c6d2325fe396fa1af2bb963e6409f7a43750..d946edad9a4917726f5690d723b8bb443d418b4d 100644 --- a/src/taste-concurrency_view.adb +++ b/src/taste-concurrency_view.adb @@ -613,6 +613,7 @@ package body TASTE.Concurrency_View is end; end loop; if Trig_Sys and File_Sys /= "" and Nodes /= "" then + -- Generate from system.tmplt Set_Sys := CV.Configuration.To_Template & Assoc ("Nodes", Nodes) & Assoc ("Node_Names", Node_Names) diff --git a/src/taste-deployment_view.ads b/src/taste-deployment_view.ads index 30012c2c71c3a7fbee9cafa04612971ac65f069f..ae7ac2e065e943dae4abfa3b374f1579fda424b1 100644 --- a/src/taste-deployment_view.ads +++ b/src/taste-deployment_view.ads @@ -61,8 +61,8 @@ package TASTE.Deployment_View is type Taste_Bus is record - Name : Unbounded_String; - AADL_Package : Unbounded_String; + Name, + AADL_Package, Classifier : Unbounded_String; Properties : Property_Maps.Map; end record; @@ -71,48 +71,29 @@ package TASTE.Deployment_View is type Bus_Connection is tagged record - Source_Node : Unbounded_String; - Source_Port : Unbounded_String; - Bus_Name : Unbounded_String; - Dest_Node : Unbounded_String; + Source_Node, + Source_Port, + Bus_Name, + Dest_Node, Dest_Port : Unbounded_String; 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); type Taste_Device_Driver is tagged record - Name : Unbounded_String; - Package_Name : Unbounded_String; - Device_Classifier : Unbounded_String; - Associated_Processor_Name : Unbounded_String; - Device_Configuration : Unbounded_String; - Accessed_Bus_Name : Unbounded_String; - Accessed_Port_Name : Unbounded_String; - ASN1_Filename : Unbounded_String; - ASN1_Typename : Unbounded_String; + Name, + Package_Name, + Device_Classifier, + Associated_Processor_Name, + Device_Configuration, + Accessed_Bus_Name, + Accessed_Port_Name, + ASN1_Filename, + ASN1_Typename, ASN1_Module : Unbounded_String; 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 new Indefinite_Vectors (Natural, Taste_Device_Driver); diff --git a/src/taste-dump.adb b/src/taste-dump.adb index acfbf8427738e9aa74a27294c010d7544778d4b0..0c5f3eb015520a8bb8deaa412445710e90889e47 100644 --- a/src/taste-dump.adb +++ b/src/taste-dump.adb @@ -44,10 +44,6 @@ package body TASTE.Dump is others => False); 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 -- and cleant up between each template folder: begin @@ -126,11 +122,13 @@ package body TASTE.Dump is Result : Unbounded_String; begin for I of Interfaces loop + Result := Result & String'(Parse (IF_Template, I)) & Newline; end loop; return Result; end Process_Interfaces; begin + Document_Template (Prefix, "interfaceview.tmplt", IV_Tags); if not Check or not Trigger then Put_Info ("Nothing generated from " & Path); return; @@ -251,6 +249,7 @@ package body TASTE.Dump is & Assoc ("Dest_Ports", Dest_Ports); -- Output is made of interface, deployment and data views + Document_Template (Prefix, "interfaceview.tmplt", IV_Tags); Output_Tags := +Assoc ("Interface_View", String'(Parse (IV_Template, IV_Tags))) & Assoc ("Deployment_View", diff --git a/src/taste-parser_utils.adb b/src/taste-parser_utils.adb index 25d25a66d716735fcd85483e27106b9675f0950c..ec1b1372964829bd727af0a3050b13305aa94d21 100644 --- a/src/taste-parser_utils.adb +++ b/src/taste-parser_utils.adb @@ -13,6 +13,7 @@ with Ada.Characters.Latin_1, GNAT.Strings, GNAT.Command_Line, Templates_Parser.Utils, + Templates_Parser.Query, Ocarina.AADL_Values, Ocarina.Configuration, Ocarina.FE_AADL.Parser, @@ -56,6 +57,22 @@ package body TASTE.Parser_Utils is New_Line; 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 function Strip_String (Input_String : String) return String is use Ada.Characters.Latin_1; @@ -66,6 +83,14 @@ package body TASTE.Parser_Utils is return Ada.Strings.Fixed.Trim (Input_String, Strip_Set, Strip_Set); 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 Config : Command_Line_Configuration; Version : aliased Boolean := False; diff --git a/src/taste-parser_utils.ads b/src/taste-parser_utils.ads index affb966e44d89572b2ba4239016e5ef2e874b40f..48c50bed7062e26e07a06362080de9a448aee52c 100644 --- a/src/taste-parser_utils.ads +++ b/src/taste-parser_utils.ads @@ -75,6 +75,14 @@ package TASTE.Parser_Utils is 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; function Get_APLC_Binding (E : Node_Id) return List_Id; diff --git a/templates/concurrency_view/aadl_2_threads/partition.tmplt b/templates/concurrency_view/aadl_2_threads/partition.tmplt index b6b4326e578228d2c478eb75ee7ca9945057051f..7a49ab6817d8c7f977fc7b41c5f1d7d86bbae5a1 100644 --- a/templates/concurrency_view/aadl_2_threads/partition.tmplt +++ b/templates/concurrency_view/aadl_2_threads/partition.tmplt @@ -55,7 +55,7 @@ subcomponents @@TABLE'ALIGN_ON(":")@@ @_Thread_Names_@ : thread @_Thread_Names_@_Thread::@_Thread_Names_@.others; @@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; @@END_IF@@ @@IF@@ @_Thread_Src_Name'Length_@ > 0 or @_In_Port_Names'Length_@ > 0 or @_Out_Port_Names'Length_@ > 0 @@ -71,4 +71,6 @@ connections port @_Connected_Threads_@.OUTPORT_@_Part_Out_Port_Name_@ -> OUTPORT_@_Part_Out_Port_Name_@; @@END_TABLE@@ @@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; diff --git a/templates/concurrency_view/aadl_2_threads/system.tmplt b/templates/concurrency_view/aadl_2_threads/system.tmplt index aced554a687ff4c599ce06c79c8192b3c26085c9..9685da9b253eed1acf4405a1f31ba41dbffeeb5f 100644 --- a/templates/concurrency_view/aadl_2_threads/system.tmplt +++ b/templates/concurrency_view/aadl_2_threads/system.tmplt @@ -56,7 +56,7 @@ properties end TASTE_Protected.Object; @@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 subprogram do_ports_polling properties @@ -64,7 +64,6 @@ properties Source_Name => "user_ports_polling"; Source_Text => ("air_polling.c"); end do_ports_polling; - thread Port_Poller end Port_Poller; diff --git a/templates/concurrency_view/aadl_4_makefile/system.tmplt b/templates/concurrency_view/aadl_4_makefile/system.tmplt index dd6eba5d00ed04c697d50bcf62519dfd78ebfe5f..faa3c1fa9a90ecb25b7d6f5b14c4c92130823329 100644 --- a/templates/concurrency_view/aadl_4_makefile/system.tmplt +++ b/templates/concurrency_view/aadl_4_makefile/system.tmplt @@ -68,8 +68,4 @@ clean: rm -rf *_adainit deploymentview_final @@END_TABLE@@ -@@INLINE(.PHONY: )( )()@@ - @@TABLE@@ - @_LOWER:Block_Names_@ - @@END_TABLE@@ -@@END_INLINE@@ +.PHONY: @_REPLACE_ALL(,/):LOWER:Block_Names_@ diff --git a/test/test-cv/Makefile b/test/test-cv/Makefile index 5e2be08a998d06d868d8143243d53c6854da45a2..b659653d827af106c3776144bad40310119c0e55 100644 --- a/test/test-cv/Makefile +++ b/test/test-cv/Makefile @@ -24,7 +24,7 @@ test-parse-ada: clean-ada test-parse-c: clean-c $(KAZOO) -p --gw \ -o output.pohic \ - --glue + --glue --debug 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