/branches/swig-2.0/Examples/tcl/value/runme.tcl

# · TCL · 39 lines · 26 code · 8 blank · 5 comment · 0 complexity · 115af3befa826ab1c71228895d22e389 MD5 · raw file

  1. # file: runme.tcl
  2. # Try to load as a dynamic module.
  3. catch { load ./example[info sharedlibextension] example}
  4. # Create a couple of a vectors
  5. set v [new_Vector 1 2 3]
  6. set w [new_Vector 10 11 12]
  7. puts "I just created the following vectors"
  8. vector_print $v
  9. vector_print $w
  10. # Now call some of our functions
  11. puts "\nNow I'm going to compute the dot product"
  12. set d [dot_product $v $w]
  13. puts "dot product = $d (should be 68)"
  14. # Add the vectors together
  15. puts "\nNow I'm going to add the vectors together"
  16. set r [vector_add $v $w]
  17. vector_print $r
  18. puts "The value should be (11,13,15)"
  19. # Now I'd better clean up the return result r
  20. puts "\nNow I'm going to clean up the return result"
  21. free $r
  22. puts "Good"