Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
e4af4b74
Commit
e4af4b74
authored
Sep 16, 2019
by
Maxime Perrotin
Browse files
Refactor the interface to pohiada (in progress)
parent
f37dd0b4
Changes
26
Hide whitespace changes
Inline
Side-by-side
src/taste-aadl_parser.adb
View file @
e4af4b74
...
...
@@ -477,7 +477,8 @@ package body TASTE.AADL_Parser is
declare
Thread
:
constant
AADL_Thread
:=
(
Name
=>
To_Lower
(
To_String
(
F
.
Name
))
&
"_"
&
PI
.
Name
,
&
"_"
&
PI
.
Name
,
Partition_Name
=>
US
(
Partition_Name
),
RCM
=>
US
(
PI
.
RCM
'
Img
),
Need_Mutex
=>
(
F
.
Provided
.
Length
>
1
),
Entry_Port_Name
=>
PI
.
Name
,
...
...
src/taste-concurrency_view.adb
View file @
e4af4b74
...
...
@@ -141,6 +141,7 @@ package body TASTE.Concurrency_View is
return
Result
:
constant
Translate_Set
:=
T
.
PI
.
To_Template
-- Template of the PI used to create the thread
&
Assoc
(
"Thread_Name"
,
To_String
(
T
.
Name
))
&
Assoc
(
"Partition_Name"
,
To_String
(
T
.
Partition_Name
))
&
Assoc
(
"Entry_Port_Name"
,
To_String
(
T
.
Entry_Port_Name
))
&
Assoc
(
"RCM"
,
To_String
(
T
.
RCM
))
&
Assoc
(
"Need_Mutex"
,
T
.
Need_Mutex
)
...
...
@@ -214,7 +215,8 @@ package body TASTE.Concurrency_View is
is
Partition
:
constant
CV_Partition
:=
CV
.
Nodes
(
Node_Name
).
Partitions
(
Partition_Name
);
Thread_Names
:
Tag
;
Thread_Names
,
Thread_Has_Param
:
Vector_Tag
;
Block_Names
:
Vector_Tag
;
Block_Languages
:
Vector_Tag
;
Blocks
:
Unbounded_String
;
...
...
@@ -290,6 +292,12 @@ package body TASTE.Concurrency_View is
Threads
:=
Threads
&
Newline
&
Result
;
Part_Threads
:=
Part_Threads
&
Newline
&
Result
;
Thread_Names
:=
Thread_Names
&
Name
;
-- Set boolean to true if thread has a param
-- That helps backend to know if POHI has generated
-- the "types" package.
Thread_Has_Param
:=
Thread_Has_Param
&
(
T
.
PI
.
Params
.
Length
>
0
);
All_Thread_Names
:=
All_Thread_Names
&
Name
;
for
P
of
T
.
Output_Ports
loop
for
Part_Threads
of
Partition
.
Threads
loop
...
...
@@ -396,6 +404,7 @@ package body TASTE.Concurrency_View is
Partition_Assoc
:=
Partition
.
Deployment_Partition
.
To_Template
&
Assoc
(
"Threads"
,
Part_Threads
)
&
Assoc
(
"Thread_Names"
,
Thread_Names
)
&
Assoc
(
"Thread_Has_Param"
,
Thread_Has_Param
)
&
Assoc
(
"Node_Name"
,
Node_Name
)
&
Assoc
(
"Blocks"
,
Blocks
)
&
Assoc
(
"Block_Names"
,
Block_Names
)
...
...
src/taste-concurrency_view.ads
View file @
e4af4b74
...
...
@@ -70,6 +70,7 @@ package TASTE.Concurrency_View is
type
AADL_Thread
is
tagged
record
Name
:
Unbounded_String
;
Partition_Name
:
Unbounded_String
;
RCM
:
Unbounded_String
;
Need_Mutex
:
Boolean
:=
False
;
Entry_Port_Name
:
Unbounded_String
;
...
...
templates/concurrency_view/aadl_2_threads/thread.tmplt
View file @
e4af4b74
@@--
The
following
tags
are
available
in
this
template
:
@@--
@@--
@
_Thread_Name_
@
:
Thread
name
@@--
@
_Partition_Name_
@
:
Partition
containing
this
thread
@@--
@
_Entry_Port_Name_
@
:
Name
of
the
PI
@@--
@
_RCM_
@
:
One
of
"CYCLIC_OPERATION"
,
"SPORADIC_OPERATION"
@@--
@
_Need_Mutex_
@
:
True
if
the
PI
is
shared
with
others
in
the
protected
block
...
...
@@ -42,7 +43,7 @@ features
@@
IF
@@
@
_Use_POHIC_
@
Compute_Entrypoint_Source_Text
=>
"call_@_LOWER:Thread_Name_@"
;
};
@@
ELSE
@@
Compute_Entrypoint_Source_Text
=>
"@_Thread_Name_@_
Wrappers.
@_Entry_Port_Name_@"
;
};
Compute_Entrypoint_Source_Text
=>
"@_
CAPITALIZE:Partition_Name_@_Polyorb_Interface.@_CAPITALIZE:
Thread_Name_@_@_Entry_Port_Name_@"
;
};
@@
END_IF
@@
@@
END_IF
@@
@@
TABLE
@@
...
...
@@ -61,7 +62,7 @@ properties
@@
IF
@@
@
_Use_POHIC_
@
Initialize_Entrypoint_Source_Text
=>
"init_@_LOWER:Pro_Block_Name_@"
;
@@
ELSE
@@
Initialize_Entrypoint_Source_Text
=>
"@_
Thread_Name_@_Wrappers.C_Init_@_
Thread_Name_@"
;
Initialize_Entrypoint_Source_Text
=>
"@_
CAPITALIZE:Partition_Name_@_Polyorb_Interface.@_CAPITALIZE:
Thread_Name_@
_Init
"
;
@@
END_IF
@@
@@
INLINE
(
)(\
n
)()@@
@@
IF
@@
@
_RCM_
@
=
"SPORADIC_OPERATION"
...
...
@@ -70,7 +71,7 @@ properties
@@
IF
@@
@
_Use_POHIC_
@
Compute_Entrypoint_Source_Text
=>
"call_@_LOWER:Thread_Name_@"
;
@@
ELSE
@@
Compute_Entrypoint_Source_Text
=>
"@_Thread_Name_@_
Wrappers.
@_Entry_Port_Name_@"
;
Compute_Entrypoint_Source_Text
=>
"@_
CAPITALIZE:Partition_Name_@_Polyorb_Interface.@_CAPITALIZE:
Thread_Name_@_@_Entry_Port_Name_@"
;
@@
END_IF
@@
Dispatch_Protocol
=>
Periodic
;
@@
END_IF
@@
...
...
templates/concurrency_view/aadl_4_makefile/partition.tmplt
View file @
e4af4b74
...
...
@@ -2,7 +2,8 @@
@@--
@@--
@
_Name_
@
:
Partition
name
(
usually
the
name
of
the
binary
)
@@--
@
_Threads_
@
:
Code
generated
for
the
threads
@@--
@
_Thread_Names_
@
:
Tag
:
list
of
thread
names
@@--
@
_Thread_Names_
@
:
Vector
Tag
:
list
of
thread
names
@@--
@
_Thread_Has_Param_
@
:
|
_
true
if
the
thread
has
a
param
@@--
@
_Node_Name_
@
:
Name
of
the
node
containing
this
partition
@@--
@
_Blocks_
@
:
Code
generated
for
protected
functions
@@--
@
_Block_Names
@
:
Vector
Tag
:
list
of
block
(
user
functions
)
names
...
...
templates/concurrency_view/ada_pohi_gpr/partition.tmplt
View file @
e4af4b74
...
...
@@ -50,7 +50,7 @@ project @_CAPITALIZE:Name_@ is
--
following
to
be
updated
with
all
relevant
source
dirs
for
Source_Dirs
use
(
"
.
"
,
(
"
@_LOWER:Name_@
"
,
"/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-ada"
,
"../../dataview/C"
,
@@
IF
@@
@
_Need_Ada_
@
=
TRUE
...
...
templates/concurrency_view/ada_ri_wrappers_source/fileblock.tmplt
View file @
e4af4b74
@@-- Specify the file name for a protected block
@@-- @_Block_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Block_Name_@_block.ads
templates/concurrency_view/ada_ri_wrappers_source/filepart.tmplt
View file @
e4af4b74
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@/required_interfaces.ads
templates/concurrency_view/ada_ri_wrappers_source/filethread.tmplt
View file @
e4af4b74
@@-- Specify the file name for a thread
@@-- @_Thread_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Thread_Name_@_async_ri_wrappers.ads
templates/concurrency_view/ada_ri_wrappers_source/partition.tmplt
View file @
e4af4b74
...
...
@@ -15,3 +15,10 @@
@@--
@
_Thread_Dst_Name_
@
:
Vector
tag
:
connection
thread
name
(
dest
)
@@--
@
_Thread_Src_Port_
@
:
Vector
tag
:
connection
port
name
(
source
)
@@--
@
_Thread_Dst_Port_
@
:
Vector
tag
:
connection
port
name
(
dest
)
with
Interfaces
.
C
;
package
Required_Interfaces
is
--
generated
from
templates
/
concurrency_view
/
ada_ri_wrappers_source
/
partition
.
tmplt
@
_Threads
'Indent_@
end Required_Interfaces;
templates/concurrency_view/ada_ri_wrappers_source/thread.tmplt
View file @
e4af4b74
...
...
@@ -17,10 +17,8 @@
@@--
@
_IF_Property_Names_
@,
_Values_
@
:
user
properties
(
vector
tag
)
@@--
@@--
Matrix
of
output
ports
:
Remote
thread
/
corresponding
remote
PI
@
_Name_
@
with
Interfaces
.
C
;
package
@
_CAPITALIZE
:
Thread_Name_
@
_Async_RI_Wrappers
is
package
@
_CAPITALIZE
:
Thread_Name_
@
is
---
generated
from
templates
/
concurrency_view
/
ada_ri_wrappers_source
/
thread
.
tmplt
@@
INLINE
(
)(\
n
)(\
n
)@@
@@
TABLE
@@
@@
IF
@@
@
_Remote_PI_Sorts
'Length_@ > 0
...
...
@@ -32,5 +30,4 @@ package @_CAPITALIZE:Thread_Name_@_Async_RI_Wrappers is
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
end @_CAPITALIZE:Thread_Name_@_Async_RI_Wrappers;
end @_CAPITALIZE:Thread_Name_@;
templates/concurrency_view/ada_wrappers_body/block.tmplt
View file @
e4af4b74
...
...
@@ -7,19 +7,13 @@
@@--
@
_Protected_PIs_
@
:
Protected
Provided
interfaces
(
from
pi
.
tmplt
)
@@--
@
_Unprotected_PIs_
@
:
Unprotected
Provided
interfaces
(
from
pi
.
tmplt
)
@@--
@
_Required_
@
:
Required
interfaces
(
from
ri
.
tmplt
)
@@
IF
@@
@
_Language_
@
=
SDL
or
@
_Language_
@
=
Ada
with
@
_CAPITALIZE
:
Name_
@;
@@
END_IF
@@
package
body
@
_CAPITALIZE
:
Name_
@
_Block
is
package
body
@
_CAPITALIZE
:
Name_
@
is
@@
IF
@@
@
_Protected_PIs_
@
/=
""
@@
IF
@@
@
_Protected_PIs_
@
/=
""
protected
body
@
_CAPITALIZE
:
Name_
@
_Protected
is
@
_Protected_PIs
'Indent_@
end @_CAPITALIZE:Name_@_Protected;
@@END_IF@@
@@END_IF@@
@_Unprotected_PIs'
Indent_
@
end
@
_CAPITALIZE
:
Name_
@
_Block
;
end
@
_CAPITALIZE
:
Name_
@;
templates/concurrency_view/ada_wrappers_body/fileblock.tmplt
View file @
e4af4b74
@@-- Specify the file name for a protected block
@@-- @_Block_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Block_Name_@_block.adb
templates/concurrency_view/ada_wrappers_body/filepart.tmplt
View file @
e4af4b74
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@/@_LOWER:Partition_Name_@_polyorb_interface.adb
templates/concurrency_view/ada_wrappers_body/filethread.tmplt
View file @
e4af4b74
@@-- Specify the file name for a thread
@@-- @_Thread_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Thread_Name_@_wrappers.adb
templates/concurrency_view/ada_wrappers_body/partition.tmplt
View file @
e4af4b74
...
...
@@ -3,6 +3,7 @@
@@--
@
_Name_
@
:
Partition
name
(
usually
the
name
of
the
binary
)
@@--
@
_Threads_
@
:
Code
generated
for
the
threads
@@--
@
_Thread_Names_
@
:
Tag
:
list
of
thread
names
@@--
@
_Thread_Has_Param_
@
:
|
_
true
if
the
thread
has
a
param
@@--
@
_Node_Name_
@
:
Name
of
the
node
containing
this
partition
@@--
@
_Blocks_
@
:
Code
generated
for
protected
functions
@@--
@
_Coverage_
@
:
True
if
user
requested
code
coverage
enable
...
...
@@ -15,3 +16,8 @@
@@--
@
_Thread_Dst_Name_
@
:
Vector
tag
:
connection
thread
name
(
dest
)
@@--
@
_Thread_Src_Port_
@
:
Vector
tag
:
connection
port
name
(
source
)
@@--
@
_Thread_Dst_Port_
@
:
Vector
tag
:
connection
port
name
(
dest
)
package
body
@
_CAPITALIZE
:
Name_
@
_Polyorb_Interface
is
--
generated
from
templates
/
concurrency_view
/
ada_wrappers_body
/
partition
.
tmplt
@
_Blocks
'Indent_@
@_Threads'
Indent_
@
end
@
_CAPITALIZE
:
Name_
@
_Polyorb_Interface
;
templates/concurrency_view/ada_wrappers_body/thread.tmplt
View file @
e4af4b74
...
...
@@ -19,44 +19,34 @@
@@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI @_Name_@
@@IF@@ @_Param_Names'Length_@ > 0
with Interfaces.C;
@@TABLE@@
procedure @_CAPITALIZE:Thread_Name_@_@_CAPITALIZE:Entry_Port_Name_@
(dummy_Entity : Entity_Type; Param_Buffer : @_REPLACE_ALL((-)/_):Param_Types_@_Buffer_Impl)
is
@@END_TABLE@@
@@ELSE@@
procedure @_CAPITALIZE:Thread_Name_@_@_CAPITALIZE:Entry_Port_Name_@
(dummy_Entity : Entity_Type)
is
@@END_IF@@
package body @_CAPITALIZE:Thread_Name_@_Wrappers is
@@INLINE( )()(\n)@@
@@IF@@ @_Param_Names'
Length_
@
>
0
@@
TABLE
@@
procedure
@
_CAPITALIZE
:
Entry_Port_Name_
@
(
dummy_Entity
:
Entity_Type
;
Param_Buffer
:
@
_REPLACE_ALL
((-)/
_
):
Param_Types_
@
_Buffer_Impl
)
is
@@
END_TABLE
@@
@@
ELSE
@@
procedure
@
_CAPITALIZE
:
Entry_Port_Name_
@
(
dummy_Entity
:
Entity_Type
)
is
@@
END_IF
@@
@@
END_INLINE
@@
@@
IF
@@
@
_Param_Names
'Length_@ > 0
@@TABLE@@
@_CAPITALIZE:Param_Names_@_AdaBuffer : Interfaces.C.char_array (1 .. Interfaces.C.size_t (Param_Buffer.Length)) with Import;
for @_CAPITALIZE:Param_Names_@_AdaBuffer'
Address
use
Param_Buffer
'Address;
@@END_TABLE@@
begin
@@IF@@ @_Need_Mutex_@
@_CAPITALIZE:Pro_Block_Name_@_Block.@_CAPITALIZE:Pro_Block_Name_@_Protected.@_CAPITALIZE:Entry_Port_Name_@
@@ELSE@@
@_CAPITALIZE:Pro_Block_Name_@_Block.@_CAPITALIZE:Entry_Port_Name_@
@@END_IF@@
(@_CAPITALIZE:Param_Names_@_AdaBuffer, @_CAPITALIZE:Param_Names_@_AdaBuffer'
Length
);
@@IF@@ @_Param_Names'Length_@ > 0
@@TABLE@@
@_CAPITALIZE:Param_Names_@_AdaBuffer : Interfaces.C.char_array (1 .. Interfaces.C.size_t (Param_Buffer.Length)) with Import;
for @_CAPITALIZE:Param_Names_@_AdaBuffer'Address use Param_Buffer'Address;
@@END_TABLE@@
begin
@@IF@@ @_Need_Mutex_@
@_CAPITALIZE:Pro_Block_Name_@.@_CAPITALIZE:Pro_Block_Name_@_Protected.@_CAPITALIZE:Entry_Port_Name_@
@@ELSE@@
@_CAPITALIZE:Pro_Block_Name_@.@_CAPITALIZE:Entry_Port_Name_@
@@END_IF@@
(@_CAPITALIZE:Param_Names_@_AdaBuffer, @_CAPITALIZE:Param_Names_@_AdaBuffer'Length);
@@ELSE@@
begin
@@IF@@ @_Need_Mutex_@
@_CAPITALIZE:Pro_Block_Name_@.@_CAPITALIZE:Pro_Block_Name_@_Protected.@_CAPITALIZE:Entry_Port_Name_@;
@@ELSE@@
begin
@@
IF
@@
@
_Need_Mutex_
@
@
_CAPITALIZE
:
Pro_Block_Name_
@
_Block
.@
_CAPITALIZE
:
Pro_Block_Name_
@
_Protected
.@
_CAPITALIZE
:
Entry_Port_Name_
@;
@@
ELSE
@@
@
_CAPITALIZE
:
Pro_Block_Name_
@
_Block
.@
_CAPITALIZE
:
Entry_Port_Name_
@;
@@
END_IF
@@
@_CAPITALIZE:Pro_Block_Name_@.@_CAPITALIZE:Entry_Port_Name_@;
@@END_IF@@
end
@
_CAPITALIZE
:
Entry_Port_Name_
@;
--
This
is
the
list
of
remote
threads
/
RIs
:
@@
TABLE
@@
--
@
_Remote_Threads_
@.@
_Remote_PIs_
@
@@
END_TABLE
@@
end
@
_CAPITALIZE
:
Thread_Name_
@
_Wrappers
;
@@END_IF@@
end @_CAPITALIZE:Thread_Name_@_@_CAPITALIZE:Entry_Port_Name_@;
templates/concurrency_view/ada_wrappers_source/block.tmplt
View file @
e4af4b74
...
...
@@ -7,22 +7,21 @@
@@--
@
_Protected_PIs_
@
:
Protected
Provided
interfaces
(
from
pi
.
tmplt
)
@@--
@
_Unprotected_PIs_
@
:
Unprotected
Provided
interfaces
(
from
pi
.
tmplt
)
@@--
@
_Required_
@
:
Required
interfaces
(
from
ri
.
tmplt
)
package
@
_CAPITALIZE
:
Name_
@
is
--
generated
from
templates
/
concurrency_view
/
ada_wrappers_source
/
block
.
tmplt
with
Interfaces
.
C
;
package
@
_CAPITALIZE
:
Name_
@
_Block
is
--
This
package
interfaces
with
the
user
code
directly
--
It
may
contain
a
protected
object
if
a
PI
requires
mutual
exclusion
procedure
Init
with
Import
,
Convention
=>
C
,
Link_Name
=>
"init_@_LOWER:Name_@"
;
@@
IF
@@
@
_Protected_PIs_
@
/=
""
@@
IF
@@
@
_Protected_PIs_
@
/=
""
protected
@
_CAPITALIZE
:
Name_
@
_Protected
is
@
_Protected_PIs
'Indent_@
end @_CAPITALIZE:Name_@_Protected;
@@END_IF@@
@@END_IF@@
@_Unprotected_PIs'
Indent_
@
end
@
_CAPITALIZE
:
Name_
@
_Block
;
end
@
_CAPITALIZE
:
Name_
@;
templates/concurrency_view/ada_wrappers_source/fileblock.tmplt
View file @
e4af4b74
@@-- Specify the file name for a protected block
@@-- @_Block_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Block_Name_@_block.ads
templates/concurrency_view/ada_wrappers_source/filepart.tmplt
View file @
e4af4b74
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@/@_LOWER:Partition_Name_@_polyorb_interface.ads
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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