Updated some examples

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@490 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-06-17 21:41:01 +00:00
commit b3e124ac21
22 changed files with 745 additions and 96 deletions

View file

@ -1,26 +1,23 @@
#
# Tcl script for testing simple example
# file: example.tcl
# Try to load as a dynamic module. If not, we'll just assume
# that it was statically linked in.
catch { load ./example.so example}
catch { load ./example.dll example} ;# Windows
puts [get_time]
set tcl_precision 17
puts "My Variable = $My_variable"
for {set i 0} {$i < 14} {incr i 1} {
set n [fact $i];
puts "$i factorial is $n"
}
# Call our gcd() function
set x 42
set y 105
set g [gcd $x $y]
puts "The gcd of $x and $y is $g"
for {set i 1} {$i < 250} {incr i 1} {
for {set j 1} {$j < 250} {incr j 1} {
set n [mod $i $j]
set My_variable [expr {$My_variable + $n}]
}
}
# Manipulate the Foo global variable
puts "My_variable = $My_variable"
# Output its current value
puts "Foo = $Foo"
# Change its value
set Foo 3.1415926
# See if the change took effect
puts "Foo = $Foo"