Some change:getVarAddressFromPosition,createMatrixOfDouble,createMatrixOfString and add argument number checking
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11315 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0eb0740556
commit
8d2ce8c8a8
5 changed files with 252 additions and 43 deletions
|
|
@ -1139,7 +1139,7 @@ r_clean:
|
||||||
##### SCILAB ######
|
##### SCILAB ######
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
# Make sure these locate your Octave installation
|
# Make sure these locate your Scilab installation
|
||||||
SCILAB_INCLUDE= $(DEFS) @SCILABINCLUDE@
|
SCILAB_INCLUDE= $(DEFS) @SCILABINCLUDE@
|
||||||
SCILAB_LIB = @SCILABLIB@
|
SCILAB_LIB = @SCILABLIB@
|
||||||
SCILAB = @SCILAB@
|
SCILAB = @SCILAB@
|
||||||
|
|
@ -1158,5 +1158,5 @@ scilab: $(SRCS)
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
scilab_clean:
|
scilab_clean:
|
||||||
rm -f *_wrap*
|
rm -f *.sce *.so lib*lib.c
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
float (int *piAddrVar, int iRows, int iCols),
|
float (int *piAddrVar, int iRows, int iCols),
|
||||||
double (int *piAddrVar, int iRows, int iCols) {
|
double (int *piAddrVar, int iRows, int iCols) {
|
||||||
double* _piData;
|
double* _piData;
|
||||||
getVarAddressFromNumber($argnum, &piAddrVar);
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
getVarDimension(piAddrVar, &iRows, &iCols);
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
if (getVarType(piAddrVar) != sci_matrix || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
if (getVarType(piAddrVar) != sci_matrix || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
%typemap(in) char (int *piAddrVar, int iRows, int iCols) {
|
%typemap(in) char (int *piAddrVar, int iRows, int iCols) {
|
||||||
char* _pstStrings;
|
char* _pstStrings;
|
||||||
int _piLength;
|
int _piLength;
|
||||||
getVarAddressFromNumber($argnum, &piAddrVar);
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
getVarDimension(piAddrVar, &iRows, &iCols);
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
if (getVarType(piAddrVar) != sci_strings || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
if (getVarType(piAddrVar) != sci_strings || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
||||||
|
|
@ -51,18 +51,82 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pointers */
|
/* Pointers */
|
||||||
%typemap(in) signed char *(int *piAddrVar, int iRows, int iCols, signed char temp),
|
%typemap(in) signed char *(int *piAddrVar, int iRows, int iCols) {
|
||||||
unsigned char *(int *piAddrVar, int iRows, int iCols, unsigned char temp),
|
char* _piData;
|
||||||
short *(int *piAddrVar, int iRows, int iCols, short temp),
|
int index;
|
||||||
unsigned short *(int *piAddrVar, int iRows, int iCols, unsigned short temp),
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
int *(int *piAddrVar, int iRows, int iCols, int temp),
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
unsigned int *(int *piAddrVar, int iRows, int iCols, unsigned int temp),
|
|
||||||
long *(int *piAddrVar, int iRows, int iCols, long temp),
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
unsigned long *(int *piAddrVar, int iRows, int iCols, unsigned long temp),
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
|
||||||
float *(int *piAddrVar, int iRows, int iCols, float temp),
|
}
|
||||||
double *(int *piAddrVar, int iRows, int iCols, double temp) {
|
getMatrixOfInteger8(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
if($1!=NULL) {
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
$1=($1_ltype)malloc(iRows*iCols*sizeof($*1_ltype));
|
||||||
|
for(index=0;index<iRows*iCols;index++){
|
||||||
|
$1[index]=($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(in) short *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned char *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
short [](int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned char [](int *piAddrVar, int iRows, int iCols) {
|
||||||
|
short* _piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
|
||||||
|
}
|
||||||
|
getMatrixOfInteger16(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
if($1!=NULL) {
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
$1=($1_ltype)malloc(iRows*iCols*sizeof($*1_ltype));
|
||||||
|
for(index=0;index<iRows*iCols;index++){
|
||||||
|
$1[index]=($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(in) unsigned short *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
int *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned int *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
long *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned long *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned short [](int *piAddrVar, int iRows, int iCols),
|
||||||
|
int [](int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned int [](int *piAddrVar, int iRows, int iCols),
|
||||||
|
long [](int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned long [](int *piAddrVar, int iRows, int iCols) {
|
||||||
|
int* _piData;
|
||||||
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
|
||||||
|
}
|
||||||
|
getMatrixOfInteger32(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
if($1!=NULL) {
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
$1=($1_ltype)malloc(iRows*iCols*sizeof($*1_ltype));
|
||||||
|
for(index=0;index<iRows*iCols;index++){
|
||||||
|
$1[index]=($*1_ltype)_piData[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(in) double *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
float *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
double [](int *piAddrVar, int iRows, int iCols),
|
||||||
|
float [](int *piAddrVar, int iRows, int iCols){
|
||||||
double* _piData;
|
double* _piData;
|
||||||
getVarAddressFromNumber($argnum, &piAddrVar);
|
int index;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
getVarDimension(piAddrVar, &iRows, &iCols);
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
if (getVarType(piAddrVar) != sci_matrix || isVarComplex(piAddrVar)) {
|
if (getVarType(piAddrVar) != sci_matrix || isVarComplex(piAddrVar)) {
|
||||||
|
|
@ -73,15 +137,16 @@
|
||||||
free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
$1=($1_ltype)malloc(iRows*iCols*sizeof($*1_ltype));
|
$1=($1_ltype)malloc(iRows*iCols*sizeof($*1_ltype));
|
||||||
memcpy($1,_piData,iRows*iCols*sizeof($*1_ltype));
|
for(index=0;index<iRows*iCols;index++){
|
||||||
//temp=($*1_ltype)*_piData;
|
$1[index]=($*1_ltype)_piData[index];
|
||||||
//$1=&temp;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in) char *(int *piAddrVar, int iRows, int iCols) {
|
%typemap(in) char *(int *piAddrVar, int iRows, int iCols),
|
||||||
|
char [](int *piAddrVar, int iRows, int iCols){
|
||||||
char* _pstStrings;
|
char* _pstStrings;
|
||||||
int _piLength;
|
int _piLength;
|
||||||
getVarAddressFromNumber($argnum, &piAddrVar);
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
getVarDimension(piAddrVar, &iRows, &iCols);
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
if (getVarType(piAddrVar) != sci_strings || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
if (getVarType(piAddrVar) != sci_strings || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
||||||
|
|
@ -91,6 +156,113 @@
|
||||||
$1=strdup(_pstStrings);
|
$1=strdup(_pstStrings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Arrays */
|
||||||
|
%typemap(in) signed char [ANY][ANY](int *piAddrVar, int iRows, int iCols) {
|
||||||
|
char* _piData;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
|
||||||
|
}
|
||||||
|
getMatrixOfInteger8(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
if($1!=NULL) {
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
$1=($1_ltype)malloc($1_dim0*$1_dim1*sizeof($1_basetype));
|
||||||
|
size_t jj;
|
||||||
|
for(jj=0;jj<$1_dim1;jj++){
|
||||||
|
size_t ii;
|
||||||
|
for(ii=0;ii<$1_dim0;ii++)
|
||||||
|
$1[ii][jj]=($1_basetype)_piData[jj*$1_dim0+ii];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(in) short [ANY][ANY](int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned char [ANY][ANY](int *piAddrVar, int iRows, int iCols) {
|
||||||
|
short* _piData;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
|
||||||
|
}
|
||||||
|
getMatrixOfInteger16(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
if($1!=NULL) {
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
$1=($1_ltype)malloc($1_dim0*$1_dim1*sizeof($1_basetype));
|
||||||
|
size_t jj;
|
||||||
|
for(jj=0;jj<$1_dim1;jj++){
|
||||||
|
size_t ii;
|
||||||
|
for(ii=0;ii<$1_dim0;ii++)
|
||||||
|
$1[ii][jj]=($1_basetype)_piData[jj*$1_dim0+ii];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(in) unsigned short [ANY][ANY](int *piAddrVar, int iRows, int iCols),
|
||||||
|
int [ANY][ANY](int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned int [ANY][ANY](int *piAddrVar, int iRows, int iCols),
|
||||||
|
long [ANY][ANY](int *piAddrVar, int iRows, int iCols),
|
||||||
|
unsigned long [ANY][ANY](int *piAddrVar, int iRows, int iCols){
|
||||||
|
int* _piData;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_ints || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
|
||||||
|
}
|
||||||
|
getMatrixOfInteger32(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
if($1!=NULL) {
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
$1=($1_ltype)malloc($1_dim0*$1_dim1*sizeof($1_basetype));
|
||||||
|
size_t jj;
|
||||||
|
for(jj=0;jj<$1_dim1;jj++){
|
||||||
|
size_t ii;
|
||||||
|
for(ii=0;ii<$1_dim0;ii++)
|
||||||
|
$1[ii][jj]=($1_basetype)_piData[jj*$1_dim0+ii];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
%typemap(in) double [ANY][ANY](int *piAddrVar, int iRows, int iCols),
|
||||||
|
float [ANY][ANY](int *piAddrVar, int iRows, int iCols) {
|
||||||
|
double* _piData;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_matrix || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
|
||||||
|
}
|
||||||
|
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
if($1!=NULL) {
|
||||||
|
free($1);
|
||||||
|
}
|
||||||
|
$1=($1_ltype)malloc($1_dim0*$1_dim1*sizeof($1_basetype));
|
||||||
|
size_t jj;
|
||||||
|
for(jj=0;jj<$1_dim1;jj++){
|
||||||
|
size_t ii;
|
||||||
|
for(ii=0;ii<$1_dim0;ii++)
|
||||||
|
$1[ii][jj]=($1_basetype)_piData[jj*$1_dim0+ii];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(in) SWIGTYPE *(int *piAddrVar, int iRows, int iCols) {
|
||||||
|
$&1_ltype _piData=($&1_ltype)0;
|
||||||
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
|
if (getVarType(piAddrVar) != sci_matrix || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
|
||||||
|
}
|
||||||
|
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
|
||||||
|
$1=($1_ltype)*_piData;
|
||||||
|
}
|
||||||
|
%typemap(in) SWIGTYPE {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* --- Output arguments ---
|
* --- Output arguments ---
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
@ -134,24 +306,24 @@
|
||||||
iVarOut++;
|
iVarOut++;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) double (int iRowsOut,int iColsOut,int* _piAddress),
|
%typemap(out) double (int iRowsOut,int iColsOut),
|
||||||
float (int iRowsOut,int iColsOut,int* _piAddress) {
|
float (int iRowsOut,int iColsOut) {
|
||||||
double temp;
|
double temp;
|
||||||
temp=(double)($result);
|
temp=(double)($result);
|
||||||
iRowsOut=1;
|
iRowsOut=1;
|
||||||
iColsOut=1;
|
iColsOut=1;
|
||||||
createMatrixOfDouble(iVarOut, iRowsOut, iColsOut, &temp, &_piAddress);
|
createMatrixOfDouble(iVarOut, iRowsOut, iColsOut, &temp);
|
||||||
LhsVar(iOutNum)=iVarOut;
|
LhsVar(iOutNum)=iVarOut;
|
||||||
iOutNum++;
|
iOutNum++;
|
||||||
iVarOut++;
|
iVarOut++;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) char (int iRowsOut,int iColsOut,int* _piAddress) {
|
%typemap(out) char (int iRowsOut,int iColsOut) {
|
||||||
char* temp;
|
char* temp;
|
||||||
temp=(char*)&($result);
|
temp=(char*)&($result);
|
||||||
iRowsOut=1;
|
iRowsOut=1;
|
||||||
iColsOut=1;
|
iColsOut=1;
|
||||||
createMatrixOfString(iVarOut, iRowsOut, iColsOut, &temp, &_piAddress);
|
createMatrixOfString(iVarOut, iRowsOut, iColsOut, &temp);
|
||||||
LhsVar(iOutNum)=iVarOut;
|
LhsVar(iOutNum)=iVarOut;
|
||||||
iOutNum++;
|
iOutNum++;
|
||||||
iVarOut++;
|
iVarOut++;
|
||||||
|
|
@ -199,22 +371,31 @@
|
||||||
iVarOut++;
|
iVarOut++;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) double *(int iRowsOut,int iColsOut,int* _piAddress),
|
%typemap(out) double *(int iRowsOut,int iColsOut),
|
||||||
float *(int iRowsOut,int iColsOut,int* _piAddress) {
|
float *(int iRowsOut,int iColsOut) {
|
||||||
double *temp;
|
double *temp;
|
||||||
temp=(double *)($result);
|
temp=(double *)($result);
|
||||||
iRowsOut=1;
|
iRowsOut=1;
|
||||||
iColsOut=1;
|
iColsOut=1;
|
||||||
createMatrixOfDouble(iVarOut, iRowsOut, iColsOut, temp, &_piAddress);
|
createMatrixOfDouble(iVarOut, iRowsOut, iColsOut, temp);
|
||||||
LhsVar(iOutNum)=iVarOut;
|
LhsVar(iOutNum)=iVarOut;
|
||||||
iOutNum++;
|
iOutNum++;
|
||||||
iVarOut++;
|
iVarOut++;
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(out) char *(int iRowsOut,int iColsOut,int* _piAddress){
|
%typemap(out) char *(int iRowsOut,int iColsOut){
|
||||||
iRowsOut=1;
|
iRowsOut=1;
|
||||||
iColsOut=1;
|
iColsOut=1;
|
||||||
createMatrixOfString(iVarOut, iRowsOut, iColsOut, &($result), &_piAddress);
|
createMatrixOfString(iVarOut, iRowsOut, iColsOut, &($result));
|
||||||
|
LhsVar(iOutNum)=iVarOut;
|
||||||
|
iOutNum++;
|
||||||
|
iVarOut++;
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(out) SWIGTYPE *(int iRowsOut,int iColsOut) {
|
||||||
|
iRowsOut=1;
|
||||||
|
iColsOut=1;
|
||||||
|
createMatrixOfDouble(iVarOut, iRowsOut, iColsOut, &$result);
|
||||||
LhsVar(iOutNum)=iVarOut;
|
LhsVar(iOutNum)=iVarOut;
|
||||||
iOutNum++;
|
iOutNum++;
|
||||||
iVarOut++;
|
iVarOut++;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ or you can use the %apply directive :
|
||||||
float *INPUT (int *piAddrVar, int iRows, int iCols, float temp),
|
float *INPUT (int *piAddrVar, int iRows, int iCols, float temp),
|
||||||
double *INPUT (int *piAddrVar, int iRows, int iCols, double temp) {
|
double *INPUT (int *piAddrVar, int iRows, int iCols, double temp) {
|
||||||
double* _piData;
|
double* _piData;
|
||||||
getVarAddressFromNumber($argnum, &piAddrVar);
|
getVarAddressFromPosition($argnum, &piAddrVar);
|
||||||
getVarDimension(piAddrVar, &iRows, &iCols);
|
getVarDimension(piAddrVar, &iRows, &iCols);
|
||||||
|
|
||||||
if (getVarType(piAddrVar) != sci_matrix || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
if (getVarType(piAddrVar) != sci_matrix || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
|
||||||
|
|
@ -123,7 +123,7 @@ output values.
|
||||||
|
|
||||||
// Force the argument to be ignored.
|
// Force the argument to be ignored.
|
||||||
|
|
||||||
%typemap(in) signed char *OUTPUT (signed temp),
|
%typemap(in,numinputs=0) signed char *OUTPUT (signed temp),
|
||||||
unsigned char *OUTPUT (unsigned temp),
|
unsigned char *OUTPUT (unsigned temp),
|
||||||
short *OUTPUT (short temp),
|
short *OUTPUT (short temp),
|
||||||
unsigned short *OUTPUT (unsigned short temp),
|
unsigned short *OUTPUT (unsigned short temp),
|
||||||
|
|
@ -169,13 +169,13 @@ output values.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
%typemap(argout) double *OUTPUT(int iRowsOut,int iColsOut,int* _piAddress),
|
%typemap(argout) double *OUTPUT(int iRowsOut,int iColsOut),
|
||||||
float *OUTPUT(int iRowsOut,int iColsOut,int* _piAddress) {
|
float *OUTPUT(int iRowsOut,int iColsOut) {
|
||||||
double temp;
|
double temp;
|
||||||
temp=(double)(*$result);
|
temp=(double)(*$result);
|
||||||
iRowsOut=1;
|
iRowsOut=1;
|
||||||
iColsOut=1;
|
iColsOut=1;
|
||||||
createMatrixOfDouble(iVarOut, iRowsOut, iColsOut, &temp$argnum, &_piAddress);
|
createMatrixOfDouble(iVarOut, iRowsOut, iColsOut, &temp$argnum);
|
||||||
LhsVar(iOutNum)=iVarOut;
|
LhsVar(iOutNum)=iVarOut;
|
||||||
iOutNum++;
|
iOutNum++;
|
||||||
iVarOut++;
|
iVarOut++;
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ clisp_examples :=
|
||||||
uffi_examples :=
|
uffi_examples :=
|
||||||
cffi_examples :=
|
cffi_examples :=
|
||||||
r_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/r/check.list)
|
r_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/r/check.list)
|
||||||
scilab_examples :=
|
scilab_examples :=$(shell sed '/^\#/d' $(srcdir)/Examples/scilab/check.list)
|
||||||
|
|
||||||
# all examples
|
# all examples
|
||||||
check-%-examples :
|
check-%-examples :
|
||||||
|
|
@ -206,7 +206,7 @@ check-gifplot: \
|
||||||
# check-lua-gifplot \
|
# check-lua-gifplot \
|
||||||
# check-csharp-gifplot \
|
# check-csharp-gifplot \
|
||||||
# check-modula3-gifplot \
|
# check-modula3-gifplot \
|
||||||
check-scilab-gifplot
|
check-scilab-gifplot
|
||||||
check-%-gifplot: gifplot-library
|
check-%-gifplot: gifplot-library
|
||||||
@if test -z "$(skip-$*)"; then \
|
@if test -z "$(skip-$*)"; then \
|
||||||
echo $* unknown; \
|
echo $* unknown; \
|
||||||
|
|
@ -253,7 +253,7 @@ check-test-suite: \
|
||||||
check-cffi-test-suite \
|
check-cffi-test-suite \
|
||||||
check-chicken-test-suite \
|
check-chicken-test-suite \
|
||||||
check-r-test-suite \
|
check-r-test-suite \
|
||||||
check-scilab-test-suite
|
check-scilab-test-suite
|
||||||
check-%-test-suite:
|
check-%-test-suite:
|
||||||
@if test -z "$(skip-$*)"; then \
|
@if test -z "$(skip-$*)"; then \
|
||||||
echo $* unknown; \
|
echo $* unknown; \
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public:
|
||||||
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 \"variable_api.h\"\n");
|
Printf(f_runtime, "#include \"api_variable.h\"\n");
|
||||||
Printf(f_runtime, "#include \"localization.h\"\n");
|
Printf(f_runtime, "#include \"localization.h\"\n");
|
||||||
|
|
||||||
/* Initialize the builder.sce file code */
|
/* Initialize the builder.sce file code */
|
||||||
|
|
@ -187,7 +187,7 @@ public:
|
||||||
if (overloaded)
|
if (overloaded)
|
||||||
Append(overname, Getattr(n, "sym:overname"));
|
Append(overname, Getattr(n, "sym:overname"));
|
||||||
|
|
||||||
Printv(f->def, "int ", overname, " (char *fname,unsigned long fname_len) {\nint iOutNum=1;\nint iVarOut=Rhs+1;", NIL);
|
Printv(f->def, "int ", overname, " (char *fname,unsigned long fname_len) {\n", NIL);
|
||||||
|
|
||||||
/* 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);
|
||||||
|
|
@ -199,8 +199,12 @@ public:
|
||||||
/* 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 */
|
||||||
|
int out_required = 0;
|
||||||
//int varargs = emit_isvarargs(l);
|
//int varargs = emit_isvarargs(l);
|
||||||
|
|
||||||
|
|
||||||
if (constructor && num_arguments == 1 && num_required == 1) {
|
if (constructor && num_arguments == 1 && num_required == 1) {
|
||||||
if (Cmp(storage, "explicit") == 0) {
|
if (Cmp(storage, "explicit") == 0) {
|
||||||
Node *parent = Swig_methodclass(n);
|
Node *parent = Swig_methodclass(n);
|
||||||
|
|
@ -252,7 +256,8 @@ public:
|
||||||
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");
|
||||||
Printf(f->code, "%s\n", tm);
|
Printf(f->code, "%s\n", tm);
|
||||||
|
if(strlen(Char(tm))!=0)
|
||||||
|
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);
|
||||||
|
|
@ -264,11 +269,20 @@ public:
|
||||||
if ((tm = Getattr(p, "tmap:argout"))) {
|
if ((tm = Getattr(p, "tmap:argout"))) {
|
||||||
Printv(outarg, tm, "\n", NIL);
|
Printv(outarg, tm, "\n", NIL);
|
||||||
p = Getattr(p, "tmap:argout:next");
|
p = Getattr(p, "tmap:argout:next");
|
||||||
|
out_required++;
|
||||||
} else {
|
} else {
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Printv(f->code, outarg, NIL);
|
Printv(f->code, outarg, NIL);
|
||||||
|
|
||||||
|
/* Insert the code checking for the number of input and output */
|
||||||
|
if(out_required==0) out_required=1;
|
||||||
|
Printf(f->def,"CheckRhs(%d,%d);\n",num_required,num_required);
|
||||||
|
Printf(f->def,"CheckLhs(%d,%d);\n",out_required,out_required);
|
||||||
|
|
||||||
|
/* Insert the order of output parameters*/
|
||||||
|
Printf(f->def,"\nint iOutNum=1;\nint iVarOut=Rhs+1;");
|
||||||
|
|
||||||
/* Finish the the code for the function */
|
/* Finish the the code for the function */
|
||||||
Printf(f->code, "return 0;\n");
|
Printf(f->code, "return 0;\n");
|
||||||
|
|
@ -312,7 +326,14 @@ public:
|
||||||
String *getname = Swig_name_get(iname);
|
String *getname = Swig_name_get(iname);
|
||||||
String *setname = Swig_name_set(iname);
|
String *setname = Swig_name_set(iname);
|
||||||
|
|
||||||
Printv(setf->def, "int ", setname, " (char *fname,unsigned long fname_len) {\nint iOutNum=1;\nint iVarOut=Rhs+1;", NIL);
|
Printv(setf->def, "int ", setname, " (char *fname,unsigned long fname_len) {\n", NIL);
|
||||||
|
|
||||||
|
/* Check the number of input and output */
|
||||||
|
Printf(setf->def,"CheckRhs(1,1);\n");
|
||||||
|
Printf(setf->def,"CheckLhs(1,1);\n");
|
||||||
|
|
||||||
|
/* Insert the order of output parameters*/
|
||||||
|
Printf(setf->def,"\nint iOutNum=1;\nint iVarOut=Rhs+1;");
|
||||||
|
|
||||||
/* add the local variable */
|
/* add the local variable */
|
||||||
Wrapper_add_local(setf, "piAddrVar", "int *piAddrVar");
|
Wrapper_add_local(setf, "piAddrVar", "int *piAddrVar");
|
||||||
|
|
@ -339,7 +360,14 @@ public:
|
||||||
/* 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;
|
||||||
Printv(getf->def, "int ", getname, " (char *fname,unsigned long fname_len){\nint iOutNum=1;\nint iVarOut=Rhs+1;", NIL);
|
Printv(getf->def, "int ", getname, " (char *fname,unsigned long fname_len){\n", NIL);
|
||||||
|
|
||||||
|
/* Check the number of input and output */
|
||||||
|
Printf(getf->def,"CheckRhs(0,0);\n");
|
||||||
|
Printf(getf->def,"CheckLhs(1,1);\n");
|
||||||
|
|
||||||
|
/* Insert the order of output parameters*/
|
||||||
|
Printf(getf->def,"\nint iOutNum=1;\nint iVarOut=Rhs+1;");
|
||||||
|
|
||||||
/* add local variabe */
|
/* add local variabe */
|
||||||
Wrapper_add_local(getf, "piAddrOut", "int* _piAddress");
|
Wrapper_add_local(getf, "piAddrOut", "int* _piAddress");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue