scilab: fix generated gateway source (missing include, entry point name)

This commit is contained in:
Simon Marchetto 2014-10-20 10:16:19 +02:00
commit c440eae1f9

View file

@ -265,7 +265,7 @@ public:
Wrapper_pretty_print(initSection, beginSection); Wrapper_pretty_print(initSection, beginSection);
if (createGatewaySource) { if (createGatewaySource) {
saveGatewaySourceFile(); saveGatewaySourceFile(moduleName);
} }
if (createGatewayXML) { if (createGatewayXML) {
@ -1032,6 +1032,7 @@ public:
Printv(gatewaySourceFile, "extern \"C\" {\n", NIL); Printv(gatewaySourceFile, "extern \"C\" {\n", NIL);
Printv(gatewaySourceFile, "#endif\n", NIL); Printv(gatewaySourceFile, "#endif\n", NIL);
Printv(gatewaySourceFile, "\n", NIL); Printv(gatewaySourceFile, "\n", NIL);
Printv(gatewaySourceFile, "#include <mex.h>\n", NIL);
Printv(gatewaySourceFile, "#include <sci_gateway.h>\n", NIL); Printv(gatewaySourceFile, "#include <sci_gateway.h>\n", NIL);
Printv(gatewaySourceFile, "#include <api_scilab.h>\n", NIL); Printv(gatewaySourceFile, "#include <api_scilab.h>\n", NIL);
Printv(gatewaySourceFile, "#include <MALLOC.h>\n", NIL); Printv(gatewaySourceFile, "#include <MALLOC.h>\n", NIL);
@ -1060,30 +1061,33 @@ public:
* Saves the gateway entry point source file * Saves the gateway entry point source file
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
void saveGatewaySourceFile() { void saveGatewaySourceFile(String *moduleName) {
Printv(gatewaySourceFile, gatewaySourceWrapperDeclaration, NIL); Printv(gatewaySourceFile, gatewaySourceWrapperDeclaration, NIL);
Printf(gatewaySourceFunctionTable, "};\n"); Printf(gatewaySourceFunctionTable, "};\n");
Printv(gatewaySourceFile, gatewaySourceFunctionTable, NIL);
Printv(gatewaySourceFile, gatewaySourceFunctionTable, NIL);
Printv(gatewaySourceFile, "\n", NIL); Printv(gatewaySourceFile, "\n", NIL);
Printv(gatewaySourceFile, "int C2F(libtypedef_array_member)()\n", NIL);
Printv(gatewaySourceFile, "{\n", NIL); String* gatewaySourceEntryPoint = NewString("");
Printv(gatewaySourceFile, " Rhs = Max(0, Rhs);\n", NIL); Printf(gatewaySourceEntryPoint, "int C2F(lib%s)()\n", moduleName);
Printv(gatewaySourceFile, " if (*(Tab[Fin-1].f) != NULL)\n", NIL); Printf(gatewaySourceEntryPoint, "{\n");
Printv(gatewaySourceFile, " {\n", NIL); Printf(gatewaySourceEntryPoint, " Rhs = Max(0, Rhs);\n");
Printv(gatewaySourceFile, " if(pvApiCtx == NULL)\n", NIL); Printf(gatewaySourceEntryPoint, " if (*(Tab[Fin-1].f) != NULL)\n");
Printv(gatewaySourceFile, " {\n", NIL); Printf(gatewaySourceEntryPoint, " {\n");
Printv(gatewaySourceFile, " pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));\n", NIL); Printf(gatewaySourceEntryPoint, " if(pvApiCtx == NULL)\n");
Printv(gatewaySourceFile, " }\n", NIL); Printf(gatewaySourceEntryPoint, " {\n");
Printv(gatewaySourceFile, " pvApiCtx->pstName = (char*)Tab[Fin-1].name;\n", NIL); Printf(gatewaySourceEntryPoint, " pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));\n");
Printv(gatewaySourceFile, " (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);\n", NIL); Printf(gatewaySourceEntryPoint, " }\n");
Printv(gatewaySourceFile, " }\n", NIL); Printf(gatewaySourceEntryPoint, " pvApiCtx->pstName = (char*)Tab[Fin-1].name;\n");
Printv(gatewaySourceFile, " return 0;\n", NIL); Printf(gatewaySourceEntryPoint, " (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);\n");
Printv(gatewaySourceFile, "}\n", NIL); Printf(gatewaySourceEntryPoint, " }\n");
Printv(gatewaySourceFile, "\n", NIL); Printf(gatewaySourceEntryPoint, " return 0;\n");
Printv(gatewaySourceFile, "#ifdef __cplusplus\n", NIL); Printf(gatewaySourceEntryPoint, "}\n");
Printv(gatewaySourceFile, "}\n", NIL); Printf(gatewaySourceEntryPoint, "\n");
Printv(gatewaySourceFile, "#endif\n", NIL); Printf(gatewaySourceEntryPoint, "#ifdef __cplusplus\n");
Printf(gatewaySourceEntryPoint, "}\n");
Printf(gatewaySourceEntryPoint, "#endif\n");
Printv(gatewaySourceFile, gatewaySourceEntryPoint, NIL);
Delete(gatewaySourceFile); Delete(gatewaySourceFile);
} }