Commit 0f3b3d4e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Initialize first templates

parent e73e99c7
...@@ -168,10 +168,12 @@ package body TASTE.Concurrency_View is ...@@ -168,10 +168,12 @@ package body TASTE.Concurrency_View is
declare declare
Path : constant String := Full_Name (Current); Path : constant String := Full_Name (Current);
Do_It : constant Boolean := Exists (Path & "/filename.tmplt"); Do_It : constant Boolean := Exists (Path & "/filename.tmplt");
Filename_Set : constant Translate_Set :=
+Assoc ("Node_Name", Node_Name);
-- Get output file name from template -- Get output file name from template
File_Name : constant String := File_Name : constant String :=
(if Do_It then (if Do_It then
Strip_String (Parse (Path & "/filename.tmplt")) Strip_String (Parse (Path & "/filename.tmplt", Filename_Set))
else ""); else "");
-- Check if file already exists -- Check if file already exists
Present : constant Boolean := Present : constant Boolean :=
...@@ -183,9 +185,11 @@ package body TASTE.Concurrency_View is ...@@ -183,9 +185,11 @@ package body TASTE.Concurrency_View is
Strip_String Strip_String
(Parse (Path & "/trigger.tmplt", Trig_Tmpl)) = "TRUE"); (Parse (Path & "/trigger.tmplt", Trig_Tmpl)) = "TRUE");
function Generate_Partition (Partition : CV_Partition) function Generate_Partition (Partition_Name : String)
return String return String
is is
Partition : constant CV_Partition :=
CV.Nodes (Node_Name).Partitions (Partition_Name);
Threads : Tag; Threads : Tag;
Blocks : Tag; Blocks : Tag;
Partition_Assoc : Translate_Set; Partition_Assoc : Translate_Set;
...@@ -224,7 +228,8 @@ package body TASTE.Concurrency_View is ...@@ -224,7 +228,8 @@ package body TASTE.Concurrency_View is
end; end;
end loop; end loop;
Partition_Assoc := +Assoc ("Threads", Threads) Partition_Assoc := +Assoc ("Threads", Threads)
& Assoc ("Blocks", Blocks); & Assoc ("Blocks", Blocks)
& Assoc ("Partition_Name", Partition_Name);
return Parse (Path & "/partition.tmplt", Partition_Assoc); return Parse (Path & "/partition.tmplt", Partition_Assoc);
end Generate_Partition; end Generate_Partition;
...@@ -233,15 +238,17 @@ package body TASTE.Concurrency_View is ...@@ -233,15 +238,17 @@ package body TASTE.Concurrency_View is
begin begin
if Trigger then if Trigger then
for Partition of CV.Nodes (Node_Name).Partitions loop for Partition in CV.Nodes (Node_Name).Partitions.Iterate loop
Partitions := Partitions & Generate_Partition (Partition); Partitions := Partitions
& Generate_Partition (CV_Partitions.Key (Partition));
end loop; end loop;
Node_Assoc := +Assoc ("Partitions", Partitions); Node_Assoc := +Assoc ("Partitions", Partitions)
& Assoc ("Node_Name", Node_Name);
Put_Info ("Generating from " & Path); Put_Info ("Generating from " & Path);
Create (File => Output_File, Create (File => Output_File,
Mode => Out_File, Mode => Out_File,
Name => Output_Dir & File_Name); Name => Output_Dir & "/" & File_Name);
Put_Line (Output_File, Put_Line (Output_File,
Parse (Path & "/node.tmplt", Node_Assoc)); Parse (Path & "/node.tmplt", Node_Assoc));
Close (Output_File); Close (Output_File);
......
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Protected block name
@@-- @_Calling_Threads_@ : List of calling threads
@@-- @_Node name_@ : Node name
@@-- @_Provided_@ : Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
protected @_CAPITALIZE:Name_@ is -- part of node "@_CAPITALIZE:Node_Name_@"
-- Calling Threads: @_Calling_Threads_@
@@TABLE@@
@_Provided'INDENT_@
@@END_TABLE@@
@@TABLE@@
@_Required'INDENT_@
@@END_TABLE@@
end @_CAPITALIZE:Name_@
process.aadl @@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node as defined in the Deployment View
@@-- The content of this file is generated from node.tmplt
@_LOWER:Node_Name_@.adb
@@-- The following tags are available in this template: @@-- The following tags are available in this template:
@@-- @@--
@@-- @_Threads_@ : List of threads @@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_Blocks_@ : List of protected blocks @@-- @_Partitions_@ : List of rendered code for partitions
@@-- In standard TASTE systems there is only one partition per node
package body @_CAPITALIZE:Node_Name_@ is
@_Partitions_@
@@TABLE@@ @@TABLE@@
-- THREAD @_Partitions'Indent_@
@_Threads_@
@@END_TABLE@@ @@END_TABLE@@
@@TABLE@@ end @_CAPITALIZE:Node_Name_@;
-- BLOCK
@_Blocks_@
@@END_TABLE@@
@@-- The following tags are available in this template:
@@--
@@-- @_Partition_Name_@ : Partition name (usually the name of the binary)
@@-- @_Threads_@ : List of threads
@@-- @_Blocks_@ : List of protected functions
package @_CAPITALIZE:Partition_Name_@ is
@@TABLE@@
@_Threads'INDENT_@
@@END_TABLE@@
@@TABLE@@
@_Blocks'INDENT_@
@@END_TABLE@@
end @_CAPITALIZE:Partition_Name_@;
...@@ -7,4 +7,8 @@ ...@@ -7,4 +7,8 @@
@@-- @_Param_Names_@ : List of parameter names @@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types @@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction @@-- @_Param_Directions_@ : |_ Corresponding direction
procedure @_CAPITALIZE:Name_@ is -- @_Direction_@ of function @_Parent_Function_@
@@TABLE@@
-- @_Param_Names_@ : @_Param_Types_@ (@_Param_Directions_@)
@@END_TABLE@@
end @_CAPITALIZE:Name_@
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
@@-- @_Remote_PIs_@ : |_ Associated PI Name @@-- @_Remote_PIs_@ : |_ Associated PI Name
@@-- @@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI @@-- Matrix of output ports: Remote thread/corresponding remote PI
Thread : @_Name_@ task @_CAPITALIZE:Name_@ is
|_ Port : @_Entry_Port_Name_@ Port : @_Entry_Port_Name_@
|_ Protected Block : @_Pro_Block_Name_@ Protected Block : @_Pro_Block_Name_@
|_ Node : @_Node_Name_@ Node : @_Node_Name_@
|_ Out_Ports : Out_Ports :
@@TABLE@@ @@TABLE@@
@_Remote_Threads_@ -> @_Remote_PIs_@ @_Remote_Threads_@ -> @_Remote_PIs_@
@@END_TABLE@@ @@END_TABLE@@
end @_CAPITALIZE:Name_@
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