Commit 86be5c35 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Prepare new templates

parent 2852a9d0
......@@ -415,8 +415,11 @@ package body TASTE.Backend.Code_Generators is
Timers : Tag;
Property_Names : Vector_Tag;
Property_Values : Vector_Tag;
CP_Names : Vector_Tag; -- For Context Parameters
CP_Types : Vector_Tag; -- For Context Parameters
CP_Names : Vector_Tag; -- CP = Context Parameters
CP_Types : Vector_Tag;
CP_Values : Vector_Tag;
CP_Asn1Modules : Vector_Tag;
CP_Filenames : Vector_Tag;
Interface_Tmplt : Translate_Set;
begin
Result.Header := +Assoc ("Name", F.Name)
......@@ -425,8 +428,11 @@ package body TASTE.Backend.Code_Generators is
-- Add context parameters details
for Each of F.Context_Params loop
CP_Names := CP_Names & Each.Name;
CP_Types := CP_Types & Each.Sort;
CP_Names := CP_Names & Each.Name;
CP_Types := CP_Types & Each.Sort;
CP_Values := CP_Values & Each.Default_Value;
CP_Asn1Modules := CP_Asn1Modules & Each.ASN1_Module;
CP_Filenames := CP_Filenames & Each.ASN1_File_Name;
end loop;
-- Add all function user-defined properties
......@@ -503,6 +509,9 @@ package body TASTE.Backend.Code_Generators is
& Assoc ("Property_Values", Property_Values)
& Assoc ("CP_Names", CP_Names)
& Assoc ("CP_Types", CP_Types)
& Assoc ("CP_Values", CP_Values)
& Assoc ("CP_Asn1Modules", CP_Asn1Modules)
& Assoc ("CP_Asn1Filenames", CP_Asn1Filenames)
& Assoc ("Is_Type", F.Is_Type)
& Assoc ("Instance_Of", F.Instance_Of.Value_Or (US ("")))
& Assoc ("Timers", Timers);
......
......@@ -28,8 +28,9 @@ end @_CAPITALIZE:Name_@;
@@ELSE@@
procedure @_CAPITALIZE:Name_@ is
procedure C_@_CAPITALIZE:Name_@
with Import, Convention => C, Link_Name => "@_LOWER:Parent_Function_@_@_LOWER:Name_@";
with Import, Convention => C, Link_Name => "@_LOWER:Parent_Function_@_PI_@_LOWER:Name_@";
begin
-- PI has no parameter - directly call user code
C_@_CAPITALIZE:Name_@;
end @_CAPITALIZE:Name_@;
......
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_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
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_ASN1_Files_@ : List of ASN.1 Files with path
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_CP_Names_@ : Tag: Context Parameters - name
@@-- @_CP_Types_@ : |_ asn1 type
@@-- @_CP_Values_@ : |_ value
@@-- @_CP_Asn1Modules_@ : |_ asn1 module
@@-- @_CP_Asn1Filenames_@ : |_ asn1 filenames
@@-- @_Provided_Interfaces_@ : From template: Provided interfaces with params
@@-- @_Required_Interfaces_@ : From template: Required interfaces with params
@@-- @_Property_Names_@ : List of User-defined properties (names)
@@-- @_Property_Values_@ : List of User-defined properties (values)
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
<Function name=@_Name_@ language=@_Language_@ is_type=@_YES_NO:Is_Type_@ instance_of=@_Instance_Of_@>
@@TABLE@@
<Timer name=@_Timers_@/>
@@END_TABLE@@
@@TABLE@@
<Context_Parameter name=@_CP_Names_@ type=@_WEB_ENCODE:CP_Types_@ value=@_WEB_ENCODE:CP_Values_@ asn1module=@_WEB_ENCODE:CP_Asn1Modules_@ asn1file=@_WEB_ENCODE:CP_Asn1Filenames_@/>
@@END_TABLE@@
@@TABLE@@
<Property name=@_WEB_ENCODE:Property_Names_@ value=@_WEB_ENCODE:Property_Values_@/>
@@END_TABLE@@
@_Provided_Interfaces'Indent_@
@_Required_Interfaces'Indent_@
</Function>
@@-- 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
@@-- @_Param_Encodings_@ : |_ Corresponding ASN.1 encoding
@@-- @_Period_@, @_WCET_@, @_Queue_Size_@ : Properties of the interface
@@-- @_IF_Property_Names_@, _Values_@ : User-defined properties (vector tag)
@@IF@@ @_Direction_@ = "PI"
<Provided_Interface name=@_Name_@ kind=@_Kind_@ period=@_Period_@ wcet=@_WCET_@ queue_size=@_Queue_Size_@>
@@ELSE@@
<Required_Interface name=@_Name_@ kind=@_Kind_@>
@@END_IF@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
<Input_Parameter name=@_Param_Names_@ type=@_WEB_ENCODE:Param_Types_@ encoding=@_Param_Encodings_@/>
@@ELSE@@
<Output_Parameter name=@_Param_Names_@ type=@_WEB_ENCODE:Param_Types_@ encoding=@_Param_Encodings_@/>
@@END_IF@@
@@END_TABLE@@
@@TABLE@@
<Property name=@_WEB_ENCODE:IF_Property_Names_@ value=@_WEB_ENCODE:IF_Property_Values_@/>
@@END_TABLE@@
@@IF@@ @_Direction_@ = "PI"
</Provided_Interface>
@@ELSE@@
</Required_Interface>
@@END_IF@@
......@@ -14,17 +14,18 @@
@@IF@@ @_EXIST:Param_Names_@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
const char *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
@@ELSE@@
void *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_IF@@
@@END_TABLE@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
const char *IN_@_LOWER:Param_Names_@, size_t IN_@_LOWER:Param_Names_@_len
@@ELSE@@
char *OUT_@_LOWER:Param_Names_@, size_t *OUT_@_LOWER:Param_Names_@_len
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@ELSE@@
void @_LOWER:Parent_Function_@_@_LOWER:Name_@()
@@END_IF@@
{
puts ("@_LOWER:Parent_Function_@_@_LOWER:Name_@ called");
// Directly call user code, no parameters to pass
// This could be done directly from the concurrency glue...
@_LOWER:Parent_Function_@_PI_@_LOWER:Name_@();
// puts ("@_LOWER:Parent_Function_@_@_LOWER:Name_@ called");
}
@@END_IF@@
Markdown is supported
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