Commit 2590d82c authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add preliminary support for vdm

parent 5455eb83
Pipeline #1173 skipped
...@@ -200,6 +200,9 @@ procedure BuildSupport is ...@@ -200,6 +200,9 @@ procedure BuildSupport is
when Language_CPP => when Language_CPP =>
Imported_Routines.C_Set_Language_To_CPP; Imported_Routines.C_Set_Language_To_CPP;
when Language_VDM =>
Imported_Routines.C_Set_Language_To_VDM;
when Language_SDL_OpenGEODE => when Language_SDL_OpenGEODE =>
Imported_Routines.C_Set_Language_To_SDL; Imported_Routines.C_Set_Language_To_SDL;
......
...@@ -150,6 +150,7 @@ package Imported_Routines is ...@@ -150,6 +150,7 @@ package Imported_Routines is
procedure C_Set_Language_To_QGenAda; procedure C_Set_Language_To_QGenAda;
procedure C_Set_Language_To_QGenC; procedure C_Set_Language_To_QGenC;
procedure C_Set_Language_To_CPP; procedure C_Set_Language_To_CPP;
procedure C_Set_Language_To_VDM;
procedure C_Set_Language_To_OpenGEODE; procedure C_Set_Language_To_OpenGEODE;
procedure C_Set_Language_To_BlackBox_Device; procedure C_Set_Language_To_BlackBox_Device;
procedure C_Set_Language_To_RTDS; procedure C_Set_Language_To_RTDS;
...@@ -232,7 +233,8 @@ private ...@@ -232,7 +233,8 @@ private
pragma Import (C, C_Set_Language_To_Other, "Set_Language_To_Other"); pragma Import (C, C_Set_Language_To_Other, "Set_Language_To_Other");
pragma Import (C, C_Set_Language_To_C, "Set_Language_To_C"); pragma Import (C, C_Set_Language_To_C, "Set_Language_To_C");
pragma Import (C, C_Set_Language_To_CPP, "Set_Language_To_CPP"); pragma Import (C, C_Set_Language_To_CPP, "Set_Language_To_CPP");
pragma Import (C, C_Set_Language_To_OpenGEODE, "Set_Language_To_OpenGEODE"); pragma Import (C, C_Set_Language_To_VDM, "Set_Language_To_VDM");
pragma Import (C, C_Set_Language_To_OpenGEODE, "Set_Language_To_SDL");
pragma Import (C, C_Set_Language_To_BlackBox_Device, pragma Import (C, C_Set_Language_To_BlackBox_Device,
"Set_Language_To_BlackBox_Device"); "Set_Language_To_BlackBox_Device");
pragma Import (C, C_Set_Language_To_RTDS, "Set_Language_To_RTDS"); pragma Import (C, C_Set_Language_To_RTDS, "Set_Language_To_RTDS");
......
...@@ -29,76 +29,76 @@ void rtds_glue_preamble(FV * fv) ...@@ -29,76 +29,76 @@ void rtds_glue_preamble(FV * fv)
/* Check if any interface needs ASN.1 types */ /* Check if any interface needs ASN.1 types */
FOREACH(i, Interface, fv->interfaces, { FOREACH(i, Interface, fv->interfaces, {
if (NULL != i->in || NULL != i->out) hasparam = 1;} if (NULL != i->in || NULL != i->out) hasparam = 1;}
); );
/* a. glue_.h preamble */ /* a. glue_.h preamble */
fprintf(glue_h, fprintf(glue_h,
"/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n"); "/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n");
fprintf(glue_h, fprintf(glue_h,
"/* Declaration of the provided and required interfaces */\n\n"); "/* Declaration of the provided and required interfaces */\n\n");
fprintf(glue_h, "#ifndef __GLUE_H_%s__\n#define __GLUE_H_%s__\n\n", fprintf(glue_h, "#ifndef __GLUE_H_%s__\n#define __GLUE_H_%s__\n\n",
fv->name, fv->name); fv->name, fv->name);
if (hasparam) { if (hasparam) {
fprintf(glue_h, "#include \"C_ASN1_Types.h\"\n\n"); fprintf(glue_h, "#include \"C_ASN1_Types.h\"\n\n");
fprintf(glue_h, "#include \"RTDS_ASN1_Types.h\"\n\n"); fprintf(glue_h, "#include \"RTDS_ASN1_Types.h\"\n\n");
} }
/* fprintf(glue_h, "#include \"RTDS_OS.h\"\n"); */ /* fprintf(glue_h, "#include \"RTDS_OS.h\"\n"); */
fprintf(glue_h, "#include \"RTDS_gen.h\"\n"); fprintf(glue_h, "#include \"RTDS_gen.h\"\n");
fprintf(glue_h, "#include \"RTDS_Proc.h\"\n"); fprintf(glue_h, "#include \"RTDS_Proc.h\"\n");
fprintf(glue_h, "#include \"RTDS_%s_project_messages.h\"\n", fprintf(glue_h, "#include \"RTDS_%s_project_messages.h\"\n",
fv->name); fv->name);
fprintf(glue_h, "#include \"%s_p_decl.h\"\n\n", fv->name); fprintf(glue_h, "#include \"%s_p_decl.h\"\n\n", fv->name);
fprintf(glue_h, "static RTDS_Proc %s_instanceDescriptor;\n", fv->name); /* Declare the SDL instance descriptor */ fprintf(glue_h, "static RTDS_Proc %s_instanceDescriptor;\n", fv->name); /* Declare the SDL instance descriptor */
fprintf(glue_h, "static RTDS_GlobalProcessInfo %s_instanceContext;\n", fv->name); /* Declare the SDL instance context */ fprintf(glue_h, "static RTDS_GlobalProcessInfo %s_instanceContext;\n", fv->name); /* Declare the SDL instance context */
fprintf(glue_h, "static RTDS_MessageHeader currentMessage;\n\n"); /* Declare the RTDS message header */ fprintf(glue_h, "static RTDS_MessageHeader currentMessage;\n\n"); /* Declare the RTDS message header */
/* b. glue_.c preamble */ /* b. glue_.c preamble */
fprintf(glue_c, fprintf(glue_c,
"/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n"); "/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n");
fprintf(glue_c, "#include \"glue_%s.h\"\n\n", fv->name); fprintf(glue_c, "#include \"glue_%s.h\"\n\n", fv->name);
fprintf(glue_c, fprintf(glue_c,
"RTDS_Proc* %s_instanceDescriptor_ptr = NULL;\n", "RTDS_Proc* %s_instanceDescriptor_ptr = NULL;\n",
fv->name); fv->name);
fprintf(glue_c, fprintf(glue_c,
"char* %s_instanceDescriptor_locals_ptr = NULL;\n", "char* %s_instanceDescriptor_locals_ptr = NULL;\n",
fv->name); fv->name);
fprintf(glue_c, "void %s_startup()\n{\n", fv->name); fprintf(glue_c, "void %s_startup()\n{\n", fv->name);
fprintf(glue_h, "void %s_startup();\n\n", fv->name); fprintf(glue_h, "void %s_startup();\n\n", fv->name);
fprintf(glue_c, fprintf(glue_c,
"\tRTDS_Proc_%s_p_createInstance(&%s_instanceDescriptor, NULL, &%s_instanceContext, NULL);\n", "\tRTDS_Proc_%s_p_createInstance(&%s_instanceDescriptor, NULL, &%s_instanceContext, NULL);\n",
fv->name, fv->name, fv->name); fv->name, fv->name, fv->name);
fprintf(glue_c, fprintf(glue_c,
"\t%s_instanceDescriptor_ptr = &%s_instanceDescriptor;\n", "\t%s_instanceDescriptor_ptr = &%s_instanceDescriptor;\n",
fv->name, fv->name); fv->name, fv->name);
fprintf(glue_c, fprintf(glue_c,
"\t%s_instanceDescriptor_locals_ptr = %s_instanceDescriptor.myLocals.%s_p.RTDS_myLocals;\n", "\t%s_instanceDescriptor_locals_ptr = %s_instanceDescriptor.myLocals.%s_p.RTDS_myLocals;\n",
fv->name, fv->name, fv->name); fv->name, fv->name, fv->name);
fprintf(glue_c, fprintf(glue_c,
"\tRTDS_%s_p_executeTransition(&%s_instanceDescriptor, NULL);\n}\n\n", "\tRTDS_%s_p_executeTransition(&%s_instanceDescriptor, NULL);\n}\n\n",
fv->name, fv->name); fv->name, fv->name);
/* c. glue macros preamble */ /* c. glue macros preamble */
fprintf(glue_macros, fprintf(glue_macros,
"/* This file was generated automatically: DO NOT MODIFY IT ! */\n"); "/* This file was generated automatically: DO NOT MODIFY IT ! */\n");
fprintf(glue_macros, fprintf(glue_macros,
"/* Definition of the RI macros called by RTDS generated code */\n\n"); "/* Definition of the RI macros called by RTDS generated code */\n\n");
fprintf(glue_macros, "#include \"glue_%s.h\"\n\n", fv->name); fprintf(glue_macros, "#include \"glue_%s.h\"\n\n", fv->name);
/* d. sync_RI preamble */ /* d. sync_RI preamble */
fprintf(sync_ri, fprintf(sync_ri,
"/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n"); "/* This file was generated automatically: DO NOT MODIFY IT ! */\n\n");
fprintf(sync_ri, fprintf(sync_ri,
"/* Definition of the synchronous required interfaces */\n\n"); "/* Definition of the synchronous required interfaces */\n\n");
fprintf(sync_ri, "#include \"common.h\"\n\n"); fprintf(sync_ri, "#include \"common.h\"\n\n");
} }
...@@ -137,7 +137,7 @@ int Init_RTDS_GLUE_Backend(FV * fv) ...@@ -137,7 +137,7 @@ int Init_RTDS_GLUE_Backend(FV * fv)
free(filename); free(filename);
assert(NULL != glue_h && NULL != glue_c && NULL != glue_macros assert(NULL != glue_h && NULL != glue_c && NULL != glue_macros
&& NULL != sync_ri); && NULL != sync_ri);
rtds_glue_preamble(fv); rtds_glue_preamble(fv);
...@@ -152,10 +152,10 @@ int Init_RTDS_GLUE_Backend(FV * fv) ...@@ -152,10 +152,10 @@ int Init_RTDS_GLUE_Backend(FV * fv)
void Convert_ASN1_to_RTDS(Parameter * p, FILE ** file) void Convert_ASN1_to_RTDS(Parameter * p, FILE ** file)
{ {
fprintf(*file, fprintf(*file,
"\tConvert_%s_from_ASN1SCC_to_RTDS (&rtds_%s_%s, asn1_%s_%s);\n", "\tConvert_%s_from_ASN1SCC_to_RTDS (&rtds_%s_%s, asn1_%s_%s);\n",
p->type, (param_in == p->param_direction) ? "IN" : "OUT", p->type, (param_in == p->param_direction) ? "IN" : "OUT",
p->name, (param_in == p->param_direction) ? "IN" : "OUT", p->name, (param_in == p->param_direction) ? "IN" : "OUT",
p->name); p->name);
} }
/* /*
...@@ -167,10 +167,10 @@ void Convert_ASN1_to_RTDS(Parameter * p, FILE ** file) ...@@ -167,10 +167,10 @@ void Convert_ASN1_to_RTDS(Parameter * p, FILE ** file)
void Convert_ASN1_to_RTDS_Macro(Parameter * p, FILE ** file) void Convert_ASN1_to_RTDS_Macro(Parameter * p, FILE ** file)
{ {
fprintf(*file, fprintf(*file,
"\tConvert_%s_from_ASN1SCC_to_RTDS (rtds_%s_%s_%s, &asn1_%s_%s);\\\n", "\tConvert_%s_from_ASN1SCC_to_RTDS (rtds_%s_%s_%s, &asn1_%s_%s);\\\n",
p->type, (param_in == p->param_direction) ? "IN" : "OUT", p->type, (param_in == p->param_direction) ? "IN" : "OUT",
p->interface->name, p->name, p->interface->name, p->name,
(param_in == p->param_direction) ? "IN" : "OUT", p->name); (param_in == p->param_direction) ? "IN" : "OUT", p->name);
} }
/* /*
...@@ -181,13 +181,13 @@ void Convert_ASN1_to_RTDS_Macro(Parameter * p, FILE ** file) ...@@ -181,13 +181,13 @@ void Convert_ASN1_to_RTDS_Macro(Parameter * p, FILE ** file)
void Convert_RTDS_to_ASN1(Parameter * p, FILE ** file, char *eol_separator) void Convert_RTDS_to_ASN1(Parameter * p, FILE ** file, char *eol_separator)
{ {
fprintf(*file, fprintf(*file,
"\tConvert_%s_from_RTDS_to_ASN1SCC (&asn1_%s_%s_%s, %srtds_%s_%s);", "\tConvert_%s_from_RTDS_to_ASN1SCC (&asn1_%s_%s_%s, %srtds_%s_%s);",
p->type, (param_in == p->param_direction) ? "IN" : "OUT", p->type, (param_in == p->param_direction) ? "IN" : "OUT",
p->interface->name, p->name, (SIMPLETYPE(p) p->interface->name, p->name, (SIMPLETYPE(p)
|| synch == || synch ==
p->interface-> p->interface->
synchronism) ? "" : "&", synchronism) ? "" : "&",
(param_in == p->param_direction) ? "IN" : "OUT", p->name); (param_in == p->param_direction) ? "IN" : "OUT", p->name);
fprintf(*file, "%s", eol_separator); fprintf(*file, "%s", eol_separator);
} }
...@@ -201,14 +201,14 @@ void List_RTDS_Params(Parameter * p, FILE ** file) ...@@ -201,14 +201,14 @@ void List_RTDS_Params(Parameter * p, FILE ** file)
/* Determine if a comma is needed prior to the item to be put in the list. */ /* Determine if a comma is needed prior to the item to be put in the list. */
comma = comma =
((p->param_direction == param_in && p != p->interface->in->value) ((p->param_direction == param_in && p != p->interface->in->value)
|| (p->param_direction == param_out || (p->param_direction == param_out
&& (NULL != p->interface->in && (NULL != p->interface->in
|| p != p->interface->out->value))); || p != p->interface->out->value)));
fprintf(*file, "%srtds_%s_%s", fprintf(*file, "%srtds_%s_%s",
comma ? ", " : "", comma ? ", " : "",
(param_in == p->param_direction) ? "IN" : "OUT", p->name); (param_in == p->param_direction) ? "IN" : "OUT", p->name);
} }
/* /*
...@@ -218,14 +218,14 @@ void List_RTDS_Params(Parameter * p, FILE ** file) ...@@ -218,14 +218,14 @@ void List_RTDS_Params(Parameter * p, FILE ** file)
void List_RTDS_Types_And_Params(Parameter * p, FILE ** file) void List_RTDS_Types_And_Params(Parameter * p, FILE ** file)
{ {
if ((param_in == p->param_direction && p != p->interface->in->value) || if ((param_in == p->param_direction && p != p->interface->in->value) ||
(param_out == p->param_direction (param_out == p->param_direction
&& (NULL != p->interface->in || p != p->interface->out->value))) { && (NULL != p->interface->in || p != p->interface->out->value))) {
fprintf(*file, ", "); fprintf(*file, ", ");
} }
fprintf(*file, "%s %srtds_%s_%s", fprintf(*file, "%s %srtds_%s_%s",
p->type, p->type,
(param_out == p->param_direction || !SIMPLETYPE(p)) ? "*" : "", (param_out == p->param_direction || !SIMPLETYPE(p)) ? "*" : "",
(param_in == p->param_direction) ? "IN" : "OUT", p->name); (param_in == p->param_direction) ? "IN" : "OUT", p->name);
} }
/* /*
...@@ -238,24 +238,24 @@ void List_ASN1_Params_With_Pointers(Parameter * p, FILE ** file) ...@@ -238,24 +238,24 @@ void List_ASN1_Params_With_Pointers(Parameter * p, FILE ** file)
/* Determine if a comma is needed prior to the item to be put in the list. */ /* Determine if a comma is needed prior to the item to be put in the list. */
comma = comma =
((p->param_direction == param_in && p != p->interface->in->value) ((p->param_direction == param_in && p != p->interface->in->value)
|| (p->param_direction == param_out || (p->param_direction == param_out
&& (NULL != p->interface->in && (NULL != p->interface->in
|| p != p->interface->out->value))); || p != p->interface->out->value)));
fprintf(*file, "%s&asn1_%s_%s_%s", fprintf(*file, "%s&asn1_%s_%s_%s",
comma ? ", " : "", comma ? ", " : "",
(param_in == p->param_direction) ? "IN" : "OUT", (param_in == p->param_direction) ? "IN" : "OUT",
p->interface->name, p->name); p->interface->name, p->name);
} }
/* ForEachWithParam function : Make a declaration of static variable for a given parameter */ /* ForEachWithParam function : Make a declaration of static variable for a given parameter */
void Declare_static_ASN1_param(Parameter * p, FILE ** file) void Declare_static_ASN1_param(Parameter * p, FILE ** file)
{ {
fprintf(*file, "static asn1Scc%s asn1_%s_%s_%s;\n", fprintf(*file, "static asn1Scc%s asn1_%s_%s_%s;\n",
p->type, p->type,
(param_in == p->param_direction) ? "IN" : "OUT", (param_in == p->param_direction) ? "IN" : "OUT",
p->interface->name, p->name); p->interface->name, p->name);
} }
/* /*
...@@ -272,52 +272,52 @@ void add_PI_to_RTDS_glue(Interface * i) ...@@ -272,52 +272,52 @@ void add_PI_to_RTDS_glue(Interface * i)
tmp = i->in; tmp = i->in;
while (NULL != tmp) { while (NULL != tmp) {
fprintf(glue_h, "%sconst asn1Scc%s *", fprintf(glue_h, "%sconst asn1Scc%s *",
(tmp != i->in) ? ", " : "", tmp->value->type); (tmp != i->in) ? ", " : "", tmp->value->type);
fprintf(glue_c, "%sconst asn1Scc%s *asn1_IN_%s", fprintf(glue_c, "%sconst asn1Scc%s *asn1_IN_%s",
(tmp != i->in) ? ", " : "", (tmp != i->in) ? ", " : "",
tmp->value->type, tmp->value->name); tmp->value->type, tmp->value->name);
tmp = tmp->next; tmp = tmp->next;
} }
fprintf(glue_h, ");\n\n"); fprintf(glue_h, ");\n\n");
fprintf(glue_c, ")\n{\n"); fprintf(glue_c, ")\n{\n");
fprintf(glue_c, fprintf(glue_c,
"\t/* 1) For each parameter, declare a RTDS variable */\n"); "\t/* 1) For each parameter, declare a RTDS variable */\n");
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
fprintf(glue_c, "\t%s rtds_%s_%s;\n", fprintf(glue_c, "\t%s rtds_%s_%s;\n",
p->type, p->type,
(param_in == p->param_direction) ? "IN" : "OUT", (param_in == p->param_direction) ? "IN" : "OUT",
p->name);} p->name);}
) )
fprintf(glue_c, "\t/* 2) RTDS Macro to declare a message */\n"); fprintf(glue_c, "\t/* 2) RTDS Macro to declare a message */\n");
fprintf(glue_c, "\n\tRTDS_MSG_DATA_DECL\n"); fprintf(glue_c, "\n\tRTDS_MSG_DATA_DECL\n");
fprintf(glue_c, fprintf(glue_c,
"\n\t/* 3) Convert each input parameter from ASN.1 to RTDS */\n"); "\n\t/* 3) Convert each input parameter from ASN.1 to RTDS */\n");
/*ForEachWithParam (i->in, Convert_ASN1_to_RTDS, &glue_c); */ /*ForEachWithParam (i->in, Convert_ASN1_to_RTDS, &glue_c); */
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
Convert_ASN1_to_RTDS(p, &glue_c); Convert_ASN1_to_RTDS(p, &glue_c);
} }
); );
fprintf(glue_c, "\n\t/* 4) Set the message header */\n"); fprintf(glue_c, "\n\t/* 4) Set the message header */\n");
fprintf(glue_c, "\tRTDS_%s_SET_MESSAGE(&currentMessage%s", i->name, fprintf(glue_c, "\tRTDS_%s_SET_MESSAGE(&currentMessage%s", i->name,
(NULL != i->in) ? ", " : ""); (NULL != i->in) ? ", " : "");
/*ForEachWithParam (i->in, List_RTDS_Params, &glue_c); */ /*ForEachWithParam (i->in, List_RTDS_Params, &glue_c); */
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
List_RTDS_Params(p, &glue_c); List_RTDS_Params(p, &glue_c);
} }
); );
fprintf(glue_c, ");\n"); fprintf(glue_c, ");\n");
fprintf(glue_c, "\n\t/* 5) Execute the SDL transition */\n"); fprintf(glue_c, "\n\t/* 5) Execute the SDL transition */\n");
fprintf(glue_c, fprintf(glue_c,
"\tRTDS_%s_p_executeTransition (&%s_instanceDescriptor, &currentMessage);\n", "\tRTDS_%s_p_executeTransition (&%s_instanceDescriptor, &currentMessage);\n",
i->parent_fv->name, i->parent_fv->name); i->parent_fv->name, i->parent_fv->name);
fprintf(glue_c, "}\n\n"); fprintf(glue_c, "}\n\n");
} }
...@@ -335,19 +335,19 @@ void add_RI_to_RTDS_glue(Interface * i) ...@@ -335,19 +335,19 @@ void add_RI_to_RTDS_glue(Interface * i)
tmp = i->in; tmp = i->in;
while (NULL != tmp) { while (NULL != tmp) {
fprintf(glue_h, "%sconst asn1Scc%s *", fprintf(glue_h, "%sconst asn1Scc%s *",
(tmp != i->in) ? ", " : "", tmp->value->type); (tmp != i->in) ? ", " : "", tmp->value->type);
tmp = tmp->next; tmp = tmp->next;
} }
tmp = i->out; tmp = i->out;
while (NULL != tmp) { while (NULL != tmp) {
fprintf(glue_h, "%sasn1Scc%s *", fprintf(glue_h, "%sasn1Scc%s *",
(tmp != i->out (tmp != i->out
|| (tmp == i->out || (tmp == i->out
&& NULL != i->in)) ? ", " : "", tmp->value->type); && NULL != i->in)) ? ", " : "", tmp->value->type);
tmp = tmp->next; tmp = tmp->next;
} }
fprintf(glue_h, ");\n\n"); fprintf(glue_h, ");\n\n");
...@@ -357,7 +357,7 @@ void add_RI_to_RTDS_glue(Interface * i) ...@@ -357,7 +357,7 @@ void add_RI_to_RTDS_glue(Interface * i)
void add_sync_RI(Interface * i) void add_sync_RI(Interface * i)
{ {
fprintf(sync_ri, "\n/* SYNCHRONOUS REQUIRED INTERFACE %s */\n", fprintf(sync_ri, "\n/* SYNCHRONOUS REQUIRED INTERFACE %s */\n",
i->name); i->name);
/* /*
* function prototype : syncRI_<InterfaceName> (rtdstype [*]rtds_IN_param1,.., rtdstype *rtds_OUT_param1,...) * function prototype : syncRI_<InterfaceName> (rtdstype [*]rtds_IN_param1,.., rtdstype *rtds_OUT_param1,...)
...@@ -365,43 +365,43 @@ void add_sync_RI(Interface * i) ...@@ -365,43 +365,43 @@ void add_sync_RI(Interface * i)
*/ */
fprintf(sync_ri, "void syncRI_%s (", i->name); fprintf(sync_ri, "void syncRI_%s (", i->name);
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
List_RTDS_Types_And_Params(p, &sync_ri); List_RTDS_Types_And_Params(p, &sync_ri);
}); });
FOREACH(p, Parameter, i->out, { FOREACH(p, Parameter, i->out, {
List_RTDS_Types_And_Params(p, &sync_ri); List_RTDS_Types_And_Params(p, &sync_ri);
}); });
fprintf(sync_ri, ")\n{\n"); fprintf(sync_ri, ")\n{\n");
/* declare static data to put the Asn.1 encoded data */ /* declare static data to put the Asn.1 encoded data */
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
Declare_static_ASN1_param(p, &sync_ri); Declare_static_ASN1_param(p, &sync_ri);
}); });
FOREACH(p, Parameter, i->out, { FOREACH(p, Parameter, i->out, {
Declare_static_ASN1_param(p, &sync_ri); Declare_static_ASN1_param(p, &sync_ri);
}); });
/* convert rtds input to asn.1 static data */ /* convert rtds input to asn.1 static data */
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
Convert_RTDS_to_ASN1(p, &sync_ri, "\n"); Convert_RTDS_to_ASN1(p, &sync_ri, "\n");
}); });
fprintf(sync_ri, "\n"); fprintf(sync_ri, "\n");
/* call RI function generated in invoke_ri.c by the C backend */ /* call RI function generated in invoke_ri.c by the C backend */
fprintf(sync_ri, "\t%s_RI_%s(", i->parent_fv->name, i->name); fprintf(sync_ri, "\t%s_RI_%s(", i->parent_fv->name, i->name);
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
List_ASN1_Params_With_Pointers(p, &sync_ri); List_ASN1_Params_With_Pointers(p, &sync_ri);
}); });
FOREACH(p, Parameter, i->out, { FOREACH(p, Parameter, i->out, {
List_ASN1_Params_With_Pointers(p, &sync_ri); List_ASN1_Params_With_Pointers(p, &sync_ri);
}); });
fprintf(sync_ri, ");\n"); fprintf(sync_ri, ");\n");
/* convert result from asn1 to rtds and end function */ /* convert result from asn1 to rtds and end function */
FOREACH(p, Parameter, i->out, { FOREACH(p, Parameter, i->out, {
fprintf(sync_ri, fprintf(sync_ri,
"\tConvert_%s_from_ASN1SCC_to_RTDS (rtds_OUT_%s, &asn1_OUT_%s_%s);\n", "\tConvert_%s_from_ASN1SCC_to_RTDS (rtds_OUT_%s, &asn1_OUT_%s_%s);\n",
p->type, p->name, p->interface->name, p->name);}); p->type, p->name, p->interface->name, p->name);});
fprintf(sync_ri, "}\n"); fprintf(sync_ri, "}\n");
} }
...@@ -413,11 +413,11 @@ void add_RI_to_Macro_Definitions(Interface * i) ...@@ -413,11 +413,11 @@ void add_RI_to_Macro_Definitions(Interface * i)
/* 1) declare static data to put the Asn.1 encoded data */ /* 1) declare static data to put the Asn.1 encoded data */
FOREACH(p, Parameter, i->in, { FOREACH(p, Parameter, i->in, {
Declare_static_ASN1_param(p, &glue_macros); Declare_static_ASN1_param(p, &glue_macros);
}); });
FOREACH(p, Parameter, i->out, { FOREACH(p, Parameter, i->out, {
Declare_static_ASN1_param(p, &glue_macros); Declare_static_ASN1_param(p, &glue_macros);
}); });
/* 2) undef the possibly existing macro */ /* 2) undef the possibly existing macro */
fprintf(glue_macros, "\n#undef RTDS_MSG_SEND_%s\n", i->name); fprintf(glue_macros, "\n#undef RTDS_MSG_SEND_%s\n", i->name);
...@@ -431,22 +431,22 @@ void add_RI_to_Macro_Definitions(Interface * i) ...@@ -431,22 +431,22 @@ void add_RI_to_Macro_Definitions(Interface * i)
* } * }
*/ */
fprintf(glue_macros, "#define RTDS_MSG_SEND_%s%s", i->name, fprintf(glue_macros, "#define RTDS_MSG_SEND_%s%s", i->name,
(NULL != i->in || NULL != i->out) ? "(" : ""); (NULL != i->in || NULL != i->out) ? "(" : "");
FOREACH(p, Parameter, i->in, {