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
a6af024b
Commit
a6af024b
authored
Feb 28, 2018
by
Maxime Perrotin
Browse files
Update backends
parent
2633de20
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/taste-backend-skeletons.adb
View file @
a6af024b
...
...
@@ -31,45 +31,26 @@ package body TASTE.Backend.Skeletons is
-- a given language (based on the directory name).
function
Is_Template_Present
(
Path
:
String
)
return
Boolean
is
(
Exists
(
Path
)
and
then
Kind
(
Path
)
=
Directory
and
then
Exists
(
Path
&
"interface-signature.tmplt"
)
and
then
Exists
(
Path
&
"header.tmplt"
)
and
then
Exists
(
Path
&
"body.tmplt"
)
and
then
Exists
(
Path
&
"body-filename.tmplt"
)
and
then
Exists
(
Path
&
"header-filename.tmplt"
)
and
then
Exists
(
Path
&
"interface-body-parameter.tmplt"
)
and
then
Exists
(
Path
&
"interface-header-parameter.tmplt"
));
Exists
(
Path
&
"interface-header.tmplt"
)
and
then
Exists
(
Path
&
"interface-body.tmplt"
)
and
then
Exists
(
Path
&
"header.tmplt"
)
and
then
Exists
(
Path
&
"body.tmplt"
)
and
then
Exists
(
Path
&
"body-filename.tmplt"
)
and
then
Exists
(
Path
&
"header-filename.tmplt"
));
function
Process_Interfaces
(
Interfaces
:
Interface_Vectors
.
Vector
;
Path
:
String
;
Target
:
Output
)
return
Tag
is
Interfaces_Tag
:
Tag
;
Tmplt_Param
:
constant
String
:=
Path
&
"interface-"
&
(
if
Target
=
Header
then
"header"
else
"body"
)
&
"-parameter.tmplt"
;
Tmplt_Sign
:
constant
String
:=
Path
&
"interface-signature.tmplt"
;
Result
:
Tag
;
Tmplt_Sign
:
constant
String
:=
Path
&
"interface-"
&
(
if
Target
=
Header
then
"header"
else
"body"
)
&
".tmplt"
;
begin
for
Each
of
Interfaces
loop
declare
Pool
:
Translate_Set
:=
Each
.
Header
;
Params
:
Tag
;
begin
for
Param
of
Each
.
Params
loop
declare
P
:
constant
String
:=
Parse
(
Tmplt_Param
,
Param
);
begin
Params
:=
Params
&
P
;
end
;
end
loop
;
Pool
:=
Pool
&
Assoc
(
"Parameters"
,
Params
);
declare
New_Interface
:
constant
String
:=
Parse
(
Tmplt_Sign
,
Pool
);
begin
Interfaces_Tag
:=
Interfaces_Tag
&
New_Interface
;
end
;
end
;
Result
:=
Result
&
String
'(
Parse
(
Tmplt_Sign
,
Each
.
Header
));
end
loop
;
return
Interfaces_Tag
;
return
Result
;
end
Process_Interfaces
;
-- Return a Tag list of ASN.1 Modules for the skeleton headers
...
...
@@ -124,7 +105,7 @@ package body TASTE.Backend.Skeletons is
&
Assoc
(
"Provided_Interfaces"
,
Process_Interfaces
(
Func_Tmpl
.
Provided
,
Path
,
Code
))
&
Assoc
(
"Required_Interfaces"
,
Process_Interfaces
(
Func_Tmpl
.
Required
,
Path
,
Code
))
Process_Interfaces
(
Func_Tmpl
.
Required
,
Path
,
Code
))
else
Null_Set
);
Body_Text
:
constant
String
:=
(
if
Proceed
...
...
@@ -188,9 +169,6 @@ package body TASTE.Backend.Skeletons is
&
Assoc
(
"Interface_Kind"
,
TI
.
RCM
'
Img
)
&
Assoc
(
"Direction"
,
Param
.
Direction
'
Img
));
-- MP: With the vector tags Param_Names/Types/Directions it should be
-- possible to completely avoid the templates specific to params
-- (Result.Params is probably unnecessary now) to be confirmed
function
Interface_Template
(
TI
:
Taste_Interface
)
return
Interface_As_Template
is
...
...
@@ -220,16 +198,17 @@ package body TASTE.Backend.Skeletons is
is
use
Interface_Vectors
;
use
Ctxt_Params
;
Result
:
Func_As_Template
;
List_Of_PIs
:
Tag
;
List_Of_RIs
:
Tag
;
List_Of_Sync_PIs
:
Tag
;
List_Of_ASync_PIs
:
Tag
;
List_Of_Sync_RIs
:
Tag
;
List_Of_ASync_RIs
:
Tag
;
Timers
:
Tag
;
Property_Names
:
Vector_Tag
;
Property_Values
:
Vector_Tag
;
Result
:
Func_As_Template
;
List_Of_PIs
:
Tag
;
List_Of_RIs
:
Tag
;
List_Of_Sync_PIs
:
Tag
;
List_Of_ASync_PIs
:
Tag
;
List_Of_Sync_RIs
:
Tag
;
List_Of_ASync_RIs
:
Tag
;
Timers
:
Tag
;
Property_Names
:
Vector_Tag
;
Property_Values
:
Vector_Tag
;
Interface_Tmplt
:
Interface_As_Template
;
begin
Result
.
Header
:=
+
Assoc
(
"Name"
,
F
.
Name
)
&
Assoc
(
"Language"
,
Language_Spelling
(
F
))
...
...
@@ -237,7 +216,10 @@ package body TASTE.Backend.Skeletons is
-- Add list of all PI names (both synchronous and asynchronous)
for
Each
of
F
.
Provided
loop
Result
.
Provided
:=
Result
.
Provided
&
Interface_Template
(
Each
);
Interface_Tmplt
:=
Interface_Template
(
Each
);
Interface_Tmplt
.
Header
:=
Interface_Tmplt
.
Header
&
Assoc
(
"Direction"
,
"PI"
);
Result
.
Provided
:=
Result
.
Provided
&
Interface_Tmplt
;
List_Of_PIs
:=
List_Of_PIs
&
Each
.
Name
;
case
Each
.
RCM
is
when
Cyclic_Operation
|
Sporadic_Operation
=>
...
...
@@ -249,7 +231,10 @@ package body TASTE.Backend.Skeletons is
-- Add list of all RI names (both synchronous and asynchronous)
for
Each
of
F
.
Required
loop
Result
.
Required
:=
Result
.
Required
&
Interface_Template
(
Each
);
Interface_Tmplt
:=
Interface_Template
(
Each
);
Interface_Tmplt
.
Header
:=
Interface_Tmplt
.
Header
&
Assoc
(
"Direction"
,
"RI"
);
Result
.
Required
:=
Result
.
Required
&
Interface_Tmplt
;
List_Of_RIs
:=
List_Of_RIs
&
Each
.
Name
;
case
Each
.
RCM
is
when
Cyclic_Operation
|
Sporadic_Operation
=>
...
...
templates/skeletons/ada/header.tmplt
View file @
a6af024b
...
...
@@ -32,19 +32,14 @@ package @_CAPITALIZE:Name_@ is
--
PROVIDED
INTERFACES
---------------------------------------------------
@@
TABLE
@@
procedure
@
_STRIP
:
Provided_Interfaces_
@
with
Export
,
Convention
=>
C
,
Link_Name
=>
"@_LOWER:Name_@_PI_@_STRIP:LOWER:REPLACE(^(\S+)\s+.*/
\1)
:Provided_Interfaces_@"
;
@
_Provided_Interfaces_
@
@@
END_TABLE
@@
--
REQUIRED
INTERFACES
---------------------------------------------------
@@
TABLE
@@
procedure
@
_STRIP
:
Required_Interfaces_
@
with
Import
,
Convention
=>
C
,
Link_Name
=>
"@_LOWER:Name_@_RI_@_STRIP:LOWER:REPLACE(^(\S+)\s+.*/
\1)
:Required_Interfaces_@"
;
procedure
RI
Ü
@
_STRIP
:
Required_Interfaces_
@
renames
@
_STRIP
:
CAPITALIZE
:
REPLACE
(^(\
S
+)\
s
+.*/\
1
):
Required_Interfaces_
@;
@
_Required_Interfaces_
@
@@
END_TABLE
@@
@@
TABLE
@@
--
FUNCTIONS
TO
HANDLE
TIMER
@
_Timers_
@
----------------------------------
procedure
@
_CAPITALIZE
:
Timers_
@;
...
...
templates/skeletons/ada/interface-body-parameter.tmplt
deleted
100644 → 0
View file @
2633de20
@@IF@@ @_Direction_@ = "PARAM_IN"
IN_@_CAPITALIZE:Name_@ : access asn1Scc@_CAPITALIZE:REPLACE_ALL((-)/_):Type_@
@@ELSE@@
OUT_@_CAPITALIZE:Name_@ : access asn1Scc@_CAPITALIZE:REPLACE_ALL((-)/_):Type_@
@@END_IF@@
templates/skeletons/ada/interface-body.tmplt
0 → 100644
View file @
a6af024b
@@-- 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
@@IF@@ @_EXIST:Param_Names_@
@@INLINE@@
procedure @_CAPITALIZE:Name_@ (
@@INLINE(; )@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_@_CAPITALIZE:Param_Names_@ : access asn1Scc@_CAPITALIZE:REPLACE_ALL((-)/_):Param_Types_@
@@ELSE@@
OUT_@_CAPITALIZE:Param_Names_@ : access asn1Scc@_CAPITALIZE:REPLACE_ALL((-)/_):Param_Types_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@END_INLINE@@
)
@@ELSE@@
procedure @_CAPITALIZE:Name_@
@@END_IF@@
templates/skeletons/ada/interface-header-parameter.tmplt
deleted
100644 → 0
View file @
2633de20
@@IF@@ @_Direction_@ = "PARAM_IN"
IN_@_CAPITALIZE:Name_@ : access asn1Scc@_CAPITALIZE:REPLACE_ALL((-)/_):Type_@
@@ELSE@@
OUT_@_CAPITALIZE:Name_@ : access asn1Scc@_CAPITALIZE:REPLACE_ALL((-)/_):Type_@
@@END_IF@@
templates/skeletons/ada/interface-header.tmplt
0 → 100644
View file @
a6af024b
@@-- 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
@@IF@@ @_EXIST:Param_Names_@
@@INLINE@@
procedure @_CAPITALIZE:Name_@ (
@@INLINE(; )@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_@_CAPITALIZE:Param_Names_@ : access asn1Scc@_CAPITALIZE:REPLACE_ALL((-)/_):Param_Types_@
@@ELSE@@
OUT_@_CAPITALIZE:Param_Names_@ : access asn1Scc@_CAPITALIZE:REPLACE_ALL((-)/_):Param_Types_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@END_INLINE@@
)
@@ELSE@@
procedure @_CAPITALIZE:Name_@
@@END_IF@@
@@IF@@ @_Direction_@ = "PI"
with Export, Convention => C, Link_Name => "@_LOWER:Parent_Function_@_PI_@_LOWER:Name_@";
@@ELSE@@
with Import, Convention => C, Link_Name => "@_LOWER:Parent_Function_@_RI_@_LOWER:Name_@";
procedure RIÜ@_CAPITALIZE:Name_@ renames @_CAPITALIZE:Name_@;
templates/skeletons/c/interface-body-parameter.tmplt
deleted
100644 → 0
View file @
2633de20
@@IF@@ @_Direction_@ = "PARAM_IN"
const asn1Scc@_REPLACE_ALL((-)/_):Type_@ *IN_@_LOWER:Name_@
@@ELSE@@
asn1Scc@_REPLACE_ALL((-)/_):Type_@ *OUT_@_LOWER:Name_@
@@END_IF@@
templates/skeletons/c/interface-body.tmplt
0 → 100644
View file @
a6af024b
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_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
@_LOWER:Name_@(
@@INLINE@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
const asn1Scc@_REPLACE_ALL((-)/_):Param_Types_@ *IN_@_LOWER:Param_Names_@
@@ELSE@@
asn1Scc@_REPLACE_ALL((-)/_):Param_Types_@ *OUT_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
)
templates/skeletons/c/interface-header-parameter.tmplt
deleted
100644 → 0
View file @
2633de20
@@IF@@ @_Direction_@ = "PARAM_IN"
const asn1Scc@_REPLACE_ALL((-)/_):Type_@ *
@@ELSE@@
asn1Scc@_REPLACE_ALL((-)/_):Type_@ *
@@END_IF@@
templates/skeletons/
ada
/interface-
signature
.tmplt
→
templates/skeletons/
c
/interface-
header
.tmplt
View file @
a6af024b
...
...
@@ -3,12 +3,13 @@
@@-- @_Name_@ : The name of the interface
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Parameters_@ : The template-generated parameters DEPRECATED
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@IF@@ @_EXIST:Parameters_@
@_CAPITALIZE:Name_@ (@_REPLACE_ALL((\n)/):Parameters_@)
@@ELSE@@
@_CAPITALIZE:Name_@
@@END_IF@@
@_LOWER:Name_@(
@@INLINE(, )@@
@@TABLE@@
asn1Scc@_REPLACE_ALL((-)/_):Param_Types_@ *
@@END_TABLE@@
@@END_INLINE@@
)
templates/skeletons/sdl/interface-body-parameter.tmplt
deleted
100644 → 0
View file @
2633de20
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the parameter
@@-- @_Type_@ : The type of the parameter
@@-- @_Direction_@ : PARAM_IN or PARAM_OUT
@@-- @_Interface_Kind_@ : The RCM Kind of the interface
templates/skeletons/
c
/interface-
signature
.tmplt
→
templates/skeletons/
sdl
/interface-
body
.tmplt
View file @
a6af024b
...
...
@@ -7,4 +7,3 @@
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@_LOWER:Name_@(@_STRIP:Parameters_@)
templates/skeletons/sdl/interface-header-parameter.tmplt
deleted
100644 → 0
View file @
2633de20
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the parameter
@@-- @_Type_@ : The type of the parameter
@@-- @_Direction_@ : PARAM_IN or PARAM_OUT
@@-- @_Interface_Kind_@ : The RCM Kind of the interface
templates/skeletons/sdl/interface-
signature
.tmplt
→
templates/skeletons/sdl/interface-
header
.tmplt
View file @
a6af024b
...
...
@@ -3,7 +3,6 @@
@@-- @_Name_@ : The name of the interface
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Parameters_@ : The template-generated parameters DEPRECATED
@@-- @_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