git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6284 626c5289-ae23-0410-ae9c-e8d60b6d4f22
21 lines
564 B
Text
21 lines
564 B
Text
/* ------------------------------------------------------------
|
|
* Enums
|
|
* ------------------------------------------------------------ */
|
|
%apply int { enum SWIGTYPE };
|
|
|
|
%typemap(varin,fragment=SWIG_AsVal_frag(int)) enum SWIGTYPE
|
|
{
|
|
if (sizeof(int) != sizeof($1)) {
|
|
PyErr_SetString(PyExc_AttributeError, "enum variable '$name' can not be set");
|
|
return 1;
|
|
}
|
|
if (!SWIG_AsVal(int)($input, (int*)(void*)&($1))) {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
/* this doesn't work now, you need to redefined it for each enum. */
|
|
%apply const int& { const enum SWIGTYPE& };
|
|
|
|
|