New test for strings

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12579 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vincent Couvert 2011-03-31 12:30:12 +00:00
commit dca46d044f
4 changed files with 57 additions and 6 deletions

View file

@ -0,0 +1,45 @@
exec("swigtest.start", -1);
testString = "Scilab test string";
if UCharFunction(testString) <> testString then swigtesterror(); end
if SCharFunction(testString) <> testString then swigtesterror(); end
if CUCharFunction(testString) <> testString then swigtesterror(); end
if CSCharFunction(testString) <> testString then swigtesterror(); end
//if CharFunction(testString) <> testString then swigtesterror(); end
//if CCharFunction(testString) <> testString then swigtesterror(); end
try
tNumber = new_TNumber()
catch
swigtesterror();
end
//TNumber_DigitsMemberA_get()
//TNumber_DigitsMemberA_set
//TNumber_DigitsMemberB_get()
//TNumber_DigitsMemberB_set
try
delete_TNumber(tNumber)
catch
swigtesterror();
end
try
directorTest = new_DirectorTest();
catch
swigtesterror();
end
if DirectorTest_UCharFunction(directorTest, testString) <> testString then swigtesterror(); end
if DirectorTest_SCharFunction(directorTest, testString) <> testString then swigtesterror(); end
if DirectorTest_CUCharFunction(directorTest, testString) <> testString then swigtesterror(); end
if DirectorTest_CSCharFunction(directorTest, testString) <> testString then swigtesterror(); end
//if DirectorTest_CharFunction(directorTest, testString) <> testString then swigtesterror(); end
//if DirectorTest_CCharFunction(directorTest, testString) <> testString then swigtesterror(); end
try
delete_DirectorTest(directorTest);
catch
swigtesterror();
end
exec("swigtest.quit", -1);

View file

@ -45,12 +45,16 @@ SWIG_Scilab_ConvertPtr(StrCtx* pvApiCtx, int obj, void **ptr, swig_type_info* de
}
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
if (sciErr.iErr || iType != sci_pointer)
if (sciErr.iErr)
{
Scierror(999, _("%s: Wrong type for input argument #%d: Pointer expected.\n"), "SWIG_Scilab_ConvertPtr", obj);
printError(&sciErr, 0);
return SWIG_ERROR;
}
if (iType != sci_pointer)
{
Scierror(999, _("%s: Wrong type for input argument #%d: Pointer expected.\n"), "SWIG_Scilab_ConvertPtr", obj);
return SWIG_ERROR;
}
sciErr = getPointer(pvApiCtx, piAddrVar, ptr);
if (sciErr.iErr)

View file

@ -675,7 +675,7 @@
iVarOut++;
}
%typemap(out) char * (int iRowsOut, int iColsOut) {
/*%typemap(out) char * (int iRowsOut, int iColsOut) {
iRowsOut = 1;
iColsOut = 1;
@ -689,7 +689,7 @@
LhsVar(iOutNum) = iVarOut;
iOutNum++;
iVarOut++;
}
}*/
%typemap(out) enum SWIGTYPE (int iRowsOut, int iColsOut) {
iRowsOut = 1;
@ -1421,7 +1421,7 @@
iVarOut++;
}
%typemap(varout,noblock=1) signed char [ANY] { SCILAB_VAROUT(char, createMatrixOfInteger8, 1, $1_dim0) }
%typemap(varout,noblock=1) unsigned char [ANY] { SCILAB_VAROUT(unsigned char, createMatrixOfUnsignedInteger8, 1, $1_dim0) }
//%typemap(varout,noblock=1) unsigned char [ANY] { SCILAB_VAROUT(unsigned char, createMatrixOfUnsignedInteger8, 1, $1_dim0) }
%typemap(varout,noblock=1) short [ANY] { SCILAB_VAROUT(short, createMatrixOfInteger16, 1, $1_dim0) }
%typemap(varout,noblock=1) unsigned short [ANY] { SCILAB_VAROUT(unsigned short, createMatrixOfUnsignedInteger16, 1, $1_dim0) }
//%typemap(varout,noblock=1) int [ANY], long [ANY] { SCILAB_VAROUT(int, createMatrixOfInteger32, 1, $1_dim0) }

View file

@ -592,8 +592,10 @@ public:
/* Insert the argument counter */
//Printf(getf->def, "\nint scilabArgNumber=0;");
Wrapper_add_local(getf, "_outv", "int _outv");
if ((tm = Swig_typemap_lookup("varout", n, name, 0))) {
Replaceall(tm, "$result", name);
Replaceall(tm, "$result", "_outv");
if (is_assignable(n)) {
Replaceall(tm, "iRowsOut", rowname);
Replaceall(tm, "iColsOut", colname);