/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
3require 'example'
4
5a = 37
6b = 42
7
8# Now call our C function with a bunch of callbacks
9
10print "Trying some C callback functions\n"
11print " a = #{a}\n"
12print " b = #{b}\n"
13print " ADD(a,b) = ", Example::do_op(a,b,Example::ADD),"\n"
14print " SUB(a,b) = ", Example::do_op(a,b,Example::SUB),"\n"
15print " MUL(a,b) = ", Example::do_op(a,b,Example::MUL),"\n"
16
17print "Here is what the C callback function objects look like in Ruby\n"
18print " ADD = #{Example::ADD}\n"
19print " SUB = #{Example::SUB}\n"
20print " MUL = #{Example::MUL}\n"
21