Commit 97e1393d authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Sync with subversion

parent 82de8cbd
Pipeline #350 skipped
...@@ -42,6 +42,7 @@ endif ...@@ -42,6 +42,7 @@ endif
# strip $(exec) # strip $(exec)
install: install:
$(MAKE)
cp buildsupport `ocarina-config --prefix`/bin/ cp buildsupport `ocarina-config --prefix`/bin/
cp misc/driveGnuPlotsStreams.pl `ocarina-config --prefix`/bin/ cp misc/driveGnuPlotsStreams.pl `ocarina-config --prefix`/bin/
......
...@@ -580,7 +580,8 @@ procedure BuildSupport is ...@@ -580,7 +580,8 @@ procedure BuildSupport is
if Is_In (Param_I) then if Is_In (Param_I) then
Imported_Routines.C_Add_In_Param Imported_Routines.C_Add_In_Param
(Get_Name_String (Get_Name_String
(Name (Identifier (Param_I))), (Display_Name
(Identifier (Param_I))),
Len_Name, Len_Name,
Get_Name_String Get_Name_String
(Get_Type_Source_Name (Asntype)), (Get_Type_Source_Name (Asntype)),
...@@ -595,7 +596,8 @@ procedure BuildSupport is ...@@ -595,7 +596,8 @@ procedure BuildSupport is
else else
Imported_Routines.C_Add_Out_Param Imported_Routines.C_Add_Out_Param
(Get_Name_String (Get_Name_String
(Name (Identifier (Param_I))), (Display_Name
(Identifier (Param_I))),
Len_Name, Len_Name,
Get_Name_String Get_Name_String
(Get_Type_Source_Name (Asntype)), (Get_Type_Source_Name (Asntype)),
...@@ -1172,111 +1174,120 @@ procedure BuildSupport is ...@@ -1172,111 +1174,120 @@ procedure BuildSupport is
end if; end if;
if Get_Category_Of_Component (Tmp_CI) = CC_Process then if Get_Category_Of_Component (Tmp_CI) = CC_Process then
declare
Node_Coverage : Boolean := False;
begin
if Is_Defined_Property (Tmp_CI,
"taste_dv_properties::coverageenabled")
then
Node_Coverage := Get_Boolean_Property
(Tmp_CI,
Get_String_Name ("taste_dv_properties::coverageenabled"));
if Node_Coverage then
Put_Line ("Needs Coverage");
else
Put_Line ("Needs No coverage");
end if;
end if;
CPU := Get_Bound_Processor (Tmp_CI); CPU := Get_Bound_Processor (Tmp_CI);
Set_Str_To_Name_Buffer ("");
CPU_Name := Name
(Identifier
(Parent_Subcomponent (CPU)));
CPU_Platform := Get_Execution_Platform (CPU);
if ATN.Namespace
(Corresponding_Declaration
(CPU)) /= No_Node
then
Set_Str_To_Name_Buffer ("");
Get_Name_String
(ATN.Name
(ATN.Identifier
(ATN.Namespace
(Corresponding_Declaration (CPU)))));
Pkg_Name := Name_Find;
Imported_Routines.C_Add_Package
(Get_Name_String (Pkg_Name),
Get_Name_String (Pkg_Name)'Length);
Set_Str_To_Name_Buffer (""); Set_Str_To_Name_Buffer ("");
Get_Name_String (Pkg_Name); CPU_Name := Name
Add_Str_To_Name_Buffer ("::"); (Identifier
Get_Name_String_And_Append (Name (Identifier (CPU))); (Parent_Subcomponent (CPU)));
CPU_Classifier := Name_Find;
else
CPU_Classifier := Name (Identifier (CPU));
end if;
Imported_Routines.C_New_Processor CPU_Platform := Get_Execution_Platform (CPU);
(Get_Name_String (CPU_Name),
Get_Name_String (CPU_Name)'Length,
Get_Name_String (CPU_Classifier),
Get_Name_String (CPU_Classifier)'Length,
Supported_Execution_Platform'Image (CPU_Platform),
Supported_Execution_Platform'Image (CPU_Platform)'Length);
Imported_Routines.C_New_Process if ATN.Namespace
(Get_Name_String (Corresponding_Declaration
(ATN.Name (CPU)) /= No_Node
(ATN.Component_Type_Identifier then
(Corresponding_Declaration (Tmp_CI)))),
Get_Name_String
(ATN.Name
(ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI))))'Length,
Get_Name_String (Name (Identifier (Processes))),
Get_Name_String (Name (Identifier (Processes)))'Length,
NodeName, NodeName'Length);
Processes2 := First_Node (Subcomponents (My_System)); Set_Str_To_Name_Buffer ("");
Get_Name_String
(ATN.Name
(ATN.Identifier
(ATN.Namespace
(Corresponding_Declaration (CPU)))));
Pkg_Name := Name_Find;
Imported_Routines.C_Add_Package
(Get_Name_String (Pkg_Name),
Get_Name_String (Pkg_Name)'Length);
Set_Str_To_Name_Buffer ("");
Get_Name_String (Pkg_Name);
Add_Str_To_Name_Buffer ("::");
Get_Name_String_And_Append (Name (Identifier (CPU)));
CPU_Classifier := Name_Find;
else
CPU_Classifier := Name (Identifier (CPU));
end if;
while Present (Processes2) loop Imported_Routines.C_New_Processor
Tmp_CI2 := Corresponding_Instance (Processes2); (Get_Name_String (CPU_Name),
Get_Name_String (CPU_Name)'Length,
Get_Name_String (CPU_Classifier),
Get_Name_String (CPU_Classifier)'Length,
Supported_Execution_Platform'Image (CPU_Platform),
Supported_Execution_Platform'Image (CPU_Platform)'Length);
Imported_Routines.C_New_Process
(Get_Name_String
(ATN.Name
(ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI)))),
Get_Name_String
(ATN.Name
(ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI))))'Length,
Get_Name_String (Name (Identifier (Processes))),
Get_Name_String (Name (Identifier (Processes)))'Length,
NodeName, NodeName'Length,
Boolean'Pos (Node_Coverage));
Processes2 := First_Node (Subcomponents (My_System));
while Present (Processes2) loop
Tmp_CI2 := Corresponding_Instance (Processes2);
if Get_Category_Of_Component (Tmp_CI2) = CC_System
and then
Is_Defined_Property
(Tmp_CI2, "taste::aplc_binding")
then
Ref := Get_Reference_Property
(Tmp_CI2, Get_String_Name ("taste::aplc_binding"));
if Get_Category_Of_Component (Tmp_CI2) = CC_System if Ref = Tmp_CI then
and then declare
Is_Defined_Property Bound_APLC_Name : Unbounded_String;
(Tmp_CI2, "taste::aplc_binding")
then
Ref := Get_Reference_Property
(Tmp_CI2, Get_String_Name ("taste::aplc_binding"));
if Ref = Tmp_CI then
declare
Bound_APLC_Name : Unbounded_String;
-- constant String :=
-- Get_Name_String
-- (ATN.Name
-- (ATN.Component_Type_Identifier
-- (Corresponding_Declaration (Tmp_CI2))));
-- (Name
-- (Identifier (Processes2)));
-- (Identifier (Tmp_CI2)));
begin
begin begin
Bound_APLC_Name := To_Unbounded_String begin
(Get_Name_String
(ATN.Name
(ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI2)))));
exception
when System.Assertions.Assert_Failure =>
Put_Line
("Detected DV from TASTE version 1.2");
Bound_APLC_Name := To_Unbounded_String Bound_APLC_Name := To_Unbounded_String
(Get_Name_String (Get_Name_String
(Name (Identifier (Processes2)))); (ATN.Name
end; (ATN.Component_Type_Identifier
(Corresponding_Declaration (Tmp_CI2)))));
exception
when System.Assertions.Assert_Failure =>
Put_Line
("Detected DV from TASTE version 1.2");
Bound_APLC_Name := To_Unbounded_String
(Get_Name_String
(Name (Identifier (Processes2))));
end;
Imported_Routines.C_Add_Binding Imported_Routines.C_Add_Binding
(To_String (Bound_APLC_Name), (To_String (Bound_APLC_Name),
To_String (Bound_APLC_Name)'Length); To_String (Bound_APLC_Name)'Length);
end; end;
end if;
end if; end if;
end if;
Processes2 := Next_Node (Processes2); Processes2 := Next_Node (Processes2);
end loop; end loop;
Imported_Routines.C_End_Process; Imported_Routines.C_End_Process;
end;
end if; end if;
Processes := Next_Node (Processes); Processes := Next_Node (Processes);
......
...@@ -34,7 +34,8 @@ package Imported_Routines is ...@@ -34,7 +34,8 @@ package Imported_Routines is
Id : String; Id : String;
LenId : Integer; LenId : Integer;
Node_Name : String; Node_Name : String;
Len_Node : Integer); Len_Node : Integer;
Coverage : Integer);
procedure C_New_Processor (Name : String; procedure C_New_Processor (Name : String;
Name_Len : Integer; Name_Len : Integer;
......
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
used as implementation language used as implementation language
updated 20/04/2009 to disable in case "-onlycv" flag is set updated 20/04/2009 to disable in case "-onlycv" flag is set
major updated 20/07/2009 to support protected objects major updated 20/07/2009 to support protected objects
*/ */
#define ID "$Id: wrappers_backend.c 447 2010-03-02 12:54:54Z maxime1008 $"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <assert.h> #include <assert.h>
...@@ -26,9 +26,7 @@ ...@@ -26,9 +26,7 @@
#include "c_ast_construction.h" #include "c_ast_construction.h"
extern void Add_Protected_Interfaces(FV * fv, FILE * ads, FILE * adb); extern void Add_Protected_Interfaces(FV * fv, FILE * ads, FILE * adb);
extern void Add_Unprotected_Interfaces(FV * fv, FILE * ads, extern void Add_Unprotected_Interfaces(FV * fv, FILE * ads, FILE * adb);
FILE * adb);
static FILE *ads = NULL, *adb = NULL, *async_ads = NULL, *async_adb = NULL; static FILE *ads = NULL, *adb = NULL, *async_ads = NULL, *async_adb = NULL;
...@@ -38,28 +36,20 @@ static int contains_sync_interface = 0; ...@@ -38,28 +36,20 @@ static int contains_sync_interface = 0;
void CheckForParams(Interface * i, int *result) void CheckForParams(Interface * i, int *result)
{ {
if (asynch == i->synchronism && (NULL != i->in || NULL != i->out)) { if (asynch == i->synchronism && (NULL != i->in || NULL != i->out)) {
*result = 1; *result = 1;
} }
} }
/* Return 1 if the FV has at least one Async RI */
void Check_If_A_Calling_Thread_Has_No_Async_RI(FV * fv, int *result)
{
FOREACH (i, Interface, fv->interfaces, {
IsThereAtLeastOneAsyncRI (i, result);
})
}
/* For a given passive function, add "with CallingThread_wrappers;"statement */ /* For a given passive function, add "with CallingThread_wrappers;"statement */
void Add_With_AsyncRI(FV * fv, FILE ** file) void Add_With_AsyncRI(FV * fv, FILE ** file)
{ {
int result = 0; bool result = false;
FOREACH (i, Interface, fv->interfaces, { FOREACH (i, Interface, fv->interfaces, {
IsThereAtLeastOneAsyncRI (i, &result); if (RI == i->direction && asynch == i->synchronism) result = true;
}) })
if (result) if (result)
fprintf(*file, "with %s_async_ri_wrappers;\n", fv->name); fprintf(*file, "with %s_async_ri_wrappers;\n", fv->name);
} }
...@@ -70,31 +60,31 @@ void ada_wrappers_preamble(FV * fv) ...@@ -70,31 +60,31 @@ void ada_wrappers_preamble(FV * fv)
int mix = 0; int mix = 0;
if (NULL == ads || NULL == adb) if (NULL == ads || NULL == adb)
return; return;
/* wrappers.ads top header */ /* wrappers.ads top header */
fprintf(ads, fprintf(ads,
"-- This file was generated automatically: DO NOT MODIFY IT !\n\n"); "-- This file was generated automatically: DO NOT MODIFY IT !\n\n");
fprintf(ads, "pragma Style_Checks (Off);\npragma Warnings (Off);\n\n"); fprintf(ads, "pragma Style_Checks (Off);\npragma Warnings (Off);\n\n");
/* wrappers.adb top header */ /* wrappers.adb top header */
fprintf(adb, fprintf(adb,
"-- This file was generated automatically: DO NOT MODIFY IT !\n\n"); "-- This file was generated automatically: DO NOT MODIFY IT !\n\n");
fprintf(adb, fprintf(adb,
"pragma Style_Checks (Off);\npragma Warnings (Off);\n\nwith PolyORB_HI_Generated.Activity;\nuse PolyORB_HI_Generated.Activity;\n\n"); "pragma Style_Checks (Off);\npragma Warnings (Off);\n\nwith PolyORB_HI_Generated.Activity;\nuse PolyORB_HI_Generated.Activity;\n\n");
fprintf(ads, "with Interfaces.C;\n"); fprintf(ads, "with Interfaces.C;\n");
/* Generates "with PolyORB_HI.Generated.Types IF at least one async IF has a param */ /* Generates "with PolyORB_HI.Generated.Types IF at least one async IF has a param */
FOREACH(i, Interface, fv->interfaces, { FOREACH(i, Interface, fv->interfaces, {
CheckForParams(i, &hasparam); CheckForParams(i, &hasparam);
}) })
if (hasparam) { if (hasparam) {
fprintf(ads, "with PolyORB_HI_Generated.Types;\n"); fprintf(ads, "with PolyORB_HI_Generated.Types;\n");
} }
// In case of Ada, make an include to the user code package to execute the elaboration part (optional user-initialization code) // In case of Ada, make an include to the user code package to execute the elaboration part (optional user-initialization code)
if (ada == fv->language || qgenada == fv->language) { if (ada == fv->language || qgenada == fv->language) {
fprintf(ads, "with %s;\n", fv->name); fprintf(ads, "with %s;\n", fv->name);
} }
fprintf(ads, "with PolyORB_HI_Generated.Deployment;\n"); fprintf(ads, "with PolyORB_HI_Generated.Deployment;\n");
...@@ -113,11 +103,11 @@ void ada_wrappers_preamble(FV * fv) ...@@ -113,11 +103,11 @@ void ada_wrappers_preamble(FV * fv)
} }
}) })
FOREACH(sync_callee, String, sync_list, { FOREACH(sync_callee, String, sync_list, {
fprintf(adb, "with %s_wrappers;\n", sync_callee); fprintf(adb, "with %s_wrappers;\n", sync_callee);
}); });
if (NULL != async_ads) if (NULL != async_ads)
fprintf(ads, "with %s_async_ri_wrappers;\n", fv->name); fprintf(ads, "with %s_async_ri_wrappers;\n", fv->name);
/* Include with and use clauses for QGenAda code if it is used */ /* Include with and use clauses for QGenAda code if it is used */
FOREACH(i, Interface, fv->interfaces, { FOREACH(i, Interface, fv->interfaces, {
...@@ -143,9 +133,9 @@ void ada_wrappers_preamble(FV * fv) ...@@ -143,9 +133,9 @@ void ada_wrappers_preamble(FV * fv)
}) })
} }
if (passive_runtime == fv->runtime_nature || mix) { if (passive_runtime == fv->runtime_nature || mix) {
FOREACH(ct, FV, fv->calling_threads, { FOREACH(ct, FV, fv->calling_threads, {
Add_With_AsyncRI(ct, &ads); Add_With_AsyncRI(ct, &ads);
}); });
} }
fprintf(ads, "\npackage %s_wrappers is\n\n", fv->name); fprintf(ads, "\npackage %s_wrappers is\n\n", fv->name);
...@@ -160,12 +150,12 @@ void ada_wrappers_preamble(FV * fv) ...@@ -160,12 +150,12 @@ void ada_wrappers_preamble(FV * fv)
//if (!file_exists(path, "_hook")) { //if (!file_exists(path, "_hook")) {
if (!fv->artificial) { if (!fv->artificial) {
fprintf(ads, "\tprocedure C_Init_%s;\n\n", fv->name); fprintf(ads, "\tprocedure C_Init_%s;\n\n", fv->name);
fprintf(adb, "\tprocedure C_Init_%s is\n", fv->name); fprintf(adb, "\tprocedure C_Init_%s is\n", fv->name);
fprintf(adb, "\t\tprocedure Init_%s;\n", fv->name); fprintf(adb, "\t\tprocedure Init_%s;\n", fv->name);
fprintf(adb, "\t\tpragma Import (C, Init_%s, \"init_%s\");\n\n", fprintf(adb, "\t\tpragma Import (C, Init_%s, \"init_%s\");\n\n",
fv->name, fv->name); fv->name, fv->name);
fprintf(adb, "\tbegin\n\t\tInit_%s;\n\tend C_Init_%s;\n\n", fprintf(adb, "\tbegin\n\t\tInit_%s;\n\tend C_Init_%s;\n\n",
fv->name, fv->name); fv->name, fv->name);
} }
/* Include call to QGenAda init code if it is present */ /* Include call to QGenAda init code if it is present */
...@@ -176,33 +166,33 @@ void ada_wrappers_preamble(FV * fv) ...@@ -176,33 +166,33 @@ void ada_wrappers_preamble(FV * fv)
fprintf(ads, "\tpragma Export (C, QGen_Init_%s, \"vm_QGen_Init_%s\");\n\n", i->distant_name, i->distant_name); fprintf(ads, "\tpragma Export (C, QGen_Init_%s, \"vm_QGen_Init_%s\");\n\n", i->distant_name, i->distant_name);
fprintf(adb, "\tprocedure QGen_Init_%s is\n", i->distant_name); fprintf(adb, "\tprocedure QGen_Init_%s is\n", i->distant_name);
fprintf(adb, "\tbegin\n\t\t%s.init;\n\tend QGen_Init_%s;\n\n", fprintf(adb, "\tbegin\n\t\t%s.init;\n\tend QGen_Init_%s;\n\n",
i->distant_name, i->distant_name); i->distant_name, i->distant_name);
})} })}
if (NULL != async_ads && NULL != async_adb) { if (NULL != async_ads && NULL != async_adb) {
fprintf(async_ads, fprintf(async_ads,
"-- This file was generated automatically: DO NOT MODIFY IT !\n\n"); "-- This file was generated automatically: DO NOT MODIFY IT !\n\n");
fprintf(async_ads, fprintf(async_ads,
"pragma Style_Checks (Off);\npragma Warnings (Off);\n\n"); "pragma Style_Checks (Off);\npragma Warnings (Off);\n\n");
fprintf(async_ads, "with Interfaces.C;\n"); fprintf(async_ads, "with Interfaces.C;\n");
if (hasparam) if (hasparam)
fprintf(async_ads, "with PolyORB_HI_Generated.Types;\n"); fprintf(async_ads, "with PolyORB_HI_Generated.Types;\n");
fprintf(async_ads, "with PolyORB_HI_Generated.Deployment;\n"); fprintf(async_ads, "with PolyORB_HI_Generated.Deployment;\n");
fprintf(async_ads, "use PolyORB_HI_Generated.Deployment;\n\n"); fprintf(async_ads, "use PolyORB_HI_Generated.Deployment;\n\n");
fprintf(async_ads, "\npackage %s_async_ri_wrappers is\n\n", fprintf(async_ads, "\npackage %s_async_ri_wrappers is\n\n",
fv->name); fv->name);
fprintf(async_adb, fprintf(async_adb,
"-- This file was generated automatically: DO NOT MODIFY IT !\n\n"); "-- This file was generated automatically: DO NOT MODIFY IT !\n\n");
fprintf(async_adb, fprintf(async_adb,
"pragma Style_Checks (Off);\npragma Warnings (Off);\n\nwith PolyORB_HI_Generated.Activity;\nuse PolyORB_HI_Generated.Activity;\n"); "pragma Style_Checks (Off);\npragma Warnings (Off);\n\nwith PolyORB_HI_Generated.Activity;\nuse PolyORB_HI_Generated.Activity;\n");
fprintf(async_adb, "with PolyORB_HI.Errors;\n\n"); fprintf(async_adb, "with PolyORB_HI.Errors;\n\n");
fprintf(async_adb, "package body %s_async_ri_wrappers is\n\n", fprintf(async_adb, "package body %s_async_ri_wrappers is\n\n",
fv->name); fv->name);
} }
} }
...@@ -210,15 +200,15 @@ void ada_wrappers_preamble(FV * fv) ...@@ -210,15 +200,15 @@ void ada_wrappers_preamble(FV * fv)
/* Creates fv_wrappers.ads, fv_wrappers.adb, and potentially RI async wrappers */ /* Creates fv_wrappers.ads, fv_wrappers.adb, and potentially RI async wrappers */
int Init_Ada_Wrappers_Backend(FV * fv) int Init_Ada_Wrappers_Backend(FV * fv)
{ {
char *filename = NULL; // to store the wrappers filename (fv_name_wrappers.ad*) char *filename = NULL; // to store the wrappers filename (fv_name_wrappers.ad*)
size_t len = 0; // length of the filename size_t len = 0; // length of the filename
char *path = NULL; char *path = NULL;
contains_sync_interface = 0; contains_sync_interface = 0;
if (NULL != fv->system_ast->context->output) if (NULL != fv->system_ast->context->output)
build_string(&path, fv->system_ast->context->output, build_string(&path, fv->system_ast->context->output,
strlen(fv->system_ast->context->output)); strlen(fv->system_ast->context->output));
build_string(&path, fv->name, strlen(fv->name)); build_string(&path, fv->name, strlen(fv->name));
// Elaborate the Wrapper file name: // Elaborate the Wrapper file name:
...@@ -237,34 +227,34 @@ int Init_Ada_Wrappers_Backend(FV * fv) ...@@ -237,34 +227,34 @@ int Init_Ada_Wrappers_Backend(FV * fv)
if (thread_runtime == fv->runtime_nature) { if (thread_runtime == fv->runtime_nature) {
int async_ri = 0; bool async_ri = 0;
FOREACH(i, Interface, fv->interfaces, { FOREACH(i, Interface, fv->interfaces, {
IsThereAtLeastOneAsyncRI(i, &async_ri); if (RI == i->direction && asynch == i->synchronism) async_ri = true;
}) })
if (async_ri) { if (async_ri) {
len = strlen(fv->name) + strlen("_async_ri_wrappers.ads"); len = strlen(fv->name) + strlen("_async_ri_wrappers.ads");
filename = (char *) malloc(len + 1); filename = (char *) malloc(len + 1);
// create .ads file // create .ads file
sprintf(filename, "%s_async_ri_wrappers.ads", fv->name); sprintf(filename, "%s_async_ri_wrappers.ads", fv->name);
create_file(path, filename, &async_ads); create_file(path, filename, &async_ads);
// create .adb file // create .adb file
sprintf(filename, "%s_async_ri_wrappers.adb", fv->name); sprintf(filename, "%s_async_ri_wrappers.adb", fv->name);
create_file(path, filename, &async_adb); create_file(path, filename, &async_adb);