Class | MultiTkIp
In: | tk/lib/remote-tk.rb tk/lib/multi-tk.rb
Parent: | Object

remove methods for security

### Methods

_DEFAULT_MASTER _IP_TABLE _TK_TABLE_LIST __create_safe_slave_obj __create_trusted_slave_obj __eval __getip __invoke _add_new_tables _add_tk_procs _conv_listelement _conv_listelement _create_console _create_slave_object _default_delete_hook _destroy_slaves_of_slaveIP _eval _eval _eval_with_enc _eval_with_enc _eval_without_enc _eval_without_enc _fromUTF8 _fromUTF8 _get_global_var _get_global_var _get_global_var2 _get_global_var2 _get_variable _get_variable _get_variable2 _get_variable2 _init_ip_env _init_ip_internal _invoke _invoke _invoke_with_enc _invoke_with_enc _invoke_without_enc _invoke_without_enc _ip_id_ _ip_id_ _merge_tklist _merge_tklist _receiver_mainloop _return_value _return_value _set_global_var _set_global_var _set_global_var2 _set_global_var2 _set_variable _set_variable _set_variable2 _set_variable2 _split_tklist _split_tklist _thread_tkwait _thread_tkwait _thread_vwait _thread_vwait _tk_cmd_tbl _tk_table_list _tk_windows _toUTF8 _toUTF8 _unset_global_var _unset_global_var _unset_global_var2 _unset_global_var2 _unset_variable _unset_variable _unset_variable2 _unset_variable2 abort abort add_tk_procs alias_delete alias_delete alias_info alias_info alias_target alias_target aliases aliases alive? alive? allow_ruby_exit= allow_ruby_exit= allow_ruby_exit? allow_ruby_exit? assign_receiver_and_watchdog background_call background_eval_proc background_eval_str background_eval_string bg_call bg_eval_proc bg_eval_str bg_eval_string bgerror bgerror call call call cb_entry_class cb_error cb_eval create_table def_alias def_alias delete delete delete_cmd delete_cmd delete_slaves delete_slaves deleted? deleted? do_one_event encoding encoding= encoding_convert_from encoding_convert_to encoding_convertfrom encoding_convertto eval_callback eval_proc eval_proc eval_str eval_string eval_string exist? exist? exit exit exit! exit! expose_cmd expose_cmd get_bgerror_handler get_cb_entry get_eventloop_tick get_eventloop_weight get_limit get_limit get_no_event_wait has_mainwindow? has_mainwindow? hidden_cmds hidden_cmds hide_cmd hide_cmd inherited init_ip_env init_ip_internal inspect inspect invalid_namespace? invalid_namespace? invoke_hidden invoke_hidden invoke_hidden_on_global invoke_hidden_on_global invoke_hidden_on_namespace invoke_hidden_on_namespace ip_name ip_name mainloop mainloop mainloop_abort_on_exception mainloop_abort_on_exception= mainloop_watchdog make_safe make_safe mark_trusted mark_trusted master? master? method_missing new new new new_master new_safe_slave new_slave path path recursion_limit recursion_limit restart restart running_mainloop? safe? safe? safe_base? safe_base? safe_level safe_level safe_level= safe_level= safeip_add_to_access_path safeip_configinfo safeip_configure safeip_delete safeip_find_in_access_path safeip_set_log_cmd set_bgerror_handler set_cb_error set_eventloop_tick set_eventloop_weight set_limit set_limit set_no_event_wait set_safe_level set_safe_level share_stderr share_stderr share_stdin share_stdin share_stdio share_stdio share_stdout share_stdout slave? slave? slaves slaves thread_eval_proc tk_cmd_tbl tk_object_table tk_windows to_eval to_eval transfer_stderr transfer_stderr transfer_stdin transfer_stdin transfer_stdio transfer_stdio transfer_stdout transfer_stdout wait_on_mainloop= wait_on_mainloop?

### External Aliases

new | -> | __new
new_master | -> | new
new_slave | -> | new_trusted_slave
new_safe_slave | -> | new_safeTk

### Attributes

cmd | [R] |
ip | [R] |
ret | [RW] |
target | [RW] |

### Public Class methods

_DEFAULT_MASTER()

[Source]

    # File tk/lib/remote-tk.rb, line 19
      def self._DEFAULT_MASTER
        # work only once
        if @flag
          @flag = nil
          @@DEFAULT_MASTER
        else
          nil
        end
      end

_IP_TABLE()

[Source]

    # File tk/lib/remote-tk.rb, line 15
      def self._IP_TABLE; @@IP_TABLE; end

_TK_TABLE_LIST()

[Source]

    # File tk/lib/remote-tk.rb, line 16
      def self._TK_TABLE_LIST; @@TK_TABLE_LIST; end

__getip()

[Source]

    # File tk/lib/multi-tk.rb, line 1096
      def self.__getip
        current = Thread.current
        if TclTkLib.mainloop_thread? != false && current['callback_ip']
          return current['callback_ip']
        end
        if current.group == ThreadGroup::Default
          @@DEFAULT_MASTER
        else
          ip = @@IP_TABLE[current.group]
          unless ip
            fail SecurityError,
              "cannot call Tk methods on #{Thread.current.inspect}"
          end
          ip
        end
      end

_conv_listelement(arg)

[Source]

    # File tk/lib/multi-tk.rb, line 1813
      def _conv_listelement(arg)
        __getip._conv_listelement(arg)
      end

_create_console()

[Source]

    # File tk/lib/multi-tk.rb, line 1817
      def _create_console
        __getip._create_console
      end

_eval(str)

[Source]

    # File tk/lib/multi-tk.rb, line 1725
      def _eval(str)
        __getip._eval(str)
      end

_eval_with_enc(str)

[Source]

    # File tk/lib/multi-tk.rb, line 1741
      def _eval_with_enc(str)
        __getip._eval_with_enc(str)
      end

_eval_without_enc(str)

[Source]

    # File tk/lib/multi-tk.rb, line 1733
      def _eval_without_enc(str)
        __getip._eval_without_enc(str)
      end

_fromUTF8(str, encoding=nil)

[Source]

    # File tk/lib/multi-tk.rb, line 1753
      def _fromUTF8(str, encoding=nil)
        __getip._fromUTF8(str, encoding)
      end

_get_global_var(var)

[Source]

    # File tk/lib/multi-tk.rb, line 1788
      def _get_global_var(var)
        __getip._get_global_var(var)
      end

_get_global_var2(var, idx)

[Source]

    # File tk/lib/multi-tk.rb, line 1791
      def _get_global_var2(var, idx)
        __getip._get_global_var2(var, idx)
      end

