Add support for member function pointers.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8617 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matthias Köppe 2006-01-29 18:47:18 +00:00
commit edba3add6b
3 changed files with 101 additions and 0 deletions

View file

@ -346,6 +346,36 @@ typedef unsigned long SCM;
$2 = ($2_ltype) temp;
}
/* ------------------------------------------------------------
* CLASS::* (member function pointer) typemaps
* taken from typemaps/swigtype.swg
* ------------------------------------------------------------ */
#define %set_output(obj) $result = obj
#define %set_varoutput(obj) $result = obj
%typemap(in) SWIGTYPE (CLASS::*) {
int res = SWIG_ConvertMember($input, (void*)(&$1), sizeof($type),$descriptor);
if (res) {
scm_wrong_type_arg((char *) FUNC_NAME, $argnum, $input);
}
}
%typemap(out,noblock=1) SWIGTYPE (CLASS::*) {
%set_output(SWIG_NewMemberObj((void*)(&$1), sizeof($type), $descriptor));
}
%typemap(varin) SWIGTYPE (CLASS::*) {
int res = SWIG_ConvertMember($input,(void*)(&$1), sizeof($type), $descriptor);
if (!SWIG_IsOK(res)) {
scm_wrong_type_arg((char *) FUNC_NAME, 1, $input);
}
}
%typemap(varout,noblock=1) SWIGTYPE (CLASS::*) {
%set_varoutput(SWIG_NewMemberObj((void*)(&$1), sizeof($type), $descriptor));
}
/* ------------------------------------------------------------
* Typechecking rules
* ------------------------------------------------------------ */