Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
c58bdc1f
Commit
c58bdc1f
authored
Mar 25, 2019
by
Maxime Perrotin
Browse files
Work on concurrency view template engine
parent
8e6ec1fc
Changes
5
Show whitespace changes
Inline
Side-by-side
src/taste-concurrency_view.adb
View file @
c58bdc1f
...
...
@@ -76,7 +76,7 @@ package body TASTE.Concurrency_View is
end
Debug_Dump
;
-- This function translates a protected block into a template
function
To
_Template
(
B
:
Protected_Block
)
return
Block_As_Template
is
function
Prepare
_Template
(
B
:
Protected_Block
)
return
Block_As_Template
is
Calling_Threads
:
Tag
;
Result
:
Block_As_Template
;
begin
...
...
@@ -103,7 +103,7 @@ package body TASTE.Concurrency_View is
&
Assoc
(
"Node_Name"
,
To_String
(
B
.
Node
.
Value_Or
(
Taste_Node
'(
Name
=>
US
(
""
),
others
=>
<>
)).
Name
));
return
Result
;
end
To
_Template
;
end
Prepare
_Template
;
-- This function translates a thread definition into a template
function
To_Template
(
T
:
AADL_Thread
)
return
Translate_Set
is
...
...
@@ -189,15 +189,38 @@ package body TASTE.Concurrency_View is
Threads
:
Tag
;
Blocks
:
Tag
;
begin
for
Thread
of
Partition
.
Threads
loop
for
T
of
Partition
.
Threads
loop
declare
-- Render each thread
Threads
:=
Threads
&
"This_Thread"
;
-- & String'(Parse (Path & "/thread.tmplt", Thread_Assoc));
Thread_Assoc
:
constant
Translate_Set
:=
T
.
To_Template
;
Result
:
constant
String
:=
(
Parse
(
Path
&
"/thread.tmplt"
,
Thread_Assoc
));
begin
Threads
:=
Threads
&
Result
;
end
;
end
loop
;
for
Block
of
Partition
.
Blocks
loop
-- Render each block
Blocks
:=
Blocks
&
"This block"
;
-- String'(Parse (Path & "/block.tmplt", Block_Assoc));
for
B
of
Partition
.
Blocks
loop
declare
Tmpl
:
constant
Block_As_Template
:=
B
.
Prepare_Template
;
Block_Assoc
:
Translate_Set
:=
Tmpl
.
Header
;
PI_Tag
:
Tag
;
RI_Tag
:
Tag
;
begin
for
PI_Assoc
of
Tmpl
.
Provided
loop
PI_Tag
:=
PI_Tag
&
String
'(
Parse
(
Path
&
"/pi.tmplt"
,
PI_Assoc
));
end
loop
;
for
RI_Assoc
of
Tmpl
.
Required
loop
RI_Tag
:=
RI_Tag
&
String
'(
Parse
(
Path
&
"/ri.tmplt"
,
RI_Assoc
));
end
loop
;
Block_Assoc
:=
Block_Assoc
&
Assoc
(
"Provided"
,
PI_Tag
)
&
Assoc
(
"Required"
,
RI_Tag
);
Blocks
:=
Blocks
&
String
'(
Parse
(
Path
&
"/block.tmplt"
,
Block_Assoc
));
end
;
end
loop
;
return
Translate_Set
'(
+
Assoc
(
"Threads"
,
Threads
)
&
Assoc
(
"Blocks"
,
Blocks
));
...
...
src/taste-concurrency_view.ads
View file @
c58bdc1f
...
...
@@ -5,7 +5,6 @@
-- Model of the Concurrency View
with
Ada
.
Containers
.
Indefinite_Ordered_Maps
,
Ada
.
Containers
.
Indefinite_Vectors
,
Ada
.
Strings
.
Unbounded
,
Text_IO
,
Templates_Parser
,
...
...
@@ -51,8 +50,7 @@ package TASTE.Concurrency_View is
Provided
:
Translate_Sets
.
Vector
;
Required
:
Translate_Sets
.
Vector
;
end
record
;
function
To_Template
(
B
:
Protected_Block
)
return
Block_As_Template
;
package
ST_Blocks
is
new
Indefinite_Vectors
(
Natural
,
Block_As_Template
);
function
Prepare_Template
(
B
:
Protected_Block
)
return
Block_As_Template
;
package
Protected_Blocks
is
new
Indefinite_Ordered_Maps
(
String
,
Protected_Block
);
...
...
@@ -78,13 +76,6 @@ package TASTE.Concurrency_View is
package
AADL_Threads
is
new
Indefinite_Ordered_Maps
(
String
,
AADL_Thread
);
-- a Partition is eventually a process (binaray) or a TSP partition
type
CV_Partition_As_Template
is
record
Threads
:
Translate_Sets
.
Vector
;
Blocks
:
ST_Blocks
.
Vector
;
end
record
;
type
CV_Partition
is
tagged
record
Threads
:
AADL_Threads
.
Map
;
...
...
templates/concurrency_view/process/block.tmplt
0 → 100644
View file @
c58bdc1f
templates/concurrency_view/process/i
nterface
.tmplt
→
templates/concurrency_view/process/
p
i.tmplt
View file @
c58bdc1f
File moved
templates/concurrency_view/process/ri.tmplt
0 → 100644
View file @
c58bdc1f
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment