scilab: fix compilation error (SWIG_exception) + rename error functions

This commit is contained in:
Simon Marchetto 2014-04-10 17:10:28 +02:00
commit 7ed91ab8fb
3 changed files with 13 additions and 15 deletions

View file

@ -2,5 +2,5 @@
%insert("runtime") {
%define_as(SWIG_exception(code, msg), %block(%error(code, msg); SWIG_fail; ))
%define_as(SWIG_exception(code, msg), SWIG_Scilab_Error(code, msg);)
}

View file

@ -16,43 +16,43 @@
ptrdiff_t, ptrdiff_t& {
char obj[20];
sprintf(obj, "%d", $1);
SwigScilabRaiseEx(obj, "$type", $descriptor);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
%typemap(throws, noblock=1) enum SWIGTYPE {
char obj[20];
sprintf(obj, "%d", $1);
SwigScilabRaiseEx(obj, "$type", $descriptor);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
%typemap(throws, noblock=1) float, double,
float&, double& {
char obj[20];
sprintf(obj, "%5.3f", $1);
SwigScilabRaiseEx(obj, "$type", $descriptor);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
%typemap(throws, noblock=1) bool, bool& {
SwigScilabRaiseEx($1 ? "true" : "false", "$type", $descriptor);
SWIG_Scilab_Raise_Ex($1 ? "true" : "false", "$type", $descriptor);
}
%typemap(throws, noblock=1) char*, char[ANY] {
SwigScilabRaiseEx($1, "$type", $descriptor);
SWIG_Scilab_Raise_Ex($1, "$type", $descriptor);
}
%typemap(throws, noblock=1) char, char& {
char obj[1];
sprintf(obj, "%c", $1);
SwigScilabRaiseEx(obj, "$type", $descriptor);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
%typemap(throws, noblock=1) SWIGTYPE,
SWIGTYPE*,
SWIGTYPE [ANY],
SWIGTYPE & {
SwigScilabRaiseEx((char*)NULL, "$type", $descriptor);
SWIG_Scilab_Raise_Ex((char*)NULL, "$type", $descriptor);
}
%typemap(throws, noblock=1) (...) {
SWIG_exception_fail(SWIG_RuntimeError,"unknown exception");
SWIG_exception(SWIG_RuntimeError, "unknown exception");
}

View file

@ -225,17 +225,17 @@ SWIG_Scilab_ErrorType(int code) {
#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code)
SWIGINTERN void
SWIG_Scilab_ErrorMsg(int code, const char *msg)
SWIG_Scilab_Error(int code, const char *msg)
{
Scierror(999, _("SWIG/Scilab: %s: %s\n"), SWIG_Scilab_ErrorType(code), msg);
}
#define SWIG_Error(code, msg) SWIG_Scilab_ErrorMsg(code, msg)
#define SWIG_Error(code, msg) SWIG_Scilab_Error(code, msg)
#define SWIG_fail return SWIG_ERROR;
SWIGRUNTIME int
SwigScilabRaiseEx(const char *obj, const char *type, swig_type_info *descriptor) {
SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) {
if (type) {
if (obj)
Scierror(999, "SWIG/Scilab: Exception (%s) occured: %s\n", type, obj);
@ -245,12 +245,10 @@ SwigScilabRaiseEx(const char *obj, const char *type, swig_type_info *descriptor)
}
SWIGRUNTIME int
SwigScilabRaise(const int obj, const char *type, swig_type_info *descriptor) {
SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) {
Scierror(999, "SWIG/Scilab: Exception (%s) occured.\n", type);
}
#define SWIG_Scilab_Raise(obj, type, descriptor) SwigScilabRaise(obj, type, descriptor)
/*
* Pointer utility functions
*/