The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5fcae5eb66
commit
12a43edc2d
1508 changed files with 125983 additions and 44037 deletions
9
Examples/python/pointer/.cvsignore
Normal file
9
Examples/python/pointer/.cvsignore
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
*_wrap.c
|
||||
*_wrap.cxx
|
||||
*.dll
|
||||
*.dsw
|
||||
*.ncb
|
||||
*.opt
|
||||
*.plg
|
||||
Release
|
||||
Debug
|
||||
|
|
@ -13,6 +13,7 @@ static::
|
|||
TARGET='mypython' INTERFACE='$(INTERFACE)' python_static
|
||||
|
||||
clean::
|
||||
rm -f *_wrap* *.o *~ *.so mypython *.pyc .~* core
|
||||
$(MAKE) -f $(TOP)/Makefile python_clean
|
||||
rm -f $(TARGET).py
|
||||
|
||||
check: all
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
/* First we'll use the pointer library */
|
||||
extern void add(int *x, int *y, int *result);
|
||||
%include pointer.i
|
||||
%include cpointer.i
|
||||
%pointer_functions(int, intp);
|
||||
|
||||
/* Next we'll use some typemaps */
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ import example;
|
|||
|
||||
# First create some objects using the pointer library.
|
||||
print "Testing the pointer library";
|
||||
a = example.ptrcreate("int",37);
|
||||
b = example.ptrcreate("int",42);
|
||||
c = example.ptrcreate("int");
|
||||
a = example.new_intp();
|
||||
b = example.new_intp();
|
||||
c = example.new_intp();
|
||||
example.intp_assign(a,37);
|
||||
example.intp_assign(b,42);
|
||||
|
||||
print " a =",a
|
||||
print " b =",b
|
||||
|
|
@ -16,13 +18,13 @@ print " c =",c
|
|||
example.add(a,b,c)
|
||||
|
||||
# Now get the result
|
||||
r = example.ptrvalue(c)
|
||||
r = example.intp_value(c)
|
||||
print " 37 + 42 =",r
|
||||
|
||||
# Clean up the pointers
|
||||
example.ptrfree(a)
|
||||
example.ptrfree(b)
|
||||
example.ptrfree(c)
|
||||
example.delete_intp(a)
|
||||
example.delete_intp(b)
|
||||
example.delete_intp(c)
|
||||
|
||||
# Now try the typemap library
|
||||
# This should be much easier. Now how it is no longer
|
||||
Loading…
Add table
Add a link
Reference in a new issue