tkutil.c File Reference
`#include "ruby.h"`
`#include "rubysig.h"`
`#include "st.h"`

Go to the source code of this file.

## Data Structures

struct | cbsubst_info

## Macros

#define | TKUTIL_RELEASE_DATE "2010-03-26"
#define | RHASH_TBL(h) (RHASH(h)->tbl)
#define | RSTRING_PTR(s) (RSTRING(s)->ptr)
#define | RSTRING_LEN(s) (RSTRING(s)->len)
#define | RARRAY_PTR(s) (RARRAY(s)->ptr)
#define | RARRAY_LEN(s) (RARRAY(s)->len)
#define | CBSUBST_TBL_MAX (256)

## Functions

static VALUE | tk_s_new (int argc, VALUE *argv, VALUE klass)
static VALUE | tkNone_to_s (VALUE self)
static VALUE | tkNone_inspect (VALUE self)
static VALUE | tk_obj_untrust (VALUE self, VALUE obj)
static VALUE | tk_eval_cmd (int argc, argv, VALUE self)
static VALUE | tk_do_callback (int argc, VALUE *argv, VALUE self)
static VALUE | tk_install_cmd_core (VALUE cmd)
static VALUE | tk_install_cmd (int argc, VALUE *argv, VALUE self)
static VALUE | tk_uninstall_cmd (VALUE self, VALUE cmd_id)
static VALUE | tk_toUTF8 (int argc, VALUE *argv, VALUE self)
static VALUE | tk_fromUTF8 (int argc, VALUE *argv, VALUE self)
static VALUE | fromDefaultEnc_toUTF8 (VALUE str, VALUE self)
static int | to_strkey (VALUE key, VALUE value, VALUE hash)
static VALUE | tk_symbolkey2str (VALUE self, VALUE keys)
static VALUE get_eval_string_core | _ ((VALUE, VALUE, VALUE))
static VALUE hash2list | _ ((VALUE, VALUE))
static VALUE | ary2list (VALUE ary, VALUE enc_flag, VALUE self)
static VALUE | ary2list2 (VALUE ary, VALUE enc_flag, VALUE self)
static VALUE | key2keyname (VALUE key)
static VALUE | assoc2kv (VALUE assoc, VALUE ary, VALUE self)
static VALUE | assoc2kv_enc (VALUE assoc, VALUE ary, VALUE self)
static int | push_kv (VALUE key, VALUE val, VALUE args)
static VALUE | hash2kv (VALUE hash, VALUE ary, VALUE self)
static int | push_kv_enc (VALUE key, VALUE val, VALUE args)
static VALUE | hash2kv_enc (VALUE hash, VALUE ary, VALUE self)
static VALUE | hash2list (VALUE hash, VALUE self)
static VALUE | hash2list_enc (VALUE hash, VALUE self)
static VALUE | tk_hash_kv (int argc, VALUE *argv, VALUE self)
static VALUE | get_eval_string_core (VALUE obj, VALUE enc_flag, VALUE self)
static VALUE | tk_get_eval_string (int argc, VALUE *argv, VALUE self)
static VALUE | tk_get_eval_enc_str (VALUE self, VALUE obj)
static VALUE | tk_conv_args (int argc, VALUE *argv, VALUE self)
static VALUE | tcl2rb_bool (VALUE self, VALUE value)
static VALUE | tkstr_to_int (VALUE value)
static VALUE | tkstr_to_float (VALUE value)
static VALUE | tkstr_invalid_numstr (VALUE value)
static VALUE | tkstr_rescue_float (VALUE value)
static VALUE | tkstr_to_number (VALUE value)
static VALUE | tcl2rb_number (VALUE self, VALUE value)
static VALUE | tkstr_to_str (VALUE value)
static VALUE | tcl2rb_string (VALUE self, VALUE value)
static VALUE | tcl2rb_num_or_str (VALUE self, VALUE value)
static VALUE | tcl2rb_num_or_nil (VALUE self, VALUE value)
static void | subst_mark (struct cbsubst_info *ptr)
static void | subst_free (struct cbsubst_info *ptr)
static VALUE | allocate_cbsubst_info (struct cbsubst_info **inf_ptr)
static void | cbsubst_init ()
static VALUE | cbsubst_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | cbsubst_ret_val (VALUE self, VALUE val)
static int | each_attr_def (VALUE key, VALUE value, VALUE klass)
static VALUE | cbsubst_def_attr_aliases (VALUE self, VALUE tbl)
static VALUE | cbsubst_sym_to_subst (VALUE self, VALUE sym)
static VALUE | cbsubst_get_subst_arg (int argc, VALUE *argv, VALUE self)
static VALUE | cbsubst_get_subst_key (VALUE self, VALUE str)
static VALUE | cbsubst_get_all_subst_keys (VALUE self)
static VALUE | cbsubst_table_setup (int argc, VALUE *argv, VALUE self)
static VALUE | cbsubst_get_extra_args_tbl (VALUE self)
static VALUE | cbsubst_scan_args (VALUE self, VALUE arg_key, VALUE val_ary)
static VALUE | cbsubst_inspect (VALUE self)
static VALUE | substinfo_inspect (VALUE self)
static VALUE | tk_cbe_inspect (VALUE self)
static VALUE | tkobj_path (VALUE self)
void | Init_tkutil ()

## Variables

static VALUE | cMethod
static VALUE | cTclTkLib
static VALUE | cTkObject
static VALUE | cTkCallbackEntry
static VALUE | TK_None
static VALUE | cCB_SUBST
static VALUE | cSUBST_INFO
static VALUE | ENCODING_NAME_UTF8
static ID | ID_split_tklist
static ID | ID_toUTF8
static ID | ID_fromUTF8
static ID | ID_path
static ID | ID_at_path
static ID | ID_at_enc
static ID | ID_to_eval
static ID | ID_to_s
static ID | ID_source
static ID | ID_downcase
static ID | ID_install_cmd
static ID | ID_merge_tklist
static ID | ID_encoding
static ID | ID_encoding_system
static ID | ID_call
static ID | ID_SUBST_INFO
static VALUE | CALLBACK_TABLE
static unsigned long | CALLBACK_ID_NUM = 0
static const char | cmd_id_head [] = "ruby_cmd TkUtil callback "
static const char | cmd_id_prefix [] = "cmd"
const char | tkutil_release_date [] = TKUTIL_RELEASE_DATE

## Macro Definition Documentation

#define CBSUBST_TBL_MAX (256)

Definition at line 1134 of file tkutil.c.

Referenced by allocate_cbsubst_info(), cbsubst_get_all_subst_keys(), cbsubst_get_subst_arg(), cbsubst_get_subst_key(), cbsubst_initialize(), cbsubst_sym_to_subst(), and subst_free().

#define RARRAY_LEN | ( |  | s | ) | (RARRAY(s)->len)

Definition at line 35 of file tkutil.c.

Referenced by ary2list(), ary2list2(), assoc2kv(), assoc2kv_enc(), cbsubst_get_subst_key(), cbsubst_scan_args(), and cbsubst_table_setup().

#define RARRAY_PTR | ( |  | s | ) | (RARRAY(s)->ptr)

Definition at line 34 of file tkutil.c.

Referenced by ary2list(), ary2list2(), assoc2kv(), assoc2kv_enc(), cbsubst_get_subst_key(), cbsubst_scan_args(), cbsubst_table_setup(), push_kv(), and push_kv_enc().

#define RHASH_TBL | ( |  | h | ) | (RHASH(h)->tbl)

Definition at line 27 of file tkutil.c.

Referenced by clear_coverage(), count_nodes(), count_objects(), count_objects_size(), count_tdata_objects(), hash2kv(), hash2kv_enc(), iseq_set_sequence(), map_charset(), rb_ary_and(), rb_ary_diff(), rb_ary_or(), rb_ary_uniq(), rb_ary_uniq_bang(), rb_check_exec_env(), rb_check_exec_options(), rb_coverage_result(), and tk_symbolkey2str().

#define RSTRING_LEN | ( |  | s | ) | (RSTRING(s)->len)

Definition at line 31 of file tkutil.c.

Referenced by cbsubst_get_subst_key(), cbsubst_scan_args(), cbsubst_table_setup(), tcl2rb_num_or_nil(), and tkstr_to_str().

#define RSTRING_PTR | ( |  | s | ) | (RSTRING(s)->ptr)

Definition at line 30 of file tkutil.c.

Referenced by cbsubst_get_subst_arg(), cbsubst_get_subst_key(), cbsubst_scan_args(), cbsubst_sym_to_subst(), cbsubst_table_setup(), each_attr_def(), get_eval_string_core(), tcl2rb_bool(), tcl2rb_num_or_str(), tcl2rb_string(), tk_uninstall_cmd(), tkstr_invalid_numstr(), tkstr_to_float(), tkstr_to_int(), tkstr_to_number(), and tkstr_to_str().

#define TKUTIL_RELEASE_DATE "2010-03-26"

Definition at line 10 of file tkutil.c.

## Function Documentation

static VALUE hash2kv_enc _ | ( | (VALUE, VALUE, VALUE) |  | ) |

static

static VALUE hash2list_enc _ | ( | (VALUE, VALUE) |  | ) |

static

static VALUE allocate_cbsubst_info | ( | struct cbsubst_info ** | inf_ptr | ) |

static

Definition at line 1171 of file tkutil.c.

References cbsubst_info::aliases, ALLOC, CBSUBST_TBL_MAX, cSUBST_INFO, Data_Wrap_Struct, cbsubst_info::full_subst_length, inf(), cbsubst_info::ivar, cbsubst_info::key, cbsubst_info::keylen, NULL, cbsubst_info::proc, rb_hash_new(), subst_free(), subst_mark(), and cbsubst_info::type.

