varin enum SWIGTYPE mods to handle unnamed enums

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6149 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-08-25 21:32:27 +00:00
commit 2631309c2f

View file

@ -225,7 +225,7 @@
/* Variable input */
%typemap(varin) int, short, long, signed char, bool, enum SWIGTYPE
%typemap(varin) int, short, long, signed char, bool
"$1 = ($1_ltype) SvIV($input);";
%typemap(varin) unsigned int, unsigned short, unsigned long, unsigned char
@ -361,8 +361,12 @@
%typemap(varin,warning="462: Unable to set variable of type char []") char []
{ croak("Variable $symname is read-only."); }
%typemap(varin) enum SWIGTYPE
"$1 = ($1_type) SvIV($input);";
%typemap(varin) enum SWIGTYPE {
if (sizeof(int) != sizeof($1)) {
croak("enum variable '$name' can not be set.");
}
*(int *)(void *)&($1) = SvIV($input);
}
/* --- Typemaps for variable output --- */