Class: TclTkIp
- Defined in:
- lib/tk.rb,
ext/tk/tcltklib.c,
lib/tk.rb,
lib/tk.rb
Instance Attribute Summary collapse
-
#encoding ⇒ Object
from tkencoding.rb by [email protected] attr_accessor :encoding.
Class Method Summary collapse
Instance Method Summary collapse
- #__eval__ ⇒ Object
- #__fromUTF8 ⇒ Object
- #__invoke__ ⇒ Object
- #__toUTF8 ⇒ Object
- #_cancel_eval(*args) ⇒ Object
- #_cancel_eval_unwind(*args) ⇒ Object
- #_conv_listelement(src) ⇒ Object
- #_create_console ⇒ Object
- #_eval(cmd) ⇒ Object (also: #_eval_with_enc, #__eval)
-
#_eval_without_enc ⇒ Object
backup original (without encoding) _eval and _invoke.
- #_fromUTF8(str, encoding = nil) ⇒ Object
- #_get_global_var(varname) ⇒ Object
- #_get_global_var2(varname, index) ⇒ Object
-
#_get_variable(varname, flag) ⇒ Object
—————————————————————.
- #_get_variable2(varname, index, flag) ⇒ Object
- #_immediate_invoke(*args) ⇒ Object
- #_invoke(*cmds) ⇒ Object (also: #_invoke_with_enc, #__invoke)
- #_invoke_without_enc ⇒ Object
- #_ip_id_ ⇒ Object
-
#_make_menu_embeddable(menu_path) ⇒ Object
—————————————————————.
- #_merge_tklist(*args) ⇒ Object
-
#_return_value ⇒ Object
get return code from Tcl_Eval().
- #_set_global_var(varname, value) ⇒ Object
- #_set_global_var2(varname, index, value) ⇒ Object
- #_set_variable(varname, value, flag) ⇒ Object
- #_set_variable2(varname, index, value, flag) ⇒ Object
-
#_split_tklist(list_str) ⇒ Object
—————————————————————.
- #_thread_tkwait(mode, target) ⇒ Object
- #_thread_vwait(var) ⇒ Object
-
#_toUTF8(str, encoding = nil) ⇒ Object
without Encoding (Ruby 1.8).
- #_unset_global_var(varname) ⇒ Object
- #_unset_global_var2(varname, index) ⇒ Object
- #_unset_variable(varname, flag) ⇒ Object
- #_unset_variable2(varname, index, flag) ⇒ Object
-
#allow_ruby_exit=(val) ⇒ Object
allow_ruby_exit = mode.
-
#allow_ruby_exit? ⇒ Boolean
allow_ruby_exit?.
-
#create_dummy_encoding_for_tk(name) ⇒ Object
—————————————————————.
- #create_slave(*args) ⇒ Object
- #default_encoding=(name) ⇒ Object
-
#delete ⇒ Object
delete interpreter.
- #deleted? ⇒ Boolean
- #do_one_event(*args) ⇒ Object
- #encoding_name ⇒ Object (also: #encoding, #default_encoding)
- #encoding_obj ⇒ Object
- #encoding_table ⇒ Object
- #force_default_encoding=(mode) ⇒ Object
- #force_default_encoding? ⇒ Boolean
- #get_eventloop_tick ⇒ Object
- #get_eventloop_weight ⇒ Object
- #get_no_event_wait ⇒ Object
- #has_mainwindow? ⇒ Boolean
-
#initialize(*args) ⇒ Object
constructor
initialize interpreter.
-
#invalid_namespace? ⇒ Boolean
is deleted?.
-
#mainloop(*args) ⇒ Object
—————————————————————.
- #mainloop_abort_on_exception ⇒ Object
- #mainloop_abort_on_exception=(val) ⇒ Object
- #mainloop_watchdog(*args) ⇒ Object
- #make_safe ⇒ Object
- #restart ⇒ Object
-
#safe? ⇒ Boolean
is safe?.
- #set_eventloop_tick(tick) ⇒ Object
- #set_eventloop_weight(loop_max, no_event) ⇒ Object
- #set_max_block_time(time) ⇒ Object
- #set_no_event_wait(wait) ⇒ Object
-
#slave_of?(master) ⇒ Boolean
self is slave of master?.
Constructor Details
#initialize(*args) ⇒ Object
initialize interpreter
5870 5871 5872 5873 5874 5875 5876 |
# File 'ext/tk/tcltklib.c', line 5870 def initialize(*args) __initialize__(*args) @force_default_encoding ||= [false] @encoding ||= [nil] def @encoding.to_s; self.join(nil); end end |
Instance Attribute Details
#encoding=(value) ⇒ Object
from tkencoding.rb by [email protected] attr_accessor :encoding
2765 2766 2767 2768 |
# File 'lib/tk.rb', line 2765 def encoding=(name) self.force_default_encoding = true # for compatibility self.default_encoding = name end |
Class Method Details
.__new__ ⇒ Object
25 |
# File 'lib/multi-tk.rb', line 25 alias __new__ new |
.new(*args) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/multi-tk.rb', line 28 def new(*args) if Thread.current.group != ThreadGroup::Default raise SecurityError, 'only ThreadGroup::Default can call TclTkIp.new' end obj = __new__(*args) obj.instance_eval{ @force_default_encoding ||= [false] @encoding ||= [nil] def @encoding.to_s; self.join(nil); end } obj end |
.to_s ⇒ Object
36 |
# File 'lib/tk.rb', line 36 def @encoding.to_s; self.join(nil); end |
Instance Method Details
#__eval__ ⇒ Object
19 |
# File 'lib/tk.rb', line 19 alias __eval__ _eval |
#__fromUTF8 ⇒ Object
2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 |
# File 'lib/tk.rb', line 2785
static VALUE
ip_fromUTF8(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(self, str, encodename);
}
|
#__invoke__ ⇒ Object
21 |
# File 'lib/tk.rb', line 21 alias __invoke__ _invoke |
#__toUTF8 ⇒ Object
2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 |
# File 'lib/tk.rb', line 2784
static VALUE
ip_toUTF8(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(self, str, encodename);
}
|
#_cancel_eval(*args) ⇒ Object
7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 |
# File 'ext/tk/tcltklib.c', line 7423
static VALUE
ip_cancel_eval(int argc, VALUE *argv, VALUE self)
{
VALUE retval;
if (rb_scan_args(argc, argv, "01", &retval) == 0) {
retval = Qnil;
}
if (ip_cancel_eval_core(get_ip(self)->ip, retval, 0) == TCL_OK) {
return Qtrue;
} else {
return Qfalse;
}
}
|
#_cancel_eval_unwind(*args) ⇒ Object
7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 |
# File 'ext/tk/tcltklib.c', line 7441
static VALUE
ip_cancel_eval_unwind(int argc, VALUE *argv, VALUE self)
{
int flag = 0;
VALUE retval;
if (rb_scan_args(argc, argv, "01", &retval) == 0) {
retval = Qnil;
}
flag |= TCL_CANCEL_UNWIND;
if (ip_cancel_eval_core(get_ip(self)->ip, retval, flag) == TCL_OK) {
return Qtrue;
} else {
return Qfalse;
}
}
|
#_conv_listelement(src) ⇒ Object
9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 |
# File 'ext/tk/tcltklib.c', line 9428
static VALUE
lib_conv_listelement(VALUE self, VALUE src)
{
TYPE_TCL_SIZE len;
int scan_flag;
volatile VALUE dst;
int thr_crit_bup;
tcl_stubs_check();
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
StringValue(src);
#if TCL_MAJOR_VERSION >= 8
len = Tcl_ScanCountedElement(RSTRING_PTR(src), RSTRING_LENINT(src),
&scan_flag);
dst = rb_str_new(0, len + 1);
len = Tcl_ConvertCountedElement(RSTRING_PTR(src), RSTRING_LENINT(src),
RSTRING_PTR(dst), scan_flag);
#else /* TCL_MAJOR_VERSION < 8 */
len = Tcl_ScanElement(RSTRING_PTR(src), &scan_flag);
dst = rb_str_new(0, len + 1);
len = Tcl_ConvertElement(RSTRING_PTR(src), RSTRING_PTR(dst), scan_flag);
#endif
rb_str_resize(dst, len);
rb_thread_critical = thr_crit_bup;
return dst;
}
|
#_create_console ⇒ Object
6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 |
# File 'ext/tk/tcltklib.c', line 6353
static VALUE
ip_create_console(VALUE self)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
return tk_funcall(ip_create_console_core, 0, (VALUE*)NULL, self);
}
|
#_eval(cmd) ⇒ Object Also known as: _eval_with_enc, __eval
7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 |
# File 'ext/tk/tcltklib.c', line 7224
static VALUE
ip_eval(VALUE self, VALUE str)
{
struct eval_queue *evq;
#ifdef RUBY_USE_NATIVE_THREAD
struct tcltkip *ptr;
#endif
char *eval_str;
int *alloc_done;
int thr_crit_bup;
volatile VALUE current = rb_thread_current();
volatile VALUE ip_obj = self;
volatile VALUE result;
volatile VALUE ret;
Tcl_QueuePosition position;
struct timeval t;
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
StringValue(str);
rb_thread_critical = thr_crit_bup;
#ifdef RUBY_USE_NATIVE_THREAD
ptr = get_ip(ip_obj);
DUMP2("eval status: ptr->tk_thread_id %p", ptr->tk_thread_id);
DUMP2("eval status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread());
#else
DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread());
#endif
DUMP2("status: eventloopt_thread %"PRIxVALUE, eventloop_thread);
if (
#ifdef RUBY_USE_NATIVE_THREAD
(ptr->tk_thread_id == 0 || ptr->tk_thread_id == Tcl_GetCurrentThread())
&&
#endif
(NIL_P(eventloop_thread) || current == eventloop_thread)
) {
if (NIL_P(eventloop_thread)) {
DUMP2("eval from thread:%"PRIxVALUE" but no eventloop", current);
} else {
DUMP2("eval from current eventloop %"PRIxVALUE, current);
}
result = ip_eval_real(self, RSTRING_PTR(str), RSTRING_LENINT(str));
if (rb_obj_is_kind_of(result, rb_eException)) {
rb_exc_raise(result);
}
return result;
}
DUMP2("eval from thread %"PRIxVALUE" (NOT current eventloop)", current);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
/* allocate memory (keep result) */
/* alloc_done = (int*)ALLOC(int); */
alloc_done = RbTk_ALLOC_N(int, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)alloc_done); /* XXXXXXXX */
#endif
*alloc_done = 0;
/* eval_str = ALLOC_N(char, RSTRING_LEN(str) + 1); */
eval_str = ckalloc(RSTRING_LENINT(str) + 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)eval_str); /* XXXXXXXX */
#endif
memcpy(eval_str, RSTRING_PTR(str), RSTRING_LEN(str));
eval_str[RSTRING_LEN(str)] = 0;
/* allocate memory (freed by Tcl_ServiceEvent) */
/* evq = (struct eval_queue *)Tcl_Alloc(sizeof(struct eval_queue)); */
evq = RbTk_ALLOC_N(struct eval_queue, 1);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve(evq);
#endif
/* allocate result obj */
result = rb_ary_new3(1, Qnil);
/* construct event data */
evq->done = alloc_done;
evq->str = eval_str;
evq->len = RSTRING_LENINT(str);
evq->interp = ip_obj;
evq->result = result;
evq->thread = current;
evq->ev.proc = eval_queue_handler;
position = TCL_QUEUE_TAIL;
/* add the handler to Tcl event queue */
DUMP1("add handler");
#ifdef RUBY_USE_NATIVE_THREAD
if (ptr->tk_thread_id) {
/* Tcl_ThreadQueueEvent(ptr->tk_thread_id, &(evq->ev), position); */
Tcl_ThreadQueueEvent(ptr->tk_thread_id, (Tcl_Event*)evq, position);
Tcl_ThreadAlert(ptr->tk_thread_id);
} else if (tk_eventloop_thread_id) {
Tcl_ThreadQueueEvent(tk_eventloop_thread_id, (Tcl_Event*)evq, position);
/* Tcl_ThreadQueueEvent(tk_eventloop_thread_id,
&(evq->ev), position); */
Tcl_ThreadAlert(tk_eventloop_thread_id);
} else {
/* Tcl_QueueEvent(&(evq->ev), position); */
Tcl_QueueEvent((Tcl_Event*)evq, position);
}
#else
/* Tcl_QueueEvent(&(evq->ev), position); */
Tcl_QueueEvent((Tcl_Event*)evq, position);
#endif
rb_thread_critical = thr_crit_bup;
/* wait for the handler to be processed */
t.tv_sec = 0;
t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0);
DUMP2("evq wait for handler (current thread:%"PRIxVALUE")", current);
while(*alloc_done >= 0) {
DUMP2("*** evq wait for handler (current thread:%"PRIxVALUE")", current);
/* rb_thread_stop(); */
/* rb_thread_sleep_forever(); */
rb_thread_wait_for(t);
DUMP2("*** evq wakeup (current thread:%"PRIxVALUE")", current);
DUMP2("*** (eventloop thread:%"PRIxVALUE")", eventloop_thread);
if (NIL_P(eventloop_thread)) {
DUMP1("*** evq lost eventloop thread");
break;
}
}
DUMP2("back from handler (current thread:%"PRIxVALUE")", current);
/* get result & free allocated memory */
ret = RARRAY_AREF(result, 0);
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)alloc_done, TCL_DYNAMIC); /* XXXXXXXX */
#else
#if 0 /* use Tcl_Preserve/Release */
Tcl_Release((ClientData)alloc_done); /* XXXXXXXX */
#else
/* free(alloc_done); */
ckfree((char*)alloc_done);
#endif
#endif
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)eval_str, TCL_DYNAMIC); /* XXXXXXXX */
#else
#if 0 /* use Tcl_Preserve/Release */
Tcl_Release((ClientData)eval_str); /* XXXXXXXX */
#else
/* free(eval_str); */
ckfree(eval_str);
#endif
#endif
#if 0 /* evq is freed by Tcl_ServiceEvent */
#if 0 /* use Tcl_Preserve/Release */
Tcl_Release(evq);
#else
ckfree((char*)evq);
#endif
#endif
if (rb_obj_is_kind_of(ret, rb_eException)) {
DUMP1("raise exception");
/* rb_exc_raise(ret); */
rb_exc_raise(rb_exc_new3(rb_obj_class(ret),
rb_funcallv(ret, ID_to_s, 0, 0)));
}
return ret;
}
|
#_eval_without_enc ⇒ Object
backup original (without encoding) _eval and _invoke
18 |
# File 'lib/tk.rb', line 18 alias _eval_without_enc _eval |
#_fromUTF8(str, encoding = nil) ⇒ Object
7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 |
# File 'ext/tk/tcltklib.c', line 7912
static VALUE
ip_fromUTF8(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(self, str, encodename);
}
|
#_get_global_var(varname) ⇒ Object
9154 9155 9156 9157 9158 9159 |
# File 'ext/tk/tcltklib.c', line 9154
static VALUE
ip_get_global_var(VALUE self, VALUE varname)
{
return ip_get_variable(self, varname,
INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG));
}
|
#_get_global_var2(varname, index) ⇒ Object
9161 9162 9163 9164 9165 9166 |
# File 'ext/tk/tcltklib.c', line 9161
static VALUE
ip_get_global_var2(VALUE self, VALUE varname, VALUE index)
{
return ip_get_variable2(self, varname, index,
INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG));
}
|
#_get_variable(varname, flag) ⇒ Object
8956 8957 8958 8959 8960 |
# File 'ext/tk/tcltklib.c', line 8956
static VALUE
ip_get_variable(VALUE self, VALUE varname, VALUE flag)
{
return ip_get_variable2(self, varname, Qnil, flag);
}
|
#_get_variable2(varname, index, flag) ⇒ Object
8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 |
# File 'ext/tk/tcltklib.c', line 8934
static VALUE
ip_get_variable2(VALUE self, VALUE varname, VALUE index, VALUE flag)
{
VALUE argv[3];
VALUE retval;
StringValue(varname);
if (!NIL_P(index)) StringValue(index);
argv[0] = varname;
argv[1] = index;
argv[2] = flag;
retval = tk_funcall(ip_get_variable2_core, 3, argv, self);
if (NIL_P(retval)) {
return rb_str_new2("");
} else {
return retval;
}
}
|
#_immediate_invoke(*args) ⇒ Object
8832 8833 8834 8835 8836 8837 |
# File 'ext/tk/tcltklib.c', line 8832
static VALUE
ip_invoke_immediate(int argc, VALUE *argv, VALUE obj)
{
/* POTENTIALY INSECURE : can create infinite loop */
return ip_invoke_with_position(argc, argv, obj, TCL_QUEUE_HEAD);
}
|
#_invoke(*cmds) ⇒ Object Also known as: _invoke_with_enc, __invoke
8826 8827 8828 8829 8830 |
# File 'ext/tk/tcltklib.c', line 8826
static VALUE
ip_invoke(int argc, VALUE *argv, VALUE obj)
{
return ip_invoke_with_position(argc, argv, obj, TCL_QUEUE_TAIL);
}
|
#_invoke_without_enc ⇒ Object
20 |
# File 'lib/tk.rb', line 20 alias _invoke_without_enc _invoke |
#_ip_id_ ⇒ Object
23 24 25 26 |
# File 'lib/tk.rb', line 23 def _ip_id_ # for RemoteTkIp '' end |
#_make_menu_embeddable(menu_path) ⇒ Object
10160 10161 10162 10163 10164 10165 10166 10167 |
# File 'ext/tk/tcltklib.c', line 10160
static VALUE
ip_make_menu_embeddable(VALUE interp, VALUE menu_path)
{
VALUE argv[1];
argv[0] = menu_path;
return tk_funcall(ip_make_menu_embeddable_core, 1, argv, interp);
}
|
#_merge_tklist(*args) ⇒ Object
9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 |
# File 'ext/tk/tcltklib.c', line 9335
static VALUE
lib_merge_tklist(int argc, VALUE *argv, VALUE obj)
{
int num;
TYPE_TCL_SIZE len;
int *flagPtr;
char *dst, *result;
volatile VALUE str;
int thr_crit_bup;
VALUE old_gc;
if (argc == 0) return rb_str_new2("");
tcl_stubs_check();
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
old_gc = rb_gc_disable();
/* based on Tcl/Tk's Tcl_Merge() */
/* flagPtr = ALLOC_N(int, argc); */
flagPtr = RbTk_ALLOC_N(int, argc);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)flagPtr); /* XXXXXXXXXX */
#endif
/* pass 1 */
len = 1;
for(num = 0; num < argc; num++) {
dst = StringValueCStr(argv[num]);
#if TCL_MAJOR_VERSION >= 8
len += Tcl_ScanCountedElement(dst, RSTRING_LENINT(argv[num]),
&flagPtr[num]) + 1;
#else /* TCL_MAJOR_VERSION < 8 */
len += Tcl_ScanElement(dst, &flagPtr[num]) + 1;
#endif
}
/* pass 2 */
/* result = (char *)Tcl_Alloc(len); */
result = (char *)ckalloc(len);
#if 0 /* use Tcl_Preserve/Release */
Tcl_Preserve((ClientData)result);
#endif
dst = result;
for(num = 0; num < argc; num++) {
#if TCL_MAJOR_VERSION >= 8
len = Tcl_ConvertCountedElement(RSTRING_PTR(argv[num]),
RSTRING_LENINT(argv[num]),
dst, flagPtr[num]);
#else /* TCL_MAJOR_VERSION < 8 */
len = Tcl_ConvertElement(RSTRING_PTR(argv[num]), dst, flagPtr[num]);
#endif
dst += len;
*dst = ' ';
dst++;
}
if (dst == result) {
*dst = 0;
} else {
dst[-1] = 0;
}
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)flagPtr, TCL_DYNAMIC); /* XXXXXXXX */
#else
#if 0 /* use Tcl_Preserve/Release */
Tcl_Release((ClientData)flagPtr);
#else
/* free(flagPtr); */
ckfree((char*)flagPtr);
#endif
#endif
/* create object */
str = rb_str_new(result, dst - result - 1);
#if 0 /* use Tcl_EventuallyFree */
Tcl_EventuallyFree((ClientData)result, TCL_DYNAMIC); /* XXXXXXXX */
#else
#if 0 /* use Tcl_Preserve/Release */
Tcl_Release((ClientData)result); /* XXXXXXXXXXX */
#else
/* Tcl_Free(result); */
ckfree(result);
#endif
#endif
if (old_gc == Qfalse) rb_gc_enable();
rb_thread_critical = thr_crit_bup;
return str;
}
|
#_return_value ⇒ Object
get return code from Tcl_Eval()
8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 |
# File 'ext/tk/tcltklib.c', line 8810
static VALUE
ip_retval(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_str_new2("");
}
return (INT2FIX(ptr->return_value));
}
|
#_set_global_var(varname, value) ⇒ Object
9168 9169 9170 9171 9172 9173 |
# File 'ext/tk/tcltklib.c', line 9168
static VALUE
ip_set_global_var(VALUE self, VALUE varname, VALUE value)
{
return ip_set_variable(self, varname, value,
INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG));
}
|
#_set_global_var2(varname, index, value) ⇒ Object
9175 9176 9177 9178 9179 9180 |
# File 'ext/tk/tcltklib.c', line 9175
static VALUE
ip_set_global_var2(VALUE self, VALUE varname, VALUE index, VALUE value)
{
return ip_set_variable2(self, varname, index, value,
INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG));
}
|
#_set_variable(varname, value, flag) ⇒ Object
9084 9085 9086 9087 9088 |
# File 'ext/tk/tcltklib.c', line 9084
static VALUE
ip_set_variable(VALUE self, VALUE varname, VALUE value, VALUE flag)
{
return ip_set_variable2(self, varname, Qnil, value, flag);
}
|
#_set_variable2(varname, index, value, flag) ⇒ Object
9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 |
# File 'ext/tk/tcltklib.c', line 9060
static VALUE
ip_set_variable2(VALUE self, VALUE varname, VALUE index, VALUE value, VALUE flag)
{
VALUE argv[4];
VALUE retval;
StringValue(varname);
if (!NIL_P(index)) StringValue(index);
StringValue(value);
argv[0] = varname;
argv[1] = index;
argv[2] = value;
argv[3] = flag;
retval = tk_funcall(ip_set_variable2_core, 4, argv, self);
if (NIL_P(retval)) {
return rb_str_new2("");
} else {
return retval;
}
}
|
#_split_tklist(list_str) ⇒ Object
9329 9330 9331 9332 9333 |
# File 'ext/tk/tcltklib.c', line 9329
static VALUE
ip_split_tklist(VALUE self, VALUE list_str)
{
return lib_split_tklist_core(self, list_str);
}
|
#_thread_tkwait(mode, target) ⇒ Object
5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 |
# File 'ext/tk/tcltklib.c', line 5264
static VALUE
ip_thread_tkwait(VALUE self, VALUE mode, VALUE target)
{
VALUE argv[3];
volatile VALUE cmd_str = rb_str_new2("thread_tkwait");
argv[0] = cmd_str;
argv[1] = mode;
argv[2] = target;
return ip_invoke_with_position(3, argv, self, TCL_QUEUE_TAIL);
}
|
#_thread_vwait(var) ⇒ Object
5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 |
# File 'ext/tk/tcltklib.c', line 5252
static VALUE
ip_thread_vwait(VALUE self, VALUE var)
{
VALUE argv[2];
volatile VALUE cmd_str = rb_str_new2("thread_vwait");
argv[0] = cmd_str;
argv[1] = var;
return ip_invoke_with_position(2, argv, self, TCL_QUEUE_TAIL);
}
|
#_toUTF8(str, encoding = nil) ⇒ Object
without Encoding (Ruby 1.8)
7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 |
# File 'ext/tk/tcltklib.c', line 7721
static VALUE
ip_toUTF8(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(self, str, encodename);
}
|
#_unset_global_var(varname) ⇒ Object
9182 9183 9184 9185 9186 9187 |
# File 'ext/tk/tcltklib.c', line 9182
static VALUE
ip_unset_global_var(VALUE self, VALUE varname)
{
return ip_unset_variable(self, varname,
INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG));
}
|
#_unset_global_var2(varname, index) ⇒ Object
9189 9190 9191 9192 9193 9194 |
# File 'ext/tk/tcltklib.c', line 9189
static VALUE
ip_unset_global_var2(VALUE self, VALUE varname, VALUE index)
{
return ip_unset_variable2(self, varname, index,
INT2FIX(TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG));
}
|
#_unset_variable(varname, flag) ⇒ Object
9148 9149 9150 9151 9152 |
# File 'ext/tk/tcltklib.c', line 9148
static VALUE
ip_unset_variable(VALUE self, VALUE varname, VALUE flag)
{
return ip_unset_variable2(self, varname, Qnil, flag);
}
|
#_unset_variable2(varname, index, flag) ⇒ Object
9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 |
# File 'ext/tk/tcltklib.c', line 9126
static VALUE
ip_unset_variable2(VALUE self, VALUE varname, VALUE index, VALUE flag)
{
VALUE argv[3];
VALUE retval;
StringValue(varname);
if (!NIL_P(index)) StringValue(index);
argv[0] = varname;
argv[1] = index;
argv[2] = flag;
retval = tk_funcall(ip_unset_variable2_core, 3, argv, self);
if (NIL_P(retval)) {
return rb_str_new2("");
} else {
return retval;
}
}
|
#allow_ruby_exit=(val) ⇒ Object
allow_ruby_exit = mode
6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 |
# File 'ext/tk/tcltklib.c', line 6454
static VALUE
ip_allow_ruby_exit_set(VALUE self, VALUE val)
{
struct tcltkip *ptr = get_ip(self);
Tk_Window mainWin;
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
if (Tcl_IsSafe(ptr->ip)) {
rb_raise(rb_eSecurityError,
"insecure operation on a safe interpreter");
}
/*
* Because of cross-threading, the following line may fail to find
* the MainWindow, even if the Tcl/Tk interpreter has one or more.
* But it has no problem. Current implementation of both type of
* the "exit" command don't need maiinWin token.
*/
mainWin = (tk_stubs_init_p())? Tk_MainWindow(ptr->ip): (Tk_Window)NULL;
if (RTEST(val)) {
ptr->allow_ruby_exit = 1;
#if TCL_MAJOR_VERSION >= 8
DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"ruby_exit\"");
Tcl_CreateObjCommand(ptr->ip, "exit", ip_RubyExitObjCmd,
(ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
#else /* TCL_MAJOR_VERSION < 8 */
DUMP1("Tcl_CreateCommand(\"exit\") --> \"ruby_exit\"");
Tcl_CreateCommand(ptr->ip, "exit", ip_RubyExitCommand,
(ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
#endif
return Qtrue;
} else {
ptr->allow_ruby_exit = 0;
#if TCL_MAJOR_VERSION >= 8
DUMP1("Tcl_CreateObjCommand(\"exit\") --> \"interp_exit\"");
Tcl_CreateObjCommand(ptr->ip, "exit", ip_InterpExitObjCmd,
(ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
#else /* TCL_MAJOR_VERSION < 8 */
DUMP1("Tcl_CreateCommand(\"exit\") --> \"interp_exit\"");
Tcl_CreateCommand(ptr->ip, "exit", ip_InterpExitCommand,
(ClientData)mainWin, (Tcl_CmdDeleteProc *)NULL);
#endif
return Qfalse;
}
}
|
#allow_ruby_exit? ⇒ Boolean
allow_ruby_exit?
6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 |
# File 'ext/tk/tcltklib.c', line 6436
static VALUE
ip_allow_ruby_exit_p(VALUE self)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
if (ptr->allow_ruby_exit) {
return Qtrue;
} else {
return Qfalse;
}
}
|
#create_dummy_encoding_for_tk(name) ⇒ Object
9586 9587 9588 9589 9590 |
# File 'ext/tk/tcltklib.c', line 9586
static VALUE
create_dummy_encoding_for_tk(VALUE interp, VALUE name)
{
return create_dummy_encoding_for_tk_core(interp, name, Qtrue);
}
|
#create_slave(*args) ⇒ Object
6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 |
# File 'ext/tk/tcltklib.c', line 6244
static VALUE
ip_create_slave(int argc, VALUE *argv, VALUE self)
{
struct tcltkip *master = get_ip(self);
VALUE safemode;
VALUE name;
VALUE callargv[2];
/* ip is deleted? */
if (deleted_ip(master)) {
rb_raise(rb_eRuntimeError,
"deleted master cannot create a new slave interpreter");
}
/* argument check */
if (rb_scan_args(argc, argv, "11", &name, &safemode) == 1) {
safemode = Qfalse;
}
if (Tcl_IsSafe(master->ip) != 1
&& (safemode == Qfalse || NIL_P(safemode))) {
}
StringValue(name);
callargv[0] = name;
callargv[1] = safemode;
return tk_funcall(ip_create_slave_core, 2, callargv, self);
}
|
#default_encoding=(name) ⇒ Object
2758 2759 2760 2761 |
# File 'lib/tk.rb', line 2758 def default_encoding=(name) name = name.name if Tk::WITH_ENCODING && name.kind_of?(::Encoding) @encoding[0] = name.to_s.dup end |
#delete ⇒ Object
delete interpreter
6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 |
# File 'ext/tk/tcltklib.c', line 6508
static VALUE
ip_delete(VALUE self)
{
int thr_crit_bup;
struct tcltkip *ptr = get_ip(self);
/* if (ptr == (struct tcltkip *)NULL || ptr->ip == (Tcl_Interp*)NULL) { */
if (deleted_ip(ptr)) {
DUMP1("delete deleted IP");
return Qnil;
}
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
DUMP1("delete interp");
if (!Tcl_InterpDeleted(ptr->ip)) {
DUMP1("call ip_finalize");
ip_finalize(ptr->ip);
Tcl_DeleteInterp(ptr->ip);
Tcl_Release(ptr->ip);
}
rb_thread_critical = thr_crit_bup;
return Qnil;
}
|
#deleted? ⇒ Boolean
6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 |
# File 'ext/tk/tcltklib.c', line 6560
static VALUE
ip_is_deleted_p(VALUE self)
{
struct tcltkip *ptr = get_ip(self);
if (deleted_ip(ptr)) {
return Qtrue;
} else {
return Qfalse;
}
}
|
#do_one_event(*args) ⇒ Object
2992 2993 2994 2995 2996 |
# File 'ext/tk/tcltklib.c', line 2992
static VALUE
ip_do_one_event(int argc, VALUE *argv, VALUE self)
{
return lib_do_one_event_core(argc, argv, self, 0);
}
|
#encoding_name ⇒ Object Also known as: encoding, default_encoding
2770 2771 2772 |
# File 'lib/tk.rb', line 2770 def encoding_name (@encoding[0])? @encoding[0].dup: nil end |
#encoding_obj ⇒ Object
2776 2777 2778 2779 2780 2781 2782 |
# File 'lib/tk.rb', line 2776 def encoding_obj if Tk::WITH_ENCODING Tk::Encoding.tcl2rb_encoding(@encoding[0]) else (@encoding[0])? @encoding[0].dup: nil end end |
#encoding_table ⇒ Object
10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 |
# File 'ext/tk/tcltklib.c', line 10019
static VALUE
ip_get_encoding_table(VALUE interp)
{
volatile VALUE table = Qnil;
table = rb_ivar_get(interp, ID_encoding_table);
if (NIL_P(table)) {
/* initialize encoding_table */
table = create_encoding_table(interp);
rb_define_singleton_method(table, "get_name", encoding_table_get_name, 1);
rb_define_singleton_method(table, "get_obj", encoding_table_get_obj, 1);
}
return table;
}
|
#force_default_encoding=(mode) ⇒ Object
2750 2751 2752 |
# File 'lib/tk.rb', line 2750 def force_default_encoding=(mode) @force_default_encoding[0] = (mode)? true: false end |
#force_default_encoding? ⇒ Boolean
2754 2755 2756 |
# File 'lib/tk.rb', line 2754 def force_default_encoding? @force_default_encoding[0] ||= false end |
#get_eventloop_tick ⇒ Object
1759 1760 1761 1762 1763 |
# File 'ext/tk/tcltklib.c', line 1759
static VALUE
ip_get_eventloop_tick(VALUE self)
{
return get_eventloop_tick(self);
}
|
#get_eventloop_weight ⇒ Object
1850 1851 1852 1853 1854 |
# File 'ext/tk/tcltklib.c', line 1850
static VALUE
ip_get_eventloop_weight(VALUE self)
{
return get_eventloop_weight(self);
}
|
#get_no_event_wait ⇒ Object
1804 1805 1806 1807 1808 |
# File 'ext/tk/tcltklib.c', line 1804
static VALUE
ip_get_no_event_wait(VALUE self)
{
return get_no_event_wait(self);
}
|
#has_mainwindow? ⇒ Boolean
6586 6587 6588 6589 6590 |
# File 'ext/tk/tcltklib.c', line 6586
static VALUE
ip_has_mainwindow_p(VALUE self)
{
return tk_funcall(ip_has_mainwindow_p_core, 0, (VALUE*)NULL, self);
}
|
#invalid_namespace? ⇒ Boolean
is deleted?
6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 |
# File 'ext/tk/tcltklib.c', line 6539
static VALUE
ip_has_invalid_namespace_p(VALUE self)
{
struct tcltkip *ptr = get_ip(self);
if (ptr == (struct tcltkip *)NULL || ptr->ip == (Tcl_Interp *)NULL) {
/* deleted IP */
return Qtrue;
}
#if TCL_NAMESPACE_DEBUG
if (rbtk_invalid_namespace(ptr)) {
return Qtrue;
} else {
return Qfalse;
}
#else
return Qfalse;
#endif
}
|
#mainloop(*args) ⇒ Object
2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 |
# File 'ext/tk/tcltklib.c', line 2700
static VALUE
ip_mainloop(int argc, VALUE *argv, VALUE self)
{
volatile VALUE ret;
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
return Qnil;
}
if (Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL) {
/* slave IP */
return Qnil;
}
eventloop_interp = ptr->ip;
ret = lib_mainloop(argc, argv, self);
eventloop_interp = (Tcl_Interp*)NULL;
return ret;
}
|
#mainloop_abort_on_exception ⇒ Object
1911 1912 1913 1914 1915 |
# File 'ext/tk/tcltklib.c', line 1911
static VALUE
ip_evloop_abort_on_exc(VALUE self)
{
return lib_evloop_abort_on_exc(self);
}
|
#mainloop_abort_on_exception=(val) ⇒ Object
1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 |
# File 'ext/tk/tcltklib.c', line 1930
static VALUE
ip_evloop_abort_on_exc_set(VALUE self, VALUE val)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
return lib_evloop_abort_on_exc(self);
}
if (Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL) {
/* slave IP */
return lib_evloop_abort_on_exc(self);
}
return lib_evloop_abort_on_exc_set(self, val);
}
|
#mainloop_watchdog(*args) ⇒ Object
2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 |
# File 'ext/tk/tcltklib.c', line 2821
static VALUE
ip_mainloop_watchdog(int argc, VALUE *argv, VALUE self)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
return Qnil;
}
if (Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL) {
/* slave IP */
return Qnil;
}
return lib_mainloop_watchdog(argc, argv, self);
}
|
#make_safe ⇒ Object
6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 |
# File 'ext/tk/tcltklib.c', line 6404
static VALUE
ip_make_safe(VALUE self)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
return tk_funcall(ip_make_safe_core, 0, (VALUE*)NULL, self);
}
|
#restart ⇒ Object
7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 |
# File 'ext/tk/tcltklib.c', line 7535
static VALUE
ip_restart(VALUE self)
{
struct tcltkip *ptr = get_ip(self);
tcl_stubs_check();
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
if (Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL) {
/* slave IP */
return Qnil;
}
return lib_restart(self);
}
|
#safe? ⇒ Boolean
is safe?
6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 |
# File 'ext/tk/tcltklib.c', line 6418
static VALUE
ip_is_safe_p(VALUE self)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
rb_raise(rb_eRuntimeError, "interpreter is deleted");
}
if (Tcl_IsSafe(ptr->ip)) {
return Qtrue;
} else {
return Qfalse;
}
}
|
#set_eventloop_tick(tick) ⇒ Object
1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 |
# File 'ext/tk/tcltklib.c', line 1742
static VALUE
ip_set_eventloop_tick(VALUE self, VALUE tick)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
return get_eventloop_tick(self);
}
if (Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL) {
/* slave IP */
return get_eventloop_tick(self);
}
return set_eventloop_tick(self, tick);
}
|
#set_eventloop_weight(loop_max, no_event) ⇒ Object
1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 |
# File 'ext/tk/tcltklib.c', line 1833
static VALUE
ip_set_eventloop_weight(VALUE self, VALUE loop_max, VALUE no_event)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
return get_eventloop_weight(self);
}
if (Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL) {
/* slave IP */
return get_eventloop_weight(self);
}
return set_eventloop_weight(self, loop_max, no_event);
}
|
#set_max_block_time(time) ⇒ Object
1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 |
# File 'ext/tk/tcltklib.c', line 1856
static VALUE
set_max_block_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_AREF(divmod, 0));
tcl_time.usec = NUM2LONG(RARRAY_AREF(divmod, 1));
break;
case T_FLOAT:
/* time is second value */
divmod = rb_funcall(time, rb_intern("divmod"), 1, INT2FIX(1));
tcl_time.sec = NUM2LONG(RARRAY_AREF(divmod, 0));
tcl_time.usec = (long)(NUM2DBL(RARRAY_AREF(divmod, 1)) * 1000000);
break;
default:
rb_raise(rb_eArgError, "invalid value for time: '%+"PRIsVALUE"'", time);
}
Tcl_SetMaxBlockTime(&tcl_time);
return Qnil;
}
|
#set_no_event_wait(wait) ⇒ Object
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 |
# File 'ext/tk/tcltklib.c', line 1787
static VALUE
ip_set_no_event_wait(VALUE self, VALUE wait)
{
struct tcltkip *ptr = get_ip(self);
/* ip is deleted? */
if (deleted_ip(ptr)) {
return get_no_event_wait(self);
}
if (Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL) {
/* slave IP */
return get_no_event_wait(self);
}
return set_no_event_wait(self, wait);
}
|
#slave_of?(master) ⇒ Boolean
self is slave of master?
6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 |
# File 'ext/tk/tcltklib.c', line 6275
static VALUE
ip_is_slave_of_p(VALUE self, VALUE master)
{
if (!rb_obj_is_kind_of(master, tcltkip_class)) {
rb_raise(rb_eArgError, "expected TclTkIp object");
}
if (Tcl_GetMaster(get_ip(self)->ip) == get_ip(master)->ip) {
return Qtrue;
} else {
return Qfalse;
}
}
|