scilab: use String and Printf in scilab.cxx

This commit is contained in:
Simon Marchetto 2014-07-21 10:47:20 +02:00
commit 46d1ae77cd

View file

@ -354,8 +354,8 @@ public:
if (paramTypemap) { if (paramTypemap) {
// Replace $input by the position on Scilab stack // Replace $input by the position on Scilab stack
char source[64]; String *source = NewString("");
sprintf(source, "%d", paramIndex + 1); Printf(source, "%d", paramIndex + 1);
Setattr(param, "emit:input", source); Setattr(param, "emit:input", source);
Replaceall(paramTypemap, "$input", Getattr(param, "emit:input")); Replaceall(paramTypemap, "$input", Getattr(param, "emit:input"));
@ -426,8 +426,8 @@ public:
minOutputArguments++; minOutputArguments++;
maxOutputArguments++; maxOutputArguments++;
Printf(wrapper->code, "SWIG_Scilab_SetOutputPosition(%d);\n", minOutputArguments); Printf(wrapper->code, "SWIG_Scilab_SetOutputPosition(%d);\n", minOutputArguments);
char result[64] = { }; String *result = NewString("");
sprintf(result, "%d", minOutputArguments); Printf(result, "%d", minOutputArguments);
Replaceall(paramTypemap, "$result", result); Replaceall(paramTypemap, "$result", result);
Printf(wrapper->code, "%s\n", paramTypemap); Printf(wrapper->code, "%s\n", paramTypemap);
Delete(paramTypemap); Delete(paramTypemap);
@ -466,14 +466,14 @@ public:
if (minOutputArguments == 0) { if (minOutputArguments == 0) {
maxOutputArguments = 1; maxOutputArguments = 1;
} }
char argnumber[64] = { }; String *argnumber = NewString("");
sprintf(argnumber, "%d", minInputArguments); Printf(argnumber, "%d", minInputArguments);
Replaceall(wrapper->code, "$mininputarguments", argnumber); Replaceall(wrapper->code, "$mininputarguments", argnumber);
sprintf(argnumber, "%d", maxInputArguments); Printf(argnumber, "%d", maxInputArguments);
Replaceall(wrapper->code, "$maxinputarguments", argnumber); Replaceall(wrapper->code, "$maxinputarguments", argnumber);
sprintf(argnumber, "%d", minOutputArguments); Printf(argnumber, "%d", minOutputArguments);
Replaceall(wrapper->code, "$minoutputarguments", argnumber); Replaceall(wrapper->code, "$minoutputarguments", argnumber);
sprintf(argnumber, "%d", maxOutputArguments); Printf(argnumber, "%d", maxOutputArguments);
Replaceall(wrapper->code, "$maxoutputarguments", argnumber); Replaceall(wrapper->code, "$maxoutputarguments", argnumber);
/* Dump the function out */ /* Dump the function out */