PageRenderTime 17ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 1ms 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
 1require 'example'
 2
 3a = 37
 4b = 42
 5
 6# Now call our C function with a bunch of callbacks
 7
 8puts "Trying some C callback functions"
 9puts "    a        = #{a}"
10puts "    b        = #{b}"
11puts "    ADD(a,b) = #{Example.do_op(a,b,Example::ADD)}"
12puts "    SUB(a,b) = #{Example.do_op(a,b,Example::SUB)}"
13puts "    MUL(a,b) = #{Example.do_op(a,b,Example::MUL)}"
14
15puts "Here is what the C callback function objects look like in Ruby"
16puts "    ADD      = #{Example::ADD}"
17puts "    SUB      = #{Example::SUB}"
18puts "    MUL      = #{Example::MUL}"