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

Add timers in C template

parent 17ea198b
......@@ -139,6 +139,7 @@ package body TASTE.Backend.Skeletons is
Result : Func_As_Template;
List_Of_PIs : Tag;
List_Of_RIs : Tag;
Timers : Tag;
begin
Result.Header := +Assoc ("Name", F.Name)
& Assoc ("Language", Language_Spelling (F))
......@@ -151,9 +152,13 @@ package body TASTE.Backend.Skeletons is
Result.Required := Result.Required & Interface_Template (Each);
List_Of_RIs := List_Of_RIs & Each.Name;
end loop;
for Each of F.Timers loop
Timers := Timers & Each;
end loop;
Result.Header := Result.Header
& Assoc ("List_Of_PIs", List_Of_PIs)
& Assoc ("List_Of_RIs", List_Of_RIs);
& Assoc ("List_Of_RIs", List_Of_RIs)
& Assoc ("Timers", Timers);
return Result;
end Func_Template;
......
......@@ -515,14 +515,23 @@ package body TASTE.Interface_View is
Zip_Id := Source_Text (1);
Result.Zip_File := Just (US (Get_Name_String (Zip_Id)));
end if;
-- Parse context parameters
-- Parse context parameters (including timers)
if Present (AIN.Subcomponents (Inst)) then
Subco := AIN.First_Node (AIN.Subcomponents (Inst));
while Present (Subco) loop
case Get_Category_Of_Component (Subco) is
when CC_Data =>
Result.Context_Params := Result.Context_Params
& Parse_CP (Subco);
declare
CP : constant Context_Parameter := Parse_CP (Subco);
use String_Vectors;
begin
if CP.Sort = "Timer" then
Result.Timers := Result.Timers
& To_String (CP.Name);
else
Result.Context_Params := Result.Context_Params & CP;
end if;
end;
when others =>
null;
end case;
......
......@@ -4,6 +4,7 @@
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_Provided_Interfaces_@ : List of Provided interfaces with parameters
@@-- @_Required_Interfaces_@ : List of Required interfaces with parameters
......@@ -13,6 +14,7 @@
* You can edit this file, it will not be overwritten
* Provided interfaces : @_List_Of_PIs_@
* Required interfaces : @_List_Of_RIs_@
* Timers : @_Timers_@
*/
#include "@_LOWER:Name_@.h"
......@@ -36,7 +38,7 @@ void @_LOWER:Name_@_PI_@_Provided_Interfaces_@
@@END_TABLE@@
@@TABLE@@
void @_LOWER:Name_@_PI_@_Timers_@
void @_LOWER:Name_@_PI_@_Timers_@()
{
// This function is called when the timer expires
}
......
......@@ -4,6 +4,7 @@
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_Provided_Interfaces_@ : List of Provided interfaces with parameters
@@-- @_Required_Interfaces_@ : List of Required interfaces with parameters
......@@ -36,7 +37,10 @@ void @_LOWER:Name_@_RI_@_Required_Interfaces_@;
@@END_TABLE@@
@@TABLE@@
@_Timers_@
void @_LOWER:Name_@_PI_@_Timers_@();
/* Call these functions to set/reset @_Timers_@ (value in milliseconds)*/
void @_LOWER:Name_@_RI_SET_@_Timers_@(asn1SccT_UInt32 *);
void @_LOWER:Name_@_RI_RESET_@_Timers_@();
@@END_TABLE@@
#ifdef __cplusplus
......
......@@ -702,6 +702,9 @@ END Z_Shown;
SYSTEM IMPLEMENTATION Z_Shown.others
SUBCOMPONENTS
my_timer : DATA DataView::Timer {
Taste::FS_Default_Value => "toto";
};
abc : DATA DataView::MyInteger {
Taste::FS_Default_Value => "42";
};
......
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