Referenced by cbsubst_init(), and cbsubst_table_setup().

static VALUE ary2list | ( | VALUE | ary,
|  | VALUE | enc_flag,
|  | VALUE | self
| ) |  |

static

Definition at line 296 of file tkutil.c.

References cTclTkLib, ENCODING_NAME_UTF8, get_eval_string_core(), hash2kv(), hash2kv_enc(), hash2list(), hash2list_enc(), ID_at_enc, ID_encoding, ID_encoding_system, ID_fromUTF8, ID_merge_tklist, ID_to_s, ID_toUTF8, NIL_P, Qnil, Qtrue, RARRAY_LEN, RARRAY_PTR, rb_apply(), rb_ary_new2(), rb_ary_push(), rb_funcall(), rb_ivar_get(), rb_ivar_set(), rb_obj_respond_to(), rb_str_cmp(), RHASH_SIZE, RTEST, size, T_ARRAY, T_FALSE, T_HASH, T_STRING, T_TRUE, TK_None, and TYPE.

Referenced by ary2list2(), and get_eval_string_core().

static VALUE ary2list2 | ( | VALUE | ary,
|  | VALUE | enc_flag,
|  | VALUE | self
| ) |  |

static

Definition at line 449 of file tkutil.c.

References ary2list(), cTclTkLib, ENCODING_NAME_UTF8, get_eval_string_core(), hash2list(), hash2list_enc(), ID_at_enc, ID_encoding, ID_encoding_system, ID_fromUTF8, ID_merge_tklist, ID_to_s, ID_toUTF8, NIL_P, Qnil, Qtrue, RARRAY_LEN, RARRAY_PTR, rb_apply(), rb_ary_new2(), rb_ary_push(), rb_funcall(), rb_ivar_get(), rb_ivar_set(), rb_obj_respond_to(), rb_str_cmp(), RTEST, size, T_ARRAY, T_FALSE, T_HASH, T_STRING, T_TRUE, TK_None, and TYPE.

Referenced by hash2list(), and hash2list_enc().

static VALUE assoc2kv | ( | VALUE | assoc,
|  | VALUE | ary,
|  | VALUE | self
| ) |  |

static

Definition at line 549 of file tkutil.c.

References i, key2keyname(), len, NIL_P, RARRAY_LEN, RARRAY_PTR, rb_ary_new2(), rb_ary_plus(), rb_ary_push(), T_ARRAY, and TYPE.

Referenced by tk_hash_kv().

static VALUE assoc2kv_enc | ( | VALUE | assoc,
|  | VALUE | ary,
|  | VALUE | self
| ) |  |

static

Definition at line 597 of file tkutil.c.

References get_eval_string_core(), i, key2keyname(), len, NIL_P, Qtrue, RARRAY_LEN, RARRAY_PTR, rb_ary_new2(), rb_ary_plus(), rb_ary_push(), T_ARRAY, and TYPE.

Referenced by tk_hash_kv().

static VALUE cbsubst_def_attr_aliases | ( | VALUE | self,
|  | VALUE | tbl
| ) |  |

static

Definition at line 1277 of file tkutil.c.

References cbsubst_info::aliases, Data_Get_Struct, each_attr_def(), ID_SUBST_INFO, inf(), rb_const_get(), rb_eArgError, rb_funcall(), rb_hash_foreach(), rb_intern, rb_raise(), T_HASH, and TYPE.

Referenced by Init_tkutil().

static VALUE cbsubst_get_all_subst_keys | ( | VALUE | self | ) |

static

Definition at line 1470 of file tkutil.c.

References ALLOC_N, buf, CBSUBST_TBL_MAX, Data_Get_Struct, cbsubst_info::full_subst_length, ID_SUBST_INFO, inf(), cbsubst_info::ivar, cbsubst_info::key, cbsubst_info::keylen, len, rb_ary_new3(), rb_const_get(), rb_str_new2(), and xfree().

Referenced by Init_tkutil().

static VALUE cbsubst_get_extra_args_tbl | ( | VALUE | self | ) |

static

Definition at line 1636 of file tkutil.c.

References rb_ary_new().

Referenced by Init_tkutil().

static VALUE cbsubst_get_subst_arg | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 1349 of file tkutil.c.

References cbsubst_info::aliases, ALLOC_N, argc, buf, CBSUBST_TBL_MAX, Data_Get_Struct, cbsubst_info::full_subst_length, i, id, ID2SYM, ID_SUBST_INFO, inf(), cbsubst_info::ivar, cbsubst_info::key, cbsubst_info::keylen, len, NIL_P, rb_const_get(), rb_eArgError, rb_hash_aref(), rb_id2name(), rb_intern, rb_raise(), rb_str_cat2(), rb_str_new2(), RSTRING_PTR, SYM2ID, T_STRING, T_SYMBOL, TYPE, and xfree().

