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
2b6944f7
Commit
2b6944f7
authored
Feb 24, 2018
by
Maxime Perrotin
Browse files
Work on the SDL templates
parent
c8875f2d
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/taste-backend-skeletons.adb
View file @
2b6944f7
...
...
@@ -170,8 +170,11 @@ package body TASTE.Backend.Skeletons is
end
loop
;
end
Generate
;
function
Parameter_Template
(
Param
:
ASN1_Parameter
)
return
Translate_Set
is
function
Parameter_Template
(
Param
:
ASN1_Parameter
;
TI
:
Taste_Interface
)
return
Translate_Set
is
(
+
Assoc
(
"Type"
,
Param
.
Sort
)
&
Assoc
(
"Name"
,
Param
.
Name
)
&
Assoc
(
"Interface_Kind"
,
TI
.
RCM
'
Img
)
&
Assoc
(
"Direction"
,
Param
.
Direction
'
Img
));
function
Interface_Template
(
TI
:
Taste_Interface
)
...
...
@@ -181,9 +184,10 @@ package body TASTE.Backend.Skeletons is
Result
:
Interface_As_Template
;
begin
Result
.
Header
:=
+
Assoc
(
"Name"
,
TI
.
Name
)
&
Assoc
(
"Kind"
,
TI
.
RCM
'
Img
)
&
Assoc
(
"Parent_Function"
,
TI
.
Parent_Function
);
for
Each
of
TI
.
Params
loop
Result
.
Params
:=
Result
.
Params
&
Parameter_Template
(
Each
);
Result
.
Params
:=
Result
.
Params
&
Parameter_Template
(
Each
,
TI
);
end
loop
;
return
Result
;
end
Interface_Template
;
...
...
@@ -192,12 +196,16 @@ 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
;
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
;
begin
Result
.
Header
:=
+
Assoc
(
"Name"
,
F
.
Name
)
&
Assoc
(
"Language"
,
Language_Spelling
(
F
))
...
...
@@ -209,9 +217,9 @@ package body TASTE.Backend.Skeletons is
List_Of_PIs
:=
List_Of_PIs
&
Each
.
Name
;
case
Each
.
RCM
is
when
Cyclic_Operation
|
Sporadic_Operation
=>
null
;
List_Of_ASync_PIs
:=
List_Of_ASync_PIs
&
Each
.
Name
;
when
others
=>
null
;
List_Of_Sync_PIs
:=
List_Of_Sync_PIs
&
Each
.
Name
;
end
case
;
end
loop
;
...
...
@@ -221,9 +229,9 @@ package body TASTE.Backend.Skeletons is
List_Of_RIs
:=
List_Of_RIs
&
Each
.
Name
;
case
Each
.
RCM
is
when
Cyclic_Operation
|
Sporadic_Operation
=>
null
;
List_Of_ASync_RIs
:=
List_Of_ASync_RIs
&
Each
.
Name
;
when
others
=>
null
;
List_Of_Sync_RIs
:=
List_Of_Sync_RIs
&
Each
.
Name
;
end
case
;
end
loop
;
...
...
@@ -240,13 +248,17 @@ package body TASTE.Backend.Skeletons is
-- Setup the mapping for the template
Result
.
Header
:=
Result
.
Header
&
Assoc
(
"List_Of_PIs"
,
List_Of_PIs
)
&
Assoc
(
"List_Of_RIs"
,
List_Of_RIs
)
&
Assoc
(
"Property_Names"
,
Property_Names
)
&
Assoc
(
"Property_Values"
,
Property_Values
)
&
Assoc
(
"Is_Type"
,
F
.
Is_Type
)
&
Assoc
(
"Instance_Of"
,
F
.
Instance_Of
.
Value_Or
(
US
(
""
)))
&
Assoc
(
"Timers"
,
Timers
);
&
Assoc
(
"List_Of_PIs"
,
List_Of_PIs
)
&
Assoc
(
"List_Of_RIs"
,
List_Of_RIs
)
&
Assoc
(
"List_Of_Sync_PIs"
,
List_Of_Sync_PIs
)
&
Assoc
(
"List_Of_Sync_RIs"
,
List_Of_Sync_RIs
)
&
Assoc
(
"List_Of_ASync_PIs"
,
List_Of_ASync_PIs
)
&
Assoc
(
"List_Of_ASync_RIs"
,
List_Of_ASync_RIs
)
&
Assoc
(
"Property_Names"
,
Property_Names
)
&
Assoc
(
"Property_Values"
,
Property_Values
)
&
Assoc
(
"Is_Type"
,
F
.
Is_Type
)
&
Assoc
(
"Instance_Of"
,
F
.
Instance_Of
.
Value_Or
(
US
(
""
)))
&
Assoc
(
"Timers"
,
Timers
);
return
Result
;
end
Func_Template
;
...
...
src/taste-backend-skeletons.ads
View file @
2b6944f7
...
...
@@ -37,7 +37,8 @@ private
end
record
;
-- Set of functions translating the AST into Templates_Parser mappings
function
Parameter_Template
(
Param
:
ASN1_Parameter
)
return
Translate_Set
;
function
Parameter_Template
(
Param
:
ASN1_Parameter
;
TI
:
Taste_Interface
)
return
Translate_Set
;
function
Interface_Template
(
TI
:
Taste_Interface
)
return
Interface_As_Template
;
function
Func_Template
(
F
:
Taste_Terminal_Function
)
...
...
src/taste-parser_version.ads
View file @
2b6944f7
package
TASTE
.
Parser_Version
is
Parser_Release
:
constant
String
:=
"
6788fd7
; Commit Date:
Fri
Feb 2
3 15:17:57
2018 "
;
"
9ee5b52
; Commit Date:
Sat
Feb 2
4 09:45:08
2018 "
;
Ocarina_Version
:
constant
String
:=
"Ocarina 2017.x (Working Copy from r
c50d
39
4
)"
;
end
TASTE
.
Parser_Version
;
"Ocarina 2017.x (Working Copy from r
61c0f
39)"
;
end
TASTE
.
Parser_Version
;
\ No newline at end of file
templates/skeletons/sdl/header.tmplt
View file @
2b6944f7
...
...
@@ -4,6 +4,11 @@
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_List_Of_Sync_PIs@ : List of synchronous Provided Interfaces
@@-- @_List_Of_Sync_RIs@ : List of synchronous Required Interfaces
@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
...
...
@@ -32,25 +37,32 @@ use Datamodel;
system @_CAPITALIZE:Name_@;
-- Add the sporadic and then synchronous interfaces.
@@TABLE@@
@_STRIP:Provided_Interfaces_@;
@@END_TABLE@@
@@TABLE@@
@_STRIP:Required_Interfaces_@;
@@END_TABLE@@
channel c
@@IF@@ @_List_Of_PIs
_@
from env to @_CAPITALIZE:Name_@ with @_List_Of_PIs_@;
@@IF@@ @_List_Of_PIs
'Length_@ > 0
from env to @_CAPITALIZE:Name_@ with @_List_Of_
ASync_
PIs_@;
@@END_IF@@
@@IF@@ @_List_Of_RIs
_@
from @_CAPITALIZE:Name_@ to env with @_List_Of_RIs_@;
@@IF@@ @_List_Of_RIs
'Length_@ > 0
from @_CAPITALIZE:Name_@ to env with @_List_Of_
ASync_
RIs_@;
@@END_IF@@
endchannel;
block @_CAPITALIZE:Name_@;
signalroute r
@@IF@@ @_List_Of_PIs
_@
from env to @_CAPITALIZE:Name_@ with @_List_Of_PIs_@;
@@IF@@ @_List_Of_PIs
'Length_@ > 0
from env to @_CAPITALIZE:Name_@ with @_List_Of_
ASync_
PIs_@;
@@END_IF@@
@@IF@@ @_List_Of_RIs
_@
from @_CAPITALIZE:Name_@ to env with @_List_Of_RIs_@;
@@IF@@ @_List_Of_RIs
'Length_@ > 0
from @_CAPITALIZE:Name_@ to env with @_List_Of_
ASync_
RIs_@;
@@END_IF@@
connect c and r;
...
...
templates/skeletons/sdl/interface-header-parameter.tmplt
View file @
2b6944f7
@@-- 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
@@IF@@ @_LOWER:Interface_Kind_@ = "cyclic_operation" or @_LOWER:Interface_Kind_@ = "sporadic_operation"
@_REPLACE_ALL((-)/_):Type_@
@@ELSE@@
@@IF@@ @_Direction_@ = "PARAM_IN"
const asn1Scc
@_REPLACE_ALL((-)/_):Type_@
*
in @_CAPITALIZE:Name_@
@_REPLACE_ALL((-)/_):
CAPITALIZE:
Type_@
@@ELSE@@
asn1Scc@_REPLACE_ALL((-)/_):Type_@ *
in/out @_CAPITALIZE:Name_@ @_REPLACE_ALL((-)/_):CAPITALIZE:Type_@
@@END_IF@@
@@END_IF@@
templates/skeletons/sdl/interface-signature.tmplt
View file @
2b6944f7
@_LOWER:Name_@(@_REPLACE_ALL((\n)/):Parameters_@)
@@-- 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
@@-- @_Parameters_@ : The template-generated parameters
@@IF@@ @_LOWER:Kind_@ = "cyclic_operation" or @_LOWER:Kind_@ = "sporadic_operation"
@@IF@@ @_Parameters'Length_@ > 0
signal @_CAPITALIZE:Name_@ (@_STRIP:Parameters_@)
@@ELSE@@
signal @_CAPITALIZE:Name_@
@@END_IF@@
@@ELSE@@
procedure @_CAPITALIZE:Name_@;
@@IF@@ @_Parameters'Length_@ > 0
fpar
@@END_IF@@
@@INLINE( )(,\n )()@@
@@TABLE@@
@_STRIP:Parameters_@
@@END_TABLE@@
@@END_INLINE@@
external
@@END_IF@@
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