scilab: roll back on primitive typemaps: return Scilab double on signed integers
This commit is contained in:
parent
ec2d851f4f
commit
a6f824a9a8
5 changed files with 81 additions and 106 deletions
|
|
@ -1,14 +1,14 @@
|
|||
/*
|
||||
* C-type: int
|
||||
* Scilab type: 32-bit signed integer
|
||||
* Scilab type: double or 32-bit signed integer
|
||||
*/
|
||||
|
||||
%fragment(SWIG_AsVal_frag(int), "header", fragment="SWIG_SciInt32_AsInt") {
|
||||
%#define SWIG_AsVal_int(scilabValue, valuePointer) SWIG_SciInt32_AsInt(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFname())
|
||||
%fragment(SWIG_AsVal_frag(int), "header", fragment="SWIG_SciDoubleOrInt32_AsInt") {
|
||||
%#define SWIG_AsVal_int(scilabValue, valuePointer) SWIG_SciDoubleOrInt32_AsInt(pvApiCtx, scilabValue, valuePointer, SWIG_Scilab_GetFname())
|
||||
}
|
||||
%fragment("SWIG_SciInt32_AsInt", "header") {
|
||||
%fragment("SWIG_SciDoubleOrInt32_AsInt", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt32_AsInt(void *_pvApiCtx, SwigSciObject _iVar, int *_piValue, char *_fname)
|
||||
SWIG_SciDoubleOrInt32_AsInt(void *_pvApiCtx, SwigSciObject _iVar, int *_piValue, char *_fname)
|
||||
{
|
||||
SciErr sciErr;
|
||||
int iRet = 0;
|
||||
|
|
@ -74,21 +74,14 @@ SWIG_SciInt32_AsInt(void *_pvApiCtx, SwigSciObject _iVar, int *_piValue, char *_
|
|||
}
|
||||
}
|
||||
|
||||
%fragment(SWIG_From_frag(int), "header", fragment="SWIG_SciInt32_FromInt") {
|
||||
%#define SWIG_From_int(scilabValue) SWIG_SciInt32_FromInt(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFname())
|
||||
%fragment(SWIG_From_frag(int), "header", fragment="SWIG_SciDouble_FromInt") {
|
||||
%#define SWIG_From_int(scilabValue) SWIG_SciDouble_FromInt(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFname())
|
||||
}
|
||||
%fragment("SWIG_SciInt32_FromInt", "header") {
|
||||
%fragment("SWIG_SciDouble_FromInt", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt32_FromInt(void *_pvApiCtx, int _iVarOut, int _iValue, char *_fname)
|
||||
SWIG_SciDouble_FromInt(void *_pvApiCtx, int _iVarOut, int _iValue, char *_fname)
|
||||
{
|
||||
SciErr sciErr;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
|
||||
sciErr = createMatrixOfInteger32(_pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + _iVarOut, iRowsOut, iColsOut, &_iValue);
|
||||
if (sciErr.iErr)
|
||||
{
|
||||
printError(&sciErr, 0);
|
||||
if (createScalarDouble(_pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + _iVarOut, (double) _iValue)) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* C-type: long
|
||||
* Scilab type: int32
|
||||
* Scilab type: double or int32
|
||||
*/
|
||||
|
||||
%fragment(SWIG_AsVal_frag(long), "header", fragment="SWIG_Int_AsLong") {
|
||||
|
|
@ -30,7 +30,7 @@ SWIG_Int_FromLong(void *_pvApiCtx, int _iVarOut, long _lValue, char *_fname) {
|
|||
|
||||
/*
|
||||
* C-type: ptrdiff_t
|
||||
* Scilab type: int32
|
||||
* Scilab type: double or int32
|
||||
*/
|
||||
|
||||
%fragment(SWIG_AsVal_frag(ptrdiff_t), "header", fragment="SWIG_Int_AsPtrDiff") {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* C-type: short
|
||||
* Scilab type: double scalar
|
||||
* Scilab type: double or int16
|
||||
*/
|
||||
|
||||
%fragment(SWIG_AsVal_frag(short), "header", fragment="SWIG_SciInt16_AsShort") {
|
||||
|
|
@ -62,18 +62,10 @@ SWIG_SciInt16_AsShort(void *_pvApiCtx, int _iVar, short *_psValue, char *_fname)
|
|||
%fragment(SWIG_From_frag(short), "header", fragment="SWIG_SciInt16_FromShort") {
|
||||
#define SWIG_From_short(scilabValue) SWIG_SciInt16_FromShort(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFname())
|
||||
}
|
||||
%fragment("SWIG_SciInt16_FromShort", "header") {
|
||||
%fragment("SWIG_SciInt16_FromShort", "header", fragment=SWIG_From_frag(int)) {
|
||||
SWIGINTERN int
|
||||
SWIG_SciInt16_FromShort(void *_pvApiCtx, int _iVarOut, signed short _usValue, char *_fname) {
|
||||
SciErr sciErr;
|
||||
int iRowsOut = 1;
|
||||
int iColsOut = 1;
|
||||
sciErr = createMatrixOfInteger16(_pvApiCtx, SWIG_NbInputArgument(_pvApiCtx) + _iVarOut, iRowsOut, iColsOut, &_usValue);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
return SWIG_NbInputArgument(_pvApiCtx) + _iVarOut;
|
||||
SWIG_SciInt16_FromShort(void *_pvApiCtx, int _iVarOut, short _sValue, char *_fname) {
|
||||
return SWIG_From_dec(int)((int)_sValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue