Class: TclTkIp
- Defined in:
- sample/demos-en/tkencoding.rb,
lib/tk.rb,
tcltklib.c,
lib/tk.rb,
lib/tk.rb
Overview
dummy methods
Instance Attribute Summary collapse
-
#encoding ⇒ Object
Returns the value of attribute encoding.
Class Method Summary collapse
Instance Method Summary collapse
- #_conv_listelement ⇒ Object
- #_create_console ⇒ Object
-
#_eval(cmd) ⇒ Object
(also: #_eval_with_enc, #__eval)
#### --> definition is moved to TclTkIp module.
-
#_eval_without_enc ⇒ Object
backup original (without encoding) _eval and _invoke.
- #_fromUTF8 ⇒ Object (also: #__fromUTF8)
- #_get_global_var ⇒ Object
- #_get_global_var2 ⇒ Object
- #_get_variable ⇒ Object
- #_get_variable2 ⇒ Object
- #_immediate_invoke ⇒ Object
- #_invoke(*cmds) ⇒ Object (also: #_invoke_with_enc, #__invoke)
- #_invoke_without_enc ⇒ Object
- #_ip_id_ ⇒ Object
- #_make_menu_embeddable ⇒ Object
- #_merge_tklist ⇒ Object
-
#_return_value ⇒ Object
get return code from Tcl_Eval().
- #_set_global_var ⇒ Object
- #_set_global_var2 ⇒ Object
- #_set_variable ⇒ Object
- #_set_variable2 ⇒ Object
- #_split_tklist ⇒ Object
- #_thread_tkwait ⇒ Object
- #_thread_vwait ⇒ Object
- #_toUTF8 ⇒ Object (also: #__toUTF8)
- #_unset_global_var ⇒ Object
- #_unset_global_var2 ⇒ Object
- #_unset_variable ⇒ Object
- #_unset_variable2 ⇒ Object
-
#allow_ruby_exit= ⇒ Object
allow_ruby_exit = mode.
-
#allow_ruby_exit? ⇒ Object
allow_ruby_exit?.
- #create_slave ⇒ Object
-
#delete ⇒ Object
delete interpreter.
- #deleted? ⇒ Boolean
- #do_one_event ⇒ Object
- #get_eventloop_tick ⇒ Object
- #get_eventloop_weight ⇒ Object
- #get_no_event_wait ⇒ Object
- #has_mainwindow? ⇒ Boolean
-
#initialize ⇒ Object
constructor
initialize interpreter.
-
#invalid_namespace? ⇒ Object
is deleted?.
- #mainloop ⇒ Object
- #mainloop_abort_on_exception ⇒ Object
- #mainloop_abort_on_exception= ⇒ Object
- #mainloop_watchdog ⇒ Object
- #make_safe ⇒ Object
- #restart ⇒ Object
-
#safe? ⇒ Object
is safe?.
- #set_eventloop_tick ⇒ Object
- #set_eventloop_weight ⇒ Object
- #set_max_block_time ⇒ Object
- #set_no_event_wait ⇒ Object
-
#slave_of? ⇒ Object
self is slave of master?.
Constructor Details
#initialize ⇒ Object
initialize interpreter
|
# File 'tcltklib.c'
static VALUE
ip_init(argc, argv, self)
int argc;
VALUE *argv;
VALUE self;
{
struct tcltkip *ptr; /* tcltkip data struct */
VALUE argv0, opts;
int cnt;
int st;
int with_tk = 1;
Tk_Window mainWin = (Tk_Window)NULL;
/* security check */
if (ruby_safe_level >= 4) {
rb_raise(rb_eSecurityError,
"Cannot create a TclTkIp object at level %d",
ruby_safe_level);
}
|
Instance Attribute Details
#encoding ⇒ Object
Returns the value of attribute encoding
2210 2211 2212 |
# File 'lib/tk.rb', line 2210 def encoding @encoding end |
Class Method Details
.new(*args) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/multi-tk.rb', line 27 def new(*args) if Thread.current.group != ThreadGroup::Default raise SecurityError, 'only ThreadGroup::Default can call TclTkIp.new' end __new__(*args) end |
Instance Method Details
#_conv_listelement ⇒ Object
#_create_console ⇒ Object
#_eval(cmd) ⇒ Object Also known as: _eval_with_enc, __eval
#### --> definition is moved to TclTkIp module
def _toUTF8(str, encoding = nil)
# decide encoding
if encoding
encoding = encoding.to_s
elsif str.kind_of?(Tk::EncodedString) && str.encoding != nil
encoding = str.encoding.to_s
elsif str.instance_variable_get(:@encoding)
encoding = str.instance_variable_get(:@encoding).to_s
elsif defined?(@encoding) && @encoding != nil
encoding = @encoding.to_s
else
encoding = __invoke('encoding', 'system')
end
# convert
case encoding
when 'utf-8', 'binary'
str
else
__toUTF8(str, encoding)
end
end
def _fromUTF8(str, encoding = nil)
unless encoding
if defined?(@encoding) && @encoding != nil
encoding = @encoding.to_s
else
encoding = __invoke('encoding', 'system')
end
end
if str.kind_of?(Tk::EncodedString)
if str.encoding == 'binary'
str
else
__fromUTF8(str, encoding)
end
elsif str.instance_variable_get(:@encoding).to_s == 'binary'
str
else
__fromUTF8(str, encoding)
end
end
2267 2268 2269 |
# File 'lib/tk.rb', line 2267 def _eval(cmd) _fromUTF8(__eval(_toUTF8(cmd))) end |
#_eval_without_enc ⇒ Object
backup original (without encoding) _eval and _invoke
15 |
# File 'lib/tk.rb', line 15 alias _eval_without_enc _eval |
#_fromUTF8 ⇒ Object Also known as: __fromUTF8
#_get_global_var ⇒ Object
#_get_global_var2 ⇒ Object
#_get_variable ⇒ Object
#_get_variable2 ⇒ Object
#_immediate_invoke ⇒ Object
#_invoke(*cmds) ⇒ Object Also known as: _invoke_with_enc, __invoke
|
# File 'tcltklib.c' def _invoke(*cmds) _fromUTF8(__invoke(*(cmds.collect{|cmd| _toUTF8(cmd)}))) end |
#_invoke_without_enc ⇒ Object
16 |
# File 'lib/tk.rb', line 16 alias _invoke_without_enc _invoke |
#_ip_id_ ⇒ Object
18 19 20 21 |
# File 'lib/tk.rb', line 18 def _ip_id_ # for RemoteTkIp '' end |
#_make_menu_embeddable ⇒ Object
#_merge_tklist ⇒ Object
#_return_value ⇒ Object
get return code from Tcl_Eval()
|
# File 'tcltklib.c'
static VALUE
ip_retval(self)
VALUE self;
{
struct tcltkip *ptr; /* tcltkip data struct */
/* get the data strcut */
ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
return rb_tainted_str_new2("");
}
|
#_set_global_var ⇒ Object
#_set_global_var2 ⇒ Object
#_set_variable ⇒ Object
#_set_variable2 ⇒ Object
#_split_tklist ⇒ Object
#_thread_tkwait ⇒ Object
#_thread_vwait ⇒ Object
#_toUTF8 ⇒ Object Also known as: __toUTF8
#_unset_global_var ⇒ Object
#_unset_global_var2 ⇒ Object
#_unset_variable ⇒ Object
#_unset_variable2 ⇒ Object
#allow_ruby_exit= ⇒ Object
allow_ruby_exit = mode
|
# File 'tcltklib.c'
static VALUE
ip_allow_ruby_exit_set(self, val)
VALUE self, val;
{
struct tcltkip *ptr = get_ip(self);
Tk_Window mainWin;
rb_secure(4);
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
|
#allow_ruby_exit? ⇒ Object
allow_ruby_exit?
|
# File 'tcltklib.c'
static VALUE
ip_allow_ruby_exit_p(self)
VALUE self;
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
|
#create_slave ⇒ Object
#delete ⇒ Object
delete interpreter
|
# File 'tcltklib.c'
static VALUE
ip_delete(self)
VALUE self;
{
int thr_crit_bup;
struct tcltkip *ptr = get_ip(self);
if (ptr == (struct tcltkip *)NULL || ptr->ip == (Tcl_Interp*)NULL) {
DUMP1("delete deleted IP");
return Qnil;
}
|
#deleted? ⇒ Boolean
#do_one_event ⇒ Object
#get_eventloop_tick ⇒ Object
#get_eventloop_weight ⇒ Object
#get_no_event_wait ⇒ Object
#has_mainwindow? ⇒ Boolean
#invalid_namespace? ⇒ Object
is deleted?
|
# File 'tcltklib.c'
static VALUE
ip_has_invalid_namespace_p(self)
VALUE self;
{
struct tcltkip *ptr = get_ip(self);
if (ptr == (struct tcltkip *)NULL || ptr->ip == (Tcl_Interp *)NULL) {
/* deleted IP */
return Qtrue;
}
|
#mainloop ⇒ Object
#mainloop_abort_on_exception ⇒ Object
#mainloop_abort_on_exception= ⇒ Object
#mainloop_watchdog ⇒ Object
#make_safe ⇒ Object
#restart ⇒ Object
#safe? ⇒ Object
is safe?
|
# File 'tcltklib.c'
static VALUE
ip_is_safe_p(self)
VALUE self;
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
|
#set_eventloop_tick ⇒ Object
#set_eventloop_weight ⇒ Object
#set_max_block_time ⇒ Object
#set_no_event_wait ⇒ Object
#slave_of? ⇒ Object
self is slave of master?
|
# File 'tcltklib.c'
static VALUE
ip_is_slave_of_p(self, master)
VALUE self, master;
{
if (!rb_obj_is_kind_of(master, tcltkip_class)) {
rb_raise(rb_eArgError, "expected TclTkIp object");
}
|