The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6fcc22a1f8
commit
516036631c
1508 changed files with 125983 additions and 44037 deletions
9
SWIG/Examples/tcl/pointer/.cvsignore
Normal file
9
SWIG/Examples/tcl/pointer/.cvsignore
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
*_wrap.c
|
||||
*_wrap.cxx
|
||||
example.dll
|
||||
example.dsw
|
||||
example.ncb
|
||||
example.opt
|
||||
example.plg
|
||||
Release
|
||||
Debug
|
||||
|
|
@ -14,6 +14,6 @@ static::
|
|||
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh
|
||||
|
||||
clean::
|
||||
rm -f *_wrap* *.o my_tclsh *~ .~* core *.so *.sl
|
||||
$(MAKE) -f $(TOP)/Makefile tcl_clean
|
||||
|
||||
check: all
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
/* 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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,12 @@ catch { load ./example.dll example} ;# Windows
|
|||
|
||||
# First create some objects using the pointer library.
|
||||
puts "Testing the pointer library"
|
||||
set a [ptrcreate int 37]
|
||||
set b [ptrcreate int 42]
|
||||
set c [ptrcreate int] ;# Memory for result
|
||||
set a [new_intp]
|
||||
set b [new_intp]
|
||||
set c [new_intp] ;# Memory for result
|
||||
|
||||
intp_assign $a 37
|
||||
intp_assign $b 42
|
||||
|
||||
puts " a = $a"
|
||||
puts " b = $b"
|
||||
|
|
@ -17,13 +20,13 @@ puts " c = $c"
|
|||
add $a $b $c
|
||||
|
||||
# Now get the result
|
||||
set r [ptrvalue $c]
|
||||
set r [intp_value $c]
|
||||
puts " 37 + 42 = $r"
|
||||
|
||||
# Clean up the pointers
|
||||
ptrfree $a
|
||||
ptrfree $b
|
||||
ptrfree $c
|
||||
delete_intp $a
|
||||
delete_intp $b
|
||||
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