Referenced by Init_tkutil().

static VALUE cbsubst_get_subst_key | ( | VALUE | self,
|  | VALUE | str
| ) |  |

static

Definition at line 1417 of file tkutil.c.

References ALLOC_N, buf, CBSUBST_TBL_MAX, cTclTkLib, Data_Get_Struct, cbsubst_info::full_subst_length, i, ID_split_tklist, ID_SUBST_INFO, inf(), cbsubst_info::key, cbsubst_info::keylen, len, list, RARRAY_LEN, RARRAY_PTR, rb_const_get(), rb_funcall(), rb_str_new2(), RSTRING_LEN, RSTRING_PTR, and xfree().

Referenced by Init_tkutil().

static void cbsubst_init | ( |  | ) |

static

Definition at line 1200 of file tkutil.c.

References allocate_cbsubst_info(), cCB_SUBST, ID_SUBST_INFO, NULL, and rb_const_set().

Referenced by Init_tkutil().

static VALUE cbsubst_initialize | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 1207 of file tkutil.c.

References CBSUBST_TBL_MAX, Data_Get_Struct, ID_SUBST_INFO, inf(), cbsubst_info::ivar, rb_const_get(), rb_ivar_set(), and rb_obj_class().

Referenced by Init_tkutil().

static VALUE cbsubst_inspect | ( | VALUE | self | ) |

static

Definition at line 1695 of file tkutil.c.

References rb_str_new2().

Referenced by Init_tkutil().

static VALUE cbsubst_ret_val | ( | VALUE | self,
|  | VALUE | val
| ) |  |

static

Definition at line 1229 of file tkutil.c.

Referenced by Init_tkutil().

static VALUE cbsubst_scan_args | ( | VALUE | self,
|  | VALUE | arg_key,
|  | VALUE | val_ary
| ) |  |

static

Definition at line 1643 of file tkutil.c.

References Data_Get_Struct, ID_call, ID_SUBST_INFO, inf(), INT2FIX, cbsubst_info::keylen, NIL_P, cbsubst_info::proc, Qfalse, Qnil, Qtrue, RARRAY_LEN, RARRAY_PTR, rb_ary_new2(), rb_ary_push(), rb_const_get(), rb_funcall(), rb_gc_disable(), rb_gc_enable(), rb_hash_aref(), RSTRING_LEN, RSTRING_PTR, and cbsubst_info::type.

Referenced by Init_tkutil().

static VALUE cbsubst_sym_to_subst | ( | VALUE | self,
|  | VALUE | sym
| ) |  |

static

Definition at line 1296 of file tkutil.c.

References cbsubst_info::aliases, ALLOC_N, buf, CBSUBST_TBL_MAX, Data_Get_Struct, cbsubst_info::full_subst_length, id, ID_SUBST_INFO, inf(), cbsubst_info::ivar, cbsubst_info::key, cbsubst_info::keylen, len, NIL_P, rb_const_get(), rb_hash_aref(), rb_id2name(), rb_intern, rb_str_cat2(), rb_str_new2(), RSTRING_PTR, sym, SYM2ID, T_SYMBOL, TYPE, and xfree().

Referenced by Init_tkutil().

static VALUE cbsubst_table_setup | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 1516 of file tkutil.c.

References allocate_cbsubst_info(), cbsubst_info::full_subst_length, id, ID_SUBST_INFO, inf(), INT2FIX, cbsubst_info::ivar, cbsubst_info::key, cbsubst_info::keylen, len, malloc(), NUM2CHR(), cbsubst_info::proc, Qtrue, RARRAY_LEN, RARRAY_PTR, rb_ary_new(), rb_attr(), rb_const_set(), rb_eArgError, rb_hash_aset(), rb_id2name(), rb_intern, rb_raise(), rb_scan_args(), rb_str_cat2(), rb_str_new2(), RSTRING_LEN, RSTRING_PTR, SYM2ID, T_ARRAY, T_STRING, TYPE, and cbsubst_info::type.

Referenced by Init_tkutil().

static int each_attr_def | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | klass
| ) |  |

static

Definition at line 1240 of file tkutil.c.

References Qundef, rb_alias(), rb_eArgError, rb_intern, rb_raise(), RSTRING_PTR, ST_CONTINUE, SYM2ID, T_STRING, T_SYMBOL, and TYPE.

Referenced by cbsubst_def_attr_aliases().

static VALUE fromDefaultEnc_toUTF8 | ( | VALUE | str,
|  | VALUE | self
| ) |  |

static

Definition at line 240 of file tkutil.c.

References argv, and tk_toUTF8().

Referenced by get_eval_string_core().

static VALUE get_eval_string_core | ( | VALUE | obj,
|  | VALUE | enc_flag,
|  | VALUE | self
| ) |  |

static

Definition at line 807 of file tkutil.c.

