Merge branch 'wkalinin-csymbols'
* wkalinin-csymbols: Tests for C nested classes symbol table not being in global space C nested classes symbol table should be in global space
This commit is contained in:
commit
f6cae1af1b
4 changed files with 116 additions and 0 deletions
|
|
@ -601,6 +601,7 @@ C_TEST_CASES += \
|
||||||
memberin_extend_c \
|
memberin_extend_c \
|
||||||
name \
|
name \
|
||||||
nested \
|
nested \
|
||||||
|
nested_extend_c \
|
||||||
nested_structs \
|
nested_structs \
|
||||||
newobject2 \
|
newobject2 \
|
||||||
overload_extend \
|
overload_extend \
|
||||||
|
|
|
||||||
38
Examples/test-suite/java/nested_extend_c_runme.java
Normal file
38
Examples/test-suite/java/nested_extend_c_runme.java
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
import nested_extend_c.*;
|
||||||
|
|
||||||
|
public class nested_extend_c_runme {
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
System.loadLibrary("nested_extend_c");
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String argv[]) throws Throwable
|
||||||
|
{
|
||||||
|
{
|
||||||
|
hiA hi = new hiA();
|
||||||
|
if (hi.hi_extend() != 'h')
|
||||||
|
throw new RuntimeException("test failed");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
lowA low = new lowA();
|
||||||
|
if (low.low_extend() != 99)
|
||||||
|
throw new RuntimeException("test failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
hiB hi = new hiB();
|
||||||
|
if (hi.hi_extend() != 'h')
|
||||||
|
throw new RuntimeException("test failed");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
lowB low = new lowB();
|
||||||
|
if (low.low_extend() != 99)
|
||||||
|
throw new RuntimeException("test failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
74
Examples/test-suite/nested_extend_c.i
Normal file
74
Examples/test-suite/nested_extend_c.i
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
%module nested_extend_c
|
||||||
|
|
||||||
|
%extend hiA {
|
||||||
|
hiA() {
|
||||||
|
union hiA *self = (union hiA *)malloc(sizeof(union hiA));
|
||||||
|
self->c = 'h';
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
char hi_extend() {
|
||||||
|
return $self->c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%extend lowA {
|
||||||
|
lowA() {
|
||||||
|
struct lowA *self = (struct lowA *)malloc(sizeof(struct lowA));
|
||||||
|
self->name = 0;
|
||||||
|
self->num = 99;
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
int low_extend() {
|
||||||
|
return $self->num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%extend hiB {
|
||||||
|
hiB() {
|
||||||
|
union hiB *self = (union hiB *)malloc(sizeof(union hiB));
|
||||||
|
self->c = 'h';
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
char hi_extend() {
|
||||||
|
return $self->c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%extend lowB {
|
||||||
|
lowB() {
|
||||||
|
struct lowB *self = (struct lowB *)malloc(sizeof(struct lowB));
|
||||||
|
self->name = 0;
|
||||||
|
self->num = 99;
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
int low_extend() {
|
||||||
|
return $self->num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
typedef struct NestedA {
|
||||||
|
int a;
|
||||||
|
union hiA {
|
||||||
|
char c;
|
||||||
|
int d;
|
||||||
|
} hiA_instance;
|
||||||
|
|
||||||
|
struct lowA {
|
||||||
|
char *name;
|
||||||
|
int num;
|
||||||
|
} lowA_instance;
|
||||||
|
} NestedA;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int a;
|
||||||
|
union hiB {
|
||||||
|
char c;
|
||||||
|
int d;
|
||||||
|
} hiB_instance;
|
||||||
|
|
||||||
|
struct lowB {
|
||||||
|
char *name;
|
||||||
|
int num;
|
||||||
|
} lowB_instance;
|
||||||
|
} NestedB;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
@ -3515,6 +3515,9 @@ cpp_class_decl : storage_class cpptype idcolon inherit LBRACE {
|
||||||
} else {
|
} else {
|
||||||
cplus_mode = CPLUS_PUBLIC;
|
cplus_mode = CPLUS_PUBLIC;
|
||||||
}
|
}
|
||||||
|
if (!cparse_cplusplus) {
|
||||||
|
set_scope_to_global();
|
||||||
|
}
|
||||||
Swig_symbol_newscope();
|
Swig_symbol_newscope();
|
||||||
Swig_symbol_setscopename($3);
|
Swig_symbol_setscopename($3);
|
||||||
Swig_inherit_base_symbols(bases);
|
Swig_inherit_base_symbols(bases);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue