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
declare
Path : constant String := Full_Name (Current);
Do_It : constant Boolean := Exists (Path & "/filename.tmplt");
Filename_Set : constant Translate_Set :=
+Assoc ("Node_Name", Node_Name);
-- Get output file name from template
File_Name : constant String :=
(if Do_It then
Strip_String (Parse (Path & "/filename.tmplt"))
Strip_String (Parse (Path & "/filename.tmplt", Filename_Set))
else "");
-- Check if file already exists
Present : constant Boolean :=
......@@ -183,9 +185,11 @@ package body TASTE.Concurrency_View is
Strip_String
(Parse (Path & "/trigger.tmplt", Trig_Tmpl)) = "TRUE");
function Generate_Partition (Partition : CV_Partition)
function Generate_Partition (Partition_Name : String)
return String
is
Partition : constant CV_Partition :=
CV.Nodes (Node_Name).Partitions (Partition_Name);
Threads : Tag;
Blocks : Tag;
Partition_Assoc : Translate_Set;
......@@ -224,7 +228,8 @@ package body TASTE.Concurrency_View is
end;
end loop;
Partition_Assoc := +Assoc ("Threads", Threads)
& Assoc ("Blocks", Blocks);
& Assoc ("Blocks", Blocks)
& Assoc ("Partition_Name", Partition_Name);
return Parse (Path & "/partition.tmplt", Partition_Assoc);
end Generate_Partition;
......@@ -233,15 +238,17 @@ package body TASTE.Concurrency_View is
begin
if Trigger then
for Partition of CV.Nodes (Node_Name).Partitions loop
Partitions := Partitions & Generate_Partition (Partition);
for Partition in CV.Nodes (Node_Name).Partitions.Iterate loop
Partitions := Partitions
& Generate_Partition (CV_Partitions.Key (Partition));
end loop;
Node_Assoc := +Assoc ("Partitions", Partitions);
Node_Assoc := +Assoc ("Partitions", Partitions)
& Assoc ("Node_Name", Node_Name);
Put_Info ("Generating from " & Path);
Create (File => Output_File,
Mode => Out_File,
Name => Output_Dir & File_Name);
Name => Output_Dir & "/" & File_Name);
Put_Line (Output_File,
Parse (Path & "/node.tmplt", Node_Assoc));
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:
@@--
@@-- @_Threads_@ : List of threads
@@-- @_Blocks_@ : List of protected blocks
@@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_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@@
-- THREAD
@_Threads_@
@_Partitions'Indent_@
@@END_TABLE@@
@@TABLE@@
-- BLOCK
@_Blocks_@
@@END_TABLE@@
end @_CAPITALIZE:Node_Name_@;
@@-- 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 @@
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_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 @@
@@-- @_Remote_PIs_@ : |_ Associated PI Name
@@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI
Thread : @_Name_@
|_ Port : @_Entry_Port_Name_@
|_ Protected Block : @_Pro_Block_Name_@
|_ Node : @_Node_Name_@
|_ Out_Ports :
@@TABLE@@
@_Remote_Threads_@ -> @_Remote_PIs_@
@@END_TABLE@@
task @_CAPITALIZE:Name_@ is
Port : @_Entry_Port_Name_@
Protected Block : @_Pro_Block_Name_@
Node : @_Node_Name_@
Out_Ports :
@@TABLE@@
@_Remote_Threads_@ -> @_Remote_PIs_@
@@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