References ary2list(), cMethod, cTkCallbackEntry, cTkObject, fromDefaultEnc_toUTF8(), hash2list(), hash2list_enc(), ID_install_cmd, ID_path, ID_source, ID_to_eval, ID_to_s, ID_toUTF8, Qnil, Qtrue, rb_cProc, rb_funcall(), rb_id2name(), rb_intern, rb_obj_is_kind_of(), rb_obj_respond_to(), rb_str_new2(), rb_sym_to_s(), rb_warning(), RSTRING_PTR, RTEST, SYM2ID, T_ARRAY, T_BIGNUM, T_FALSE, T_FIXNUM, T_FLOAT, T_HASH, T_NIL, T_REGEXP, T_STRING, T_SYMBOL, T_TRUE, tk_install_cmd_core(), TK_None, and TYPE.

Referenced by ary2list(), ary2list2(), assoc2kv_enc(), push_kv(), push_kv_enc(), tk_conv_args(), tk_get_eval_enc_str(), and tk_get_eval_string().

static VALUE hash2kv | ( | VALUE | hash,
|  | VALUE | ary,
|  | VALUE | self
| ) |  |

static

Definition at line 669 of file tkutil.c.

References args, NIL_P, push_kv(), rb_ary_concat(), rb_ary_new2(), rb_ary_new3(), RHASH_SIZE, RHASH_TBL, and st_foreach.

Referenced by ary2list(), hash2list(), tk_conv_args(), and tk_hash_kv().

static VALUE hash2kv_enc | ( | VALUE | hash,
|  | VALUE | ary,
|  | VALUE | self
| ) |  |

static

Definition at line 714 of file tkutil.c.

References args, NIL_P, push_kv_enc(), rb_ary_concat(), rb_ary_new2(), rb_ary_new3(), RHASH_SIZE, RHASH_TBL, and st_foreach.

Referenced by ary2list(), hash2list_enc(), tk_conv_args(), and tk_hash_kv().

static VALUE hash2list | ( | VALUE | hash,
|  | VALUE | self
| ) |  |

static

Definition at line 732 of file tkutil.c.

References ary2list2(), hash2kv(), Qfalse, and Qnil.

Referenced by ary2list(), ary2list2(), and get_eval_string_core().

static VALUE hash2list_enc | ( | VALUE | hash,
|  | VALUE | self
| ) |  |

static

Definition at line 741 of file tkutil.c.

References ary2list2(), hash2kv_enc(), Qfalse, and Qnil.

Referenced by ary2list(), ary2list2(), and get_eval_string_core().

void Init_tkutil | ( |  | ) |

Definition at line 1732 of file tkutil.c.

References CALLBACK_TABLE, cbsubst_def_attr_aliases(), cbsubst_get_all_subst_keys(), cbsubst_get_extra_args_tbl(), cbsubst_get_subst_arg(), cbsubst_get_subst_key(), cbsubst_init(), cbsubst_initialize(), cbsubst_inspect(), cbsubst_ret_val(), cbsubst_scan_args(), cbsubst_sym_to_subst(), cbsubst_table_setup(), cCB_SUBST, cMethod, cSUBST_INFO, cTclTkLib, cTkCallbackEntry, cTkObject, ENCODING_NAME_UTF8, ID_at_enc, ID_at_path, ID_call, ID_downcase, ID_encoding, ID_encoding_system, ID_fromUTF8, ID_install_cmd, ID_merge_tklist, ID_path, ID_source, ID_split_tklist, ID_SUBST_INFO, ID_to_eval, ID_to_s, ID_toUTF8, OBJ_FREEZE, rb_cObject, rb_const_get(), rb_define_class(), rb_define_class_under(), rb_define_const(), rb_define_method(), rb_define_module(), rb_define_singleton_method(), rb_global_variable(), rb_hash_new(), rb_intern, rb_obj_alloc(), rb_obj_freeze(), rb_require(), rb_str_new2(), substinfo_inspect(), tcl2rb_bool(), tcl2rb_num_or_nil(), tcl2rb_num_or_str(), tcl2rb_number(), tcl2rb_string(), tk_cbe_inspect(), tk_conv_args(), tk_do_callback(), tk_eval_cmd(), tk_fromUTF8(), tk_get_eval_enc_str(), tk_get_eval_string(), tk_hash_kv(), tk_install_cmd(), TK_None, tk_obj_untrust(), tk_s_new(), tk_symbolkey2str(), tk_toUTF8(), tk_uninstall_cmd(), tkNone_inspect(), tkNone_to_s(), and tkobj_path().

static VALUE key2keyname | ( | VALUE | key | ) |

static

Definition at line 542 of file tkutil.c.

References ID_to_s, rb_funcall(), rb_str_append(), and rb_str_new2().

Referenced by assoc2kv(), assoc2kv_enc(), push_kv(), and push_kv_enc().

static int push_kv | ( | VALUE | key,
|  | VALUE | val,
|  | VALUE | args
| ) |  |

