fix C + enums + struct

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8747 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-08 08:23:45 +00:00
commit ceaeb49a9f
3 changed files with 13 additions and 2 deletions

View file

@ -39,3 +39,13 @@ enum { globalinstance1, globalinstance2, globalinstance3 = 30 } GlobalInstance;
enum { AnonEnum1, AnonEnum2 = 100 };
%}
%inline %{
typedef struct _Foo {
enum { BAR1, BAR2 } e;
} Foo;
%}

View file

@ -1527,7 +1527,7 @@ int Language::enumvalueDeclaration(Node *n) {
tmpValue = NewString(name);
Setattr(n, "value", tmpValue);
if (!CurrentClass) {
if (!CurrentClass || !cparse_cplusplus) {
Setattr(n,"name",tmpValue); /* for wrapping of enums in a namespace when emit_action is used */
constantWrapper(n);
} else {

View file

@ -20,6 +20,7 @@
char cvsroot_typepass_cxx[] = "$Header$";
#include "swigmod.h"
#include "cparse.h"
struct normal_node {
Symtab *symtab;
@ -726,7 +727,7 @@ class TypePass : private Dispatcher {
if (!value) value = name;
if (Strcmp(value,name) == 0) {
String *new_value;
if ((nsname) || (inclass)) {
if (((nsname) || (inclass)) && cparse_cplusplus ) {
new_value = NewStringf("%s::%s", SwigType_namestr(Swig_symbol_qualified(n)), value);
} else {
new_value = NewString(value);