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

* ext/tk/lib/tk.rb: add Tk.appsend_deny and improve Tk.rb_appsend

* ext/tk/lib/tk.rb, ext/tk/lib/tk/*.rb : replace obj.send() -> obj.__send__()
* ext/tk/lib/remote-tk.rb: add a new library which create an object to
                           control a Tk interpreter on the other process


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2004-05-21 20:45:27 +00:00
parent dfdffdd9a3
commit ea710f0dca
18 changed files with 562 additions and 43 deletions

View file

@ -6,6 +6,10 @@ require 'tcltklib'
require 'tkutil'
require 'thread'
if defined? Tk
fail RuntimeError, "'multi-tk' library must be required before requiring 'tk'"
end
################################################
# ignore exception on the mainloop?
@ -37,14 +41,14 @@ MultiTkIp_OK.freeze
class MultiTkIp
SLAVE_IP_ID = ['slave'.freeze, '0'.taint].freeze
@@IP_TABLE = {}.taint
@@IP_TABLE = {}.taint unless defined?(@@IP_TABLE)
@@INIT_IP_ENV = [].taint # table of Procs
@@ADD_TK_PROCS = [].taint # table of [name, args, body]
@@INIT_IP_ENV = [].taint unless defined?(@@INIT_IP_ENV) # table of Procs
@@ADD_TK_PROCS = [].taint unless defined?(@@ADD_TK_PROCS) # table of [name, args, body]
@@TK_TABLE_LIST = [].taint
@@TK_TABLE_LIST = [].taint unless defined?(@@TK_TABLE_LIST)
@@TK_CMD_TBL = {}.taint
@@TK_CMD_TBL = {}.taint unless defined?(@@TK_CMD_TBL)
######################################
@ -603,6 +607,13 @@ end
# get target IP
class MultiTkIp
def self._ip_id_
__getip._ip_id_
end
def _ip_id_
''
end
def self.__getip
if Thread.current.group == ThreadGroup::Default
@@DEFAULT_MASTER
@ -636,7 +647,7 @@ class << MultiTkIp
ip.eval_proc(&b) if b
ip
end
alias new_trusted_slave new_master
alias new_trusted_slave new_slave
def new_safe_slave(keys={},&b)
ip = __new(__getip, true, keys)
@ -798,7 +809,7 @@ class MultiTkIp
@@TK_TABLE_LIST << obj
obj.instance_eval <<-EOD
def self.method_missing(m, *args)
MultiTkIp.tk_object_table(#{id}).send(m, *args)
MultiTkIp.tk_object_table(#{id}).__send__(m, *args)
end
EOD
obj.freeze
@ -972,7 +983,7 @@ end
# class methods to delegate to TclTkIp
class << MultiTkIp
def method_missing(id, *args)
__getip.send(id, *args)
__getip.__send__(id, *args)
end
def make_safe
@ -1184,6 +1195,14 @@ class MultiTkIp
@interp.restart
end
def __eval(str)
@interp.__eval(str)
end
def __invoke(*args)
@interp.__invoke(*args)
end
def _eval(str)
@interp._eval(str)
end
@ -1555,7 +1574,7 @@ class MultiTkIp
conf = _lst2ary(ip._eval("::safe::interpConfigure " +
@ip_name + " -#{slot}"))
if conf[0] == '-deleteHook'
if conf[1] =~ /^rb_out (c\d+)/
if conf[1] =~ /^rb_out\S* (c(_\d+_)?\d+)/
ret[conf[0][1..-1]] = MultiTkIp._tk_cmd_tbl[$1]
else
ret[conf[0][1..-1]] = conf[1]
@ -1567,7 +1586,7 @@ class MultiTkIp
Hash[*_lst2ary(ip._eval("::safe::interpConfigure " +
@ip_name))].each{|k, v|
if k == '-deleteHook'
if v =~ /^rb_out (c\d+)/
if v =~ /^rb_out\S* (c(_\d+_)?\d+)/
ret[k[1..-1]] = MultiTkIp._tk_cmd_tbl[$1]
else
ret[k[1..-1]] = v