Commit 40ae022c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

First working version with C++ type/instances

parent 39631e3b
......@@ -220,8 +220,9 @@ package body TASTE.Concurrency_View is
CV.Nodes (Node_Name).Partitions (Partition_Name);
Thread_Names,
Thread_Has_Param : Vector_Tag;
Block_Names : Vector_Tag;
Block_Languages : Vector_Tag;
Block_Names,
Block_Languages,
Block_Instance_Of : Vector_Tag;
Blocks : Unbounded_String;
Part_Threads : Unbounded_String;
Partition_Assoc : Translate_Set;
......@@ -361,6 +362,8 @@ package body TASTE.Concurrency_View is
All_Block_Names := All_Block_Names & Block_Name;
Block_Languages := Block_Languages
& TASTE.Backend.Language_Spelling (B.Ref_Function);
Block_Instance_Of := Block_Instance_Of
& B.Ref_Function.Instance_Of.Value_Or (US (""));
for PI_Assoc of Tmpl.Protected_Provided loop
Pro_PI_Tag := Pro_PI_Tag & Newline
......@@ -416,6 +419,7 @@ package body TASTE.Concurrency_View is
& Assoc ("Blocks", Blocks)
& Assoc ("Block_Names", Block_Names)
& Assoc ("Block_Languages", Block_Languages)
& Assoc ("Block_Instance_Of", Block_Instance_Of)
& Assoc ("In_Port_Names", Input_Port_Names)
& Assoc ("In_Port_Thread_Name", Input_Port_Thread_Name)
& Assoc ("In_Port_Type_Name", Input_Port_Type_Name)
......
......@@ -7,6 +7,7 @@
@@-- @_Blocks_@ : Code generated for protected functions
@@-- @_Block_Names@ : Vector Tag: list of block (user functions) names
@@-- @_Block_Languages_@ : |_ Corresponding implementation language
@@-- @_Block_Instance_Of_@: |_ Name of parent function (if instance)
@@-- @_Coverage_@ : True if user requested code coverage enable
@@-- @_Package_Name_@ : AADL Package name for the target (e.g. ocarina_porocessors_x86)
@@-- @_CPU_Name_@ : CPU Name (e.g. x86_linux)
......@@ -63,6 +64,10 @@ project @_CAPITALIZE:Name_@ is
"../../@_LOWER:Block_Names_@/@_Block_Languages_@/src",
"../../@_LOWER:Block_Names_@/@_Block_Languages_@/wrappers",
@@END_IF@@
@@-- CPP Instances: Add the folder of the parent function (in C++)
@@IF@@ @_EXIST:Block_Instance_Of_@ and @_Block_Languages_@ = CPP
"../../@_LOWER:Block_Instance_Of_@/@_Block_Languages_@/src",
@@END_IF@@
@@END_TABLE@@
"../deploymentview_final/@_LOWER:Name_@")
& external_as_list("EXTERNAL_SOURCE_PATH", ":")
......
......@@ -33,13 +33,30 @@
*/
#include "@_LOWER:Name_@.h"
#include "@_LOWER:Instance_Of_@.h"
@@IF@@ @_Has_Context_@
// Include Context Parameters (constants defined in the Interface View)
#include "Context-@_REPLACE_ALL(_/-):LOWER:Name_@.h"
@@END_IF@@
void @_LOWER:Name_@_startup()
// Declaration of the function instance
@@IF@@ @_List_Of_RIs'Length_@ = 0 and @_Timers'Length_@ = 0
extern @_LOWER:Instance_Of_@ @_Name_@();
@@ELSE@@
@@INLINE@@
extern @_LOWER:Instance_Of_@ @_Name_@
@@INLINE(\()(, )(\);)@@
@@TABLE@@
@_LOWER:Name_@_RI_@_List_Of_RIs_@
@@END_TABLE@@
@@TABLE@@
@_LOWER:Name_@_RI_SET_@_Timers_@, @_LOWER:Name_@_RI_RESET_@_TImers_@
@@END_TABLE@@
@@END_INLINE@@
@@END_INLINE@@
extern "C" void @_LOWER:Name_@_startup()
{
@_Name_@.startup();
}
......
......@@ -9,7 +9,7 @@
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@IF@@ @_Direction_@ = "PI"
@@INLINE@@
void @_LOWER:Parent_Function_@_PI_@_Name_@
extern "C" void @_LOWER:Parent_Function_@_PI_@_Name_@
@@IF@@ @_Param_Names'Length_@ > 0
@@INLINE(\()(, )(\))@@
@@TABLE@@
......
......@@ -34,30 +34,20 @@
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "dataview-uniq.h"
#include "@_LOWER:Instance_Of_@.h"
extern "C" {
// External declaration of required interfaces
@_Required_Interfaces_@
// Declaration of the function instance
@@IF@@ @_List_Of_RIs'Length_@ = 0 and @_Timers'Length_@ = 0
extern @_Instance_Of_@ @_Name_@();
@@ELSE@@
@@INLINE@@
extern @_Instance_Of_@ @_Name_@
@@INLINE(\()(, )(\);)@@
@@TABLE@@
@_LOWER:Name_@_RI_@_List_Of_RIs_@
@@END_TABLE@@
@@TABLE@@
@_LOWER:Name_@_RI_SET_@_Timers_@, @_LOWER:Name_@_RI_RESET_@_TImers_@
@@END_TABLE@@
@@END_INLINE@@
@@END_INLINE@@
void @_LOWER:Name_@_startup();
@@TABLE@@
@_Provided_Interfaces_@
@@END_TABLE@@
#ifdef __cplusplus
}
#endif
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