fix C + enums + struct
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8747 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0a0ca7bc6d
commit
579f5963fb
3 changed files with 13 additions and 2 deletions
|
|
@ -39,3 +39,13 @@ enum { globalinstance1, globalinstance2, globalinstance3 = 30 } GlobalInstance;
|
||||||
enum { AnonEnum1, AnonEnum2 = 100 };
|
enum { AnonEnum1, AnonEnum2 = 100 };
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
|
||||||
|
typedef struct _Foo {
|
||||||
|
enum { BAR1, BAR2 } e;
|
||||||
|
} Foo;
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1527,7 +1527,7 @@ int Language::enumvalueDeclaration(Node *n) {
|
||||||
tmpValue = NewString(name);
|
tmpValue = NewString(name);
|
||||||
Setattr(n, "value", tmpValue);
|
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 */
|
Setattr(n,"name",tmpValue); /* for wrapping of enums in a namespace when emit_action is used */
|
||||||
constantWrapper(n);
|
constantWrapper(n);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
char cvsroot_typepass_cxx[] = "$Header$";
|
char cvsroot_typepass_cxx[] = "$Header$";
|
||||||
|
|
||||||
#include "swigmod.h"
|
#include "swigmod.h"
|
||||||
|
#include "cparse.h"
|
||||||
|
|
||||||
struct normal_node {
|
struct normal_node {
|
||||||
Symtab *symtab;
|
Symtab *symtab;
|
||||||
|
|
@ -726,7 +727,7 @@ class TypePass : private Dispatcher {
|
||||||
if (!value) value = name;
|
if (!value) value = name;
|
||||||
if (Strcmp(value,name) == 0) {
|
if (Strcmp(value,name) == 0) {
|
||||||
String *new_value;
|
String *new_value;
|
||||||
if ((nsname) || (inclass)) {
|
if (((nsname) || (inclass)) && cparse_cplusplus ) {
|
||||||
new_value = NewStringf("%s::%s", SwigType_namestr(Swig_symbol_qualified(n)), value);
|
new_value = NewStringf("%s::%s", SwigType_namestr(Swig_symbol_qualified(n)), value);
|
||||||
} else {
|
} else {
|
||||||
new_value = NewString(value);
|
new_value = NewString(value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue