Commit ef251076 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Refactor interface signature

Don't need param-specific templates anymore
tested with SDL
parent 2b6944f7
...@@ -177,18 +177,31 @@ package body TASTE.Backend.Skeletons is ...@@ -177,18 +177,31 @@ package body TASTE.Backend.Skeletons is
& Assoc ("Interface_Kind", TI.RCM'Img) & Assoc ("Interface_Kind", TI.RCM'Img)
& Assoc ("Direction", Param.Direction'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) function Interface_Template (TI : Taste_Interface)
return Interface_As_Template return Interface_As_Template
is is
use Template_Vectors; use Template_Vectors;
Result : Interface_As_Template; Result : Interface_As_Template;
Param_Names : Vector_Tag;
Param_Types : Vector_Tag;
Param_Directions : Vector_Tag;
begin begin
Result.Header := +Assoc ("Name", TI.Name) Result.Header := +Assoc ("Name", TI.Name)
& Assoc ("Kind", TI.RCM'Img) & Assoc ("Kind", TI.RCM'Img)
& Assoc ("Parent_Function", TI.Parent_Function); & Assoc ("Parent_Function", TI.Parent_Function);
for Each of TI.Params loop for Each of TI.Params loop
Result.Params := Result.Params & Parameter_Template (Each, TI); Result.Params := Result.Params & Parameter_Template (Each, TI);
Param_Names := Param_Names & Each.Name;
Param_Types := Param_Types & Each.Sort;
Param_Directions := Param_Directions & Each.Direction'Img;
end loop; end loop;
Result.Header := Result.Header
& Assoc ("Param_Names", Param_Names)
& Assoc ("Param_Types", Param_Types)
& Assoc ("Param_Directions", Param_Directions);
return Result; return Result;
end Interface_Template; end Interface_Template;
......
...@@ -3,23 +3,31 @@ ...@@ -3,23 +3,31 @@
@@-- @_Name_@ : The name of the interface @@-- @_Name_@ : The name of the interface
@@-- @_Kind_@ : The RCM Kind @@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function @@-- @_Parent_Function_@ : The name of the function
@@-- @_Parameters_@ : The template-generated parameters @@-- @_Parameters_@ : The template-generated parameters DEPRECATED
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@IF@@ @_LOWER:Kind_@ = "cyclic_operation" or @_LOWER:Kind_@ = "sporadic_operation" @@IF@@ @_LOWER:Kind_@ = "cyclic_operation" or @_LOWER:Kind_@ = "sporadic_operation"
@@IF@@ @_Parameters'Length_@ > 0 @@IF@@ @_Param_Names'Length_@ > 0
signal @_CAPITALIZE:Name_@ (@_STRIP:Parameters_@) /* CIF Keep Specific Geode PARAMNAMES @_Param_Names_@ */
signal @_CAPITALIZE:Name_@ (@_REPLACE_ALL((-)/_):Param_Types_@)
@@ELSE@@ @@ELSE@@
signal @_CAPITALIZE:Name_@ signal @_CAPITALIZE:Name_@
@@END_IF@@ @@END_IF@@
@@ELSE@@ @@ELSE@@
procedure @_CAPITALIZE:Name_@; procedure @_CAPITALIZE:Name_@;
@@IF@@ @_Parameters'Length_@ > 0 @@IF@@ @_Param_Names'Length_@ > 0
fpar fpar
@@END_IF@@ @@END_IF@@
@@INLINE( )(,\n )()@@ @@INLINE( )(,\n )()@@
@@TABLE@@ @@TABLE@@
@_STRIP:Parameters_@ @@IF@@ @_Param_Directions_@ = "PARAM_IN"
in @_CAPITALIZE:Param_Names_@ @_REPLACE_ALL((-)/_):Param_Types_@
@@ELSE@@
in/out @_CAPITALIZE:Param_Names_@ @_REPLACE_ALL((-)/_):Param_Types_@
@@END_IF@@
@@END_TABLE@@ @@END_TABLE@@
@@END_INLINE@@ @@END_INLINE@@
;
external external
@@END_IF@@ @@END_IF@@
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