Commit 23955eaf authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
parents 597bddbc f7e1922d
This diff is collapsed.
......@@ -37,22 +37,22 @@ int ada_gw_preamble(FV * fv)
"-- This file was generated automatically: DO NOT MODIFY IT !\n\n");
fprintf(ads,
"-- Declaration of the provided and required interfaces\n\n");
fprintf(ads, "pragma style_checks (off);\n");
fprintf(ads, "pragma warnings (off);\n");
fprintf(ads, "-- pragma style_checks (off);\n");
fprintf(ads, "-- pragma warnings (off);\n");
/* Check if any interface needs Asn.1 types and if so, include asn1 modules */
if (NULL != fv->timer_list || get_context()->polyorb_hi_c) {
fprintf(ads, "with taste_basictypes;\n"
"use taste_basictypes;\n\n");
fprintf(ads, "with TASTE_Basictypes;\n"
"use TASTE_Basictypes;\n\n");
}
FOREACH(i, Interface, fv->interfaces, {
CheckForAsn1Params(i, &hasparam);}
);
if (hasparam) {
fprintf(ads, "with adaasn1rtl;\n");
fprintf(ads, "use adaasn1rtl;\n\n");
fprintf(ads, "with AdaASN1RTL;\n");
fprintf(ads, "use AdaASN1RTL;\n\n");
/* Build the list of Ada packages to include from the ASN.1 module list */
FOREACH(i, Interface, fv->interfaces, {
......@@ -93,7 +93,7 @@ int ada_gw_preamble(FV * fv)
strcmp (cp->type.name, "Timer")) {
fprintf(ads,
" %s : asn1Scc%s := context_%s.%s_ctxt.%s;\n"
" %s : asn1Scc%s := Context_%s.%s_Ctxt.%s;\n"
" pragma Export(C, %s, \"%s_%s\");\n",
cp->name,
asn2underscore(cp->type.name, strlen(cp->type.name)),
......@@ -110,19 +110,19 @@ int ada_gw_preamble(FV * fv)
/* b. adb preamble (if applicable) */
if (NULL != adb) {
fprintf(adb, "-- User implementation of the %s function\n",
fprintf(adb, "-- User implementation of the %s function\n",
fv->name);
fprintf(adb,
"-- This file will never be overwritten once edited and modified\n");
"-- This file will never be overwritten once edited and modified\n");
fprintf(adb,
"-- Only the interface of functions is regenerated (in the .ads file)\n\n");
"-- Only the interface of functions is regenerated (in the .ads file)\n\n");
fprintf(adb, "pragma style_checks (off);\n");
fprintf(adb, "pragma warnings (off);\n");
fprintf(adb, "-- pragma style_checks (off);\n");
fprintf(adb, "-- pragma warnings (off);\n");
if (hasparam) {
fprintf(adb, "with adaasn1rtl;\n");
fprintf(adb, "use adaasn1rtl;\n\n");
fprintf(adb, "with AdaASN1RTL;\n");
fprintf(adb, "use AdaASN1RTL;\n\n");
FOREACH(m, ASN1_Module, modules, {
fprintf(adb, "with %s;\nuse %s;\n\n", m, m);}
);
......@@ -202,7 +202,7 @@ void Create_Ada_Access_Param(Parameter * p, char **result)
build_string(result, "; ", 2);
}
build_string(result, p->name, strlen(p->name));
build_string(result, ": access asn1scc", strlen(": access asn1scc"));
build_string(result, ": access Asn1Scc", strlen(": access asn1scc"));
build_string(result, p->type, strlen(p->type));
}
......
......@@ -27,23 +27,16 @@ void add_sync_PI(Interface * i)
if (qgenc == i->parent_fv->language || qgenada == i->parent_fv->language) {
return;
}
/* Count the number of calling threads for this passive function */
int count = 0;
FOREACH(t, FV, i->parent_fv->calling_threads, {
(void) t;
count++;
});
char *header = make_string(
" ------------------------------------------------------\n"
" -- %srotected Provided Interface \"%s\"\n"
" ------------------------------------------------------\n"
" procedure %s (calling_thread: Integer%s",
" procedure %s%s",
(protected == i->rcm) ? "P" : "Unp",
i->name,
i->name,
(NULL != i->in || NULL != i->out) ? ";": "");
(NULL != i->in || NULL != i->out) ? "(": "");
fprintf(sync_adb, "%s", header);
fprintf(sync_ads, "%s", header);
......@@ -59,10 +52,12 @@ void add_sync_PI(Interface * i)
List_Ada_Param_Types_And_Names(p, &sync_ads);
List_Ada_Param_Types_And_Names(p, &sync_adb);
})
fprintf(sync_ads, ");\n");
fprintf(sync_adb, ")");
fprintf(sync_adb, " \n is\n");
if (NULL != i->in || NULL != i->out) {
fprintf(sync_ads, ")\n");
fprintf(sync_adb, ")");
}
fprintf(sync_ads, ";\n");
fprintf(sync_adb, "\n is\n");
/* Declare the external C function in the body */
fprintf(sync_adb, " procedure C_%s", i->name);
......@@ -87,9 +82,6 @@ void add_sync_PI(Interface * i)
i->name, i->parent_fv->name, i->name);
fprintf(sync_adb, " begin\n");
if (count > 1) {
fprintf(sync_adb, " callinglist.push(calling_thread);\n"); /* Put the calling thread in the stack */
}
/* Call the C function in the body */
fprintf(sync_adb, " C_%s", i->name);
......@@ -111,11 +103,6 @@ void add_sync_PI(Interface * i)
fprintf(sync_adb, ";\n");
/* Remove the calling thread from the stack before returning*/
if (count > 1) {
fprintf(sync_adb, " callinglist.pop;\n");
}
/* End of the procedure body */
fprintf(sync_adb, " end %s;\n\n", i->name);
......
......@@ -296,7 +296,7 @@ void Set_Sporadic_IF()
void Set_Variator_IF()
{
if (NULL != interface)
interface->rcm = variator;
interface->rcm = sporadic;
}
void Set_Protected_IF()
......@@ -1046,18 +1046,6 @@ void End_IF()
interface->parent_fv = fv;
/* Check if this is the first interface of this FV
* If not, and if op_kind=sporadic, then change it to variator
* MP 20/04/10: variators are deprecated with the new VT rules
* that create a thread per PI as soon as there is more than
* one "active" (spo, var, cyc) PI in a function.
*/
if (NULL != fv->interfaces) {
if (sporadic == interface->rcm && PI == interface->direction) {
interface->rcm = variator;
}
}
/* Add new interface to the list contained in the Function definition */
APPEND_TO_LIST (Interface, fv->interfaces, interface);
}
......@@ -1073,14 +1061,24 @@ void End_FV()
fv->system_ast = system_ast;
/* Determine if the function is a thread or a passive function
* (thread if at least 1 active PI) */
fv->runtime_nature = passive_runtime;
* (thread if only one single PI, and this PI is cyclic or sporadic) */
int count_pis = 0;
int count_async_pis = 0;
FOREACH(i, Interface, fv->interfaces, {
if (PI == i->direction
&& (sporadic == i->rcm || cyclic == i->rcm
|| variator == i->rcm)) fv->runtime_nature =
thread_runtime;}
)
if (PI == i->direction) {
count_pis ++;
}
if (sporadic == i->rcm || cyclic == i->rcm) {
count_async_pis ++;
}
});
if (1 == count_pis && 1 == count_async_pis) {
fv->runtime_nature = thread_runtime;
}
else {
fv->runtime_nature = passive_runtime;
}
APPEND_TO_LIST(FV, system_ast->functions, fv);
......
......@@ -107,7 +107,8 @@ void c_wrappers_preamble(FV * fv)
result = true;
}
});
if (result) {
if (result && fv->process == ct->process) {
// include only if the functions are in the same node
fprintf(h,
"#include \"../../%s/%s_polyorb_interface.h\"\n",
ct->name, ct->name);
......
......@@ -260,6 +260,7 @@ int create_file(char *fv_name, char *file, FILE ** f)
filename = make_string ("%s/%s", fv_name, file);
assert(NULL != filename);
INFO ("[INFO] Creating %s\n", filename);
*f = fopen(filename, "w");
......
This diff is collapsed.
......@@ -122,6 +122,7 @@ void write_thread_implementation(FV *fv)
}
fprintf(thread, "\tInitialize_Entrypoint_Source_Text => ");
//fprintf(thread, "\tActivate_Entrypoint_Source_Text => ");
if (0 == fv->system_ast->context->polyorb_hi_c) { /* PolyORB-HI/Ada */
fprintf(thread, "\"%s_wrappers.C_Init_%s\";\n",
......
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