Module: TkUtil

Module | TkUtil
In: | tk/tkutil.c

### Methods

_conv_args _conv_args _fromUTF8 _get_eval_enc_str _get_eval_enc_str _get_eval_string _get_eval_string _symbolkey2str _symbolkey2str _toUTF8 bool bool callback eval_cmd hash_kv hash_kv install_cmd num_or_str num_or_str number number string string uninstall_cmd

### Classes and Modules

Class TkUtil::CallbackSubst

### Public Class methods

_conv_args(...)
_get_eval_enc_str(p1)
_get_eval_string(...)
_symbolkey2str(p1)
bool(p1)

/

[Source]

    /*************************************/

    static VALUE
    tcl2rb_bool(self, value)
        VALUE self;
        VALUE value;
    {
        if (TYPE(value) == T_FIXNUM) {
            if (NUM2INT(value) == 0) {
                return Qfalse;
            } else {
                return Qtrue;
            }
        }

        if (TYPE(value) == T_TRUE || TYPE(value) == T_FALSE) {
            return value;
        }

        rb_check_type(value, T_STRING);

        value = rb_funcall(value, ID_downcase, 0);

        if (RSTRING(value)->ptr == (char*)NULL) return Qnil;

        if (RSTRING(value)->ptr[0] == '\0'
            || strcmp(RSTRING(value)->ptr, "0") == 0
            || strcmp(RSTRING(value)->ptr, "no") == 0
            || strcmp(RSTRING(value)->ptr, "off") == 0
            || strcmp(RSTRING(value)->ptr, "false") == 0) {
            return Qfalse;
        } else {
            return Qtrue;
        }
    }

callback(...)
eval_cmd(...)

/

[Source]

    /*************************************/

    static VALUE
    tk_eval_cmd(argc, argv, self)
        int argc;
        VALUE argv[];
        VALUE self;
    {
        volatile VALUE cmd, rest, arg;
        volatile VALUE ret;
        int status;

        rb_scan_args(argc, argv, "1*", &cmd, &rest);
        return rb_eval_cmd(cmd, rest, 0);
    }

hash_kv(...)
install_cmd(...)
num_or_str(p1)
number(p1)
string(p1)
uninstall_cmd(p1)

### Public Instance methods

_conv_args(...)
_fromUTF8(...)
_get_eval_enc_str(p1)
_get_eval_string(...)
_symbolkey2str(p1)
_toUTF8(...)
bool(p1)

/

[Source]

    /*************************************/

    static VALUE
    tcl2rb_bool(self, value)
        VALUE self;
        VALUE value;
    {
        if (TYPE(value) == T_FIXNUM) {
            if (NUM2INT(value) == 0) {
                return Qfalse;
            } else {
                return Qtrue;
            }
        }

        if (TYPE(value) == T_TRUE || TYPE(value) == T_FALSE) {
            return value;
        }

        rb_check_type(value, T_STRING);

        value = rb_funcall(value, ID_downcase, 0);

        if (RSTRING(value)->ptr == (char*)NULL) return Qnil;

        if (RSTRING(value)->ptr[0] == '\0'
            || strcmp(RSTRING(value)->ptr, "0") == 0
            || strcmp(RSTRING(value)->ptr, "no") == 0
            || strcmp(RSTRING(value)->ptr, "off") == 0
            || strcmp(RSTRING(value)->ptr, "false") == 0) {
            return Qfalse;
        } else {
            return Qtrue;
        }
    }

hash_kv(...)
num_or_str(p1)
number(p1)
string(p1)

[Validate]