5
# Try to set the values of some global variables
10
Example.uivar = 123456
12
Example.ulvar = 654321
16
Example.fvar = 3.14159
18
Example.strvar = "Hello World"
19
Example.cstrvar = "Goodbye"
20
Example.iptrvar= Example.new_int(37)
21
Example.ptptr = Example.new_Point(37,42)
24
# Now print out the values of the variables
26
puts "Variables (values printed from Ruby)"
28
print "ivar = ", Example.ivar, "\n"
29
print "svar = ", Example.svar, "\n"
30
print "lvar = ", Example.lvar, "\n"
31
print "uivar = ", Example.uivar, "\n"
32
print "usvar = ", Example.usvar, "\n"
33
print "ulvar = ", Example.ulvar, "\n"
34
print "scvar = ", Example.scvar, "\n"
35
print "ucvar = ", Example.ucvar, "\n"
36
print "fvar = ", Example.fvar, "\n"
37
print "dvar = ", Example.dvar, "\n"
38
print "cvar = ", Example.cvar, "\n"
39
print "strvar = ", Example.strvar, "\n"
40
print "cstrvar = ", Example.cstrvar, "\n"
41
print "iptrvar = ", Example.iptrvar, "\n"
42
print "name = ", Example.name, "\n"
43
print "ptptr = ", Example.ptptr, " ", Example.Point_print(Example.ptptr), "\n"
44
print "pt = ", Example.pt, " ", Example.Point_print(Example.pt), "\n"
46
puts "\nVariables (values printed from C)"
50
puts "\nNow I'm going to try and modify some read only variables";
52
puts " Tring to set 'path'";
54
Example.path = "Whoa!"
55
puts "Hey, what's going on?!?! This shouldn't work"
60
puts " Trying to set 'status'";
63
puts "Hey, what's going on?!?! This shouldn't work"
69
print "\nI'm going to try and update a structure variable.\n\n"
71
Example.pt = Example.ptptr
73
puts "The new value is"
75
print "You should see the value ", Example.Point_print(Example.ptptr), "\n"