Commit c6c13b24 authored by Maxime Perrotin's avatar Maxime Perrotin

Last update of the ObjectGEODE glue file

parent 09da4d3f
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
this program generates the code to interface an objectgeode generated application with the assert virtual machine this program generates the code to interface an objectgeode generated application with the assert virtual machine
It creates vm_if.c, hpredef.h and hpostdef.h It creates vm_if.c, hpredef.h and hpostdef.h
updated 20/04/2009 to disable in case "-onlycv" flag is set updated 20/04/2009 to disable in case "-onlycv" flag is set
update 09/2016 - This code is legacy - ObjectGEODE is discontinued and no
further support is ever expected. This file is not maintained.
*/ */
#define ID "$Id: build_sdl_glue.c 414 2009-12-04 16:21:52Z maxime1008 $" #define ID "$Id: build_sdl_glue.c 414 2009-12-04 16:21:52Z maxime1008 $"
...@@ -34,18 +36,18 @@ int create_gluefiles(FV * fv) ...@@ -34,18 +36,18 @@ int create_gluefiles(FV * fv)
{ {
char *path = NULL; char *path = NULL;
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));
create_file(path, "vm_if.c", &vm_if); create_file(path, "vm_if.c", &vm_if);
create_file(path, "hpredef.h", &hpredef); create_file(path, "hpredef.h", &hpredef);
create_file(path, "hpostdef.h", &hpostdef); create_file(path, "hpostdef.h", &hpostdef);
free(path); free(path);
if (NULL == vm_if || NULL == hpredef || NULL == hpostdef) if (NULL == vm_if || NULL == hpredef || NULL == hpostdef)
return -1; return -1;
else else
return 0; return 0;
} }
void close_gluefiles() void close_gluefiles()
...@@ -53,70 +55,72 @@ void close_gluefiles() ...@@ -53,70 +55,72 @@ void close_gluefiles()
close_file(&vm_if); close_file(&vm_if);
close_file(&hpredef); close_file(&hpredef);
close_file(&hpostdef); close_file(&hpostdef);
} void vm_if_preamble(FV * fv) }
void vm_if_preamble(FV * fv)
{ {
if (NULL == vm_if) if (NULL == vm_if)
return; return;
fprintf(vm_if, fprintf(vm_if,
"#include \"g2_appli.h\"\n#include \"g2_com.h\"\n#include \"s_%s.h\"\n", "#include \"g2_appli.h\"\n#include \"g2_com.h\"\n#include \"s_%s.h\"\n",
fv->name); fv->name);
fprintf(vm_if, "#include \"OG_ASN1_Types.h\"\n\n\n"); fprintf(vm_if, "#include \"OG_ASN1_Types.h\"\n\n\n");
} }
void add_PI_to_vm_if(Interface * i) void add_PI_to_vm_if(Interface * i)
{ {
if (NULL == vm_if) if (NULL == vm_if)
return; return;
/* Create glue for the PI */ /* Create glue for the PI */
// a. If this PI has a parameter, declare an external global variable of type SIGNAL_signalname * for the data. Else of type GX_SIG_P // a. If this PI has a parameter, declare an external global variable of type SIGNAL_signalname * for the data. Else of type GX_SIG_P
if (NULL != i->in) { if (NULL != i->in) {
fprintf(vm_if, "extern SIGNAL_%s *p_%s;\n\n", (i->name), fprintf(vm_if, "extern SIGNAL_%s *p_%s;\n\n", (i->name),
(i->name)); (i->name));
} }
else { else {
fprintf(vm_if, "extern GX_SIG_P p_%s;\n\n", (i->name)); fprintf(vm_if, "extern GX_SIG_P p_%s;\n\n", (i->name));
} }
// b. function name and preamble (declaration of g2x_self used in OG macros) // b. function name and preamble (declaration of g2x_self used in OG macros)
fprintf(vm_if, "void %s_%s(%s) {\n\n\tint g2x_self=0;\n\n", fprintf(vm_if, "void %s_%s(%s) {\n\n\tint g2x_self=0;\n\n",
(i->parent_fv->name), (i->parent_fv->name),
(i->name), (i->name),
(NULL != i->in) ? "char *param, int length" : "" ); (NULL != i->in) ? "char *param, int length" : "" );
// c. if the PI has NO PARAMETER, only make a simple output of the signal corresponding to the PI. Use G2S_OUTPUT and not SDL_OUTPUT (which makes malloc) // c. if the PI has NO PARAMETER, only make a simple output of the signal corresponding to the PI. Use G2S_OUTPUT and not SDL_OUTPUT (which makes malloc)
if (NULL == i->in) { if (NULL == i->in) {
fprintf(vm_if, "\t// Send the message to the SDL model\n"); fprintf(vm_if, "\t// Send the message to the SDL model\n");
fprintf(vm_if, "\tG2S_OUTPUT(sig_%s,(G2P_FINDPID(%s)),(GX_SIG_P)p_%s);\n\n", (i->name), (i->parent_fv->name), // SDL_DEST fprintf(vm_if, "\tG2S_OUTPUT(sig_%s,(G2P_FINDPID(%s)),(GX_SIG_P)p_%s);\n\n", (i->name), (i->parent_fv->name), // SDL_DEST
(i->name) ); (i->name) );
} }
// d. if the PI has a parameter // d. if the PI has a parameter
// generate 3 lines: // generate 3 lines:
// G2M_INIT_REC (p_signalname, SIGNAL_signalname); // G2M_INIT_REC (p_signalname, SIGNAL_signalname);
// DECODE_paramtype(...): call to Thanassis macros // DECODE_paramtype(...): call to Thanassis macros
// G2S_OUTPUT(sig_signalname,(G2P_FINDPID(nodename)),(GX_SIG_P)p_signalname); // G2S_OUTPUT(sig_signalname,(G2P_FINDPID(nodename)),(GX_SIG_P)p_signalname);
else { else {
fprintf(vm_if, fprintf(vm_if,
"\t//1. Clean the global variable before putting the decoded data\n"); "\t//1. Clean the global variable before putting the decoded data\n");
fprintf(vm_if, "\tG2M_INIT_REC (p_%s, SIGNAL_%s);\n\n", fprintf(vm_if, "\tG2M_INIT_REC (p_%s, SIGNAL_%s);\n\n",
(i->name), (i->name) ); (i->name), (i->name) );
// call to Thanassis Decoding macro (in the future replace by a loop: there can be several params) // call to Thanassis Decoding macro (in the future replace by a loop: there can be several params)
fprintf(vm_if, fprintf(vm_if,
"\t//2. Decode the ASN.1 binary stream and put it in the SDL variable\n"); "\t//2. Decode the ASN.1 binary stream and put it in the SDL variable\n");
fprintf(vm_if, "\tDECODE_%s_%s(param, length, &p_%s->sg1_%s)\n\n", fprintf(vm_if, "\tDECODE_%s_%s(param, length, &p_%s->sg1_%s)\n\n",
BINARY_ENCODING(i->in->value), BINARY_ENCODING(i->in->value),
/*(PARAM_ENCODING(i->in)),*/ /*(PARAM_ENCODING(i->in)),*/
(PARAM_TYPE(i->in)), (PARAM_TYPE(i->in)),
(i->name), (i->name),
(PARAM_TYPE(i->in)) (PARAM_TYPE(i->in))
); );
fprintf(vm_if, "\t//3. Send the message to the SDL model\n"); fprintf(vm_if, "\t//3. Send the message to the SDL model\n");
fprintf(vm_if, "\tG2S_OUTPUT(sig_%s,(G2P_FINDPID(%s)),(GX_SIG_P)p_%s);\n\n", (i->name), (i->parent_fv->name), // SDL_DEST fprintf(vm_if, "\tG2S_OUTPUT(sig_%s,(G2P_FINDPID(%s)),(GX_SIG_P)p_%s);\n\n", (i->name), (i->parent_fv->name), // SDL_DEST
(i->name) ); (i->name) );
} }
// e. function postamble (call to sdl_loop() and return) // e. function postamble (call to sdl_loop() and return)
...@@ -126,21 +130,21 @@ void add_PI_to_vm_if(Interface * i) ...@@ -126,21 +130,21 @@ void add_PI_to_vm_if(Interface * i)
void add_PI_to_hpostdef(Interface * i) void add_PI_to_hpostdef(Interface * i)
{ {
if (NULL == hpostdef) if (NULL == hpostdef)
return; return;
/* Declaration for PI with parameters: global variable + undef of the SDL_OUTPUT not used anymore */ /* Declaration for PI with parameters: global variable + undef of the SDL_OUTPUT not used anymore */
fprintf(hpostdef, "// PROVIDED INTERFACE %s\n\n", i->name); fprintf(hpostdef, "// PROVIDED INTERFACE %s\n\n", i->name);
// a. global variables if there is a parameter: use the type SIGNAL_signalname // a. global variables if there is a parameter: use the type SIGNAL_signalname
if (NULL != i->in) { if (NULL != i->in) {
fprintf(hpostdef, "SIGNAL_%s %s;\nSIGNAL_%s *p_%s=&%s;\n\n", fprintf(hpostdef, "SIGNAL_%s %s;\nSIGNAL_%s *p_%s=&%s;\n\n",
(i->name), (i->name),
(i->name), (i->name), (i->name), (i->name) ); (i->name), (i->name), (i->name), (i->name) );
} }
// b. global variables if there is no parameter: use the types GX_SIG_T and GX_SIG_P // b. global variables if there is no parameter: use the types GX_SIG_T and GX_SIG_P
else { else {
fprintf(hpostdef, "GX_SIG_T %s;\nGX_SIG_P p_%s = &%s;\n\n", fprintf(hpostdef, "GX_SIG_T %s;\nGX_SIG_P p_%s = &%s;\n\n",
(i->name), (i->name), (i->name) ); (i->name), (i->name), (i->name) );
} }
fprintf(hpostdef, "#undef SDL_OUTPUT_%s\n\n", (i->name)); fprintf(hpostdef, "#undef SDL_OUTPUT_%s\n\n", (i->name));
} }
...@@ -148,9 +152,9 @@ void add_PI_to_hpostdef(Interface * i) ...@@ -148,9 +152,9 @@ void add_PI_to_hpostdef(Interface * i)
void hpredef_preamble() void hpredef_preamble()
{ {
if (NULL == hpredef) if (NULL == hpredef)
return; return;
fprintf(hpredef, fprintf(hpredef,
"/* External declaration of VM callback function for each REQUIRED INTERFACE */\n\n"); "/* External declaration of VM callback function for each REQUIRED INTERFACE */\n\n");
} }
void add_RI_to_hpredef(Interface * i) void add_RI_to_hpredef(Interface * i)
...@@ -160,35 +164,35 @@ void add_RI_to_hpredef(Interface * i) ...@@ -160,35 +164,35 @@ void add_RI_to_hpredef(Interface * i)
int count_out_param = 0; int count_out_param = 0;
int i_in = 0, i_out = 0; int i_in = 0, i_out = 0;
if (NULL == hpredef) if (NULL == hpredef)
return; return;
/* Count IN and OUT param */ /* Count IN and OUT param */
v_local = i->in; v_local = i->in;
while (v_local != NULL) { while (v_local != NULL) {
v_local = v_local->next; v_local = v_local->next;
count_in_param++; count_in_param++;
} }
v_local = i->out; v_local = i->out;
while (v_local != NULL) { while (v_local != NULL) {
v_local = v_local->next; v_local = v_local->next;
count_out_param++; count_out_param++;
} }
/* Preamble (function declaration) */ /* Preamble (function declaration) */
fprintf(hpredef, "extern void vm_%s_%s(", fprintf(hpredef, "extern void vm_%s_%s(",
(i->parent_fv->name), (i->name)); (i->parent_fv->name), (i->name));
/* For each IN param, add "char *, int" to the declaration */ /* For each IN param, add "char *, int" to the declaration */
while (i_in < count_in_param) { while (i_in < count_in_param) {
fprintf(hpredef, "%schar *, int", (i_in > 0) ? ", " : ""); fprintf(hpredef, "%schar *, int", (i_in > 0) ? ", " : "");
i_in++; i_in++;
} }
/* For each OUT param, add "char *, int*" to the declaration */ /* For each OUT param, add "char *, int*" to the declaration */
while (i_out < count_out_param) { while (i_out < count_out_param) {
fprintf(hpredef, "%schar *, int *", fprintf(hpredef, "%schar *, int *",
(i_out > 0 || count_in_param > 0) ? ", " : ""); (i_out > 0 || count_in_param > 0) ? ", " : "");
i_out++; i_out++;
} }
/* Postamble */ /* Postamble */
...@@ -198,21 +202,21 @@ void add_RI_to_hpredef(Interface * i) ...@@ -198,21 +202,21 @@ void add_RI_to_hpredef(Interface * i)
void hpostdef_preamble() void hpostdef_preamble()
{ {
if (NULL == hpostdef) if (NULL == hpostdef)
return; return;
fprintf(hpostdef, "#include \"OG_ASN1_Types.h\"\n\n\n"); fprintf(hpostdef, "#include \"OG_ASN1_Types.h\"\n\n\n");
} }
void hpostdef_postamble() void hpostdef_postamble()
{ {
if (NULL == hpostdef) if (NULL == hpostdef)
return; return;
fprintf(hpostdef, fprintf(hpostdef,
"/* ** Redefinition of the macro G2S_RELEASE that makes a free of the current message */\n"); "/* ** Redefinition of the macro G2S_RELEASE that makes a free of the current message */\n");
fprintf(hpostdef, "#undef G2S_RELEASE\n\n#define G2S_RELEASE()\n\n"); fprintf(hpostdef, "#undef G2S_RELEASE\n\n#define G2S_RELEASE()\n\n");
fprintf(hpostdef, fprintf(hpostdef,
"/* ** Redefinition of the macro G2I_CRE_START (call of malloc to send the START message at system startup) */\n"); "/* ** Redefinition of the macro G2I_CRE_START (call of malloc to send the START message at system startup) */\n");
fprintf(hpostdef, fprintf(hpostdef,
"#undef G2I_CRE_START\n\n#define G2I_CRE_START(proc) \\\n{GX_SIG_T sig; \\\nsig.sg_signo=sig_START;\\\nsig.sg_receiver=new_pid;\\\nCAT(PROCESS_, proc)(&sig); }"); "#undef G2I_CRE_START\n\n#define G2I_CRE_START(proc) \\\n{GX_SIG_T sig; \\\nsig.sg_signo=sig_START;\\\nsig.sg_receiver=new_pid;\\\nCAT(PROCESS_, proc)(&sig); }");
} }
void add_Immediate_RI_to_hpostdef(Interface * i) void add_Immediate_RI_to_hpostdef(Interface * i)
...@@ -222,47 +226,47 @@ void add_Immediate_RI_to_hpostdef(Interface * i) ...@@ -222,47 +226,47 @@ void add_Immediate_RI_to_hpostdef(Interface * i)
int count_out_param = 0; int count_out_param = 0;
int j; int j;
if (NULL == hpostdef) if (NULL == hpostdef)
return; return;
fprintf(hpostdef, "// IMMEDIATE REQUIRED INTERFACE %s\n\n", i->name); fprintf(hpostdef, "// IMMEDIATE REQUIRED INTERFACE %s\n\n", i->name);
/* 1) for all parameters (in/out) declare encoding/decoding buffers: DEFINE_type(IN/OUT_RIname_varname) */ /* 1) for all parameters (in/out) declare encoding/decoding buffers: DEFINE_type(IN/OUT_RIname_varname) */
// First IN param // First IN param
v_local = i->in; v_local = i->in;
while (NULL != v_local) { while (NULL != v_local) {
fprintf(hpostdef, "DEFINE_%s(IN_%s_%s)\n\n", fprintf(hpostdef, "DEFINE_%s(IN_%s_%s)\n\n",
(PARAM_TYPE(v_local)), (PARAM_TYPE(v_local)),
(i->name), (PARAM_NAME(v_local)) ); (i->name), (PARAM_NAME(v_local)) );
/* In the meantime, also count the number of params */ /* In the meantime, also count the number of params */
count_in_param++; count_in_param++;
v_local = v_local->next; v_local = v_local->next;
} }
// Then OUT param // Then OUT param
v_local = i->out; v_local = i->out;
while (NULL != v_local) { while (NULL != v_local) {
fprintf(hpostdef, "DEFINE_%s(OUT_%s_%s)\n\n", fprintf(hpostdef, "DEFINE_%s(OUT_%s_%s)\n\n",
(PARAM_TYPE(v_local)), (PARAM_TYPE(v_local)),
(i->name), (PARAM_NAME(v_local)) ); (i->name), (PARAM_NAME(v_local)) );
/* In the meantime, also count the number of params */ /* In the meantime, also count the number of params */
count_out_param++; count_out_param++;
v_local = v_local->next; v_local = v_local->next;
} }
/* 2) Macro declaration: "#define RI_NAME(...)" */ /* 2) Macro declaration: "#define RI_NAME(...)" */
fprintf(hpostdef, "#define %s(", (i->name)); fprintf(hpostdef, "#define %s(", (i->name));
for (j = 0; j < count_in_param; j++) { for (j = 0; j < count_in_param; j++) {
if (j > 0) if (j > 0)
fprintf(hpostdef, ", "); fprintf(hpostdef, ", ");
fprintf(hpostdef, "param_in_%d", j + 1); fprintf(hpostdef, "param_in_%d", j + 1);
} }
if (count_in_param > 0 && count_out_param > 0) if (count_in_param > 0 && count_out_param > 0)
fprintf(hpostdef, ", "); fprintf(hpostdef, ", ");
for (j = 0; j < count_out_param; j++) { for (j = 0; j < count_out_param; j++) {
if (j > 0) if (j > 0)
fprintf(hpostdef, ", "); fprintf(hpostdef, ", ");
fprintf(hpostdef, "param_out_%d", j + 1); fprintf(hpostdef, "param_out_%d", j + 1);
} }
fprintf(hpostdef, ")\\\n{ "); fprintf(hpostdef, ")\\\n{ ");
...@@ -271,60 +275,60 @@ void add_Immediate_RI_to_hpostdef(Interface * i) ...@@ -271,60 +275,60 @@ void add_Immediate_RI_to_hpostdef(Interface * i)
v_local = i->in; v_local = i->in;
j = 1; j = 1;
while (NULL != v_local) { while (NULL != v_local) {
fprintf(hpostdef, "ENCODE_SYNC_%s_%s(IN_%s_%s,param_in_%d)\\\n", fprintf(hpostdef, "ENCODE_SYNC_%s_%s(IN_%s_%s,param_in_%d)\\\n",
BINARY_ENCODING(v_local->value), /*(PARAM_ENCODING(v_local)), */ BINARY_ENCODING(v_local->value),
(PARAM_TYPE(v_local)), (PARAM_TYPE(v_local)),
(i->name), (PARAM_NAME(v_local)), j ); (i->name), (PARAM_NAME(v_local)), j );
j++; j++;
v_local = v_local->next; v_local = v_local->next;
} }
/* 4a) Inside the macro: add the call to the VM interface (preamble) */ /* 4a) Inside the macro: add the call to the VM interface (preamble) */
fprintf(hpostdef, "vm_%s_%s(", (i->parent_fv->name), (i->name) ); fprintf(hpostdef, "vm_%s_%s(", (i->parent_fv->name), (i->name) );
/* 4b) Add each IN param (IN_RIname_varname, IN_RIname_varname_len) */ /* 4b) Add each IN param (IN_RIname_varname, IN_RIname_varname_len) */
v_local = i->in; v_local = i->in;
j = 0; j = 0;
while (NULL != v_local) { while (NULL != v_local) {
fprintf(hpostdef, "%sIN_%s_%s,IN_%s_%s_len", fprintf(hpostdef, "%sIN_%s_%s,IN_%s_%s_len",
(j > 0) ? ", " : "", (j > 0) ? ", " : "",
(i->name), (i->name),
(PARAM_NAME(v_local)), (PARAM_NAME(v_local)),
(i->name), (PARAM_NAME(v_local)) ); (i->name), (PARAM_NAME(v_local)) );
j++; j++;
v_local = v_local->next; v_local = v_local->next;
} }
if (count_in_param > 0 && count_out_param > 0) if (count_in_param > 0 && count_out_param > 0)
fprintf(hpostdef, ", "); fprintf(hpostdef, ", ");
/* 4c) Add each OUT param (OUT_RIname_varname, &OUT_RIname_varname_len) */ /* 4c) Add each OUT param (OUT_RIname_varname, &OUT_RIname_varname_len) */
v_local = i->out; v_local = i->out;
j = 0; j = 0;
while (NULL != v_local) { while (NULL != v_local) {
fprintf(hpostdef, "%sOUT_%s_%s,&OUT_%s_%s_len", fprintf(hpostdef, "%sOUT_%s_%s,&OUT_%s_%s_len",
(j > 0) ? ", " : "", (j > 0) ? ", " : "",
(i->name), (i->name),
(PARAM_NAME(v_local)), (PARAM_NAME(v_local)),
(i->name), (PARAM_NAME(v_local)) ); (i->name), (PARAM_NAME(v_local)) );
j++; j++;
v_local = v_local->next; v_local = v_local->next;
} }
fprintf(hpostdef, ");\\\n"); fprintf(hpostdef, ");\\\n");
/* 5) Inside the macro: add DECODE for each OUT param */ /* 5) Inside the macro: add DECODE for each OUT param */
if (count_out_param > 0) { if (count_out_param > 0) {
v_local = i->out; v_local = i->out;
j = 1; j = 1;
while (NULL != v_local) { while (NULL != v_local) {
fprintf(hpostdef, fprintf(hpostdef,
"DECODE_%s_%s(OUT_%s_%s,OUT_%s_%s_len,param_out_%d)\\\n", "DECODE_%s_%s(OUT_%s_%s,OUT_%s_%s_len,param_out_%d)\\\n",
BINARY_ENCODING(v_local->value), /*(PARAM_ENCODING(v_local)), */ BINARY_ENCODING(v_local->value),
(PARAM_TYPE(v_local)), (PARAM_TYPE(v_local)),
(i->name), (PARAM_NAME(v_local)), (i->name), (i->name), (PARAM_NAME(v_local)), (i->name),
(PARAM_NAME(v_local)), j ); (PARAM_NAME(v_local)), j );
j++; j++;
v_local = v_local->next; v_local = v_local->next;
} }
} }
fprintf(hpostdef, "}\n\n"); fprintf(hpostdef, "}\n\n");
} }
...@@ -332,42 +336,42 @@ void add_Immediate_RI_to_hpostdef(Interface * i) ...@@ -332,42 +336,42 @@ void add_Immediate_RI_to_hpostdef(Interface * i)
void add_Deffered_RI_to_hpostdef(Interface * i) void add_Deffered_RI_to_hpostdef(Interface * i)
{ {
if (NULL == hpostdef) if (NULL == hpostdef)
return; return;
fprintf(hpostdef, "/* DEFFERED (ASYNCHRONOUS) REQUIRED INTERFACE %s */\n\n", i->name); fprintf(hpostdef, "/* DEFFERED (ASYNCHRONOUS) REQUIRED INTERFACE %s */\n\n", i->name);
// 1). call to Thanassis macro to declare encoding buffers: // 1). call to Thanassis macro to declare encoding buffers:
if (NULL != i->in) { if (NULL != i->in) {
fprintf(hpostdef, "DEFINE_%s(%s_sg1)\n\n", fprintf(hpostdef, "DEFINE_%s(%s_sg1)\n\n",
(PARAM_TYPE(i->in)), (i->name) ); (PARAM_TYPE(i->in)), (i->name) );
} }
// 2) redefine SDL_OUTPUT // 2) redefine SDL_OUTPUT
fprintf(hpostdef, "#undef SDL_OUTPUT_%s\n\n", (i->name)); fprintf(hpostdef, "#undef SDL_OUTPUT_%s\n\n", (i->name));
if (NULL != i->in) { if (NULL != i->in) {
fprintf(hpostdef, "#define SDL_OUTPUT_%s(pid, param1)\\\n{ ", fprintf(hpostdef, "#define SDL_OUTPUT_%s(pid, param1)\\\n{ ",
(i->name)); (i->name));
fprintf(hpostdef, "ENCODE_ASYNC_%s_%s(%s_sg1,param1)\\\n", fprintf(hpostdef, "ENCODE_ASYNC_%s_%s(%s_sg1,param1)\\\n",
BINARY_ENCODING(i->in->value), /*(PARAM_ENCODING(i->in)),*/ BINARY_ENCODING(i->in->value), /*(PARAM_ENCODING(i->in)),*/
(PARAM_TYPE(i->in)), (i->name)); (PARAM_TYPE(i->in)), (i->name));
fprintf(hpostdef, "vm_async_%s_%s(%s_sg1,%s_sg1_len);}\n\n", fprintf(hpostdef, "vm_async_%s_%s(%s_sg1,%s_sg1_len);}\n\n",
(i->parent_fv->name), (i->name), (i->name), (i->name)); (i->parent_fv->name), (i->name), (i->name), (i->name));
} }
else { else {
fprintf(hpostdef, fprintf(hpostdef,
"#define SDL_OUTPUT_%s(pid)\\\n{vm_async_%s_%s();}\n\n", "#define SDL_OUTPUT_%s(pid)\\\n{vm_async_%s_%s();}\n\n",
(i->name), (i->parent_fv->name), (i->name) ); (i->name), (i->parent_fv->name), (i->name) );
} }
} }
int Create_OG_files(FV * fv) int Create_OG_files(FV * fv)
{ {
if (create_gluefiles(fv) != -1) { if (create_gluefiles(fv) != -1) {
vm_if_preamble(fv); vm_if_preamble(fv);
hpredef_preamble(); hpredef_preamble();
hpostdef_preamble(); hpostdef_preamble();
} else { } else {
printf("File creation error (Build_SDL_Glue backend)\n\n"); printf("File creation error (Build_SDL_Glue backend)\n\n");
return -1; return -1;
} }
return 0; return 0;
} }
...@@ -384,22 +388,22 @@ void GLUE_OG_Interface(Interface * i) ...@@ -384,22 +388,22 @@ void GLUE_OG_Interface(Interface * i)
switch (i->direction) { switch (i->direction) {
case PI: case PI:
add_PI_to_vm_if(i); add_PI_to_vm_if(i);
add_PI_to_hpostdef(i); add_PI_to_hpostdef(i);
break; break;
case RI: case RI:
switch (i->synchronism) { switch (i->synchronism) {
case asynch: case asynch:
add_Deffered_RI_to_hpostdef(i); add_Deffered_RI_to_hpostdef(i);
break; break;
case synch: case synch:
add_Immediate_RI_to_hpostdef(i); add_Immediate_RI_to_hpostdef(i);