_get_variable(var, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 1769
      def _get_variable(var, flag)
        __getip._get_variable(var, flag)
      end

_get_variable2(var, idx, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 1772
      def _get_variable2(var, idx, flag)
        __getip._get_variable2(var, idx, flag)
      end

_invoke(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 1729
      def _invoke(*args)
        __getip._invoke(*args)
      end

_invoke_with_enc(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 1745
      def _invoke_with_enc(*args)
        __getip._invoke_with_enc(*args)
      end

_invoke_without_enc(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 1737
      def _invoke_without_enc(*args)
        __getip._invoke_without_enc(*args)
      end

_ip_id_()

[Source]

    # File tk/lib/multi-tk.rb, line 1089
      def self._ip_id_
        __getip._ip_id_
      end

_merge_tklist(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 1810
      def _merge_tklist(*args)
        __getip._merge_tklist(*args)
      end

_return_value()

[Source]

    # File tk/lib/multi-tk.rb, line 1765
      def _return_value
        __getip._return_value
      end

_set_global_var(var, value)

[Source]

    # File tk/lib/multi-tk.rb, line 1794
      def _set_global_var(var, value)
        __getip._set_global_var(var, value)
      end

_set_global_var2(var, idx, value)

[Source]

    # File tk/lib/multi-tk.rb, line 1797
      def _set_global_var2(var, idx, value)
        __getip._set_global_var2(var, idx, value)
      end

_set_variable(var, value, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 1775
      def _set_variable(var, value, flag)
        __getip._set_variable(var, value, flag)
      end

_set_variable2(var, idx, value, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 1778
      def _set_variable2(var, idx, value, flag)
        __getip._set_variable2(var, idx, value, flag)
      end

_split_tklist(str)

[Source]

    # File tk/lib/multi-tk.rb, line 1807
      def _split_tklist(str)
        __getip._split_tklist(str)
      end

_thread_tkwait(mode, target)

[Source]

    # File tk/lib/multi-tk.rb, line 1761
      def _thread_tkwait(mode, target)
        __getip._thread_tkwait(mode, target)
      end

_thread_vwait(var)

[Source]

    # File tk/lib/multi-tk.rb, line 1757
      def _thread_vwait(var)
        __getip._thread_vwait(var)
      end

_toUTF8(str, encoding=nil)

[Source]

    # File tk/lib/multi-tk.rb, line 1749
      def _toUTF8(str, encoding=nil)
        __getip._toUTF8(str, encoding)
      end

_unset_global_var(var)

[Source]

    # File tk/lib/multi-tk.rb, line 1800
      def _unset_global_var(var)
        __getip._unset_global_var(var)
      end

_unset_global_var2(var, idx)

[Source]

    # File tk/lib/multi-tk.rb, line 1803
      def _unset_global_var2(var, idx)
        __getip._unset_global_var2(var, idx)
      end

_unset_variable(var, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 1781
      def _unset_variable(var, flag)
        __getip._unset_variable(var, flag)
      end

_unset_variable2(var, idx, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 1784
      def _unset_variable2(var, idx, flag)
        __getip._unset_variable2(var, idx, flag)
      end

abort(msg = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 1702
      def abort(msg = nil)
        __getip.abort(msg)
      end

add_tk_procs(name, args=nil, body=nil)

[Source]

    # File tk/lib/multi-tk.rb, line 1365
      def self.add_tk_procs(name, args=nil, body=nil)
        @@ADD_TK_PROCS << [name, args, body]
        @@IP_TABLE.each{|tg, ip|
          ip._add_tk_procs(name, args, body)
        }
      end

alias_delete(slave, cmd_name)

[Source]

    # File tk/lib/multi-tk.rb, line 2275
      def self.alias_delete(slave, cmd_name)
        __getip.alias_delete(slave, cmd_name)
        self
      end

alias_info(slave, cmd_name)

[Source]

    # File tk/lib/multi-tk.rb, line 2267
      def self.alias_info(slave, cmd_name)
        __getip.alias_info(slave, cmd_name)
      end

alias_target(aliascmd, slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2486
      def self.alias_target(aliascmd, slave = '')
        __getip.alias_target(aliascmd, slave)
      end

aliases(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2293
      def self.aliases(slave = '')
        __getip.aliases(slave)
      end

alive?()

[Source]

    # File tk/lib/multi-tk.rb, line 1241
      def self.alive?
        __getip.alive?
      end

allow_ruby_exit=(mode)

[Source]

    # File tk/lib/multi-tk.rb, line 1682
      def allow_ruby_exit= (mode)
        __getip.allow_ruby_exit = mode
      end

allow_ruby_exit?()

[Source]

    # File tk/lib/multi-tk.rb, line 1678
      def allow_ruby_exit?
        __getip.allow_ruby_exit?
      end

assign_receiver_and_watchdog(target)

[Source]

    # File tk/lib/multi-tk.rb, line 650
        def self.assign_receiver_and_watchdog(target)
          ret = [nil]
          @assign_thread.raise(@assign_request.new(target, ret))
          while ret[0] == nil
            unless @assign_thread.alive?
              raise RuntimeError, 'lost the thread to assign a receiver and a watchdog thread'
            end
          end
          if ret[0].kind_of?(Exception)
            raise ret[0]
          else
            ret[0]
          end
        end

bgerror(cmd = Proc.new, slave = nil, &b)

[Source]

    # File tk/lib/multi-tk.rb, line 2434
      def self.bgerror(cmd = Proc.new, slave = nil, &b)
        __getip.bgerror(cmd, slave, &b)
      end

bgerror(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2441
      def self.bgerror(slave = '')
        __getip.bgerror(slave)
      end

cb_entry_class()

[Source]

    # File tk/lib/multi-tk.rb, line 1380
      def self.cb_entry_class
        @@CB_ENTRY_CLASS
      end

create_table()

[Source]

    # File tk/lib/multi-tk.rb, line 1340
      def self.create_table
        #if __getip.slave?
        #  raise SecurityError, "slave-IP has no permission creating a new table"
        #end
        id = @@TK_TABLE_LIST.size
        obj = Object.new
        @@TK_TABLE_LIST << obj
        obj.instance_eval "def self.method_missing(m, *args)\nMultiTkIp.tk_object_table(\#{id}).__send__(m, *args)\nend\n"
        obj.freeze
        @@IP_TABLE.each{|tg, ip| ip._add_new_tables }
        return obj
      end

def_alias(slave, new_cmd, org_cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 2285
      def self.def_alias(slave, new_cmd, org_cmd, *args)
        ret = __getip.def_alias(slave, new_cmd, org_cmd, *args)
        (ret == new_cmd)? self: nil
      end

delete()

[Source]

    # File tk/lib/multi-tk.rb, line 1686
      def delete
        __getip.delete
      end

delete_cmd(slave, cmd)

[Source]

    # File tk/lib/multi-tk.rb, line 2320
      def self.delete_cmd(slave, cmd)
        __getip.delete_cmd(slave, cmd)
        self
      end

delete_slaves(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 2302
      def self.delete_slaves(*args)
        __getip.delete_slaves(*args)
        self
      end

deleted?()

[Source]

    # File tk/lib/multi-tk.rb, line 1690
      def deleted?
        __getip.deleted?
      end

do_one_event(flag = TclTkLib::EventFlag::ALL)

[Source]

    # File tk/lib/multi-tk.rb, line 1625
      def do_one_event(flag = TclTkLib::EventFlag::ALL)
        __getip.do_one_event(flag)
      end

eval_proc(*args, &blk)

class method

[Source]

    # File tk/lib/multi-tk.rb, line 1607
      def eval_proc(*args, &blk)
        # class ==> interp object
        __getip.eval_proc(*args, &blk)
      end

exist?(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2311
      def self.exist?(slave = '')
        __getip.exist?(slave)
      end

exit(st = true)

[Source]

    # File tk/lib/multi-tk.rb, line 1706
      def exit(st = true)
        __getip.exit(st)
      end

exit!(st = false)

[Source]

    # File tk/lib/multi-tk.rb, line 1710
      def exit!(st = false)
        __getip.exit!(st)
      end

expose_cmd(slave, cmd, aliasname = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2333
      def self.expose_cmd(slave, cmd, aliasname = nil)
        __getip.expose_cmd(slave, cmd, aliasname)
        self
      end

get_cb_entry(cmd)

[Source]

    # File tk/lib/multi-tk.rb, line 1383
      def self.get_cb_entry(cmd)
        @@CB_ENTRY_CLASS.new(__getip, cmd).freeze
      end

get_eventloop_tick()

[Source]

    # File tk/lib/multi-tk.rb, line 1639
      def get_eventloop_tick
        __getip.get_eventloop_tick
      end

get_eventloop_weight()

[Source]

    # File tk/lib/multi-tk.rb, line 1651
      def get_eventloop_weight
        __getip.get_eventloop_weight
      end

get_limit(limit_type, slave = '', slot = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2471
      def self.get_limit(limit_type, slave = '', slot = nil)
        __getip.get_limit(limit_type, slave, slot)
      end

get_no_event_wait()

[Source]

    # File tk/lib/multi-tk.rb, line 1645
      def get_no_event_wait
        __getip.get_no_event_wait
      end

has_mainwindow?()

[Source]

    # File tk/lib/multi-tk.rb, line 1694
      def has_mainwindow?
        __getip.has_mainwindow?
      end

hidden_cmds(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2354
      def self.hidden_cmds(slave = '')
        __getip.hidden_cmds(slave)
      end

hide_cmd(slave, cmd, aliasname = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2346
      def self.hide_cmd(slave, cmd, aliasname = nil)
        __getip.hide_cmd(slave, cmd, aliasname)
        self
      end

inherited(subclass)

[Source]

    # File tk/lib/multi-tk.rb, line 675
      def self.inherited(subclass)
        # trust if on ThreadGroup::Default or @@DEFAULT_MASTER's ThreadGroup
        if @@IP_TABLE[Thread.current.group] == @@DEFAULT_MASTER
          begin
            class << subclass
              self.methods.each{|m|
                begin
                  unless m == '__id__' || m == '__send__' || m == 'freeze'
                    undef_method(m)
                  end
                rescue Exception
                  # ignore all exceptions
                end
              }
            end
          ensure
            subclass.freeze
            fail SecurityError,
              "cannot create subclass of MultiTkIp on a untrusted ThreadGroup"
          end
        end
      end

init_ip_env(script = Proc.new)

[Source]

    # File tk/lib/multi-tk.rb, line 1358
      def self.init_ip_env(script = Proc.new)
        @@INIT_IP_ENV << script
        @@IP_TABLE.each{|tg, ip|
          ip._init_ip_env(script)
        }
      end

init_ip_internal()

[Source]

    # File tk/lib/multi-tk.rb, line 1372
      def self.init_ip_internal
        __getip._init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
      end

invalid_namespace?()

[Source]

    # File tk/lib/multi-tk.rb, line 1698
      def invalid_namespace?
        __getip.invalid_namespace?
      end

invoke_hidden(slave, cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 2373
      def self.invoke_hidden(slave, cmd, *args)
        __getip.invoke_hidden(slave, cmd, *args)
      end

invoke_hidden_on_global(slave, cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 2393
      def self.invoke_hidden_on_global(slave, cmd, *args)
        __getip.invoke_hidden_on_global(slave, cmd, *args)
      end

invoke_hidden_on_namespace(slave, ns, cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 2410
      def self.invoke_hidden_on_namespace(slave, ns, cmd, *args)
        __getip.invoke_hidden_on_namespace(slave, ns, cmd, *args)
      end

ip_name()

[Source]

    # File tk/lib/multi-tk.rb, line 1254
      def self.ip_name
        __getip.ip_name
      end

mainloop(check_root = true)

[Source]

    # File tk/lib/multi-tk.rb, line 1619
      def mainloop(check_root = true)
        __getip.mainloop(check_root)
      end

mainloop_abort_on_exception()

[Source]

    # File tk/lib/multi-tk.rb, line 1628
      def mainloop_abort_on_exception
        # __getip.mainloop_abort_on_exception
        TclTkLib.mainloop_abort_on_exception
      end

mainloop_abort_on_exception=(mode)

[Source]

    # File tk/lib/multi-tk.rb, line 1632
      def mainloop_abort_on_exception=(mode)
        # __getip.mainloop_abort_on_exception=(mode)
        TclTkLib.mainloop_abort_on_exception=(mode)
      end

mainloop_watchdog(check_root = true)

[Source]

    # File tk/lib/multi-tk.rb, line 1622
      def mainloop_watchdog(check_root = true)
        __getip.mainloop_watchdog(check_root)
      end

make_safe()

[Source]

    # File tk/lib/multi-tk.rb, line 1662
      def make_safe
        __getip.make_safe
      end

mark_trusted(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2418
      def self.mark_trusted(slave = '')
        __getip.mark_trusted(slave)
        self
      end

master?()

[Source]

    # File tk/lib/multi-tk.rb, line 1220
      def self.master?
        __getip.master?
      end

method_missing(id, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 1658
      def method_missing(id, *args)
        __getip.__send__(id, *args)
      end

new(target, ret)

[Source]

    # File tk/lib/multi-tk.rb, line 614
          def self.new(target, ret)
            obj = super()
            obj.target = target
            obj.ret = ret
            obj
          end

new(master, safeip=true, keys={})

[Source]

    # File tk/lib/multi-tk.rb, line 938
      def initialize(master, safeip=true, keys={})
        if $SAFE >= 4
          fail SecurityError, "cannot create a new interpreter at level #{$SAFE}"
        end

        if safeip == nil && $SAFE >= 2
          fail SecurityError, "cannot create a master-ip at level #{$SAFE}"
        end

        if master.deleted? && safeip == nil
          fail RuntimeError, "cannot create a slave of a deleted interpreter"
        end

        if !master.deleted? && !master.master? && master.safe?
          fail SecurityError, "safe-slave-ip cannot create a new interpreter"
        end

        if safeip == nil && !master.master?
          fail SecurityError, "slave-ip cannot create a master-ip"
        end

        unless keys.kind_of? Hash
          fail ArgumentError, "expecting a Hash object for the 2nd argument"
        end

        @tk_windows = {}
        @tk_table_list = []
        @slave_ip_tbl = {}
        @slave_ip_top = {}
        @cb_error_proc = []
        @evloop_thread = []

        @tk_windows.taint unless @tk_windows.tainted?
        @tk_table_list.taint unless @tk_table_list.tainted?
        @slave_ip_tbl.taint unless @slave_ip_tbl.tainted?
        @slave_ip_top.taint unless @slave_ip_top.tainted?
        @cb_error_proc.taint unless @cb_error_proc.tainted?
        @evloop_thread.taint unless @evloop_thread.tainted?

        name, safe, safe_opts, tk_opts = _parse_slaveopts(keys)

        safe = 4 if safe && !safe.kind_of?(Fixnum)

        @safe_base = false

        if safeip == nil
          # create master-ip
          @interp = TclTkIp.new(name, _keys2opts(tk_opts))

          @ip_name = nil
          if safe
            safe = $SAFE if safe < $SAFE
            @safe_level = [safe]
          else
            @safe_level = [$SAFE]
          end
        else
          # create slave-ip
          if safeip || master.safe?
            @safe_base = true
            @interp, @ip_name = master.__create_safe_slave_obj(safe_opts,
                                                               name, tk_opts)
            if safe
              safe = master.safe_level if safe < master.safe_level
              @safe_level = [safe]
            else
              @safe_level = [4]
            end
          else
            @interp, @ip_name = master.__create_trusted_slave_obj(name, tk_opts)
            if safe
              safe = master.safe_level if safe < master.safe_level
              @safe_level = [safe]
            else
              @safe_level = [master.safe_level]
            end
          end
          @set_alias_proc = proc{|name|
            master._invoke('interp', 'alias', @ip_name, name, '', name)
          }.freeze
        end

        @system = Object.new

        @wait_on_mainloop = [true, 0].taint
        # @wait_on_mainloop = [false, 0].taint

        @threadgroup  = ThreadGroup.new

        @cmd_queue = Queue.new

    ??
        @@DEFAULT_MASTER.assign_receiver_and_watchdog(self)

        @@IP_TABLE[@threadgroup] = self
        _init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
        @@TK_TABLE_LIST.size.times{
          (tbl = {}).tainted? || tbl.taint
          @tk_table_list << tbl
        }

        class << self
          undef :instance_eval
        end

        # dummy call for initialization
        self.eval_proc{ Tk.tk_call('set', 'tcl_patchLevel') }

        self.freeze  # defend against modification
      end

new(ip, cmd)

[Source]

    # File tk/lib/multi-tk.rb, line 71
        def initialize(ip, cmd)
          @ip = ip
          @cmd = cmd
          freeze
        end

new_master(safe=nil, keys={})

[Source]

    # File tk/lib/multi-tk.rb, line 1121
      def new_master(safe=nil, keys={})
        if safe.kind_of?(Hash)
          keys = safe
        elsif safe.kind_of?(Integer)
          raise ArgumentError, "unexpected argument(s)" unless keys.kind_of?(Hash)
          if !keys.key?(:safe) && !keys.key?('safe')
            keys[:safe] = safe
          end
        elsif safe == nil
          # do nothing
        else
          raise ArgumentError, "unexpected argument(s)"
        end

        ip = __new(__getip, nil, keys)
        #ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
         if block_given?
           Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
         end
        ip
      end

new_safe_slave(safe=4, keys={})

[Source]

    # File tk/lib/multi-tk.rb, line 1168
      def new_safe_slave(safe=4, keys={})
        if safe.kind_of?(Hash)
          keys = safe
        elsif safe.kind_of?(Integer)
          raise ArgumentError, "unexpected argument(s)" unless keys.kind_of?(Hash)
          if !keys.key?(:safe) && !keys.key?('safe')
            keys[:safe] = safe
          end
        else
          raise ArgumentError, "unexpected argument(s)"
        end

        ip = __new(__getip, true, keys)
        # ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
        if block_given?
          Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
        end
        ip
      end

new_slave(safe=nil, keys={})

[Source]

    # File tk/lib/multi-tk.rb, line 1145
      def new_slave(safe=nil, keys={})
        if safe.kind_of?(Hash)
          keys = safe
        elsif safe.kind_of?(Integer)
          raise ArgumentError, "unexpected argument(s)" unless keys.kind_of?(Hash)
          if !keys.key?(:safe) && !keys.key?('safe')
            keys[:safe] = safe
          end
        elsif safe == nil
          # do nothing
        else
          raise ArgumentError, "unexpected argument(s)"
        end

        ip = __new(__getip, false, keys)
        # ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
        if block_given?
          Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
        end
        ip
      end

path()

[Source]

    # File tk/lib/multi-tk.rb, line 1248
      def self.path
        __getip.path
      end

recursion_limit(slave = '', limit = None)

[Source]

    # File tk/lib/multi-tk.rb, line 2479
      def self.recursion_limit(slave = '', limit = None)
        __getip.recursion_limit(slave)
      end

restart(app_name = nil, keys = {})

[Source]

    # File tk/lib/multi-tk.rb, line 1714
      def restart(app_name = nil, keys = {})
        init_ip_internal

        __getip._invoke('set', 'argv0', app_name) if app_name
        if keys.kind_of?(Hash)
          __getip._invoke('set', 'argv', _keys2opts(keys))
        end

        __getip.restart
      end

safe?()

[Source]

    # File tk/lib/multi-tk.rb, line 1666
      def safe?
        __getip.safe?
      end

safe_base?()

[Source]

    # File tk/lib/multi-tk.rb, line 1670
      def safe_base?
        begin
          __getip.safe_base?
        rescue
          false
        end
      end

safe_level()

[Source]

    # File tk/lib/multi-tk.rb, line 212
      def self.safe_level
        __getip.safe_level
      end

safe_level=(safe)

[Source]

    # File tk/lib/multi-tk.rb, line 206
      def self.safe_level=(safe)
        self.set_safe_level(safe)
      end

set_eventloop_tick(tick)

[Source]

    # File tk/lib/multi-tk.rb, line 1636
      def set_eventloop_tick(tick)
        __getip.set_eventloop_tick(tick)
      end

set_eventloop_weight(loop_max, no_event_tick)

[Source]

    # File tk/lib/multi-tk.rb, line 1648
      def set_eventloop_weight(loop_max, no_event_tick)
        __getip.set_eventloop_weight(loop_max, no_event_tick)
      end

set_limit(limit_type, slave = '', opts = {})

[Source]

    # File tk/lib/multi-tk.rb, line 2448
      def self.set_limit(limit_type, slave = '', opts = {})
        __getip.set_limit(limit_type, slave, opts)
      end

set_no_event_wait(tick)

[Source]

    # File tk/lib/multi-tk.rb, line 1642
      def set_no_event_wait(tick)
        __getip.set_no_event_wait(tick)
      end

set_safe_level(safe)

[Source]

    # File tk/lib/multi-tk.rb, line 203
      def self.set_safe_level(safe)
        __getip.set_safe_level(safe)
      end

share_stderr(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2512
      def self.share_stderr(dist, src = '')
        __getip.share_stderr(dist, src)
        self
      end

share_stdin(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2494
      def self.share_stdin(dist, src = '')
        __getip.share_stdin(dist, src)
        self
      end

share_stdio(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2550
      def self.share_stdio(dist, src = '')
        __getip.share_stdio(dist, src)
        self
      end

share_stdout(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2503
      def self.share_stdout(dist, src = '')
        __getip.share_stdout(dist, src)
        self
      end

slave?()

[Source]

    # File tk/lib/multi-tk.rb, line 1227
      def self.slave?
        not self.master?
      end

slaves(all = false)

[Source]

    # File tk/lib/multi-tk.rb, line 1275
      def self.slaves(all = false)
        __getip.slaves(all)
      end

tk_cmd_tbl()

[Source]

    # File tk/lib/multi-tk.rb, line 1331
      def self.tk_cmd_tbl
        @@TK_CMD_TBL
      end

tk_object_table(id)

[Source]

    # File tk/lib/multi-tk.rb, line 1337
      def self.tk_object_table(id)
        __getip._tk_table_list[id]
      end

tk_windows()

[Source]

    # File tk/lib/multi-tk.rb, line 1334
      def self.tk_windows
        __getip._tk_windows
      end

to_eval()

[Source]

    # File tk/lib/multi-tk.rb, line 1260
      def self.to_eval
        __getip.to_eval
      end

transfer_stderr(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2539
      def self.transfer_stderr(dist, src = '')
        __getip.transfer_stderr(dist, src)
        self
      end

transfer_stdin(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2521
      def self.transfer_stdin(dist, src = '')
        __getip.transfer_stdin(dist, src)
        self
      end

transfer_stdio(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2561
      def self.transfer_stdio(dist, src = '')
        __getip.transfer_stdio(dist, src)
        self
      end

transfer_stdout(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2530
      def self.transfer_stdout(dist, src = '')
        __getip.transfer_stdout(dist, src)
        self
      end

### Public Instance methods

__create_safe_slave_obj(safe_opts, app_name, tk_opts)

[Source]

    # File tk/lib/multi-tk.rb, line 878
      def __create_safe_slave_obj(safe_opts, app_name, tk_opts)
        # safe interpreter
        ip_name = _create_slave_ip_name
        slave_ip = @interp.create_slave(ip_name, true)
        @slave_ip_tbl[ip_name] = slave_ip
        def slave_ip.safe_base?
          true
        end

        @interp._eval("::safe::interpInit #{ip_name}")

        slave_ip._invoke('set', 'argv0', app_name) if app_name.kind_of?(String)

        if tk_opts
          tk_opts = __check_safetk_optkeys(tk_opts)
          if tk_opts.key?('use')
            @slave_ip_top[ip_name] = ''
          else
            tk_opts, top_path = __create_safetk_frame(slave_ip, ip_name, app_name,
                                                      tk_opts)
            @slave_ip_top[ip_name] = top_path
          end
          @interp._eval("::safe::loadTk #{ip_name} #{_keys2opts(tk_opts)}")
        else
          @slave_ip_top[ip_name] = nil
        end

        if safe_opts.key?('deleteHook') || safe_opts.key?(:deleteHook)
          @interp._eval("::safe::interpConfigure #{ip_name} " +
                        _keys2opts(safe_opts))
        else
          @interp._eval("::safe::interpConfigure #{ip_name} " +
                        _keys2opts(safe_opts) + '-deleteHook {' +
                        TkComm._get_eval_string(proc{|slave|
                                                  self._default_delete_hook(slave)
                                                }) + '}')
        end

        [slave_ip, ip_name]
      end

__create_trusted_slave_obj(name, keys)

[Source]

    # File tk/lib/multi-tk.rb, line 919
      def  __create_trusted_slave_obj__create_trusted_slave_obj(name, keys)
        ip_name = _create_slave_ip_name
        slave_ip = @interp.create_slave(ip_name, false)
        slave_ip._invoke('set', 'argv0', name) if name.kind_of?(String)
        slave_ip._invoke('set', 'argv', _keys2opts(keys))
        @interp._invoke('load', '', 'Tk', ip_name)
        @slave_ip_tbl[ip_name] = slave_ip
        [slave_ip, ip_name]
      end

__eval(str)

[Source]

    # File tk/lib/multi-tk.rb, line 2118
      def __eval(str)
        @interp.__eval(str)
      end

__invoke(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 2122
      def __invoke(*args)
        @interp.__invoke(*args)
      end

_add_new_tables()

[Source]

    # File tk/lib/multi-tk.rb, line 1297
      def _add_new_tables
        (@@TK_TABLE_LIST.size - @tk_table_list.size).times{
          (tbl = {}).tainted? || tbl.taint
          @tk_table_list << tbl
        }
      end

_add_tk_procs(name, args, body)

[Source]

    # File tk/lib/multi-tk.rb, line 1308
      def _add_tk_procs(name, args, body)
        return if slave?
        @interp._invoke('proc', name, args, body) if args && body
        @interp._invoke('interp', 'slaves').split.each{|slave|
          @interp._invoke('interp', 'alias', slave, name, '', name)
        }
      end

_conv_listelement(arg)

[Source]

    # File tk/lib/multi-tk.rb, line 2214
      def _conv_listelement(arg)
        @interp._conv_listelement(arg)
      end

_create_slave_object(keys={})

[Source]

    # File tk/lib/multi-tk.rb, line 931
      def _create_slave_object(keys={})
        ip = MultiTkIp.new_slave(self, keys={})
        @slave_ip_tbl[ip.name] = ip
      end

_default_delete_hook(slave)

[Source]

    # File tk/lib/multi-tk.rb, line 1058
      def _default_delete_hook(slave)
        @slave_ip_tbl.delete(slave)
        top = @slave_ip_top.delete(slave)
        if top.kind_of?(String)
          # call default hook of safetk.tcl (ignore exceptions)
          if top == ''
            begin
              @interp._eval("::safe::disallowTk #{slave}")
            rescue
              warn("Waring: fail to call '::safe::disallowTk'") if $DEBUG
            end
          else # toplevel path
            begin
              @interp._eval("::safe::tkDelete {} #{top} #{slave}")
            rescue
              warn("Waring: fail to call '::safe::tkDelete'") if $DEBUG
              begin
                @interp._eval("destroy #{top}")
              rescue
                warn("Waring: fail to destroy toplevel") if $DEBUG
              end
            end
          end
        end
      end

_destroy_slaves_of_slaveIP(ip)

[Source]

    # File tk/lib/multi-tk.rb, line 227
      def _destroy_slaves_of_slaveIP(ip)
        unless ip.deleted?
          # ip._split_tklist(ip._invoke('interp', 'slaves')).each{|name|
          ip._split_tklist(ip._invoke_without_enc('interp', 'slaves')).each{|name|
            name = _fromUTF8(name)
            begin
              # ip._eval_without_enc("#{name} eval {foreach i [after info] {after cancel $i}}")
              after_ids = ip._eval_without_enc("#{name} eval {after info}")
              ip._eval_without_enc("#{name} eval {foreach i {#{after_ids}} {after cancel $i}}")
            rescue Exception
            end
            begin
              # ip._invoke('interp', 'eval', name, 'destroy', '.')
              ip._invoke(name, 'eval', 'destroy', '.')
            rescue Exception
            end

            # safe_base?
            if ip._eval_without_enc("catch {::safe::interpConfigure #{name}}") == '0'
              begin
                ip._eval_without_enc("::safe::interpDelete #{name}")
              rescue Exception
              end
            end
    ??
            unless ip.deleted?
              if ip._invoke('interp', 'exists', name) == '1'
                begin
                  ip._invoke('interp', 'delete', name)
                rescue Exception
                end
              end
            end
          }
        end
      end

_eval(str)

[Source]

    # File tk/lib/multi-tk.rb, line 2126
      def _eval(str)
        @interp._eval(str)
      end

_eval_with_enc(str)

[Source]

    # File tk/lib/multi-tk.rb, line 2142
      def _eval_with_enc(str)
        @interp._eval_with_enc(str)
      end

_eval_without_enc(str)

[Source]

    # File tk/lib/multi-tk.rb, line 2134
      def _eval_without_enc(str)
        @interp._eval_without_enc(str)
      end

_fromUTF8(str, encoding=nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2154
      def _fromUTF8(str, encoding=nil)
        @interp._fromUTF8(str, encoding)
      end

_get_global_var(var)

[Source]

    # File tk/lib/multi-tk.rb, line 2189
      def _get_global_var(var)
        @interp._get_global_var(var)
      end

_get_global_var2(var, idx)

[Source]

    # File tk/lib/multi-tk.rb, line 2192
      def _get_global_var2(var, idx)
        @interp._get_global_var2(var, idx)
      end

_get_variable(var, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 2170
      def _get_variable(var, flag)
        @interp._get_variable(var, flag)
      end

_get_variable2(var, idx, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 2173
      def _get_variable2(var, idx, flag)
        @interp._get_variable2(var, idx, flag)
      end

_init_ip_env(script)

[Source]

    # File tk/lib/multi-tk.rb, line 1304
      def _init_ip_env(script)
        script.call(self)
      end

_init_ip_internal(init_ip_env, add_tk_procs)

[Source]

    # File tk/lib/multi-tk.rb, line 1316
      def _init_ip_internal(init_ip_env, add_tk_procs)
        init_ip_env.each{|script| script.call(self)}
        add_tk_procs.each{|name, args, body|
          if master?
            @interp._invoke('proc', name, args, body) if args && body
          else
            @set_alias_proc.call(name)
          end
        }
      end

_invoke(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 2130
      def _invoke(*args)
        @interp._invoke(*args)
      end

_invoke_with_enc(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 2146
      def _invoke_with_enc(*args)
        @interp._invoke_with_enc(*args)
      end

_invoke_without_enc(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 2138
      def _invoke_without_enc(*args)
        @interp._invoke_without_enc(*args)
      end

_ip_id_()

[Source]

    # File tk/lib/multi-tk.rb, line 1092
      def _ip_id_
        ''
      end

_merge_tklist(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 2211
      def _merge_tklist(*args)
        @interp._merge_tklist(*args)
      end

_receiver_mainloop(check_root)

[Source]

    # File tk/lib/multi-tk.rb, line 473
      def _receiver_mainloop(check_root)
        if @evloop_thread[0] && @evloop_thread[0].alive?
          @evloop_thread[0]
        else
          @evloop_thread[0] = Thread.new{
            while !@interp.deleted?
              #if check_root
              #  inf = @interp._invoke_without_enc('info', 'command', '.')
              #  break if !inf.kind_of?(String) || inf != '.'
              #end
              break if check_root && !@interp.has_mainwindow?
              sleep 0.5
            end
          }
          @evloop_thread[0]
        end
      end

_return_value()

[Source]

    # File tk/lib/multi-tk.rb, line 2166
      def _return_value
        @interp._return_value
      end

_set_global_var(var, value)

[Source]

    # File tk/lib/multi-tk.rb, line 2195
      def _set_global_var(var, value)
        @interp._set_global_var(var, value)
      end

_set_global_var2(var, idx, value)

[Source]

    # File tk/lib/multi-tk.rb, line 2198
      def _set_global_var2(var, idx, value)
        @interp._set_global_var2(var, idx, value)
      end

_set_variable(var, value, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 2176
      def _set_variable(var, value, flag)
        @interp._set_variable(var, value, flag)
      end

_set_variable2(var, idx, value, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 2179
      def _set_variable2(var, idx, value, flag)
        @interp._set_variable2(var, idx, value, flag)
      end

_split_tklist(str)

[Source]

    # File tk/lib/multi-tk.rb, line 2208
      def _split_tklist(str)
        @interp._split_tklist(str)
      end

_thread_tkwait(mode, target)

[Source]

    # File tk/lib/multi-tk.rb, line 2162
      def _thread_tkwait(mode, target)
        @interp._thread_tkwait(mode, target)
      end

_thread_vwait(var)

[Source]

    # File tk/lib/multi-tk.rb, line 2158
      def _thread_vwait(var)
        @interp._thread_vwait(var)
      end

_tk_cmd_tbl()

[Source]

    # File tk/lib/multi-tk.rb, line 1283
      def _tk_cmd_tbl
        tbl = {}
        MultiTkIp.tk_cmd_tbl.each{|id, ent| tbl[id] = ent if ent.ip == self }
        tbl
      end

_tk_table_list()

[Source]

    # File tk/lib/multi-tk.rb, line 1293
      def _tk_table_list
        @tk_table_list
      end

_tk_windows()

[Source]

    # File tk/lib/multi-tk.rb, line 1289
      def _tk_windows
        @tk_windows
      end

_toUTF8(str, encoding=nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2150
      def _toUTF8(str, encoding=nil)
        @interp._toUTF8(str, encoding)
      end

_unset_global_var(var)

[Source]

    # File tk/lib/multi-tk.rb, line 2201
      def _unset_global_var(var)
        @interp._unset_global_var(var)
      end

_unset_global_var2(var, idx)

[Source]

    # File tk/lib/multi-tk.rb, line 2204
      def _unset_global_var2(var, idx)
        @interp._unset_global_var2(var, idx)
      end

_unset_variable(var, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 2182
      def _unset_variable(var, flag)
        @interp._unset_variable(var, flag)
      end

_unset_variable2(var, idx, flag)

[Source]

    # File tk/lib/multi-tk.rb, line 2185
      def _unset_variable2(var, idx, flag)
        @interp._unset_variable2(var, idx, flag)
      end

abort(msg = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2075
      def abort(msg = nil)
        if master?
          if msg
            Kernel.abort(msg)
          else
            Kernel.abort
          end
        else
          # ignore msg
          delete
          1
        end
      end

alias_delete(slave, cmd_name)

[Source]

    # File tk/lib/multi-tk.rb, line 2271
      def alias_delete(slave, cmd_name)
        @interp._invoke('interp', 'alias', _slavearg(slave), cmd_name, '')
        self
      end

alias_info(slave, cmd_name)

[Source]

    # File tk/lib/multi-tk.rb, line 2264
      def alias_info(slave, cmd_name)
        _lst2ary(@interp._invoke('interp', 'alias', _slavearg(slave), cmd_name))
      end

alias_target(aliascmd, slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2483
      def alias_target(aliascmd, slave = '')
        @interp._invoke('interp', 'target', _slavearg(slave), aliascmd)
      end

aliases(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2290
      def aliases(slave = '')
        _lst2ary(@interp._invoke('interp', 'aliases', _slavearg(slave)))
      end

alive?()

[Source]

    # File tk/lib/multi-tk.rb, line 1231
      def alive?
        begin
          return false unless @cmd_receiver.alive?
          return false if @interp.deleted?
          return false if @interp._invoke('interp', 'exists', '') == '0'
        rescue Exception
          return false
        end
        true
      end

allow_ruby_exit=(mode)

[Source]

    # File tk/lib/multi-tk.rb, line 1997
      def allow_ruby_exit= (mode)
        @interp.allow_ruby_exit = mode
      end

allow_ruby_exit?()

[Source]

    # File tk/lib/multi-tk.rb, line 1993
      def allow_ruby_exit?
        @interp.allow_ruby_exit?
      end

background_call(*args)

Alias for bg_eval_proc

background_eval_proc(*args)

Alias for bg_eval_proc

background_eval_str(cmd, *eval_args)

Alias for bg_eval_string

background_eval_string(cmd, *eval_args)

Alias for bg_eval_string

bg_call(*args)

Alias for bg_eval_proc

bg_eval_proc(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 1548
      def bg_eval_proc(*args)
        if block_given?
          cmd = Proc.new
        else
          unless (cmd = args.shift)
            fail ArgumentError, "A Proc or Method object is expected for 1st argument"
          end
        end
        Thread.new{
          eval_proc(cmd, *args)
    ??
        }
      end

bg_eval_str(cmd, *eval_args)

Alias for bg_eval_string

bg_eval_string(cmd, *eval_args)

[Source]

    # File tk/lib/multi-tk.rb, line 1587
      def bg_eval_string(cmd, *eval_args)
        # cmd string ==> proc
        unless cmd.kind_of?(String)
          raise RuntimeError, "A String object is expected for the 'cmd' argument"
        end
        Thread.new{
          eval_proc_core(true,
                         proc{|safe|
                           Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd,
                                       *eval_args)
                         })
        }
      end

call(*args)

Alias for eval_proc

call(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 80
        def call(*args)
          unless @ip.deleted?
            current = Thread.current
            backup_ip = current['callback_ip']
            current['callback_ip'] = @ip
            begin
              @ip.cb_eval(@cmd, *args)
            rescue TkCallbackBreak, TkCallbackContinue => e
              fail e
            rescue SecurityError => e
              # in 'exit', 'exit!', and 'abort' : security error --> delete IP
              if e.backtrace[0] =~ /^(.+?):(\d+):in `(exit|exit!|abort)'/
                @ip.delete
              elsif @ip.safe?
                if @ip.respond_to?(:cb_error)
                  @ip.cb_error(e)
                else
                  nil # ignore
                end
              else
                fail e
              end
            rescue Exception => e
              if @ip.safe?
                if @ip.respond_to?(:cb_error)
                  @ip.cb_error(e)
                else
                  nil # ignore
                end
              else
                fail e
              end
            ensure
              current['callback_ip'] = backup_ip
            end
          end
        end

call(*args)

Alias for eval_proc

cb_error(e)

[Source]

    # File tk/lib/multi-tk.rb, line 185
      def cb_error(e)
        if @cb_error_proc[0].respond_to?(:call)
          @cb_error_proc[0].call(e)
        end
      end

cb_eval(cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 1387
      def cb_eval(cmd, *args)
        #self.eval_callback{ TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *args)) }
        #ret = self.eval_callback{ TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *args)) }
        ret = self.eval_callback(*args){|safe, *params|
          $SAFE=safe if $SAFE < safe
          TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
        }
        if ret.kind_of?(Exception)
          raise ret
        end
        ret
      end

def_alias(slave, new_cmd, org_cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 2280
      def def_alias(slave, new_cmd, org_cmd, *args)
        ret = @interp._invoke('interp', 'alias', _slavearg(slave), new_cmd,
                              '', org_cmd, *args)
        (ret == new_cmd)? self: nil
      end

delete()

[Source]

    # File tk/lib/multi-tk.rb, line 2001
      def delete
        @slave_ip_tbl.each{|name, subip|
          _destroy_slaves_of_slaveIP(subip)
    ??
          begin
            # subip._eval_without_enc("foreach i [after info] {after cancel $i}")
            unless subip.deleted?
              after_ids = subip._eval_without_enc("after info")
              subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
            end
          rescue Exception
          end

          # safe_base?
          if @interp._eval_without_enc("catch {::safe::interpConfigure #{name}}") == '0'
            begin
              @interp._eval_without_enc("::safe::interpDelete #{name}")
            rescue Exception
            else
              next if subip.deleted?
            end
          end
          if subip.respond_to?(:safe_base?) && subip.safe_base? &&
              !subip.deleted?
            # do 'exit' to call the delete_hook procedure
            begin
              subip._eval_without_enc('exit')
            rescue Exception
            end
          else
            begin
              subip.delete unless subip.deleted?
            rescue Exception
            end
          end
        }

        begin
          # @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
          after_ids = @interp._eval_without_enc("after info")
          @interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
        rescue Exception
        end

        begin
          @interp._invoke('destroy', '.') unless @interp.deleted?
        rescue Exception
        end

        if @safe_base && !@interp.deleted?
          # do 'exit' to call the delete_hook procedure
          @interp._eval_without_enc('exit')
        end
        @interp.delete
        self
      end

delete_cmd(slave, cmd)

[Source]

    # File tk/lib/multi-tk.rb, line 2315
      def delete_cmd(slave, cmd)
        slave_invoke = @interp._invoke('list', 'rename', cmd, '')
        @interp._invoke('interp', 'eval', _slavearg(slave), slave_invoke)
        self
      end

delete_slaves(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 2297
      def delete_slaves(*args)
        slaves = args.collect{|s| _slavearg(s)}
        @interp._invoke('interp', 'delete', *slaves) if slaves.size > 0
        self
      end

deleted?()

[Source]

    # File tk/lib/multi-tk.rb, line 2063
      def deleted?
        @interp.deleted?
      end

encoding()

[Source]

    # File tk/lib/multi-tk.rb, line 2639
      def encoding
        @interp.encoding
      end

encoding=(enc)

[Source]

    # File tk/lib/multi-tk.rb, line 2642
      def encoding=(enc)
        @interp.encoding = enc
      end

encoding_convert_from(str, enc=None)

Alias for encoding_convertfrom

encoding_convert_to(str, enc=None)

Alias for encoding_convertto

encoding_convertfrom(str, enc=None)

[Source]

    # File tk/lib/multi-tk.rb, line 2646
      def encoding_convertfrom(str, enc=None)
        @interp.encoding_convertfrom(str, enc)
      end

encoding_convertto(str, enc=None)

[Source]

    # File tk/lib/multi-tk.rb, line 2651
      def encoding_convertto(str, enc=None)
        @interp.encoding_convertto(str, enc)
      end

eval_callback(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 1496
      def eval_callback(*args)
        if block_given?
          cmd = Proc.new
        else
          cmd = args.shift
        end
        current = Thread.current
        backup_ip = current['callback_ip']
        current['callback_ip'] = self
        begin
          eval_proc_core(false, cmd, *args)
        ensure
          current['callback_ip'] = backup_ip
        end
      end

eval_proc(*args)

[Source]

    # File tk/lib/multi-tk.rb, line 1512
      def eval_proc(*args)
        # The scope of the eval-block of 'eval_proc' method is different from
        # the external. If you want to pass local values to the eval-block,
        # use arguments of eval_proc method. They are passed to block-arguments.
        if block_given?
          cmd = Proc.new
        else
          unless (cmd = args.shift)
            fail ArgumentError, "A Proc or Method object is expected for 1st argument"
          end
        end
        if TclTkLib.mainloop_thread? == true
          # call from eventloop
          current = Thread.current
          backup_ip = current['callback_ip']
          current['callback_ip'] = self
          begin
            eval_proc_core(false,
                           proc{|safe, *params|
                             $SAFE=safe if $SAFE < safe
                             cmd.call(*params)
                           }, *args)
          ensure
            current['callback_ip'] = backup_ip
          end
        else
          eval_proc_core(true,
                         proc{|safe, *params|
                           $SAFE=safe if $SAFE < safe
                           Thread.new(*params, &cmd).value
                         },
                         *args)
        end
      end

eval_str(cmd, *eval_args)

Alias for eval_string

eval_string(cmd, *eval_args)

[Source]

    # File tk/lib/multi-tk.rb, line 1573
      def eval_string(cmd, *eval_args)
        # cmd string ==> proc
        unless cmd.kind_of?(String)
          raise RuntimeError, "A String object is expected for the 'cmd' argument"
        end

        eval_proc_core(true,
                       proc{|safe|
                         Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd,
                                     *eval_args)
                       })
      end

eval_string(*args)

Alias for eval_proc

exist?(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2307
      def exist?(slave = '')
        ret = @interp._invoke('interp', 'exists', _slavearg(slave))
        (ret == '1')? true: false
      end

exit(st = true)

[Source]

    # File tk/lib/multi-tk.rb, line 2089
      def exit(st = true)
        if master?
          Kernel.exit(st)
        else
          delete
          st
        end
      end

exit!(st = false)

[Source]

    # File tk/lib/multi-tk.rb, line 2098
      def exit!(st = false)
        if master? && !safe? && allow_ruby_exit?
          Kernel.exit!(st)
        else
          delete
          st
        end
      end

expose_cmd(slave, cmd, aliasname = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2325
      def expose_cmd(slave, cmd, aliasname = nil)
        if aliasname
          @interp._invoke('interp', 'expose', _slavearg(slave), cmd, aliasname)
        else
          @interp._invoke('interp', 'expose', _slavearg(slave), cmd)
        end
        self
      end

get_bgerror_handler(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2438
      def get_bgerror_handler(slave = '')
        procedure(@interp._invoke('interp', 'bgerror', _slavearg(slave)))
      end

get_limit(limit_type, slave = '', slot = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2452
      def get_limit(limit_type, slave = '', slot = nil)
        if slot
          num_or_str(@interp._invoke('interp', 'limit', _slavearg(slave),
                                     limit_type, slot))
        else
          l = @interp._split_tklist(@interp._invoke_without_enc('interp', 'limit',
                                                                _slavearg(slave),
                                                                limit_type))
          l.map!{|s| _fromUTF8(s)}
          r = {}
          until l.empty?
            key = l.shift[1..-1]
            val = l.shift
            val = num_or_str(val) if val
            r[key] = val
          end
          r
        end
      end

has_mainwindow?()

[Source]

    # File tk/lib/multi-tk.rb, line 2067
      def has_mainwindow?
        @interp.has_mainwindow?
      end

hidden_cmds(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2351
      def hidden_cmds(slave = '')
        _lst2ary(@interp._invoke('interp', 'hidden', _slavearg(slave)))
      end

hide_cmd(slave, cmd, aliasname = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2338
      def hide_cmd(slave, cmd, aliasname = nil)
        if aliasname
          @interp._invoke('interp', 'hide', _slavearg(slave), cmd, aliasname)
        else
          @interp._invoke('interp', 'hide', _slavearg(slave), cmd)
        end
        self
      end

inspect()

[Source]

    # File tk/lib/multi-tk.rb, line 1193
      def inspect
        s = self.to_s.chop!
        if master?
          if @interp.deleted?
            s << ':deleted-master'
          else
            s << ':master'
          end
        else
          if @interp.deleted?
            s << ':deleted-slave'
          elsif @interp.safe?
            s << ':safe-slave'
          else
            s << ':trusted-slave'
          end
        end
        s << '>'
      end

inspect()

[Source]

    # File tk/lib/multi-tk.rb, line 77
        def inspect
          cmd.inspect
        end

invalid_namespace?()

[Source]

    # File tk/lib/multi-tk.rb, line 2071
      def invalid_namespace?
        @interp.invalid_namespace?
      end

invoke_hidden(slave, cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 2358
      def invoke_hidden(slave, cmd, *args)
        if args[-1].kind_of?(Hash)
          keys = _symbolkey2str(args.pop)
        else
          keys = []
        end
        keys << _slavearg(slave)
        if Tk::TCL_MAJOR_VERSION > 8 ||
            (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
          keys << '--'
        end
        keys << cmd
        keys.concat(args)
        @interp._invoke('interp', 'invokehidden', *keys)
      end

invoke_hidden_on_global(slave, cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 2377
      def invoke_hidden_on_global(slave, cmd, *args)
        if args[-1].kind_of?(Hash)
          keys = _symbolkey2str(args.pop)
        else
          keys = []
        end
        keys << _slavearg(slave)
        keys << '-global'
        if Tk::TCL_MAJOR_VERSION > 8 ||
            (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
          keys << '--'
        end
        keys << cmd
        keys.concat(args)
        @interp._invoke('interp', 'invokehidden', *keys)
      end

invoke_hidden_on_namespace(slave, ns, cmd, *args)

[Source]

    # File tk/lib/multi-tk.rb, line 2397
      def invoke_hidden_on_namespace(slave, ns, cmd, *args)
        # for Tcl8.5 or later
        if args[-1].kind_of?(Hash)
          keys = _symbolkey2str(args.pop)
        else
          keys = []
        end
        keys << _slavearg(slave)
        keys << '-namespace' << TkComm._get_eval_string(ns)
        keys << '--' << cmd
        keys.concat(args)
        @interp._invoke('interp', 'invokehidden', *keys)
      end

ip_name()

[Source]

    # File tk/lib/multi-tk.rb, line 1251
      def ip_name
        @ip_name || ''
      end

mainloop(check_root = true, restart_on_dead = true)

[Source]

    # File tk/lib/multi-tk.rb, line 1873
      def mainloop(check_root = true, restart_on_dead = true)
        #return self if self.slave?
        #return self if self != @@DEFAULT_MASTER
        if self != @@DEFAULT_MASTER
          if @wait_on_mainloop[0]
            begin
              @wait_on_mainloop[1] += 1
              if $SAFE >= 4
                _receiver_mainloop(check_root).join
              else
                @cmd_queue.enq([@system, 'call_mainloop',
                                Thread.current, check_root])
                Thread.stop
              end
            rescue MultiTkIp_OK => ret
              # return value
              if ret.value.kind_of?(Thread)
                return ret.value.value
              else
                return ret.value
              end
            rescue SystemExit => e
              # exit IP
              warn("Warning: " + $! + " on " + self.inspect) if $DEBUG
              begin
                self._eval_without_enc('exit')
              rescue Exception
              end
              self.delete
            rescue StandardError => e
              if $DEBUG
                warn("Warning: " + e.class.inspect +
                     ((e.message.length > 0)? ' "' + e.message + '"': '') +
                     " on " + self.inspect)
              end
              return e
            rescue Exception => e
              return e
            ensure
              @wait_on_mainloop[1] -= 1
            end
          end
          return
        end

        unless restart_on_dead
          @wait_on_mainloop[1] += 1
    ??
          begin
            @interp.mainloop(check_root)
          ensure
            @wait_on_mainloop[1] -= 1
          end
        else
          loop do
            break unless self.alive?
            if check_root
              begin
                break if TclTkLib.num_of_mainwindows == 0
              rescue StandardError
                break
              end
            end
            break if @interp.deleted?
            begin
              @wait_on_mainloop[1] += 1
              @interp.mainloop(check_root)
            rescue StandardError => e
              if TclTkLib.mainloop_abort_on_exception != nil
                #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect,
                #             " exception (ignore) : ", $!.message, "\n");
                if $DEBUG
                  warn("Warning: Tk mainloop receives " << e.class.inspect <<
                       " exception (ignore) : " << e.message);
                end
              end
              #raise e
            rescue Exception => e
    ??
              raise e
            ensure
              @wait_on_mainloop[1] -= 1
              Thread.pass  # avoid eventloop conflict
            end
          end
        end
        self
      end

make_safe()

[Source]

    # File tk/lib/multi-tk.rb, line 1981
      def make_safe
        @interp.make_safe
      end

mark_trusted(slave = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2414
      def mark_trusted(slave = '')
        @interp._invoke('interp', 'marktrusted', _slavearg(slave))
        self
      end

master?()

[Source]

    # File tk/lib/multi-tk.rb, line 1213
      def master?
        if @ip_name
          false
        else
          true
        end
      end

path()

[Source]

    # File tk/lib/multi-tk.rb, line 1245
      def path
        @ip_name || ''
      end

recursion_limit(slave = '', limit = None)

[Source]

    # File tk/lib/multi-tk.rb, line 2475
      def recursion_limit(slave = '', limit = None)
        number(@interp._invoke('interp', 'recursionlimit',
                               _slavearg(slave), limit))
      end

restart(app_name = nil, keys = {})

[Source]

    # File tk/lib/multi-tk.rb, line 2107
      def restart(app_name = nil, keys = {})
        _init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)

        @interp._invoke('set', 'argv0', app_name) if app_name
        if keys.kind_of?(Hash)
          @interp._invoke('set', 'argv', _keys2opts(keys))
        end

        @interp.restart
      end

running_mainloop?()

[Source]

    # File tk/lib/multi-tk.rb, line 223
      def running_mainloop?
        @wait_on_mainloop[1] > 0
      end

safe?()

[Source]

    # File tk/lib/multi-tk.rb, line 1985
      def safe?
        @interp.safe?
      end

safe_base?()

[Source]

    # File tk/lib/multi-tk.rb, line 1989
      def safe_base?
        @safe_base
      end

safe_level()

[Source]

    # File tk/lib/multi-tk.rb, line 209
      def safe_level
        @safe_level[0]
      end

safe_level=(safe)

[Source]

    # File tk/lib/multi-tk.rb, line 200
      def safe_level=(safe)
        set_safe_level(safe)
      end

safeip_add_to_access_path(dir)

[Source]

    # File tk/lib/multi-tk.rb, line 2620
      def safeip_add_to_access_path(dir)
        ip = MultiTkIp.__getip
        ip._eval("::safe::interpAddToAccessPath #{@ip_name} #{dir}")
      end

safeip_configinfo(slot = nil)

[Source]

    # File tk/lib/multi-tk.rb, line 2583
      def safeip_configinfo(slot = nil)
        ip = MultiTkIp.__getip
        ret = {}
        if slot
          conf = _lst2ary(ip._eval("::safe::interpConfigure " +
                                   @ip_name + " -#{slot}"))
          if conf[0] == '-deleteHook'
            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]
            end
          else
            ret[conf[0][1..-1]] = conf[1]
          end
        else
          Hash[*_lst2ary(ip._eval("::safe::interpConfigure " +
                                  @ip_name))].each{|k, v|
            if k == '-deleteHook'
              if v =~ /^rb_out\S* (c(_\d+_)?\d+)/
                ret[k[1..-1]] = MultiTkIp._tk_cmd_tbl[$1]
              else
                ret[k[1..-1]] = v
              end
            else
              ret[k[1..-1]] = v
            end
          }
        end
        ret
      end

safeip_configure(slot, value=None)

[Source]

    # File tk/lib/multi-tk.rb, line 2570
      def safeip_configure(slot, value=None)
        # use for '-noStatics' option ==> {statics=>false}
        #     for '-nestedLoadOk' option ==> {nested=>true}
        if slot.kind_of?(Hash)
          ip = MultiTkIp.__getip
          ip._eval('::safe::interpConfigure ' + @ip_name + ' ' + _keys2opts(slot))
        else
          ip._eval('::safe::interpConfigure ' + @ip_name + ' ' +
                   "-#{slot} #{_get_eval_string(value)}")
        end
        self
      end

safeip_delete()

[Source]

    # File tk/lib/multi-tk.rb, line 2615
      def safeip_delete
        ip = MultiTkIp.__getip
        ip._eval("::safe::interpDelete " + @ip_name)
      end

safeip_find_in_access_path(dir)

[Source]

    # File tk/lib/multi-tk.rb, line 2625
      def safeip_find_in_access_path(dir)
        ip = MultiTkIp.__getip
        ip._eval("::safe::interpFindInAccessPath #{@ip_name} #{dir}")
      end

safeip_set_log_cmd(cmd = Proc.new)

[Source]

    # File tk/lib/multi-tk.rb, line 2630
      def safeip_set_log_cmd(cmd = Proc.new)
        ip = MultiTkIp.__getip
        ip._eval("::safe::setLogCmd #{@ip_name} #{_get_eval_string(cmd)}")
      end

set_bgerror_handler(cmd = Proc.new, slave = nil, &b)

[Source]

    # File tk/lib/multi-tk.rb, line 2423
      def set_bgerror_handler(cmd = Proc.new, slave = nil, &b)
        unless TkComm._callback_entry?(cmd)
          if !slave && b
            slave = cmd
            cmd = Proc.new(&b)
          end
        end
        slave = '' unless slave

        @interp._invoke('interp', 'bgerror', _slavearg(slave), cmd)
      end

set_cb_error(cmd = Proc.new)

[Source]

    # File tk/lib/multi-tk.rb, line 181
      def set_cb_error(cmd = Proc.new)
        @cb_error_proc[0] = cmd
      end

set_limit(limit_type, slave = '', opts = {})

[Source]

    # File tk/lib/multi-tk.rb, line 2445
      def set_limit(limit_type, slave = '', opts = {})
        @interp._invoke('interp', 'limit', _slavearg(slave), limit_type, opts)
      end

set_safe_level(safe)

[Source]

    # File tk/lib/multi-tk.rb, line 193
      def set_safe_level(safe)
        if safe > @safe_level[0]
          @safe_level[0] = safe
          @cmd_queue.enq([@system, 'set_safe_level', safe])
        end
        @safe_level[0]
      end

share_stderr(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2508
      def share_stderr(dist, src = '')
        @interp._invoke('interp', 'share', src, 'stderr', dist)
        self
      end

share_stdin(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2490
      def share_stdin(dist, src = '')
        @interp._invoke('interp', 'share', src, 'stdin', dist)
        self
      end

share_stdio(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2544
      def share_stdio(dist, src = '')
        @interp._invoke('interp', 'share', src, 'stdin',  dist)
        @interp._invoke('interp', 'share', src, 'stdout', dist)
        @interp._invoke('interp', 'share', src, 'stderr', dist)
        self
      end

share_stdout(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2499
      def share_stdout(dist, src = '')
        @interp._invoke('interp', 'share', src, 'stdout', dist)
        self
      end

slave?()

[Source]

    # File tk/lib/multi-tk.rb, line 1224
      def slave?
        not master?
      end

slaves(all = false)

[Source]

    # File tk/lib/multi-tk.rb, line 1264
      def slaves(all = false)
        @interp._invoke('interp','slaves').split.map!{|name|
          if @slave_ip_tbl.key?(name)
            @slave_ip_tbl[name]
          elsif all
            name
          else
            nil
          end
        }.compact!
      end

thread_eval_proc(*args)

Alias for bg_eval_proc

to_eval()

[Source]

    # File tk/lib/multi-tk.rb, line 1257
      def to_eval
        @ip_name || ''
      end

transfer_stderr(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2535
      def transfer_stderr(dist, src = '')
        @interp._invoke('interp', 'transfer', src, 'stderr', dist)
        self
      end

transfer_stdin(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2517
      def transfer_stdin(dist, src = '')
        @interp._invoke('interp', 'transfer', src, 'stdin', dist)
        self
      end

transfer_stdio(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2555
      def transfer_stdio(dist, src = '')
        @interp._invoke('interp', 'transfer', src, 'stdin',  dist)
        @interp._invoke('interp', 'transfer', src, 'stdout', dist)
        @interp._invoke('interp', 'transfer', src, 'stderr', dist)
        self
      end

transfer_stdout(dist, src = '')

[Source]

    # File tk/lib/multi-tk.rb, line 2526
      def transfer_stdout(dist, src = '')
        @interp._invoke('interp', 'transfer', src, 'stdout', dist)
        self
      end

wait_on_mainloop=(bool)

[Source]

    # File tk/lib/multi-tk.rb, line 219
      def wait_on_mainloop=(bool)
        @wait_on_mainloop[0] = bool
      end

wait_on_mainloop?()

[Source]

    # File tk/lib/multi-tk.rb, line 216
      def wait_on_mainloop?
        @wait_on_mainloop[0]
      end

[Validate]