static

Definition at line 645 of file tkutil.c.

References get_eval_string_core(), key2keyname(), Qnil, Qundef, RARRAY_PTR, rb_ary_push(), ST_CHECK, ST_CONTINUE, and TK_None.

Referenced by hash2kv().

static int push_kv_enc | ( | VALUE | key,
|  | VALUE | val,
|  | VALUE | args
| ) |  |

static

Definition at line 687 of file tkutil.c.

References get_eval_string_core(), key2keyname(), Qtrue, Qundef, RARRAY_PTR, rb_ary_push(), ST_CHECK, ST_CONTINUE, and TK_None.

Referenced by hash2kv_enc().

static void subst_free | ( | struct cbsubst_info * | ptr | ) |

static

Definition at line 1154 of file tkutil.c.

References CBSUBST_TBL_MAX, free(), i, NULL, and xfree().

Referenced by allocate_cbsubst_info().

static void subst_mark | ( | struct cbsubst_info * | ptr | ) |

static

Definition at line 1146 of file tkutil.c.

References rb_gc_mark().

Referenced by allocate_cbsubst_info().

static VALUE substinfo_inspect | ( | VALUE | self | ) |

static

Definition at line 1702 of file tkutil.c.

References rb_str_new2().

Referenced by Init_tkutil().

static VALUE tcl2rb_bool | ( | VALUE | self,
|  | VALUE | value
| ) |  |

static

Definition at line 982 of file tkutil.c.

References ID_downcase, NULL, NUM2INT, Qfalse, Qnil, Qtrue, rb_check_type(), rb_funcall(), RSTRING_PTR, T_FALSE, T_FIXNUM, T_STRING, T_TRUE, and TYPE.

Referenced by Init_tkutil().

static VALUE tcl2rb_num_or_nil | ( | VALUE | self,
|  | VALUE | value
| ) |  |

static

Definition at line 1120 of file tkutil.c.

References Qnil, rb_check_type(), RSTRING_LEN, T_STRING, and tkstr_to_number().

Referenced by Init_tkutil().

static VALUE tcl2rb_num_or_str | ( | VALUE | self,
|  | VALUE | value
| ) |  |

static

Definition at line 1106 of file tkutil.c.

References NULL, rb_check_type(), rb_eArgError, rb_rescue2(), rb_tainted_str_new2(), RSTRING_PTR, T_STRING, tkstr_to_number(), and tkstr_to_str().

Referenced by Init_tkutil().

static VALUE tcl2rb_number | ( | VALUE | self,
|  | VALUE | value
| ) |  |

static

Definition at line 1070 of file tkutil.c.

References tkstr_to_number().

Referenced by Init_tkutil().

static VALUE tcl2rb_string | ( | VALUE | self,
|  | VALUE | value
| ) |  |

static

Definition at line 1094 of file tkutil.c.

References NULL, rb_check_type(), rb_tainted_str_new2(), RSTRING_PTR, T_STRING, and tkstr_to_str().

Referenced by Init_tkutil().

static VALUE tk_cbe_inspect | ( | VALUE | self | ) |

static

Definition at line 1711 of file tkutil.c.

References rb_str_new2().

Referenced by Init_tkutil().

static VALUE tk_conv_args | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 933 of file tkutil.c.

References argc, get_eval_string_core(), hash2kv(), hash2kv_enc(), Qfalse, Qtrue, rb_ary_new2(), rb_ary_plus(), rb_ary_push(), rb_eArgError, rb_gc_disable(), rb_gc_enable(), rb_raise(), RHASH_SIZE, RTEST, size, T_HASH, TK_None, and TYPE.

Referenced by Init_tkutil().

static VALUE tk_do_callback | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 146 of file tkutil.c.

References CALLBACK_TABLE, id, ID_call, rb_apply(), rb_funcall2(), rb_hash_aref(), and rb_scan_args().

Referenced by Init_tkutil().

static VALUE tk_eval_cmd | ( | int | argc,
|  | argv | ,
|  | VALUE | self
| ) |  |

static

Definition at line 134 of file tkutil.c.

References rb_eval_cmd(), and rb_scan_args().

Referenced by Init_tkutil().

static VALUE tk_fromUTF8 | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 231 of file tkutil.c.

References cTclTkLib, ID_fromUTF8, and rb_funcall2().

Referenced by Init_tkutil().

static VALUE tk_get_eval_enc_str | ( | VALUE | self,
|  | VALUE | obj
| ) |  |

static

Definition at line 921 of file tkutil.c.

References get_eval_string_core(), Qtrue, and TK_None.

Referenced by Init_tkutil().

static VALUE tk_get_eval_string | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 906 of file tkutil.c.

References get_eval_string_core(), Qnil, and rb_scan_args().

Referenced by Init_tkutil().

static VALUE tk_hash_kv | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 749 of file tkutil.c.

References assoc2kv(), assoc2kv_enc(), hash(), hash2kv(), hash2kv_enc(), NIL_P, Qnil, rb_ary_new(), rb_eArgError, rb_raise(), RTEST, T_ARRAY, T_HASH, T_NIL, TK_None, and TYPE.

Referenced by Init_tkutil().

static VALUE tk_install_cmd | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 179 of file tkutil.c.

References rb_block_proc(), rb_scan_args(), and tk_install_cmd_core().

Referenced by Init_tkutil().

static VALUE tk_install_cmd_core | ( | VALUE | cmd | ) |

static

Definition at line 166 of file tkutil.c.

References CALLBACK_ID_NUM, CALLBACK_TABLE, ID_to_s, rb_funcall(), rb_hash_aset(), rb_str_append(), rb_str_new2(), and ULONG2NUM().

Referenced by get_eval_string_core(), and tk_install_cmd().

static VALUE tk_obj_untrust | ( | VALUE | self,
|  | VALUE | obj
| ) |  |

static

Definition at line 119 of file tkutil.c.

References rb_obj_taint(), and rb_obj_untrust().

Referenced by Init_tkutil().

static VALUE tk_s_new | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | klass
| ) |  |

static

Definition at line 83 of file tkutil.c.

References rb_block_given_p(), rb_class_new_instance(), rb_obj_instance_eval(), and rb_obj_instance_exec().

Referenced by Init_tkutil().

static VALUE tk_symbolkey2str | ( | VALUE | self,
|  | VALUE | keys
| ) |  |

static

Definition at line 275 of file tkutil.c.

References NIL_P, rb_convert_type(), rb_hash_new(), RHASH_TBL, st_foreach, T_HASH, and to_strkey().

Referenced by Init_tkutil().

static VALUE tk_toUTF8 | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 222 of file tkutil.c.

References cTclTkLib, ID_toUTF8, and rb_funcall2().

Referenced by fromDefaultEnc_toUTF8(), and Init_tkutil().

static VALUE tk_uninstall_cmd | ( | VALUE | self,
|  | VALUE | cmd_id
| ) |  |

static

Definition at line 201 of file tkutil.c.

References CALLBACK_TABLE, Qnil, rb_hash_delete(), rb_str_new2(), RSTRING_PTR, StringValue, and strlen().

Referenced by Init_tkutil().

static VALUE tkNone_inspect | ( | VALUE | self | ) |

static

Definition at line 110 of file tkutil.c.

References rb_str_new2().

Referenced by Init_tkutil().

static VALUE tkNone_to_s | ( | VALUE | self | ) |

static

Definition at line 103 of file tkutil.c.

References rb_str_new2().

Referenced by Init_tkutil().

static VALUE tkobj_path | ( | VALUE | self | ) |

static

Definition at line 1720 of file tkutil.c.

References ID_at_path, and rb_ivar_get().

Referenced by Init_tkutil().

static VALUE tkstr_invalid_numstr | ( | VALUE | value | ) |

static

Definition at line 1039 of file tkutil.c.

References Qnil, rb_eArgError, rb_raise(), and RSTRING_PTR.

Referenced by tkstr_rescue_float().

static VALUE tkstr_rescue_float | ( | VALUE | value | ) |

static

Definition at line 1048 of file tkutil.c.

References rb_eArgError, rb_rescue2(), tkstr_invalid_numstr(), and tkstr_to_float().

Referenced by tkstr_to_number().

static VALUE tkstr_to_float | ( | VALUE | value | ) |

static

Definition at line 1032 of file tkutil.c.

References rb_cstr_to_dbl(), rb_float_new(), and RSTRING_PTR.

Referenced by tkstr_rescue_float().

static VALUE tkstr_to_int | ( | VALUE | value | ) |

static

Definition at line 1025 of file tkutil.c.

References rb_cstr_to_inum(), and RSTRING_PTR.

Referenced by tkstr_to_number().

static VALUE tkstr_to_number | ( | VALUE | value | ) |

static

Definition at line 1057 of file tkutil.c.

References INT2FIX, NULL, rb_check_type(), rb_eArgError, rb_rescue2(), RSTRING_PTR, T_STRING, tkstr_rescue_float(), and tkstr_to_int().

Referenced by tcl2rb_num_or_nil(), tcl2rb_num_or_str(), and tcl2rb_number().

static VALUE tkstr_to_str | ( | VALUE | value | ) |

static

Definition at line 1078 of file tkutil.c.

References len, rb_str_new(), RSTRING_LEN, and RSTRING_PTR.

Referenced by tcl2rb_num_or_str(), and tcl2rb_string().

static int to_strkey | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | hash
| ) |  |

static

Definition at line 264 of file tkutil.c.

References ID_to_s, Qundef, rb_funcall(), rb_hash_aset(), ST_CHECK, and ST_CONTINUE.

Referenced by tk_symbolkey2str().

