diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html
index 1742df746..cdb63a815 100644
--- a/Doc/Manual/Scilab.html
+++ b/Doc/Manual/Scilab.html
@@ -286,8 +286,8 @@ The following table lists the Scilab specific command line options in addition t
-| -internalmodule <gateway id> |
-Generate an internal module with the given <gateway id> |
+-gatewayxml <gateway_id> |
+Generate the gateway XML with the given <gateway_id> |
diff --git a/Source/Modules/scilab.cxx b/Source/Modules/scilab.cxx
index 1452e3e86..f0915cb87 100644
--- a/Source/Modules/scilab.cxx
+++ b/Source/Modules/scilab.cxx
@@ -26,7 +26,7 @@ Scilab options (available with -scilab)\n\
-addsources - Add comma separated source files \n\
-buildflags - Use the Scilab script to set build flags\n\
-buildverbositylevel - Set the build verbosity (default 0)\n\
- -internalmodule - Generate internal module files with the given \n\
+ -gatewayxml - Generate gateway xml with the given \n\
-nobuilder - Do not generate builder script\n\
-outputlibrary - Set name of the output library to \n\n";
@@ -41,6 +41,7 @@ protected:
String *variablesCode;
+ bool generateBuilder;
File *builderFile;
String *builderCode;
int builderFunctionCount;
@@ -52,19 +53,17 @@ protected:
String *verboseBuildLevel;
String *buildFlagsScript;
- File *gatewayXMLFile;
- String *gatewayXML;
-
+ bool createGatewayGenerator;
File *gatewayGeneratorFile;
String *gatewayGeneratorCode;
+ bool createGatewayXML;
+ File *gatewayXMLFile;
+ String *gatewayXML;
+
String *gatewayID;
int primitiveID;
-
String *libraryName;
-
- bool generateBuilder;
- bool internalModule;
public:
/* ------------------------------------------------------------------------
@@ -85,7 +84,8 @@ public:
gatewayGeneratorFile = NULL;
libraryName = NULL;
generateBuilder = true;
- internalModule = false;
+ createGatewayGenerator = false;
+ createGatewayXML = false;
/* Manage command line arguments */
for (int argIndex = 1; argIndex < argc; argIndex++) {
@@ -125,10 +125,9 @@ public:
} else if (strcmp(argv[argIndex], "-nobuilder") == 0) {
Swig_mark_arg(argIndex);
generateBuilder = false;
- } else if (strcmp(argv[argIndex], "-internalmodule") == 0) {
+ } else if (strcmp(argv[argIndex], "-gatewayxml") == 0) {
Swig_mark_arg(argIndex);
- generateBuilder = false;
- internalModule = true;
+ createGatewayXML = true;
gatewayID = NewString(argv[argIndex + 1]);
Swig_mark_arg(argIndex + 1);
} else if (strcmp(argv[argIndex], "-outputlibrary") == 0) {
@@ -196,16 +195,22 @@ public:
/* Output module initialization code */
Swig_banner(beginSection);
- // Add builder header code
+ // Create builder file if required
if (generateBuilder) {
createBuilderFile();
startBuilderCode(outputFilename);
}
- // In the case of internal module, create gateway gateway XML and generation script
- if (internalModule) {
- createGatewayXMLFile(moduleName);
+
+ // Create gateway generator script if required
+ if (createGatewayGenerator) {
createGatewayGeneratorFile();
}
+
+ // Create gateway XML if required
+ if (createGatewayXML) {
+ createGatewayXMLFile(moduleName);
+ }
+
// Module initialization function
String *moduleInitFunctionName = NewString("");
Printf(moduleInitFunctionName, "%s_Init", moduleName);
@@ -252,12 +257,15 @@ public:
Dump(variablesCode, beginSection);
Wrapper_pretty_print(initSection, beginSection);
- // In the case of internal module, terminate and save gateway XML and generation script
- if (internalModule) {
- saveGatewayXMLFile();
+ // Save gateway generator script
+ if (createGatewayGenerator) {
saveGatewayGeneratorFile(moduleName);
}
+ if (createGatewayXML) {
+ saveGatewayXMLFile();
+ }
+
/* Cleanup files */
Delete(runtimeSection);
Delete(headerSection);
@@ -988,6 +996,7 @@ public:
* ----------------------------------------------------------------------- */
void saveGatewayGeneratorFile(String *moduleName) {
+
Printf(gatewayGeneratorCode, "];\n");
Printv(gatewayGeneratorFile, gatewayGeneratorCode, NIL);
String *gatewayGenerateCommand = NewStringf("ilib_gen_gateway('gw_%s.c', table);\n", moduleName);
@@ -1005,13 +1014,12 @@ public:
addFunctionInScriptTable(scilabFunctionName, wrapperFunctionName, builderCode);
}
- if (internalModule) {
- if (gatewayGeneratorFile) {
- addFunctionInScriptTable(scilabFunctionName, wrapperFunctionName, gatewayGeneratorCode);
- }
- if (gatewayXMLFile) {
- Printf(gatewayXML, "\n", gatewayID, primitiveID++, scilabFunctionName);
- }
+ if (createGatewayGenerator) {
+ addFunctionInScriptTable(scilabFunctionName, wrapperFunctionName, gatewayGeneratorCode);
+ }
+
+ if (gatewayXMLFile) {
+ Printf(gatewayXML, "\n", gatewayID, primitiveID++, scilabFunctionName);
}
}