scilab: fix comment and indentation
This commit is contained in:
parent
2933826722
commit
656f2b8932
1 changed files with 118 additions and 103 deletions
|
|
@ -62,7 +62,6 @@ public:
|
||||||
/* ------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------
|
||||||
* main()
|
* main()
|
||||||
* ----------------------------------------------------------------------*/
|
* ----------------------------------------------------------------------*/
|
||||||
|
|
||||||
virtual void main(int argc, char *argv[]) {
|
virtual void main(int argc, char *argv[]) {
|
||||||
|
|
||||||
sourceFileList = NewList();
|
sourceFileList = NewList();
|
||||||
|
|
@ -149,7 +148,6 @@ public:
|
||||||
/* ------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------
|
||||||
* top()
|
* top()
|
||||||
* ----------------------------------------------------------------------*/
|
* ----------------------------------------------------------------------*/
|
||||||
|
|
||||||
virtual int top(Node *node) {
|
virtual int top(Node *node) {
|
||||||
|
|
||||||
/* Get the module name */
|
/* Get the module name */
|
||||||
|
|
@ -260,7 +258,6 @@ public:
|
||||||
/* ------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------
|
||||||
* emitBanner()
|
* emitBanner()
|
||||||
* ----------------------------------------------------------------------*/
|
* ----------------------------------------------------------------------*/
|
||||||
|
|
||||||
void emitBanner(File *f) {
|
void emitBanner(File *f) {
|
||||||
Printf(f, "// ----------------------------------------------------------------------------\n");
|
Printf(f, "// ----------------------------------------------------------------------------\n");
|
||||||
Swig_banner_target_lang(f, "// ");
|
Swig_banner_target_lang(f, "// ");
|
||||||
|
|
@ -270,7 +267,6 @@ public:
|
||||||
/* ------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------
|
||||||
* functionWrapper()
|
* functionWrapper()
|
||||||
* ----------------------------------------------------------------------*/
|
* ----------------------------------------------------------------------*/
|
||||||
|
|
||||||
virtual int functionWrapper(Node *node) {
|
virtual int functionWrapper(Node *node) {
|
||||||
|
|
||||||
/* Get some useful attributes of this function */
|
/* Get some useful attributes of this function */
|
||||||
|
|
@ -328,7 +324,6 @@ public:
|
||||||
Printf(wrapper->code, "SWIG_Scilab_SetFname(fname);\n");
|
Printf(wrapper->code, "SWIG_Scilab_SetFname(fname);\n");
|
||||||
|
|
||||||
for (paramIndex = 0, param = functionParamsList; paramIndex < maxInputArguments; ++paramIndex) {
|
for (paramIndex = 0, param = functionParamsList; paramIndex < maxInputArguments; ++paramIndex) {
|
||||||
|
|
||||||
// Ignore parameter if the typemap specifies numinputs=0
|
// Ignore parameter if the typemap specifies numinputs=0
|
||||||
while (checkAttribute(param, "tmap:in:numinputs", "0")) {
|
while (checkAttribute(param, "tmap:in:numinputs", "0")) {
|
||||||
param = Getattr(param, "tmap:in:next");
|
param = Getattr(param, "tmap:in:next");
|
||||||
|
|
@ -485,7 +480,6 @@ public:
|
||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
* dispatchFunction()
|
* dispatchFunction()
|
||||||
* ----------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
void dispatchFunction(Node *node) {
|
void dispatchFunction(Node *node) {
|
||||||
Wrapper *wrapper = NewWrapper();
|
Wrapper *wrapper = NewWrapper();
|
||||||
|
|
||||||
|
|
@ -524,7 +518,6 @@ public:
|
||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
* variableWrapper()
|
* variableWrapper()
|
||||||
* ----------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
virtual int variableWrapper(Node *node) {
|
virtual int variableWrapper(Node *node) {
|
||||||
|
|
||||||
/* Get information about variable */
|
/* Get information about variable */
|
||||||
|
|
@ -591,7 +584,6 @@ public:
|
||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
* constantWrapper()
|
* constantWrapper()
|
||||||
* ----------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
virtual int constantWrapper(Node *node) {
|
virtual int constantWrapper(Node *node) {
|
||||||
|
|
||||||
/* Get the useful information from the node */
|
/* Get the useful information from the node */
|
||||||
|
|
@ -672,7 +664,6 @@ public:
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* enumvalueDeclaration()
|
* enumvalueDeclaration()
|
||||||
* --------------------------------------------------------------------- */
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
virtual int enumvalueDeclaration(Node *node) {
|
virtual int enumvalueDeclaration(Node *node) {
|
||||||
static int iPreviousEnumValue = 0;
|
static int iPreviousEnumValue = 0;
|
||||||
|
|
||||||
|
|
@ -712,6 +703,11 @@ public:
|
||||||
return Language::enumvalueDeclaration(node);
|
return Language::enumvalueDeclaration(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
* checkIdentifierName()
|
||||||
|
* Display a warning for too long generated identifier names
|
||||||
|
* Scilab identifier name (functions, variables) can have 24 chars max
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
void checkIdentifierName(String *name) {
|
void checkIdentifierName(String *name) {
|
||||||
if (Len(name) > 24) {
|
if (Len(name) > 24) {
|
||||||
if (extraWarning) {
|
if (extraWarning) {
|
||||||
|
|
@ -722,11 +718,17 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
* addHelperFunctions()
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
void addHelperFunctions() {
|
void addHelperFunctions() {
|
||||||
addFunctionToScilab("swig_this", "swig_this");
|
addFunctionToScilab("swig_this", "swig_this");
|
||||||
addFunctionToScilab("swig_ptr", "swig_ptr");
|
addFunctionToScilab("swig_ptr", "swig_ptr");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
* createBuilderCode()
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
void createBuilderFile() {
|
void createBuilderFile() {
|
||||||
String *builderFilename = NewStringf("%sbuilder.sce", SWIG_output_directory());
|
String *builderFilename = NewStringf("%sbuilder.sce", SWIG_output_directory());
|
||||||
builderFile = NewFile(builderFilename, "w", SWIG_output_files());
|
builderFile = NewFile(builderFilename, "w", SWIG_output_files());
|
||||||
|
|
@ -737,6 +739,9 @@ public:
|
||||||
emitBanner(builderFile);
|
emitBanner(builderFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
* startBuilderCode()
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
void startBuilderCode(String *moduleName, String *outputFilename) {
|
void startBuilderCode(String *moduleName, String *outputFilename) {
|
||||||
builderFunctionCount = 0;
|
builderFunctionCount = 0;
|
||||||
builderCode = NewString("");
|
builderCode = NewString("");
|
||||||
|
|
@ -796,8 +801,10 @@ public:
|
||||||
Printf(builderCode, "table = [");
|
Printf(builderCode, "table = [");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
* terminateBuilderCode()
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
void terminateBuilderCode() {
|
void terminateBuilderCode() {
|
||||||
|
|
||||||
Printf(builderCode, "];\n");
|
Printf(builderCode, "];\n");
|
||||||
Printf(builderCode, "err_msg = [];\n");
|
Printf(builderCode, "err_msg = [];\n");
|
||||||
Printf(builderCode, "if ~isempty(table) then\n");
|
Printf(builderCode, "if ~isempty(table) then\n");
|
||||||
|
|
@ -816,12 +823,18 @@ public:
|
||||||
Printf(builderCode, "end\n");
|
Printf(builderCode, "end\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
* saveBuilderCode():
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
void saveBuilderFile() {
|
void saveBuilderFile() {
|
||||||
// Save builder
|
|
||||||
Printv(builderFile, builderCode, NIL);
|
Printv(builderFile, builderCode, NIL);
|
||||||
Delete(builderFile);
|
Delete(builderFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
* createGatewayXMLFile()
|
||||||
|
* This file is used by Scilab in the context of internal modules
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
void createGatewayXMLFile(String *moduleName) {
|
void createGatewayXMLFile(String *moduleName) {
|
||||||
String *gatewayXMLFilename = NewStringf("%s_gateway.xml", moduleName);
|
String *gatewayXMLFilename = NewStringf("%s_gateway.xml", moduleName);
|
||||||
gatewayXMLFile = NewFile(gatewayXMLFilename, "w", SWIG_output_files());
|
gatewayXMLFile = NewFile(gatewayXMLFilename, "w", SWIG_output_files());
|
||||||
|
|
@ -845,6 +858,9 @@ public:
|
||||||
Printf(gatewayXML, "-->\n");
|
Printf(gatewayXML, "-->\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
* saveGatewayXMLFile()
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
void saveGatewayXMLFile() {
|
void saveGatewayXMLFile() {
|
||||||
Printv(gatewayXML, "</GATEWAY>\n");
|
Printv(gatewayXML, "</GATEWAY>\n");
|
||||||
Printv(gatewayXMLFile, gatewayXML, NIL);
|
Printv(gatewayXMLFile, gatewayXML, NIL);
|
||||||
|
|
@ -852,10 +868,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
* addFunctionToScilab: add a function in Scilab (builder, XML, ...)
|
* addFunctionToScilab(): add a function in Scilab (builder, XML, ...)
|
||||||
* ----------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------- */
|
||||||
void addFunctionToScilab(const_String_or_char_ptr scilabFunctionName, const_String_or_char_ptr wrapperFunctionName)
|
void addFunctionToScilab(const_String_or_char_ptr scilabFunctionName, const_String_or_char_ptr wrapperFunctionName) {
|
||||||
{
|
|
||||||
addFunctionInBuilder(scilabFunctionName, wrapperFunctionName);
|
addFunctionInBuilder(scilabFunctionName, wrapperFunctionName);
|
||||||
if (gatewayID) {
|
if (gatewayID) {
|
||||||
Printf(gatewayXML, "<PRIMITIVE gatewayId=\"%s\" primitiveId=\"%d\" primitiveName=\"%s\"/>\n", gatewayID, primitiveID++, scilabFunctionName);
|
Printf(gatewayXML, "<PRIMITIVE gatewayId=\"%s\" primitiveId=\"%d\" primitiveName=\"%s\"/>\n", gatewayID, primitiveID++, scilabFunctionName);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue