2004-05-21 16:45:27 -04:00
|
|
|
#
|
2004-10-11 00:51:21 -04:00
|
|
|
# remote-tk.rb - supports to control remote Tk interpreters
|
|
|
|
# by Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
2004-05-21 16:45:27 -04:00
|
|
|
|
|
|
|
if defined? MultiTkIp
|
|
|
|
fail RuntimeError, "'remote-tk' library must be required before requiring 'multi-tk'"
|
|
|
|
end
|
|
|
|
|
|
|
|
class MultiTkIp; end
|
|
|
|
class RemoteTkIp < MultiTkIp; end
|
|
|
|
|
|
|
|
class MultiTkIp
|
|
|
|
@@IP_TABLE = {}.taint unless defined?(@@IP_TABLE)
|
2004-06-14 05:25:06 -04:00
|
|
|
@@TK_TABLE_LIST = [].taint unless defined?(@@TK_TABLE_LIST)
|
2004-05-21 16:45:27 -04:00
|
|
|
def self._IP_TABLE; @@IP_TABLE; end
|
|
|
|
def self._TK_TABLE_LIST; @@TK_TABLE_LIST; end
|
2004-09-09 01:03:21 -04:00
|
|
|
|
|
|
|
@flag = true
|
|
|
|
def self._DEFAULT_MASTER
|
|
|
|
# work only once
|
|
|
|
if @flag
|
|
|
|
@flag = nil
|
|
|
|
@@DEFAULT_MASTER
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
2004-06-14 05:25:06 -04:00
|
|
|
class RemoteTkIp
|
2004-05-21 16:45:27 -04:00
|
|
|
@@IP_TABLE = MultiTkIp._IP_TABLE unless defined?(@@IP_TABLE)
|
|
|
|
@@TK_TABLE_LIST = MultiTkIp._TK_TABLE_LIST unless defined?(@@TK_TABLE_LIST)
|
|
|
|
end
|
|
|
|
class << MultiTkIp
|
|
|
|
undef _IP_TABLE
|
|
|
|
undef _TK_TABLE_LIST
|
|
|
|
end
|
|
|
|
|
|
|
|
require 'multi-tk'
|
|
|
|
|
2004-09-09 01:03:21 -04:00
|
|
|
class RemoteTkIp
|
|
|
|
if defined?(@@DEFAULT_MASTER)
|
|
|
|
MultiTkIp._DEFAULT_MASTER
|
|
|
|
else
|
|
|
|
@@DEFAULT_MASTER = MultiTkIp._DEFAULT_MASTER
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
###############################
|
|
|
|
|
2004-06-14 05:25:06 -04:00
|
|
|
class << RemoteTkIp
|
|
|
|
undef new_master, new_slave, new_safe_slave
|
|
|
|
undef new_trusted_slave, new_safeTk
|
|
|
|
|
|
|
|
def new(*args, &b)
|
|
|
|
ip = __new(*args)
|
|
|
|
ip.eval_proc(&b) if b
|
|
|
|
ip
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class RemoteTkIp
|
|
|
|
def initialize(remote_ip, displayof=nil, timeout=5)
|
2004-05-21 16:45:27 -04:00
|
|
|
if $SAFE >= 4
|
|
|
|
fail SecurityError, "cannot access another interpreter at level #{$SAFE}"
|
|
|
|
end
|
|
|
|
|
|
|
|
@interp = MultiTkIp.__getip
|
2005-11-18 03:39:29 -05:00
|
|
|
if @interp.safe?
|
|
|
|
fail SecurityError, "safe-IP cannot create RemoteTkIp"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2004-09-11 13:45:53 -04:00
|
|
|
@interp.allow_ruby_exit = false
|
2004-05-21 16:45:27 -04:00
|
|
|
@appname = @interp._invoke('tk', 'appname')
|
2005-05-25 07:09:59 -04:00
|
|
|
@remote = remote_ip.to_s.dup.freeze
|
2004-05-21 16:45:27 -04:00
|
|
|
if displayof.kind_of?(TkWindow)
|
|
|
|
@displayof = displayof.path.dup.freeze
|
|
|
|
else
|
|
|
|
@displayof = nil
|
|
|
|
end
|
|
|
|
if self.deleted?
|
|
|
|
fail RuntimeError, "no Tk application named \"#{@remote}\""
|
|
|
|
end
|
|
|
|
|
|
|
|
@tk_windows = {}
|
|
|
|
@tk_table_list = []
|
|
|
|
@slave_ip_tbl = {}
|
|
|
|
@slave_ip_top = {}
|
|
|
|
|
* ext/tk/tcltklib.c: SEGV when tcltk-stubs is enabled.
* ext/tk/tcltklib.c: avoid error on a shared object.
* ext/tk/extconf.rb: support --with-tcltkversion
* ext/tk/README.tcltklib: add document about --with-tcltkversion
* ext/tk/lib/tk.rb, ext/tk/lib/multi-tk.rb, ext/tk/lib/remote-tk.rb:
not work on $SAFE==4
* ext/tk/lib/multi-tk.rb: Object#methods returns Symbols on Ruby1.9.
* ext/tk/lib/tk/timer.rb: add TkTimer#at_end(proc) to register the
procedure which called at end of the timer.
* ext/tk/lib/tk.rb, ext/tk/lib/tk/itemfont.rb, ext/tk/lib/font.rb:
support __IGNORE_UNKNOWN_CONFIGURE_OPTION__ about font options.
* ext/tk/lib/*: treat __IGNORE_UNKNOWN_CONFIGURE_OPTION__
* ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: bug fix.
* ext/tk/lib/tk/text.rb: typo. call a wrong method.
* ext/tk/lib/tk/itemconfig.rb: ditto.
* ext/tk/lib/tk.rb, ext/tk/lib/tk/itemconfig.rb,
ext/tk/lib/tk/canvas.rb: support alias names of option keys.
* ext/tk/lib/tk/grid.rb: lack of module-method definitions.
* ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase supported
parameter patterns of configure method.
* ext/tk/lib/tk.rb: add TkWindow#grid_anchor, grid_column, grid_row.
* ext/tk/lib/tk/wm.rb: methods of Tk::Wm_for_General module cannot
pass the given block to methods of Tk::Wm module.
* ext/tk/lib/tk/wm.rb: Wm#overrideredirect overwrites arguemnt to
an invalid value.
* ext/tk/lib/tk.rb: fix memory (object) leak bug.
* ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.
* ext/tk/sample/demos-jp/aniwave.rb, ext/tk/sample/demos-en/aniwave.rb:
bug fix.
* ext/tk/lib/tkextlib/blt/component.rb,
ext/tk/lib/tkextlib/tile/tentry.rb,
ext/tk/lib/tkextlib/tile/treeview.rb: ditto.
* ext/tk/lib/tkextlib/tile/tpaned.rb: improve TPaned#add.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget,
ext/tk/sample/demos-jp/style.rb, ext/tk/sample/demos-en/style.rb,
ext/tk/sample/demos-jp/bind.rb, ext/tk/sample/demos-en/bind.rb:
bug fix.
* ext/tk/sample/ttk_wrapper.rb: ditto.
* ext/tk/sample/ttk_wrapper.rb: support "if __FILE__ == $0" idiom.
* ext/tk/sample/tktextio.rb: add binding for 'Ctrl-u' at console mode.
* ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
ext/tk/sample/ttk_wrapper.rb: improve treating and control themes.
add Tk::Tile.themes and Tk::Tile.set_theme(theme).
* ext/tk/lib/tkextlib/tile.rb: lack of autoload definitions.
* ext/tk/lib/tkextlib/tile/tnotebook.rb: cannot use kanji (not UTF-8)
characters for headings.
* ext/tk/lib/tkextlib/tkDND/shape.rb: wrong package name.
* ext/tk/tkutil/tkutil.c: improve handling callback-subst-keys.
Now, support longnam-keys (e.g. '%CTT' on tkdnd-2.0; however, still
not support tkdnd-2.0 on tkextlib), and symbols of parameters (e.g.
:widget=>'%W', :keycode=>'%k', '%x'=>:x, '%X'=>:root_x, and so on;
those are attributes of event object). It means that Ruby/Tk accepts
not only "widget.bind(ev, '%W', '%k', ...){|w, k, ...| ... }", but
also "widget.bind(ev, :widget, :keycode, ...){|w, k, ...| ... }".
It is potentially incompatible, when user passes symbols to the
arguments of the callback block (the block receives the symbols as
strings). I think that is very rare case (probably, used by Ruby/Tk
experts only). When causes such trouble, please give strings instead
of such symbol parameters (e.g. call Symbol#to_s method).
* ext/tk/lib/tk/event.rb, ext/tk/lib/tk/validation.rb,
ext/tk/lib/tkextlib/blt/treeview.rb,
ext/tk/lib/tkextlib/winico/winico.rb: ditto.
* ext/tk/tkutil/tkutil.c: strings are available on subst_tables on
TkUtil::CallbackSubst class (it is useful on Ruby 1.9).
* ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tkextlib/iwidgets/hierarchy.rb,
ext/tk/lib/tkextlib/iwidgets/spinner.rb,
ext/tk/lib/tkextlib/iwidgets/entryfield.rb,
ext/tk/lib/tkextlib/iwidgets/calendar.rb,
ext/tk/lib/tkextlib/blt/dragdrop.rb,
ext/tk/lib/tkextlib/tkDND/tkdnd.rb,
ext/tk/lib/tkextlib/treectrl/tktreectrl.rb,
ext/tk/lib/tkextlib/tktable/tktable.rb: disable code piece became
unnecessary by reason of the changes of ext/tk/tkutil/tkutil.c.
* ext/tk/lib/tk.rb, ext/tk/lib/multi-tk.rb: change strategy to define
the constant WITH_ENCODING.
* ext/tk/lib/tk.rb: fix bug on Tk::Encoding.tk_encoding_names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 16:59:10 -04:00
|
|
|
@force_default_encoding ||= [false].taint
|
|
|
|
@encoding ||= [nil].taint
|
|
|
|
def @encoding.to_s; self.join(nil); end
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
@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?
|
|
|
|
|
|
|
|
@system = Object.new
|
|
|
|
|
|
|
|
@threadgroup = ThreadGroup.new
|
|
|
|
|
2004-09-09 01:03:21 -04:00
|
|
|
@safe_level = [$SAFE]
|
|
|
|
|
2005-07-21 18:05:04 -04:00
|
|
|
@wait_on_mainloop = [true, 0]
|
2004-09-17 02:05:33 -04:00
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
@cmd_queue = Queue.new
|
|
|
|
|
2004-09-09 01:03:21 -04:00
|
|
|
=begin
|
2004-05-21 16:45:27 -04:00
|
|
|
@cmd_receiver, @receiver_watchdog = _create_receiver_and_watchdog()
|
|
|
|
|
|
|
|
@threadgroup.add @cmd_receiver
|
|
|
|
@threadgroup.add @receiver_watchdog
|
|
|
|
|
|
|
|
@threadgroup.enclose
|
2004-09-09 01:03:21 -04:00
|
|
|
=end
|
|
|
|
@@DEFAULT_MASTER.assign_receiver_and_watchdog(self)
|
2004-05-21 16:45:27 -04:00
|
|
|
|
|
|
|
@@IP_TABLE[@threadgroup] = self
|
|
|
|
@@TK_TABLE_LIST.size.times{
|
|
|
|
(tbl = {}).tainted? || tbl.taint
|
|
|
|
@tk_table_list << tbl
|
|
|
|
}
|
|
|
|
|
2004-06-14 05:25:06 -04:00
|
|
|
@ret_val = TkVariable.new
|
|
|
|
if timeout > 0 && ! _available_check(timeout)
|
|
|
|
fail RuntimeError, "cannot create connection"
|
|
|
|
end
|
2004-05-21 16:45:27 -04:00
|
|
|
@ip_id = _create_connection
|
|
|
|
|
2004-09-09 01:03:21 -04:00
|
|
|
class << self
|
|
|
|
undef :instance_eval
|
|
|
|
end
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
self.freeze # defend against modification
|
|
|
|
end
|
|
|
|
|
2005-11-18 03:39:29 -05:00
|
|
|
def manipulable?
|
|
|
|
return true if (Thread.current.group == ThreadGroup::Default)
|
|
|
|
MultiTkIp.__getip == @interp && ! @interp.safe?
|
|
|
|
end
|
|
|
|
def self.manipulable?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def _is_master_of?(tcltkip_obj)
|
|
|
|
tcltkip_obj == @interp
|
|
|
|
end
|
|
|
|
protected :_is_master_of?
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
def _ip_id_
|
|
|
|
@ip_id
|
|
|
|
end
|
|
|
|
|
2004-06-14 05:25:06 -04:00
|
|
|
def _available_check(timeout = 5)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-06-14 05:25:06 -04:00
|
|
|
return nil if timeout < 1
|
|
|
|
@ret_val.value = ''
|
|
|
|
@interp._invoke('send', '-async', @remote,
|
2004-10-11 00:51:21 -04:00
|
|
|
'send', '-async', Tk.appname,
|
|
|
|
"set #{@ret_val.id} ready")
|
2004-06-14 05:25:06 -04:00
|
|
|
Tk.update
|
|
|
|
if @ret_val != 'ready'
|
|
|
|
(1..(timeout*5)).each{
|
2004-10-11 00:51:21 -04:00
|
|
|
sleep 0.2
|
|
|
|
Tk.update
|
|
|
|
break if @ret_val == 'ready'
|
2004-06-14 05:25:06 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
@ret_val.value == 'ready'
|
|
|
|
end
|
|
|
|
private :_available_check
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
def _create_connection
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
ip_id = '_' + @interp._invoke('send', @remote, <<-'EOS') + '_'
|
|
|
|
if {[catch {set _rubytk_control_ip_id_} ret] != 0} {
|
2004-10-11 00:51:21 -04:00
|
|
|
set _rubytk_control_ip_id_ 0
|
2004-05-21 16:45:27 -04:00
|
|
|
} else {
|
2004-10-11 00:51:21 -04:00
|
|
|
set _rubytk_control_ip_id_ [expr $ret + 1]
|
2004-05-21 16:45:27 -04:00
|
|
|
}
|
|
|
|
return $_rubytk_control_ip_id_
|
|
|
|
EOS
|
|
|
|
|
|
|
|
@interp._invoke('send', @remote, <<-EOS)
|
|
|
|
proc rb_out#{ip_id} args {
|
2004-10-11 00:51:21 -04:00
|
|
|
send #{@appname} rb_out \$args
|
2004-05-21 16:45:27 -04:00
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
ip_id
|
|
|
|
end
|
|
|
|
private :_create_connection
|
|
|
|
|
|
|
|
def _appsend(enc_mode, async, *cmds)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
p ['_appsend', [@remote, @displayof], enc_mode, async, cmds] if $DEBUG
|
|
|
|
if $SAFE >= 4
|
|
|
|
fail SecurityError, "cannot send commands at level 4"
|
|
|
|
elsif $SAFE >= 1 && cmds.find{|obj| obj.tainted?}
|
|
|
|
fail SecurityError, "cannot send tainted commands at level #{$SAFE}"
|
|
|
|
end
|
|
|
|
|
2005-07-21 18:05:04 -04:00
|
|
|
cmds = @interp._merge_tklist(*TkUtil::_conv_args([], enc_mode, *cmds))
|
2004-05-21 16:45:27 -04:00
|
|
|
if @displayof
|
|
|
|
if async
|
2004-10-11 00:51:21 -04:00
|
|
|
@interp.__invoke('send', '-async', '-displayof', @displayof,
|
|
|
|
'--', @remote, *cmds)
|
2004-05-21 16:45:27 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
@interp.__invoke('send', '-displayof', @displayof,
|
|
|
|
'--', @remote, *cmds)
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
if async
|
2004-10-11 00:51:21 -04:00
|
|
|
@interp.__invoke('send', '-async', '--', @remote, *cmds)
|
2004-05-21 16:45:27 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
@interp.__invoke('send', '--', @remote, *cmds)
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
private :_appsend
|
|
|
|
|
2004-06-14 05:25:06 -04:00
|
|
|
def ready?(timeout=5)
|
|
|
|
if timeout < 0
|
|
|
|
fail ArgumentError, "timeout must be positive number"
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
2004-06-14 05:25:06 -04:00
|
|
|
_available_check(timeout)
|
|
|
|
end
|
|
|
|
|
|
|
|
def is_rubytk?
|
|
|
|
return false if _appsend(false, false, 'info', 'command', 'ruby') == ""
|
|
|
|
[ _appsend(false, false, 'ruby', 'RUBY_VERSION'),
|
|
|
|
_appsend(false, false, 'set', 'tk_patchLevel') ]
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def appsend(async, *args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
if async != true && async != false && async != nil
|
|
|
|
args.unshift(async)
|
|
|
|
async = false
|
|
|
|
end
|
|
|
|
if @displayof
|
|
|
|
Tk.appsend_displayof(@remote, @displayof, async, *args)
|
|
|
|
else
|
|
|
|
Tk.appsend(@remote, async, *args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def rb_appsend(async, *args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
if async != true && async != false && async != nil
|
|
|
|
args.unshift(async)
|
|
|
|
async = false
|
|
|
|
end
|
|
|
|
if @displayof
|
|
|
|
Tk.rb_appsend_displayof(@remote, @displayof, async, *args)
|
|
|
|
else
|
|
|
|
Tk.rb_appsend(@remote, async, *args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_slave(name, safe=false)
|
|
|
|
if safe
|
|
|
|
safe_opt = ''
|
|
|
|
else
|
|
|
|
safe_opt = '-safe'
|
|
|
|
end
|
|
|
|
_appsend(false, false, "interp create #{safe_opt} -- #{name}")
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_safe
|
|
|
|
fail RuntimeError, 'cannot change safe mode of the remote interpreter'
|
|
|
|
end
|
|
|
|
|
|
|
|
def safe?
|
|
|
|
_appsend(false, false, 'interp issafe')
|
|
|
|
end
|
|
|
|
|
2004-09-11 13:45:53 -04:00
|
|
|
def safe_base?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def allow_ruby_exit?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def allow_ruby_exit= (mode)
|
|
|
|
fail RuntimeError, 'cannot change mode of the remote interpreter'
|
|
|
|
end
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
def delete
|
|
|
|
_appsend(false, true, 'exit')
|
|
|
|
end
|
|
|
|
|
|
|
|
def deleted?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
if @displayof
|
|
|
|
lst = @interp._invoke_without_enc('winfo', 'interps',
|
2004-10-11 00:51:21 -04:00
|
|
|
'-displayof', @displayof)
|
2004-05-21 16:45:27 -04:00
|
|
|
else
|
|
|
|
lst = @interp._invoke_without_enc('winfo', 'interps')
|
|
|
|
end
|
2005-05-25 07:09:59 -04:00
|
|
|
# unless @interp._split_tklist(lst).index(@remote)
|
|
|
|
unless @interp._split_tklist(lst).index(_toUTF8(@remote))
|
2004-05-21 16:45:27 -04:00
|
|
|
true
|
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-07-21 18:05:04 -04:00
|
|
|
def has_mainwindow?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2005-07-21 18:05:04 -04:00
|
|
|
begin
|
|
|
|
inf = @interp._invoke_without_enc('info', 'command', '.')
|
|
|
|
rescue Exception
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
if !inf.kind_of?(String) || inf != '.'
|
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-01-30 23:14:50 -05:00
|
|
|
def invalid_namespace?
|
2005-01-25 00:09:22 -05:00
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
def restart
|
|
|
|
fail RuntimeError, 'cannot restart the remote interpreter'
|
|
|
|
end
|
|
|
|
|
|
|
|
def __eval(str)
|
|
|
|
_appsend(false, false, str)
|
|
|
|
end
|
|
|
|
def _eval(str)
|
|
|
|
_appsend(nil, false, str)
|
|
|
|
end
|
|
|
|
def _eval_without_enc(str)
|
|
|
|
_appsend(false, false, str)
|
|
|
|
end
|
|
|
|
def _eval_with_enc(str)
|
|
|
|
_appsend(true, false, str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _invoke(*args)
|
|
|
|
_appsend(nil, false, *args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def __invoke(*args)
|
|
|
|
_appsend(false, false, *args)
|
|
|
|
end
|
|
|
|
def _invoke(*args)
|
|
|
|
_appsend(nil, false, *args)
|
|
|
|
end
|
|
|
|
def _invoke_without_enc(*args)
|
|
|
|
_appsend(false, false, *args)
|
|
|
|
end
|
|
|
|
def _invoke_with_enc(*args)
|
|
|
|
_appsend(true, false, *args)
|
|
|
|
end
|
|
|
|
|
2005-07-05 01:56:31 -04:00
|
|
|
def _toUTF8(str, encoding=nil)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-21 16:45:27 -04:00
|
|
|
@interp._toUTF8(str, encoding)
|
|
|
|
end
|
|
|
|
|
2005-07-05 01:56:31 -04:00
|
|
|
def _fromUTF8(str, encoding=nil)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-21 16:45:27 -04:00
|
|
|
@interp._fromUTF8(str, encoding)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _thread_vwait(var_name)
|
|
|
|
_appsend(false, 'thread_vwait', varname)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _thread_tkwait(mode, target)
|
|
|
|
_appsend(false, 'thread_tkwait', mode, target)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _return_value
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-21 16:45:27 -04:00
|
|
|
@interp._return_value
|
|
|
|
end
|
|
|
|
|
|
|
|
def _get_variable(var_name, flag)
|
|
|
|
# ignore flag
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'set', TkComm::_get_eval_string(var_name))
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
def _get_variable2(var_name, index_name, flag)
|
|
|
|
# ignore flag
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})")
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def _set_variable(var_name, value, flag)
|
|
|
|
# ignore flag
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'set', TkComm::_get_eval_string(var_name), TkComm::_get_eval_string(value))
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
def _set_variable2(var_name, index_name, value, flag)
|
|
|
|
# ignore flag
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})", TkComm::_get_eval_string(value))
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def _unset_variable(var_name, flag)
|
|
|
|
# ignore flag
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'unset', TkComm::_get_eval_string(var_name))
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
def _unset_variable2(var_name, index_name, flag)
|
|
|
|
# ignore flag
|
|
|
|
_appsend(false, 'unset', "#{var_name}(#{index_name})")
|
|
|
|
end
|
|
|
|
|
|
|
|
def _get_global_var(var_name)
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'set', TkComm::_get_eval_string(var_name))
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
def _get_global_var2(var_name, index_name)
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})")
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def _set_global_var(var_name, value)
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'set', TkComm::_get_eval_string(var_name), TkComm::_get_eval_string(value))
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
def _set_global_var2(var_name, index_name, value)
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'set', "#{TkComm::_get_eval_string(var_name)}(#{TkComm::_get_eval_string(index_name)})", TkComm::_get_eval_string(value))
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def _unset_global_var(var_name)
|
2005-07-21 18:05:04 -04:00
|
|
|
_appsend(false, 'unset', TkComm::_get_eval_string(var_name))
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
def _unset_global_var2(var_name, index_name)
|
|
|
|
_appsend(false, 'unset', "#{var_name}(#{index_name})")
|
|
|
|
end
|
|
|
|
|
|
|
|
def _split_tklist(str)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-21 16:45:27 -04:00
|
|
|
@interp._split_tklist(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _merge_tklist(*args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-21 16:45:27 -04:00
|
|
|
@interp._merge_tklist(*args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _conv_listelement(str)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-21 16:45:27 -04:00
|
|
|
@interp._conv_listelement(str)
|
|
|
|
end
|
|
|
|
|
2005-03-30 03:44:19 -05:00
|
|
|
def _create_console
|
|
|
|
fail RuntimeError, 'not support "_create_console" on the remote interpreter'
|
|
|
|
end
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
def mainloop
|
|
|
|
fail RuntimeError, 'not support "mainloop" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def mainloop_watchdog
|
|
|
|
fail RuntimeError, 'not support "mainloop_watchdog" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def do_one_evant(flag = nil)
|
|
|
|
fail RuntimeError, 'not support "do_one_event" on the remote interpreter'
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
def mainloop_abort_on_exception
|
|
|
|
fail RuntimeError, 'not support "mainloop_abort_on_exception" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def mainloop_abort_on_exception=(mode)
|
|
|
|
fail RuntimeError, 'not support "mainloop_abort_on_exception=" on the remote interpreter'
|
|
|
|
end
|
2004-05-21 16:45:27 -04:00
|
|
|
def set_eventloop_tick(*args)
|
|
|
|
fail RuntimeError, 'not support "set_eventloop_tick" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def get_eventloop_tick
|
|
|
|
fail RuntimeError, 'not support "get_eventloop_tick" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def set_no_event_wait(*args)
|
|
|
|
fail RuntimeError, 'not support "set_no_event_wait" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def get_no_event_wait
|
|
|
|
fail RuntimeError, 'not support "get_no_event_wait" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def set_eventloop_weight(*args)
|
|
|
|
fail RuntimeError, 'not support "set_eventloop_weight" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def get_eventloop_weight
|
|
|
|
fail RuntimeError, 'not support "get_eventloop_weight" on the remote interpreter'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class << RemoteTkIp
|
2004-09-17 02:05:33 -04:00
|
|
|
def mainloop(*args)
|
2004-05-21 16:45:27 -04:00
|
|
|
fail RuntimeError, 'not support "mainloop" on the remote interpreter'
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
def mainloop_watchdog(*args)
|
2004-05-21 16:45:27 -04:00
|
|
|
fail RuntimeError, 'not support "mainloop_watchdog" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def do_one_evant(flag = nil)
|
|
|
|
fail RuntimeError, 'not support "do_one_event" on the remote interpreter'
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
def mainloop_abort_on_exception
|
|
|
|
fail RuntimeError, 'not support "mainloop_abort_on_exception" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def mainloop_abort_on_exception=(mode)
|
|
|
|
fail RuntimeError, 'not support "mainloop_abort_on_exception=" on the remote interpreter'
|
|
|
|
end
|
2004-05-21 16:45:27 -04:00
|
|
|
def set_eventloop_tick(*args)
|
|
|
|
fail RuntimeError, 'not support "set_eventloop_tick" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def get_eventloop_tick
|
|
|
|
fail RuntimeError, 'not support "get_eventloop_tick" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def set_no_event_wait(*args)
|
|
|
|
fail RuntimeError, 'not support "set_no_event_wait" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def get_no_event_wait
|
|
|
|
fail RuntimeError, 'not support "get_no_event_wait" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def set_eventloop_weight(*args)
|
|
|
|
fail RuntimeError, 'not support "set_eventloop_weight" on the remote interpreter'
|
|
|
|
end
|
|
|
|
def get_eventloop_weight
|
|
|
|
fail RuntimeError, 'not support "get_eventloop_weight" on the remote interpreter'
|
|
|
|
end
|
|
|
|
end
|