1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/tcltklib/sample/sample0.rb

40 lines
993 B
Ruby
Raw Normal View History

#! /usr/local/bin/ruby -vd
# tcltklib <20><EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD>Υƥ<CEA5><C6A5><EFBFBD>
require "tcltklib"
def test
# <20><><EFBFBD>󥿥ץ꥿<D7A5><EAA5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ip1 = TclTkIp.new()
# ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>Ƥߤ<C6A4>
print ip1._return_value().inspect, "\n"
print ip1._eval("puts {abc}").inspect, "\n"
# <20>ܥ<EFBFBD><DCA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>äƤߤ<C6A4>
print ip1._return_value().inspect, "\n"
print ip1._eval("button .lab -text exit -command \"destroy .\"").inspect,
"\n"
print ip1._return_value().inspect, "\n"
print ip1._eval("pack .lab").inspect, "\n"
print ip1._return_value().inspect, "\n"
# <20><><EFBFBD>󥿥ץ꥿<D7A5><EAA5BF><EFBFBD><EFBFBD> ruby <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>Ƥߤ<C6A4>
# print ip1._eval(%q/ruby {print "print by ruby\n"}/).inspect, "\n"
print ip1._eval(%q+puts [ruby {print "print by ruby\n"; "puts by tcl/tk"}]+).inspect, "\n"
print ip1._return_value().inspect, "\n"
# <20><EFBFBD><E2A4A6><EFBFBD>ĥ<EFBFBD><C4A5>󥿥ץ꥿<D7A5><EAA5BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥߤ<C6A4>
ip2 = TclTkIp.new()
ip2._eval("button .lab -text test -command \"puts test ; destroy .\"")
ip2._eval("pack .lab")
TclTkLib.mainloop
end
test
GC.start
print "exit\n"