Fixed handling of constants. Previously if a %constant directive was defined before a #define it would not work correctly.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7578 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Charlie Savage 2005-10-03 19:47:06 +00:00
commit 72c48ff661
2 changed files with 4 additions and 3 deletions

View file

@ -87,10 +87,10 @@
/* --- Constants --- */ /* --- Constants --- */
%typemap(constant) char %typemap(constant) char
"rb_define_const($module,\"$symname\", rb_str_new(\"$1\",1));"; "rb_define_const($module,\"$symname\", rb_str_new($1,1));";
%typemap(constant) char * %typemap(constant) char *
"rb_define_const($module,\"$symname\", rb_str_new2(\"$1\"));"; "rb_define_const($module,\"$symname\", rb_str_new2($1));";
/* directorin typemaps */ /* directorin typemaps */

View file

@ -1578,7 +1578,8 @@ public:
char *iname = GetChar(n,"sym:name"); char *iname = GetChar(n,"sym:name");
SwigType *type = Getattr(n,"type"); SwigType *type = Getattr(n,"type");
char *value = GetChar(n,"value"); String *rawval = Getattr(n,"rawval");
String *value = rawval ? rawval : Getattr(n,"value");
if (current == CLASS_CONST) { if (current == CLASS_CONST) {
iname = klass->strip(iname); iname = klass->strip(iname);