From 9c5b888299c56722d20ea76f7c80cca745e53a74 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Mon, 31 Oct 2005 09:45:51 +0000 Subject: [PATCH] add missing directors typemaps git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7761 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/typemaps/swigtype.swg | 48 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/Lib/typemaps/swigtype.swg b/Lib/typemaps/swigtype.swg index f55b8ca80..10a015a7b 100644 --- a/Lib/typemaps/swigtype.swg +++ b/Lib/typemaps/swigtype.swg @@ -279,7 +279,7 @@ $result = %reinterpret_cast(argp, $ltype); } %typemap(directorout,noblock=1) SWIGTYPE &(void *argp) { - if (SWIG_ConvertPtr($input, &argp, $descriptor, $disown | %convertptr_flags) != SWIG_OK) { + if (SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags) != SWIG_OK) { %dirout_fail(SWIG_TypeError,"$type"); } if (!argp) { %dirout_nullref("$type"); } @@ -341,7 +341,7 @@ } } -%typemap(varout,noblock=1) SWIGTYPE (CLASS::*) { +%typemap(varout,noblock=1) SWIGTYPE (CLASS::*) { %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)); } @@ -349,6 +349,23 @@ %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($type), $descriptor)); } +#if defined(SWIG_DIRECTOR_TYPEMAPS) + +/* directorin */ + +%typemap(directorin,noblock=1) SWIGTYPE (CLASS::*) { + $input = SWIG_NewMemberObj(%as_voidptr(&$1_name), sizeof($type), $descriptor); +} + +/* directorout */ + +%typemap(directorout,noblock=1) SWIGTYPE (CLASS::*) { + if (SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor) != SWIG_OK) { + %dirout_fail(SWIG_TypeError,"$type"); + } + $result = %reinterpret_cast(argp, $ltype); +} +#endif /* ------------------------------------------------------------ * --- function ptr typemaps --- @@ -370,11 +387,38 @@ %set_output(SWIG_NewFunctionPtrObj((void *)($1), $descriptor)); } +%typemap(varin,noblock=1) SWIGTYPE ((*)(ANY)) { + if (SWIG_ConvertFunctionPtr($input, %as_voidptrptr(&$1), $descriptor) != SWIG_OK) { + %variable_fail(SWIG_TypeError, "$type", "$name"); + } +} + +%typemap(varout,noblock=1) SWIGTYPE ((*)(ANY)) { + %set_varoutput(SWIG_NewFunctionPtrObj((void *)($1), $descriptor)); +} %typemap(constcode, noblock=1) SWIGTYPE ((*)(ANY)){ %set_constant("$symname", SWIG_NewFunctionPtrObj((void *)$value, $descriptor)); } +#if defined(SWIG_DIRECTOR_TYPEMAPS) + +/* directorin */ + +%typemap(directorin,noblock=1) SWIGTYPE ((*)(ANY)) { + $input = SWIG_NewFunctionPtrObj((void*)($1_name), $descriptor); +} + +/* directorout */ + +%typemap(directorout,noblock=1) SWIGTYPE ((*)(ANY)) { + if (SWIG_ConvertFunctionPtr($input,%as_voidptrptr(&$result),$descriptor) != SWIG_OK) { + %dirout_fail(SWIG_TypeError,"$type"); + } +} +#endif + + /* ------------------------------------------------------------ * --- Special typemaps --- * ------------------------------------------------------------ */