Scilab: support of Scilab 5.3.3 (api_scilab: Rhs, Lhs, ..)
This commit is contained in:
parent
3a190fec2b
commit
0fc9e4d0a4
9 changed files with 50 additions and 28 deletions
|
|
@ -244,12 +244,12 @@ SwigScilabStringFromCharPtrArray(void *_pvApiCtx, int _iVarOut, char **_charPtrA
|
|||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
sciErr = createMatrixOfString(_pvApiCtx, nbInputArgument(pvApiCtx) + _iVarOut, _charPtrArraySize, 1, _charPtrArray);
|
||||
sciErr = createMatrixOfString(_pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + _iVarOut, _charPtrArraySize, 1, _charPtrArray);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
return nbInputArgument(pvApiCtx) + _iVarOut;
|
||||
return SWIG_NbInputArgument(pvApiCtx) + _iVarOut;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ SWIG_From_dec(int)(int _iValue)
|
|||
double dblDoubleValue = (double) _iValue;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
int iVarOut = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
int iVarOut = SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
|
||||
sciErr = createMatrixOfDouble(pvApiCtx, iVarOut, iRowsOut, iColsOut, &dblDoubleValue);
|
||||
if (sciErr.iErr)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
{
|
||||
if (SwigScilabStringFromCharPtrArray(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
{
|
||||
if (SwigScilabStringFromCharPtrArray(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$1) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
{
|
||||
if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
{
|
||||
if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
{
|
||||
if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -172,7 +172,7 @@
|
|||
{
|
||||
if (SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
{
|
||||
if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$2, *$3, *$1) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
{
|
||||
if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), *$1, *$2, *$3) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -144,7 +144,7 @@
|
|||
{
|
||||
if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$2, *$1) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
{
|
||||
if (SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, SWIG_Scilab_GetOutputPosition(), 1, *$1, *$2) != SWIG_ERROR)
|
||||
{
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@ SWIGINTERN int
|
|||
SwigScilabInt32FromEnum(void *_pvApiCtx, int _iVarOut, int _enumValue)
|
||||
{
|
||||
int iRet;
|
||||
iRet = createScalarInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + _iVarOut, _enumValue);
|
||||
iRet = createScalarInteger32(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + _iVarOut, _enumValue);
|
||||
if (iRet)
|
||||
{
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
AssignOutputVariable(pvApiCtx, _iVarOut) = nbInputArgument(pvApiCtx) + _iVarOut;
|
||||
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + _iVarOut);
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,10 @@ SWIG_Scilab_ErrorMsg(int code, const char *mesg)
|
|||
sciprint(_("SWIG/Scilab Error : %s\n%s"),SWIG_Scilab_ErrorType(code),mesg);
|
||||
}
|
||||
|
||||
|
||||
#define SCILAB_VERSION_54_OR_HIGHER (SCI_VERSION_MAJOR > 5) || ((SCI_VERSION_MAJOR == 5) && (SCI_VERSION_MINOR >= 4))
|
||||
#if !SCILAB_VERSION_54_OR_HIGHER
|
||||
#include "stack-c.h"
|
||||
#endif
|
||||
|
||||
#define SWIG_fail return SWIG_ERROR;
|
||||
#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code)
|
||||
|
|
@ -75,6 +78,20 @@ SWIG_Scilab_ErrorMsg(int code, const char *mesg)
|
|||
/* Used for C++ enums */
|
||||
//#define SWIG_AsVal_int(scilabValue, valuePointer) SWIG_SciDouble_AsInt(pvApiCtx, scilabValue, valuePointer, fname)
|
||||
|
||||
|
||||
#if SCILAB_VERSION_54_OR_HIGHER
|
||||
#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument)
|
||||
#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument)
|
||||
#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx)
|
||||
|
||||
#else
|
||||
|
||||
#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckRhs(minInputArgument, maxInputArgument)
|
||||
#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckLhs(minOutputArgument, maxOutputArgument)
|
||||
#define SWIG_NbInputArgument(pvApiCtx) Rhs
|
||||
#endif
|
||||
|
||||
|
||||
SWIGINTERN int
|
||||
SwigScilabPtrToObject(void *_pvApiCtx, int _iVar, void **_pObjValue, swig_type_info *_descriptor, int _flags, char *_fname) {
|
||||
SciErr sciErr;
|
||||
|
|
@ -214,7 +231,11 @@ SWIG_Scilab_SetOutput(void *_pvApiCtx, SciObject _output) {
|
|||
if (outputPosition < 0 || _output < 0) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
AssignOutputVariable(_pvApiCtx, outputPosition) = _output;
|
||||
#if SCILAB_VERSION_54_OR_HIGHER
|
||||
AssignOutputVariable(pvApiCtx, outputPosition) = _output;
|
||||
#else
|
||||
LhsVar(outputPosition) = _output;
|
||||
#endif
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ SWIG_FromSet_Sequence_dec(ptr)(int _size, long long *_sequence) {
|
|||
SciErr sciErr;
|
||||
int *piListAddr;
|
||||
|
||||
int iVarOut = nbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
int iVarOut = SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition();
|
||||
|
||||
sciErr = createList(pvApiCtx, iVarOut, _size, &piListAddr);
|
||||
if (sciErr.iErr)
|
||||
|
|
|
|||
|
|
@ -285,9 +285,10 @@ public:
|
|||
int minInputArguments = emit_num_required(functionParamsList);
|
||||
int minOutputArguments = 0;
|
||||
int maxOutputArguments = 0;
|
||||
|
||||
/* Insert calls to CheckInputArgument and CheckOutputArgument */
|
||||
Printf(wrapper->code, "CheckInputArgument(pvApiCtx, $mininputarguments, $maxinputarguments);\n");
|
||||
Printf(wrapper->code, "CheckOutputArgument(pvApiCtx, $minoutputarguments, $maxoutputarguments);\n");
|
||||
Printf(wrapper->code, "SWIG_CheckInputArgument(pvApiCtx, $mininputarguments, $maxinputarguments);\n");
|
||||
Printf(wrapper->code, "SWIG_CheckOutputArgument(pvApiCtx, $minoutputarguments, $maxoutputarguments);\n");
|
||||
Printf(wrapper->code, "SWIG_Scilab_SetFname(fname);\n");
|
||||
|
||||
for (paramIndex = 0, param = functionParamsList; paramIndex < maxInputArguments; ++paramIndex) {
|
||||
|
|
@ -314,7 +315,7 @@ public:
|
|||
}
|
||||
|
||||
if (paramIndex >= minInputArguments) { /* Optional input argument management */
|
||||
Printf(wrapper->code, "if (Rhs > %d) {\n%s\n}\n", paramIndex, paramTypemap);
|
||||
Printf(wrapper->code, "if (SWIG_NbInputArgument(pvApiCtx) > %d) {\n%s\n}\n", paramIndex, paramTypemap);
|
||||
} else {
|
||||
Printf(wrapper->code, "%s\n", paramTypemap);
|
||||
}
|
||||
|
|
@ -461,7 +462,7 @@ public:
|
|||
Printv(wrapper->def, "int ", wrapperName, " (char *fname, unsigned long fname_len) {\n", NIL);
|
||||
|
||||
/* Get the number of the parameters */
|
||||
Wrapper_add_local(wrapper, "argc", "int argc = Rhs");
|
||||
Wrapper_add_local(wrapper, "argc", "int argc = SWIG_NbInputArgument(pvApiCtx)");
|
||||
Printf(tmp, "int argv[%d] = {", maxargs);
|
||||
for (int j = 0; j < maxargs; ++j) {
|
||||
Printf(tmp, "%s%d", j ? "," : " ", j + 1);
|
||||
|
|
@ -499,8 +500,8 @@ public:
|
|||
Printv(getFunctionWrapper->def, "int ", getFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL);
|
||||
|
||||
/* Check the number of input and output */
|
||||
Printf(getFunctionWrapper->def, "CheckInputArgument(pvApiCtx, 0, 0);\n");
|
||||
Printf(getFunctionWrapper->def, "CheckOutputArgument(pvApiCtx, 1, 1);\n");
|
||||
Printf(getFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 0, 0);\n");
|
||||
Printf(getFunctionWrapper->def, "SWIG_CheckOutputArgument(pvApiCtx, 1, 1);\n");
|
||||
|
||||
String *varoutTypemap = Swig_typemap_lookup("varout", node, origVariableName, 0);
|
||||
if (varoutTypemap != NULL) {
|
||||
|
|
@ -526,8 +527,8 @@ public:
|
|||
Printv(setFunctionWrapper->def, "int ", setFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL);
|
||||
|
||||
/* Check the number of input and output */
|
||||
Printf(setFunctionWrapper->def, "CheckInputArgument(pvApiCtx, 1, 1);\n");
|
||||
Printf(setFunctionWrapper->def, "CheckOutputArgument(pvApiCtx, 1, 1);\n");
|
||||
Printf(setFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 1, 1);\n");
|
||||
Printf(setFunctionWrapper->def, "SWIG_CheckOutputArgument(pvApiCtx, 1, 1);\n");
|
||||
|
||||
String *varinTypemap = Swig_typemap_lookup("varin", node, origVariableName, 0);
|
||||
if (varinTypemap != NULL) {
|
||||
|
|
@ -575,8 +576,8 @@ public:
|
|||
Printv(getFunctionWrapper->def, "int ", getFunctionName, "(char *fname, unsigned long fname_len) {\n", NIL);
|
||||
|
||||
/* Check the number of input and output */
|
||||
Printf(getFunctionWrapper->def, "CheckInputArgument(pvApiCtx, 0, 0);\n");
|
||||
Printf(getFunctionWrapper->def, "CheckOutputArgument(pvApiCtx, 1, 1);\n");
|
||||
Printf(getFunctionWrapper->def, "SWIG_CheckInputArgument(pvApiCtx, 0, 0);\n");
|
||||
Printf(getFunctionWrapper->def, "SWIG_CheckOutputArgument(pvApiCtx, 1, 1);\n");
|
||||
|
||||
constantTypemap = Swig_typemap_lookup("constcode", node, nodeName, 0);
|
||||
if (constantTypemap != NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue