scilab: implement & fix throw_exception test

This commit is contained in:
Simon Marchetto 2014-04-07 11:36:11 +02:00
commit 7bc8201719
3 changed files with 46 additions and 10 deletions

View file

@ -236,14 +236,16 @@ SWIG_Scilab_ErrorMsg(int code, const char *msg)
SWIGRUNTIME int
SwigScilabRaise(const char *type) {
Scierror(999, "An exception of type %s has been thrown.\n", type);
#ifdef __cplusplus
throw;
#endif
SwigScilabRaise(const char *obj, const char *type, swig_type_info *descriptor) {
if (type) {
if (obj)
Scierror(999, "Exception (%s) occured: %s\n", type, obj);
else
Scierror(999, "Exception (%s) occured.\n", type);
}
}
#define SWIG_Scilab_Raise(obj, type, desc) SwigScilabRaise(type)
#define SWIG_Scilab_Raise(obj, type, descriptor) SwigScilabRaise(obj, type, descriptor)
/*
* Pointer utility functions

View file

@ -18,12 +18,12 @@
/* ---------------------------------------------------------------------------*/
/* Generic typmemaps */
/* */
/* This typemap is used when Scilab does not store this type directly */
/* For example, a 'float' is stored in Scilab as a 'double' */
/* So we read a 'double' in Scilab and cast it to a 'float' */
/* ---------------------------------------------------------------------------*/
* This typemap is used when Scilab does not store this type directly
* For example, a 'float' is stored in Scilab as a 'double'
* So we read a 'double' in Scilab and cast it to a 'float'
*/
%define %scilab_in_typemap_withcast(TYPEMAPTYPE, FRAGMENTNAME, CTYPE, TEMPTYPE, TEMPINIT)
%typemap(TYPEMAPTYPE, fragment="FRAGMENTNAME") CTYPE {
TEMPTYPE tempValue = TEMPINIT;
@ -203,3 +203,10 @@
if (SWIG_CreateScilabVariable_double(pvApiCtx, "$result", $value) != SWIG_OK)
return SWIG_ERROR;
%}
/* ---------------------------------------------------------------------------*/
/* Exception typmemaps */
/* ---------------------------------------------------------------------------*/
%include "sciexception.swg"