Class: TclTkIp

Inherits:
Object show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeObject

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

#encodingObject

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_listelementObject

#_create_consoleObject

#_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_encObject

backup original (without encoding) _eval and _invoke



15
# File 'lib/tk.rb', line 15

alias _eval_without_enc _eval

#_fromUTF8Object Also known as: __fromUTF8

#_get_global_varObject

#_get_global_var2Object

#_get_variableObject

#_get_variable2Object

#_immediate_invokeObject

#_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_encObject



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_embeddableObject

#_merge_tklistObject

#_return_valueObject

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_varObject

#_set_global_var2Object

#_set_variableObject

#_set_variable2Object

#_split_tklistObject

#_thread_tkwaitObject

#_thread_vwaitObject

#_toUTF8Object Also known as: __toUTF8

#_unset_global_varObject

#_unset_global_var2Object

#_unset_variableObject

#_unset_variable2Object

#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_slaveObject

#deleteObject

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

Returns:

  • (Boolean)

#do_one_eventObject

#get_eventloop_tickObject

#get_eventloop_weightObject

#get_no_event_waitObject

#has_mainwindow?Boolean

Returns:

  • (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;
}

#mainloopObject

#mainloop_abort_on_exceptionObject

#mainloop_abort_on_exception=Object

#mainloop_watchdogObject

#make_safeObject

#restartObject

#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_tickObject

#set_eventloop_weightObject

#set_max_block_timeObject

#set_no_event_waitObject

#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");
}