add INPUT/OUTPUT support

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11325 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2009-06-27 09:08:23 +00:00
commit 5d23e5310a
8 changed files with 139 additions and 13 deletions

View file

@ -31,7 +31,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
$1=($1_ltype)*_piData;
@ -44,12 +44,13 @@
getVarDimension(piAddrVar, &iRows, &iCols);
if (getVarType(piAddrVar) != sci_strings || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfString(piAddrVar, &iRows, &iCols,&_piLength, &_pstStrings);
$1=($1_ltype)*_pstStrings;
}
/* Pointers */
%typemap(in) signed char *(int *piAddrVar, int iRows, int iCols) {
char* _piData;
@ -58,7 +59,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfInteger8(piAddrVar, &iRows, &iCols, &_piData);
if($1!=NULL) {
@ -80,7 +81,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfInteger16(piAddrVar, &iRows, &iCols, &_piData);
if($1!=NULL) {
@ -108,7 +109,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfInteger32(piAddrVar, &iRows, &iCols, &_piData);
if($1!=NULL) {
@ -130,7 +131,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
if($1!=NULL) {
@ -150,7 +151,7 @@
getVarDimension(piAddrVar, &iRows, &iCols);
if (getVarType(piAddrVar) != sci_strings || iRows != 1 || iCols != 1 || isVarComplex(piAddrVar)) {
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, 1);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfString(piAddrVar, &iRows, &iCols,&_piLength, &_pstStrings);
$1=strdup(_pstStrings);
@ -163,7 +164,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfInteger8(piAddrVar, &iRows, &iCols, &_piData);
if($1!=NULL) {
@ -185,7 +186,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfInteger16(piAddrVar, &iRows, &iCols, &_piData);
if($1!=NULL) {
@ -210,7 +211,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfInteger32(piAddrVar, &iRows, &iCols, &_piData);
if($1!=NULL) {
@ -233,7 +234,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
if($1!=NULL) {
@ -254,7 +255,7 @@
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
$1=($1_ltype)*_piData;

View file

@ -68,7 +68,7 @@ or you can use the %apply directive :
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);
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
}
getMatrixOfDouble(piAddrVar, &iRows, &iCols, &_piData);
temp=($*1_ltype)*_piData;