Reindent Scilab sources

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12277 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Sylvestre Ledru 2010-10-14 15:59:20 +00:00
commit 8d0ceb287d

View file

@ -17,7 +17,7 @@ char cvsroot_scilab_cxx[] = "$Id$";
static const char *usage = (char *) "\ static const char *usage = (char *) "\
Scilab Options (available with -scilab)\n\ Scilab Options (available with -scilab)\n\
(none yet)\n\n"; (none yet)\n\n";
class SCILAB:public Language { class SCILAB:public Language {
@ -38,7 +38,7 @@ public:
allow_overloading(); allow_overloading();
} }
/* ------------------------------------------------------------ /* ------------------------------------------------------------
* main() * main()
* ------------------------------------------------------------ */ * ------------------------------------------------------------ */
@ -46,21 +46,21 @@ public:
virtual void main(int argc, char *argv[]) { virtual void main(int argc, char *argv[]) {
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
if (argv[i]) { if (argv[i]) {
if (strcmp(argv[i], "-help") == 0) { if (strcmp(argv[i], "-help") == 0) {
fputs(usage, stderr); fputs(usage, stderr);
} }
} }
} }
/* Set language-specific subdirectory in SWIG library */ /* Set language-specific subdirectory in SWIG library */
SWIG_library_directory("scilab"); SWIG_library_directory("scilab");
/* Add a symbol to the parser for conditional compilation */ /* Add a symbol to the parser for conditional compilation */
Preprocessor_define("SWIGSCILAB 1", 0); Preprocessor_define("SWIGSCILAB 1", 0);
/* Set scilab configuration file */ /* Set scilab configuration file */
SWIG_config_file("scilab.swg"); SWIG_config_file("scilab.swg");
/* Set typemap for scilab */ /* Set typemap for scilab */
SWIG_typemap_lang("scilab"); SWIG_typemap_lang("scilab");
} }
@ -70,10 +70,10 @@ public:
* --------------------------------------------------------------------- */ * --------------------------------------------------------------------- */
virtual int top(Node *n) { virtual int top(Node *n) {
/* Get the name of the module */ /* Get the name of the module */
String *module = Getattr(n, "name"); String *module = Getattr(n, "name");
/* One output file for as the wrapper file */ /* One output file for as the wrapper file */
String *outfile; String *outfile;
if (CPlusPlus) if (CPlusPlus)
@ -81,37 +81,37 @@ public:
else else
outfile= NewStringf("%s%s_wrap.c", SWIG_output_directory(), module); outfile= NewStringf("%s%s_wrap.c", SWIG_output_directory(), module);
f_begin = NewFile(outfile, "w", SWIG_output_files()); f_begin = NewFile(outfile, "w", SWIG_output_files());
/* Initialize the output files */ /* Initialize the output files */
if (!f_begin) { if (!f_begin) {
FileErrorDisplay(outfile); FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE); SWIG_exit(EXIT_FAILURE);
} }
f_runtime = NewString(""); f_runtime = NewString("");
f_header = NewString(""); f_header = NewString("");
f_wrappers = NewString(""); f_wrappers = NewString("");
f_init = NewString(""); f_init = NewString("");
/* Register file targets with the SWIG file handler */ /* Register file targets with the SWIG file handler */
Swig_register_filebyname("begin", f_begin); Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime); Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("header", f_header); Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers); Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("init", f_init); Swig_register_filebyname("init", f_init);
/* Insert the banner at the beginning */ /* Insert the banner at the beginning */
Swig_banner(f_begin); Swig_banner(f_begin);
/* Include some header file of scilab */ /* Include some header file of scilab */
if (CPlusPlus) if (CPlusPlus)
Printf(f_runtime, "extern \"C\" {\n"); Printf(f_runtime, "extern \"C\" {\n");
Printf(f_runtime, "#include \"stack-c.h\"\n"); Printf(f_runtime, "#include \"stack-c.h\"\n");
Printf(f_runtime, "#include \"sciprint.h\"\n"); Printf(f_runtime, "#include \"sciprint.h\"\n");
Printf(f_runtime, "#include \"Scierror.h\"\n"); Printf(f_runtime, "#include \"Scierror.h\"\n");
Printf(f_runtime, "#include \"api_scilab.h\"\n"); Printf(f_runtime, "#include \"api_scilab.h\"\n");
Printf(f_runtime, "#include \"localization.h\"\n"); Printf(f_runtime, "#include \"localization.h\"\n");
if (CPlusPlus) if (CPlusPlus)
Printf(f_runtime, "}\n"); Printf(f_runtime, "}\n");
@ -126,13 +126,13 @@ public:
if (CPlusPlus) if (CPlusPlus)
Printf(f_wrappers, "extern \"C\" {\n"); Printf(f_wrappers, "extern \"C\" {\n");
/* Emit code for children */ /* Emit code for children */
Language::top(n); Language::top(n);
if (CPlusPlus) if (CPlusPlus)
Printf(f_wrappers, "}\n"); Printf(f_wrappers, "}\n");
/* Create the file to generate the module: "builder.sce" */ /* Create the file to generate the module: "builder.sce" */
if(hasfunction_flag) { if(hasfunction_flag) {
Printf(f_builder_code, "];\n"); Printf(f_builder_code, "];\n");
@ -147,14 +147,14 @@ public:
else { else {
Delete(f_builder_code); Delete(f_builder_code);
} }
/* Dump out all the files */ /* Dump out all the files */
SwigType_emit_type_table(f_runtime, f_wrappers); SwigType_emit_type_table(f_runtime, f_wrappers);
Dump(f_runtime, f_begin); Dump(f_runtime, f_begin);
Dump(f_header, f_begin); Dump(f_header, f_begin);
Dump(f_wrappers, f_begin); Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin); Wrapper_pretty_print(f_init, f_begin);
/* Close all of the files */ /* Close all of the files */
Delete(f_init); Delete(f_init);
Delete(f_wrappers); Delete(f_wrappers);
@ -162,7 +162,7 @@ public:
Delete(f_runtime); Delete(f_runtime);
Close(f_begin); Close(f_begin);
Delete(f_begin); Delete(f_begin);
return SWIG_OK; return SWIG_OK;
} }
@ -171,7 +171,7 @@ public:
* ---------------------------------------------------------------------- */ * ---------------------------------------------------------------------- */
virtual int functionWrapper(Node *n) { virtual int functionWrapper(Node *n) {
hasfunction_flag = true; hasfunction_flag = true;
/* A new wrapper function object */ /* A new wrapper function object */
@ -182,10 +182,10 @@ public:
/* Determine whether the function is overloaded or not */ /* Determine whether the function is overloaded or not */
bool overloaded = !!Getattr(n, "sym:overloaded"); bool overloaded = !!Getattr(n, "sym:overloaded");
/* Determine whether the function is the last overloaded */ /* Determine whether the function is the last overloaded */
bool last_overload = overloaded && !Getattr(n, "sym:nextSibling"); bool last_overload = overloaded && !Getattr(n, "sym:nextSibling");
String *iname = Getattr(n, "sym:name"); String *iname = Getattr(n, "sym:name");
String *wname = Swig_name_wrapper(iname); String *wname = Swig_name_wrapper(iname);
String *overname = Copy(wname); String *overname = Copy(wname);
@ -202,77 +202,78 @@ public:
/* Emit all of the local variables for holding arguments */ /* Emit all of the local variables for holding arguments */
emit_parameter_variables(l, f); emit_parameter_variables(l, f);
/* Attach typemaps to the parameter list */ /* Attach typemaps to the parameter list */
emit_attach_parmmaps(l, f); emit_attach_parmmaps(l, f);
Setattr(n, "wrap:parms", l); Setattr(n, "wrap:parms", l);
/* Get number of required and total arguments */ /* Get number of required and total arguments */
int num_arguments = emit_num_arguments(l); int num_arguments = emit_num_arguments(l);
int num_required = emit_num_required(l); int num_required = emit_num_required(l);
/* The number of the output */ /* The number of the output */
int out_required = 0; int out_required = 0;
/* Walk the function parameter list and generate code to get arguments */ /* Walk the function parameter list and generate code to get arguments */
for (j = 0, p = l; j < num_arguments; ++j) { for (j = 0, p = l; j < num_arguments; ++j) {
while (checkAttribute(p, "tmap:in:numinputs", "0")) { while (checkAttribute(p, "tmap:in:numinputs", "0")) {
p = Getattr(p, "tmap:in:next"); p = Getattr(p, "tmap:in:next");
} }
SwigType *pt = Getattr(p, "type"); SwigType *pt = Getattr(p, "type");
if ( Equal(SwigType_base(pt), "long long") || Equal(SwigType_base(pt), "unsigned long long")) if ( Equal(SwigType_base(pt), "long long") || Equal(SwigType_base(pt), "unsigned long long")) {
Printv(f->code, " #ifdef __SCILAB_INT64__\n", NIL); Printv(f->code, " #ifdef __SCILAB_INT64__\n", NIL);
}
/* Get typemap for this argument */ /* Get typemap for this argument */
String *tm = Getattr(p, "tmap:in"); String *tm = Getattr(p, "tmap:in");
if (tm) { if (tm) {
if (!tm || checkAttribute(p, "tmap:in:numinputs", "0")) { if (!tm || checkAttribute(p, "tmap:in:numinputs", "0")) {
p = nextSibling(p); p = nextSibling(p);
continue; continue;
} }
char source[64]; char source[64];
sprintf(source, "%d", j + 1); sprintf(source, "%d", j + 1);
Setattr(p, "emit:input", source); Setattr(p, "emit:input", source);
Replaceall(tm, "$input", Getattr(p, "emit:input")); Replaceall(tm, "$input", Getattr(p, "emit:input"));
String *getargs = NewString(""); String *getargs = NewString("");
/* The paremeter is variable */ /* The paremeter is variable */
if (j >= num_required) if (j >= num_required)
Printf(getargs, "if (Rhs > %d) {\n%s\n}", j, tm); Printf(getargs, "if (Rhs > %d) {\n%s\n}", j, tm);
else else
Printv(getargs, tm, NIL); Printv(getargs, tm, NIL);
Printv(f->code, getargs, "\n", NIL); Printv(f->code, getargs, "\n", NIL);
if ( Equal(SwigType_base(pt), "long long") || Equal(SwigType_base(pt), "unsigned long long")) if ( Equal(SwigType_base(pt), "long long") || Equal(SwigType_base(pt), "unsigned long long"))
Printv(f->code, "#endif\n", NIL); Printv(f->code, "#endif\n", NIL);
Delete(getargs); Delete(getargs);
p = Getattr(p, "tmap:in:next"); p = Getattr(p, "tmap:in:next");
continue; continue;
} }
else { else {
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0)); Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
break; break;
} }
} }
Setattr(n, "wrap:name", overname); Setattr(n, "wrap:name", overname);
/* Now write code to make the function call */ /* Now write code to make the function call */
Swig_director_emit_dynamic_cast(n, f); Swig_director_emit_dynamic_cast(n, f);
String *actioncode = emit_action(n); String *actioncode = emit_action(n);
/* Insert the return variable */ /* Insert the return variable */
emit_return_variable(n, d, f); emit_return_variable(n, d, f);
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) { if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
Replaceall(tm, "$result", "result"); Replaceall(tm, "$result", "result");
/* There are more than one output */ /* There are more than one output */
if (out_required > 0) { if (out_required > 0) {
Printf(f->code, "LhsVar(iOutNum) = iVarOut;\n"); Printf(f->code, "LhsVar(iOutNum) = iVarOut;\n");
Printf(f->code, "iOutNum ++;\niVarOut ++;\n"); Printf(f->code, "iOutNum ++;\niVarOut ++;\n");
} }
Printf(f->code, "%s\n", tm); Printf(f->code, "%s\n", tm);
@ -280,22 +281,22 @@ public:
out_required ++; out_required ++;
} }
else { else {
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), iname); Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), iname);
} }
/* Insert argument output code */ /* Insert argument output code */
String *outarg = NewString(""); String *outarg = NewString("");
for (p = l; p;) { for (p = l; p;) {
if ((tm = Getattr(p, "tmap:argout"))) { if ((tm = Getattr(p, "tmap:argout"))) {
//if (out_required > 0) { //if (out_required > 0) {
// Printf(f->code, "LhsVar(iOutNum) = iVarOut;\n"); // Printf(f->code, "LhsVar(iOutNum) = iVarOut;\n");
// Printf(f->code,"iOutNum ++;\niVarOut ++;\n"); // Printf(f->code,"iOutNum ++;\niVarOut ++;\n");
//} //}
Printv(outarg, tm, "\n", NIL); Printv(outarg, tm, "\n", NIL);
p = Getattr(p, "tmap:argout:next"); p = Getattr(p, "tmap:argout:next");
out_required ++; out_required ++;
} else { } else {
p = nextSibling(p); p = nextSibling(p);
} }
} }
Printv(f->code, outarg, NIL); Printv(f->code, outarg, NIL);
@ -303,10 +304,10 @@ public:
/* Insert constraint checking code */ /* Insert constraint checking code */
for (p = l; p;) { for (p = l; p;) {
if ((tm = Getattr(p, "tmap:check"))) { if ((tm = Getattr(p, "tmap:check"))) {
Printv(f->code, tm, "\n", NIL); Printv(f->code, tm, "\n", NIL);
p = Getattr(p, "tmap:check:next"); p = Getattr(p, "tmap:check:next");
} else { } else {
p = nextSibling(p); p = nextSibling(p);
} }
} }
@ -314,12 +315,12 @@ public:
String *cleanup = NewString(""); String *cleanup = NewString("");
for (p = l; p;) { for (p = l; p;) {
if ((tm = Getattr(p, "tmap:freearg"))) { if ((tm = Getattr(p, "tmap:freearg"))) {
if (tm && (Len(tm) != 0)) { if (tm && (Len(tm) != 0)) {
Printv(cleanup, tm, "\n", NIL); Printv(cleanup, tm, "\n", NIL);
} }
p = Getattr(p, "tmap:freearg:next"); p = Getattr(p, "tmap:freearg:next");
} else { } else {
p = nextSibling(p); p = nextSibling(p);
} }
} }
@ -336,7 +337,7 @@ public:
else { else {
flag = 1; flag = 1;
} }
/* Insert the code checking the number of input */ /* Insert the code checking the number of input */
@ -353,16 +354,16 @@ public:
/* Finish the the code for the function */ /* Finish the the code for the function */
//if (flag) //if (flag)
Printf(f->code, "//PutLhsVar();\n"); Printf(f->code, "//PutLhsVar();\n");
Printf(f->code, "return 0;\n"); Printf(f->code, "return 0;\n");
Printf(f->code, "}\n"); Printf(f->code, "}\n");
Replaceall(f->code, "$symname", iname); Replaceall(f->code, "$symname", iname);
/* Dump the wrapper function */ /* Dump the wrapper function */
Wrapper_print(f, f_wrappers); Wrapper_print(f, f_wrappers);
DelWrapper(f); DelWrapper(f);
if (last_overload) { if (last_overload) {
if (++ function_count % 10 == 0) { if (++ function_count % 10 == 0) {
Printf(f_builder_code, "];\n\ntable = [table;"); Printf(f_builder_code, "];\n\ntable = [table;");
@ -400,15 +401,16 @@ public:
String *tmp = NewString(""); String *tmp = NewString("");
Printv(f->def, "int ", wname, " (char *fname, unsigned long fname_len) {\n", NIL); Printv(f->def, "int ", wname, " (char *fname, unsigned long fname_len) {\n", NIL);
/* Get the number of the parameters */ /* Get the number of the parameters */
Wrapper_add_local(f, "argc", "int argc = Rhs"); Wrapper_add_local(f, "argc", "int argc = Rhs");
Wrapper_add_local(f, "sciErr", "SciErr sciErr"); Wrapper_add_local(f, "sciErr", "SciErr sciErr");
Wrapper_add_local(f, "iOutNum", "int iOutNum = 1"); Wrapper_add_local(f, "iOutNum", "int iOutNum = 1");
Wrapper_add_local(f, "iVarOut", "int iVarOut = Rhs + 1"); Wrapper_add_local(f, "iVarOut", "int iVarOut = Rhs + 1");
Printf(tmp, "int argv[%d]={", maxargs); Printf(tmp, "int argv[%d]={", maxargs);
for (int j = 0; j < maxargs; ++j) for (int j = 0; j < maxargs; ++j) {
Printf(tmp, "%s%d", j ? "," : " ", j + 1); Printf(tmp, "%s%d", j ? "," : " ", j + 1);
}
Printf(tmp, "}"); Printf(tmp, "}");
Wrapper_add_local(f, "argv", tmp); Wrapper_add_local(f, "argv", tmp);
/* Dump the dispatch function */ /* Dump the dispatch function */
@ -418,7 +420,7 @@ public:
Printf(f->code, "return 0;\n"); Printf(f->code, "return 0;\n");
Printv(f->code, "}\n", NIL); Printv(f->code, "}\n", NIL);
Wrapper_print(f, f_wrappers); Wrapper_print(f, f_wrappers);
Delete(tmp); Delete(tmp);
DelWrapper(f); DelWrapper(f);
Delete(dispatch); Delete(dispatch);
@ -430,17 +432,17 @@ public:
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
virtual int variableWrapper(Node *n) { virtual int variableWrapper(Node *n) {
hasfunction_flag = true; hasfunction_flag = true;
/* Get the useful information from the node */ /* Get the useful information from the node */
String *name = Getattr(n, "name"); String *name = Getattr(n, "name");
String *iname = Getattr(n, "sym:name"); String *iname = Getattr(n, "sym:name");
SwigType *t = Getattr(n, "type"); SwigType *t = Getattr(n, "type");
if (!addSymbol(iname, n)) if (!addSymbol(iname, n))
return SWIG_ERROR; return SWIG_ERROR;
/* The rows and cols name of the variable */ /* The rows and cols name of the variable */
String *rowname = NewString(""); String *rowname = NewString("");
String *colname = NewString(""); String *colname = NewString("");
@ -448,7 +450,7 @@ public:
Printf(rowname, "iRows_%s", iname); Printf(rowname, "iRows_%s", iname);
Printf(colname, "iCols_%s", iname); Printf(colname, "iCols_%s", iname);
Printf(iscomplexname, "isComplex_%s", iname); Printf(iscomplexname, "isComplex_%s", iname);
/* Two wrapper function to get and set the variable */ /* Two wrapper function to get and set the variable */
String *tm; String *tm;
String *globalVar = NewString(""); String *globalVar = NewString("");
@ -457,17 +459,19 @@ public:
String *getname = Swig_name_get(NSPACE_TODO, iname); String *getname = Swig_name_get(NSPACE_TODO, iname);
String *setname = Swig_name_set(NSPACE_TODO, iname); String *setname = Swig_name_set(NSPACE_TODO, iname);
Printf(globalVar, "int %s = 1;\n", rowname); Printf(globalVar, "int %s = 1;\n", rowname);
Printf(globalVar, "int %s = 1;\n", colname); Printf(globalVar, "int %s = 1;\n", colname);
if(!Strcmp(t, "p.double")) if(!Strcmp(t, "p.double")) {
Printf(globalVar, "int %s = 0;\n\n", iscomplexname); Printf(globalVar, "int %s = 0;\n\n", iscomplexname);
else } else {
Printf(globalVar, "\n"); Printf(globalVar, "\n");
if ( Equal(SwigType_base(t), "long long") || Equal(SwigType_base(t), "unsigned long long")) }
if ( Equal(SwigType_base(t), "long long") || Equal(SwigType_base(t), "unsigned long long")) {
Printv(setf->def, "#ifdef __SCILAB_INT64__\n", NIL); Printv(setf->def, "#ifdef __SCILAB_INT64__\n", NIL);
}
Printv(setf->def, "int ", setname, " (char *fname, unsigned long fname_len) {\n", NIL); Printv(setf->def, "int ", setname, " (char *fname, unsigned long fname_len) {\n", NIL);
/* Check the number of input and output */ /* Check the number of input and output */
Printf(setf->def, "CheckRhs(1, 1);\n"); Printf(setf->def, "CheckRhs(1, 1);\n");
Printf(setf->def, "CheckLhs(1, 1);\n"); Printf(setf->def, "CheckLhs(1, 1);\n");
@ -483,29 +487,29 @@ public:
if (Getattr(n, "unnamedinstance")) if (Getattr(n, "unnamedinstance"))
Setattr(n, "type", "int"); Setattr(n, "type", "int");
if ((tm = Swig_typemap_lookup("varin", n, name, 0))) { if ((tm = Swig_typemap_lookup("varin", n, name, 0))) {
Replaceall(tm, "$argnum", "1"); Replaceall(tm, "$argnum", "1");
Replaceall(tm, "iRows", rowname); Replaceall(tm, "iRows", rowname);
Replaceall(tm, "iCols", colname); Replaceall(tm, "iCols", colname);
Replaceall(tm, "isComplex", iscomplexname); Replaceall(tm, "isComplex", iscomplexname);
Replaceall(tm, "$input", "1"); Replaceall(tm, "$input", "1");
emit_action_code(n, setf->code, tm); emit_action_code(n, setf->code, tm);
Delete(tm); Delete(tm);
} else { } else {
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(t, 0)); Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(t, 0));
} }
} }
else { else {
Append(setf->code, "SWIG_Error(999, \"attempt to set immutable member variable\");"); Append(setf->code, "SWIG_Error(999, \"attempt to set immutable member variable\");");
} }
Append(setf->code, "}\n"); Append(setf->code, "}\n");
if ( Equal(SwigType_base(t), "long long") || Equal(SwigType_base(t), "unsigned long long")) if ( Equal(SwigType_base(t), "long long") || Equal(SwigType_base(t), "unsigned long long"))
Printv(setf->def, "#endif\n", NIL); Printv(setf->def, "#endif\n", NIL);
Wrapper_print(setf, f_wrappers); Wrapper_print(setf, f_wrappers);
if (++ function_count % 10 == 0) { if (++ function_count % 10 == 0) {
Printf(f_builder_code, "];\n\ntable = [table;"); Printf(f_builder_code, "];\n\ntable = [table;");
} }
Printf(f_builder_code, "\"%s\",\"%s\";", setname, setname); Printf(f_builder_code, "\"%s\",\"%s\";", setname, setname);
/* Deal with the get function */ /* Deal with the get function */
Setattr(n, "wrap:name", getname); Setattr(n, "wrap:name", getname);
int addfail = 0; int addfail = 0;
@ -542,22 +546,22 @@ public:
/* Dump the wrapper function */ /* Dump the wrapper function */
Printf(getf->code, "LhsVar(iOutNum) = iVarOut;\n"); Printf(getf->code, "LhsVar(iOutNum) = iVarOut;\n");
Append(getf->code, "}\n"); Append(getf->code, "}\n");
if ( Equal(SwigType_base(t), "long long") || Equal(SwigType_base(t), "unsigned long long")) if ( Equal(SwigType_base(t), "long long") || Equal(SwigType_base(t), "unsigned long long"))
Printv(getf->def, " #endif\n", NIL); Printv(getf->def, " #endif\n", NIL);
Wrapper_print(getf, f_wrappers); Wrapper_print(getf, f_wrappers);
Printf(f_header,"%s", globalVar); Printf(f_header,"%s", globalVar);
if (++ function_count % 10 == 0) { if (++ function_count % 10 == 0) {
Printf(f_builder_code, "];\n\ntable = [table;"); Printf(f_builder_code, "];\n\ntable = [table;");
} }
Printf(f_builder_code, "\"%s\",\"%s\";", getname, getname); Printf(f_builder_code, "\"%s\",\"%s\";", getname, getname);
Delete(rowname); Delete(rowname);
Delete(colname); Delete(colname);
Delete(iscomplexname); Delete(iscomplexname);
Delete(globalVar); Delete(globalVar);
DelWrapper(setf); DelWrapper(setf);
DelWrapper(getf); DelWrapper(getf);
return SWIG_OK; return SWIG_OK;
} }
@ -566,9 +570,9 @@ public:
* ----------------------------------------------------------------------- */ * ----------------------------------------------------------------------- */
virtual int constantWrapper(Node *n) { virtual int constantWrapper(Node *n) {
hasfunction_flag = true; hasfunction_flag = true;
/* Get the useful information from the node */ /* Get the useful information from the node */
String *name = Getattr(n, "name"); String *name = Getattr(n, "name");
String *iname = Getattr(n, "sym:name"); String *iname = Getattr(n, "sym:name");
@ -576,10 +580,10 @@ public:
String *rawval = Getattr(n, "rawval"); String *rawval = Getattr(n, "rawval");
String *value = rawval ? rawval : Getattr(n, "value"); String *value = rawval ? rawval : Getattr(n, "value");
String *tm; String *tm;
if (!addSymbol(iname, n)) if (!addSymbol(iname, n))
return SWIG_ERROR; return SWIG_ERROR;
/* Use the get function to get the constant value */ /* Use the get function to get the constant value */
Wrapper *getf = NewWrapper(); Wrapper *getf = NewWrapper();
String *getname = Swig_name_get(NSPACE_TODO, iname); String *getname = Swig_name_get(NSPACE_TODO, iname);
@ -593,7 +597,7 @@ public:
Printf(getf->def, "SciErr sciErr;\n"); Printf(getf->def, "SciErr sciErr;\n");
/* Insert the order of output parameters*/ /* Insert the order of output parameters*/
Printf(getf->def, "\nint iOutNum=1;\nint iVarOut=Rhs+1;"); Printf(getf->def, "\nint iOutNum=1;\nint iVarOut=Rhs+1;");
/* Insert the argument counter */ /* Insert the argument counter */
//Printf(getf->def, "\nint scilabArgNumber=0;"); //Printf(getf->def, "\nint scilabArgNumber=0;");
@ -612,10 +616,10 @@ public:
Append(getf->code, "}\n"); Append(getf->code, "}\n");
Wrapper_print(getf, f_wrappers); Wrapper_print(getf, f_wrappers);
if (++ function_count % 10 == 0) { if (++ function_count % 10 == 0) {
Printf(f_builder_code, "];\n\ntable = [table;"); Printf(f_builder_code, "];\n\ntable = [table;");
} }
Printf(f_builder_code, "\"%s\",\"%s\";", getname, getname); Printf(f_builder_code, "\"%s\",\"%s\";", getname, getname);
DelWrapper(getf); DelWrapper(getf);
return SWIG_OK; return SWIG_OK;