summaryrefslogtreecommitdiff
path: root/trunk/Examples/python/funcptr2/runme.py
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2010-06-02 20:53:17 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2010-06-02 20:53:17 +0000
commit2824b0cbb66e715490e1ef13250bd675d87b32d9 (patch)
treec3bc8d54c6d73f2b7ce08cac34172dbc9f5e5b95 /trunk/Examples/python/funcptr2/runme.py
parent289cfef4b4766ff266f3b1bdda8ca3a952e5a047 (diff)
downloadswig-2.0.0.tar.gz
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-2.0.0@12089 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'trunk/Examples/python/funcptr2/runme.py')
-rw-r--r--trunk/Examples/python/funcptr2/runme.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/trunk/Examples/python/funcptr2/runme.py b/trunk/Examples/python/funcptr2/runme.py
new file mode 100644
index 000000000..bd58fb620
--- /dev/null
+++ b/trunk/Examples/python/funcptr2/runme.py
@@ -0,0 +1,24 @@
+# file: runme.py
+
+import example
+
+a = 37
+b = 42
+
+# Now call our C function with a bunch of callbacks
+
+print "Trying some C callback functions"
+print " a =", a
+print " b =", b
+print " ADD(a,b) =", example.do_op(a,b,example.ADD)
+print " SUB(a,b) =", example.do_op(a,b,example.SUB)
+print " MUL(a,b) =", example.do_op(a,b,example.MUL)
+
+print "Here is what the C callback function objects look like in Python"
+print " ADD =", example.ADD
+print " SUB =", example.SUB
+print " MUL =", example.MUL
+
+print "Call the functions directly..."
+print " add(a,b) =", example.add(a,b)
+print " sub(a,b) =", example.sub(a,b)