add cast to work with SwigValueWrapper and write the out enum types appart, as needed

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6375 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-10-08 09:11:09 +00:00
commit 092a7d9f09
2 changed files with 33 additions and 12 deletions

View file

@ -20,9 +20,9 @@
%define PYVAL_OUT_TYPEMAP(from_meth,pyfrag,...)
%typemap(out,fragment=pyfrag) __VA_ARGS__
"$result = from_meth((__VA_ARGS__)$1);";
"$result = from_meth((__VA_ARGS__)($basetype)($1));";
%typemap(out,fragment=pyfrag) const __VA_ARGS__&
"$result = from_meth((__VA_ARGS__)*($1));";
"$result = from_meth((__VA_ARGS__)($basetype)(*$1));";
%enddef
/* varin */
@ -42,13 +42,13 @@
%define PYVAL_VAROUT_TYPEMAP(from_meth,pyfrag,...)
%typemap(varout,fragment=pyfrag) __VA_ARGS__, const __VA_ARGS__&
"$result = from_meth((__VA_ARGS__)$1);";
"$result = from_meth((__VA_ARGS__)($basetype)$1);";
%enddef
/* constant installation code */
%define PYVAL_CONSTCODE_TYPEMAP(from_meth,pyfrag,...)
%typemap(constcode,fragment=pyfrag) __VA_ARGS__
"PyDict_SetItemString(d,\"$symname\", from_meth((__VA_ARGS__)$value));";
"PyDict_SetItemString(d,\"$symname\", from_meth((__VA_ARGS__)($basetype)$value));";
%enddef
@ -56,9 +56,9 @@
%define PYVAL_DIRECTORIN_TYPEMAP(from_meth,pyfrag,...)
%typemap(directorin,fragment=pyfrag) __VA_ARGS__ *DIRECTORIN
"$input = from_meth((__VA_ARGS__)*$1_name);";
"$input = from_meth((__VA_ARGS__)($basetype)*$1_name);";
%typemap(directorin,fragment=pyfrag) __VA_ARGS__, const __VA_ARGS__&
"$input = from_meth((__VA_ARGS__)$1_name);";
"$input = from_meth((__VA_ARGS__)($basetype)$1_name);";
%enddef
/* directorout */
@ -80,10 +80,9 @@
/* throws */
%define PYVAL_THROWS_TYPEMAP(from_meth,pyfrag,...)
%typemap(throws,fragment=pyfrag) __VA_ARGS__ {
PyErr_SetObject(PyExc_RuntimeError, from_meth((__VA_ARGS__)$1));
SWIG_fail;
}
%typemap(throws,fragment=pyfrag) __VA_ARGS__
"PyErr_SetObject(PyExc_RuntimeError, from_meth((__VA_ARGS__)($basetype)$1));
SWIG_fail;";
%enddef
/* typecheck */