## Variable Documentation

unsigned long CALLBACK_ID_NUM = 0

static

Definition at line 75 of file tkutil.c.

Referenced by tk_install_cmd_core().

VALUE CALLBACK_TABLE

static

Definition at line 74 of file tkutil.c.

Referenced by Init_tkutil(), tk_do_callback(), tk_install_cmd_core(), and tk_uninstall_cmd().

VALUE cCB_SUBST

static

Definition at line 51 of file tkutil.c.

Referenced by cbsubst_init(), and Init_tkutil().

const char cmd_id_head[] = "ruby_cmd TkUtil callback "

static

Definition at line 162 of file tkutil.c.

const char cmd_id_prefix[] = "cmd"

static

Definition at line 163 of file tkutil.c.

VALUE cMethod

static

Definition at line 42 of file tkutil.c.

Referenced by get_eval_string_core(), and Init_tkutil().

VALUE cSUBST_INFO

static

Definition at line 52 of file tkutil.c.

Referenced by allocate_cbsubst_info(), and Init_tkutil().

VALUE cTclTkLib

static

Definition at line 44 of file tkutil.c.

Referenced by ary2list(), ary2list2(), cbsubst_get_subst_key(), Init_tkutil(), tk_fromUTF8(), and tk_toUTF8().

VALUE cTkCallbackEntry

static

Definition at line 47 of file tkutil.c.

Referenced by get_eval_string_core(), and Init_tkutil().

VALUE cTkObject

static

Definition at line 46 of file tkutil.c.

Referenced by get_eval_string_core(), and Init_tkutil().

VALUE ENCODING_NAME_UTF8

static

Definition at line 54 of file tkutil.c.

Referenced by ary2list(), ary2list2(), and Init_tkutil().

ID ID_at_enc

static

Definition at line 61 of file tkutil.c.

Referenced by ary2list(), ary2list2(), and Init_tkutil().

ID ID_at_path

static

Definition at line 60 of file tkutil.c.

Referenced by Init_tkutil(), and tkobj_path().

ID ID_call

static

Definition at line 70 of file tkutil.c.

Referenced by cbsubst_scan_args(), Init_tkutil(), and tk_do_callback().

ID ID_downcase

static

Definition at line 65 of file tkutil.c.

Referenced by Init_tkutil(), and tcl2rb_bool().

ID ID_encoding

static

Definition at line 68 of file tkutil.c.

Referenced by ary2list(), ary2list2(), and Init_tkutil().

ID ID_encoding_system

static

Definition at line 69 of file tkutil.c.

Referenced by ary2list(), ary2list2(), and Init_tkutil().

ID ID_fromUTF8

static

Definition at line 58 of file tkutil.c.

Referenced by ary2list(), ary2list2(), Init_tkutil(), and tk_fromUTF8().

ID ID_install_cmd

static

Definition at line 66 of file tkutil.c.

Referenced by get_eval_string_core(), and Init_tkutil().

ID ID_merge_tklist

static

Definition at line 67 of file tkutil.c.

Referenced by ary2list(), ary2list2(), and Init_tkutil().

ID ID_path

static

Definition at line 59 of file tkutil.c.

Referenced by get_eval_string_core(), and Init_tkutil().

ID ID_source

static

Definition at line 64 of file tkutil.c.

Referenced by get_eval_string_core(), and Init_tkutil().

ID ID_split_tklist

static

Definition at line 56 of file tkutil.c.

Referenced by cbsubst_get_subst_key(), and Init_tkutil().

ID ID_SUBST_INFO

static

Definition at line 72 of file tkutil.c.

Referenced by cbsubst_def_attr_aliases(), cbsubst_get_all_subst_keys(), cbsubst_get_subst_arg(), cbsubst_get_subst_key(), cbsubst_init(), cbsubst_initialize(), cbsubst_scan_args(), cbsubst_sym_to_subst(), cbsubst_table_setup(), and Init_tkutil().

ID ID_to_eval

static

Definition at line 62 of file tkutil.c.

Referenced by get_eval_string_core(), and Init_tkutil().

ID ID_to_s

static

Definition at line 63 of file tkutil.c.

Referenced by ary2list(), ary2list2(), get_eval_string_core(), Init_tkutil(), key2keyname(), tk_install_cmd_core(), and to_strkey().

ID ID_toUTF8

static

Definition at line 57 of file tkutil.c.

Referenced by ary2list(), ary2list2(), get_eval_string_core(), Init_tkutil(), and tk_toUTF8().

VALUE TK_None

static

Definition at line 49 of file tkutil.c.

Referenced by ary2list(), ary2list2(), get_eval_string_core(), Init_tkutil(), push_kv(), push_kv_enc(), tk_conv_args(), tk_get_eval_enc_str(), and tk_hash_kv().

const char tkutil_release_date[] = TKUTIL_RELEASE_DATE

Definition at line 1729 of file tkutil.c.