In Files

  • tk/lib/multi-tk.rb
  • tk/lib/tk.rb
  • tk/tcltklib.c

Class/Module Index [+]

Quicksearch

TclTkLib

wrap methods on TclTkLib : not permit calling TclTkLib module methods

—- initialization —-

Public Class Methods

_conv_listelement(arg) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2331
def _conv_listelement(arg)
  MultiTkIp._conv_listelement(arg)
end
            
_encoding() click to toggle source
Alias for: encoding
_encoding=(name) click to toggle source
Alias for: encoding=
_fromUTF8(p1, p2 = v2) click to toggle source
 
               static VALUE
lib_fromUTF8(argc, argv, self)
    int   argc;
    VALUE *argv;
    VALUE self;
{
    VALUE str, encodename;

    if (rb_scan_args(argc, argv, "11", &str, &encodename) == 1) {
        encodename = Qnil;
    }
    return lib_fromUTF8_core(Qnil, str, encodename);
}
            
_merge_tklist(*args) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2328
def _merge_tklist(*args)
  MultiTkIp._merge_tklist(*args)
end
            
_split_tklist(p1) click to toggle source
 
               static VALUE
lib_split_tklist(self, list_str)
    VALUE self;
    VALUE list_str;
{
    return lib_split_tklist_core(Qnil, list_str);
}
            
_subst_Tcl_backslash(p1) click to toggle source
 
               static VALUE
lib_Tcl_backslash(self, str)
    VALUE self;
    VALUE str;
{
    return lib_UTF_backslash_core(self, str, 1);
}
            
_subst_UTF_backslash(p1) click to toggle source
 
               static VALUE
lib_UTF_backslash(self, str)
    VALUE self;
    VALUE str;
{
    return lib_UTF_backslash_core(self, str, 0);
}
            
_toUTF8(p1, p2 = v2) click to toggle source
 
               static VALUE
lib_toUTF8(argc, argv, self)
    int   argc;
    VALUE *argv;
    VALUE self;
{
    VALUE str, encodename;

    if (rb_scan_args(argc, argv, "11", &str, &encodename) == 1) {
        encodename = Qnil;
    }
    return lib_toUTF8_core(Qnil, str, encodename);
}
            
do_one_event(flag = TclTkLib::EventFlag::ALL) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2297
def do_one_event(flag = TclTkLib::EventFlag::ALL)
  MultiTkIp.do_one_event(flag)
end
            
do_thread_callback(p1 = v1) click to toggle source
 
               static VALUE
lib_thread_callback(argc, argv, self)
    int argc;
    VALUE *argv;
    VALUE self;
{
    struct thread_call_proc_arg *q;
    VALUE proc, th, ret;
    int status, foundEvent;

    if (rb_scan_args(argc, argv, "01", &proc) == 0) {
        proc = rb_block_proc();
    }

    q = (struct thread_call_proc_arg *)ALLOC(struct thread_call_proc_arg);
    q->proc = proc;
    q->done = (int*)ALLOC(int);
    *(q->done) = 0;

    /* create call-proc thread */
    th = rb_thread_create(_thread_call_proc, (void*)q);

    rb_thread_schedule();

    /* start sub-eventloop */
    foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0, 0, 
                                              q->done, (Tcl_Interp*)NULL));

    if (RTEST(rb_funcall(th, ID_alive_p, 0))) {
        rb_funcall(th, ID_kill, 0);
        ret = Qnil;
    } else {
        ret = rb_protect(_thread_call_proc_value, th, &status);
    }

    free(q->done);
    free(q);

    if (NIL_P(rbtk_pending_exception)) {
        /* return ruby_errinfo; */
        if (status) {
            rb_exc_raise(ruby_errinfo);
        }
    } else {
        VALUE exc = rbtk_pending_exception;
        rbtk_pending_exception = Qnil;
        /* return exc; */
        rb_exc_raise(exc);
    }

    return ret;
}
            
encoding() click to toggle source
 
               # File tk/lib/tk.rb, line 2339
def encoding
  TkCore::INTERP.encoding
end
            
Also aliased as: _encoding
encoding=(name) click to toggle source
 
               # File tk/lib/tk.rb, line 2336
def encoding=(name)
  TkCore::INTERP.encoding = name
end
            
Also aliased as: _encoding=
encoding_system() click to toggle source
 
               static VALUE
lib_get_system_encoding(self)
    VALUE self;
{
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 0)
    tcl_stubs_check();
    return rb_str_new2(Tcl_GetEncodingName((Tcl_Encoding)NULL));
#else
    return Qnil;
#endif
}
            
encoding_system=(p1) click to toggle source
 
               static VALUE
