throws typemaps added
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7620 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9470b25456
commit
eca4cc3fae
2 changed files with 32 additions and 1 deletions
|
|
@ -268,6 +268,30 @@
|
||||||
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
||||||
" /* tyepcheck void * */ "
|
" /* tyepcheck void * */ "
|
||||||
|
|
||||||
/* php kewords */
|
|
||||||
|
/* Exception handling */
|
||||||
|
|
||||||
|
%typemap(throws) int,
|
||||||
|
long,
|
||||||
|
short,
|
||||||
|
unsigned int,
|
||||||
|
unsigned long,
|
||||||
|
unsigned short {
|
||||||
|
char error_msg[256];
|
||||||
|
sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
|
||||||
|
SWIG_PHP_Error(E_ERROR, error_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY] %{
|
||||||
|
(void)$1;
|
||||||
|
SWIG_PHP_Error(E_ERROR, "C++ $1_type exception thrown");
|
||||||
|
%}
|
||||||
|
|
||||||
|
%typemap(throws) char * %{
|
||||||
|
SWIG_PHP_Error(E_ERROR, (char *)$1);
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
/* php keywords */
|
||||||
/* please test and activate */
|
/* please test and activate */
|
||||||
//%include "phpkw.swg"
|
//%include "phpkw.swg"
|
||||||
|
|
|
||||||
|
|
@ -42,4 +42,11 @@ namespace std {
|
||||||
ZVAL_STRINGL($result,const_cast<char*>($1->c_str()),$1->length(),1);
|
ZVAL_STRINGL($result,const_cast<char*>($1->c_str()),$1->length(),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(throws) string %{
|
||||||
|
SWIG_PHP_Error(E_ERROR, (char *)$1.c_str());
|
||||||
|
%}
|
||||||
|
|
||||||
|
%typemap(throws) const string& %{
|
||||||
|
SWIG_PHP_Error(E_ERROR, (char *)$1.c_str());
|
||||||
|
%}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue