PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/Root-branch-php-utl/SWIG/Examples/ruby/funcptr/runme.rb

#
Ruby | 21 lines | 13 code | 6 blank | 2 comment | 0 complexity | 5d703f65ec4d01b853712bca3e09ec90 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. # file: runme.rb
  2. require '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\n"
  7. print " a = #{a}\n"
  8. print " b = #{b}\n"
  9. print " ADD(a,b) = ", Example::do_op(a,b,Example::ADD),"\n"
  10. print " SUB(a,b) = ", Example::do_op(a,b,Example::SUB),"\n"
  11. print " MUL(a,b) = ", Example::do_op(a,b,Example::MUL),"\n"
  12. print "Here is what the C callback function objects look like in Ruby\n"
  13. print " ADD = #{Example::ADD}\n"
  14. print " SUB = #{Example::SUB}\n"
  15. print " MUL = #{Example::MUL}\n"