Namespaces support.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@10611 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Maciej Drwal 2008-06-29 15:09:31 +00:00
commit ea05035844
10 changed files with 88 additions and 55 deletions

View file

@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig -debug-module 4 > tree.txt
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
MAIN = main.c
MAIN = test.c
all::
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \

View file

@ -27,3 +27,4 @@ double Square::area(void) {
double Square::perimeter(void) {
return 4*width;
}

View file

@ -35,7 +35,3 @@ public:
virtual double perimeter(void);
};

20
Examples/c/class/testns.c Normal file
View file

@ -0,0 +1,20 @@
#include <stdio.h>
#include "example_proxy.h"
int main(int argc, char **argv) {
geom_Circle* pc = new_geom_Circle(10.0);
geom_Square* ps = new_geom_Square(10.0);
printf("Circle perim.=%f, area=%f\n", geom_Circle_perimeter(pc), geom_Circle_area(pc));
printf("Square perim.=%f, area=%f\n", geom_Square_perimeter(ps), geom_Square_area(ps));
printf("Circle pos.=(%f, %f)\n", geom_Shape_get_x(pc), geom_Shape_get_y(pc));
geom_Shape_move(pc, 5.0, -5.0);
printf("After move pos.=(%f, %f)\n", geom_Shape_get_x(pc), geom_Shape_get_y(pc));
delete_geom_Square(ps);
delete_geom_Circle(pc);
}

View file

@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig -debug-module 4
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
MAIN = main.c
MAIN = test.c
all::
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \

View file

@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig -debug-module 4 > tree.txt
SRCS = example.c
TARGET = example
INTERFACE = example.i
MAIN = main.c
MAIN = test.c
all::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \

View file

@ -10,6 +10,7 @@ int main(int argc, char **argv) {
printf("my_str is: %s\n", my_str);
printf("GCD(%d, %d)=%d\n", a, b, gcd(a, b));
printf("array_of_strs contains %s and %s\n", get_str(0), get_str(1));
printf("const Val = %d\n", Val);
return 0;
}