added correct void* support

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8810 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Gossage 2006-02-13 02:49:55 +00:00
commit ebbae30d72
4 changed files with 106 additions and 2 deletions

View file

@ -89,7 +89,6 @@
%typemap(out) const char&
%{ lua_pushfstring(L,"%c",*$1); SWIG_arg++;%}
// pointers and references
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE*,SWIGTYPE&,SWIGTYPE[]
%{$1=($1_ltype)SWIG_MustGetPtr(L,$input,$descriptor,0,$argnum,"$symname");%}
@ -129,6 +128,13 @@
// void (must be empty without the SWIG_arg++)
%typemap(out) void "";
/* void* is a special case
A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does)
but if its an output, then it should be wrappered like any other SWIG object (using default typemap)
*/
%typemap(in,checkfn="lua_isuserdata") void*
%{$1=((swig_lua_userdata*)(lua_touserdata(L,$input)))->ptr;%}
/* -----------------------------------------------------------------------------
* constants typemaps
@ -253,6 +259,7 @@ SWIG_NUMBER_BY_CONST_REF(float);
SWIG_NUMBER_BY_CONST_REF(double);
SWIG_NUMBER_BY_CONST_REF(enum SWIGTYPE);
// Also needed for object ptrs by const ref
// eg const A* ref_pointer(A* const& a);
// found in mixed_types.i