PageRenderTime 25ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-15/SWIG/Examples/ruby/funcptr2/runme.rb

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