lib_set_system_encoding(self, enc_name)
    VALUE self;
    VALUE enc_name;
{
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 0)
    tcl_stubs_check();

    if (NIL_P(enc_name)) {
        Tcl_SetSystemEncoding((Tcl_Interp *)NULL, (CONST char *)NULL);
        return lib_get_system_encoding(self);
    }

    enc_name = rb_funcall(enc_name, ID_to_s, 0, 0);
    if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL, 
                              StringValuePtr(enc_name)) != TCL_OK) {
        rb_raise(rb_eArgError, "unknown encoding name '%s'", 
                 RSTRING(enc_name)->ptr);
    }

    return enc_name;
#else
    return Qnil;
#endif
}
            
get_eventloop_tick() click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2309
def get_eventloop_tick
  MultiTkIp.get_eventloop_tick
end
            
get_eventloop_weight() click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2321
def get_eventloop_weight
  MultiTkIp.get_eventloop_weight
end
            
get_no_event_wait() click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2315
def get_no_event_wait
  MultiTkIp.get_no_event_wait
end
            
mainloop(check_root = true) click to toggle source

execute Tk_MainLoop

 
               # File tk/lib/multi-tk.rb, line 2291
def mainloop(check_root = true)
  MultiTkIp.mainloop(check_root)
end
            
mainloop_abort_on_exception() click to toggle source
 
               static VALUE
lib_evloop_abort_on_exc(self)
    VALUE self;
{
    if (event_loop_abort_on_exc > 0) {
        return Qtrue;
    } else if (event_loop_abort_on_exc == 0) {
        return Qfalse;
    } else {
        return Qnil;
    }
}
            
mainloop_abort_on_exception=(p1) click to toggle source
 
               static VALUE
lib_evloop_abort_on_exc_set(self, val)
    VALUE self, val;
{
    rb_secure(4);
    if (RTEST(val)) {
        event_loop_abort_on_exc =  1;
    } else if (NIL_P(val)) {
        event_loop_abort_on_exc = -1;
    } else {
        event_loop_abort_on_exc =  0;
    }
    return lib_evloop_abort_on_exc(self);
}
            
mainloop_thread?() click to toggle source
 
               static VALUE
lib_evloop_thread_p(self)
    VALUE self;
{
    if (NIL_P(eventloop_thread)) {
        return Qnil;    /* no eventloop */
    } else if (rb_thread_current() == eventloop_thread) {
        return Qtrue;   /* is eventloop */
    } else {
        return Qfalse;  /* not eventloop */
    }
}
            
mainloop_watchdog(check_root = true) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2294
def mainloop_watchdog(check_root = true)
  MultiTkIp.mainloop_watchdog(check_root)
end
            
num_of_mainwindows() click to toggle source
 
               static VALUE
lib_num_of_mainwindows(self)
    VALUE self;
{
    if (tk_stubs_init_p()) {
        return INT2FIX(Tk_GetNumMainWindows());
    } else {
        return INT2FIX(0);
    }
}
            
restart(*args) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2324
def restart(*args)
  MultiTkIp.restart(*args)
end
            
set_eventloop_tick(tick) click to toggle source

def ::mainloop_abort_on_exception

MultiTkIp.mainloop_abort_on_exception

end def ::mainloop_abort_on_exception=(mode)

MultiTkIp.mainloop_abort_on_exception=(mode)

end

 
               # File tk/lib/multi-tk.rb, line 2306
def set_eventloop_tick(tick)
  MultiTkIp.set_eventloop_tick(tick)
end
            
set_eventloop_weight(loop_max, no_event_tick) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2318
def set_eventloop_weight(loop_max, no_event_tick)
  MultiTkIp.set_eventloop_weight(loop_max, no_event_tick)
end
            
set_max_block_time(p1) click to toggle source
 
               static VALUE
set_max_block_time(self, time)
    VALUE self;
    VALUE time;
{
    struct Tcl_Time tcl_time;
    VALUE divmod;

    switch(TYPE(time)) {
    case T_FIXNUM:
    case T_BIGNUM:
        /* time is micro-second value */
        divmod = rb_funcall(time, rb_intern("divmod"), 1, LONG2NUM(1000000));
        tcl_time.sec  = NUM2LONG(RARRAY(divmod)->ptr[0]);
        tcl_time.usec = NUM2LONG(RARRAY(divmod)->ptr[1]);
        break;

    case T_FLOAT:
        /* time is second value */
        divmod = rb_funcall(time, rb_intern("divmod"), 1, INT2FIX(1));
        tcl_time.sec  = NUM2LONG(RARRAY(divmod)->ptr[0]);
        tcl_time.usec = (long)(NUM2DBL(RARRAY(divmod)->ptr[1]) * 1000000);

    default:
        {
            VALUE tmp = rb_funcall(time, ID_inspect, 0, 0);
            rb_raise(rb_eArgError, "invalid value for time: '%s'", 
                     StringValuePtr(tmp));
        }
    }

    Tcl_SetMaxBlockTime(&tcl_time);

    return Qnil;
}
            
set_no_event_wait(tick) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2312
def set_no_event_wait(tick)
  MultiTkIp.set_no_event_wait(tick)
end