change the format of error (add SciErr)

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11871 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2010-02-26 09:34:30 +00:00
commit 215a9c649b
3 changed files with 1079 additions and 704 deletions

File diff suppressed because it is too large Load diff

View file

@ -65,14 +65,17 @@ or you can use the %apply directive :
double *INPUT (int *piAddrVar, int iRows, int iCols, double temp) {
double *_piData;
int typearg;
getVarAddressFromPosition(pvApiCtx, $argnum, &piAddrVar);
getVarDimension(pvApiCtx, piAddrVar, &iRows, &iCols);
getVarType(pvApiCtx, piAddrVar, &typearg);
if (typearg != sci_matrix || iRows != 1 || iCols != 1 || isVarComplex(pvApiCtx, piAddrVar)) {
Scierror(999, _("%s: Wrong type for input argument #%d: Real scalar expected.\n"), fname, $argnum);
sciErr = getVarAddressFromPosition(pvApiCtx, $argnum, &piAddrVar);
if (sciErr.iErr) {
printError(&sciErr, 0);
return 0;
}
sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &_piData);
if (sciErr.iErr) {
printError(&sciErr, 0);
return 0;
}
getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &_piData);
temp = ($*1_ltype)*_piData;
$1 = &temp;
}
@ -141,7 +144,11 @@ output values.
%typemap(argout) signed char *OUTPUT(int iRowsOut, int iColsOut) {
iRowsOut = 1;
iColsOut = 1;
createMatrixOfInteger8(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
sciErr = createMatrixOfInteger8(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
if (sciErr.iErr) {
printError(&sciErr, 0);
return 0;
}
LhsVar(iOutNum) = iVarOut;
}
@ -149,7 +156,11 @@ output values.
unsigned char *OUTPUT(int iRowsOut, int iColsOut) {
iRowsOut = 1;
iColsOut = 1;
createMatrixOfInteger16(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
sciErr = createMatrixOfInteger16(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
if (sciErr.iErr) {
printError(&sciErr, 0);
return 0;
}
LhsVar(iOutNum) = iVarOut;
}
@ -160,7 +171,11 @@ output values.
long *OUTPUT(int iRowsOut,int iColsOut) {
iRowsOut=1;
iColsOut=1;
createMatrixOfInteger32(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
sciErr = createMatrixOfInteger32(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
if (sciErr.iErr) {
printError(&sciErr, 0);
return 0;
}
LhsVar(iOutNum)=iVarOut;
}
@ -171,7 +186,11 @@ output values.
temp = (double)(*$result);
iRowsOut = 1;
iColsOut = 1;
createMatrixOfDouble(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
sciErr = createMatrixOfDouble(pvApiCtx, iVarOut, iRowsOut, iColsOut, &temp$argnum);
if (sciErr.iErr) {
printError(&sciErr, 0);
return 0;
}
LhsVar(iOutNum) = iVarOut;
}
@ -249,4 +268,3 @@ do this :

View file

@ -315,6 +315,7 @@ public:
/* Insert the code checking the number of input */
Printf(f->def, "CheckRhs(%d, %d);\n",num_required,num_arguments);
Printf(f->def, "CheckLhs(%d, %d);\n",out_required,out_required);
Printf(f->def, "SciErr sciErr;\n");
/* Insert the order of output parameters*/
if (flag)
@ -419,7 +420,7 @@ public:
/* Check the number of input and output */
Printf(setf->def, "CheckRhs(1, 1);\n");
Printf(setf->def, "CheckLhs(1, 1);\n");
Printf(setf->def, "SciErr sciErr;\n");
/* Add the local variable */
Wrapper_add_local(setf, "piAddrVar", "int *piAddrVar");
@ -454,7 +455,7 @@ public:
/* Check the number of input and output */
Printf(getf->def, "CheckRhs(0, 0);\n");
Printf(getf->def, "CheckLhs(1, 1);\n");
Printf(getf->def, "SciErr sciErr;\n");
/* Insert the order of output parameters */
Printf(getf->def, "\nint iOutNum=1;\nint iVarOut=Rhs+1;");
@ -520,7 +521,7 @@ public:
/* Check the number of input and output */
Printf(getf->def, "CheckRhs(0, 0);\n");
Printf(getf->def, "CheckLhs(1, 1);\n");
Printf(getf->def, "SciErr sciErr;\n");
/* Insert the order of output parameters*/
Printf(getf->def, "\nint iOutNum=1;\nint iVarOut=Rhs+1;");