The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
5fcae5eb66
commit
12a43edc2d
1508 changed files with 125983 additions and 44037 deletions
25
Examples/ruby/template/runme.rb
Normal file
25
Examples/ruby/template/runme.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# file: runme.rb
|
||||
|
||||
require 'example'
|
||||
|
||||
# Call some templated functions
|
||||
puts Example::maxint(3, 7)
|
||||
puts Example::maxdouble(3.14, 2.18)
|
||||
|
||||
# Create some class
|
||||
|
||||
iv = Example::Vecint.new(100)
|
||||
dv = Example::Vecdouble.new(1000)
|
||||
|
||||
100.times { |i| iv.setitem(i, 2*i) }
|
||||
|
||||
1000.times { |i| dv.setitem(i, 1.0/(i+1)) }
|
||||
|
||||
sum = 0
|
||||
100.times { |i| sum = sum + iv.getitem(i) }
|
||||
|
||||
puts sum
|
||||
|
||||
sum = 0.0
|
||||
1000.times { |i| sum = sum + dv.getitem(i) }
|
||||
puts sum
|
||||
Loading…
Add table
Add a link
Reference in a new issue