PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/python/funcptr2/runme.py

#
Python | 20 lines | 13 code | 5 blank | 2 comment | 0 complexity | b15b05278ed6f1a95af4d7bd6ac18de8 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. # file: example.py
  2. import example
  3. a = 37
  4. b = 42
  5. # Now call our C function with a bunch of callbacks
  6. print "Trying some C callback functions"
  7. print " a =", a
  8. print " b =", b
  9. print " ADD(a,b) =", example.do_op(a,b,example.ADD)
  10. print " SUB(a,b) =", example.do_op(a,b,example.SUB)
  11. print " MUL(a,b) =", example.do_op(a,b,example.MUL)
  12. print "Here is what the C callback function objects look like in Python"
  13. print " ADD =", example.ADD
  14. print " SUB =", example.SUB
  15. print " MUL =", example.MUL