From 87cad12ae84f9ce07f55100f02fd82ae0fdc7884 Mon Sep 17 00:00:00 2001 From: nagai Date: Wed, 25 May 2005 21:11:13 +0000 Subject: [PATCH] * ext/tk/lib/tk.rb: add shortcut-methods of tk_call + tk_split_list git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ ext/tk/lib/tk.rb | 56 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5404dd0bb0..e61d4b5530 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu May 26 06:08:11 2005 Hidetoshi NAGAI + + * ext/tk/lib/tk.rb: add shortcut-methods of tk_call + tk_split_list + Wed May 25 20:06:27 2005 Hidetoshi NAGAI * ext/tk/lib/tk.rb: TkComm#tk_split_*list fail to split a kind of SJIS diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 1560f2a17d..d6811b4e70 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -1635,6 +1635,41 @@ module TkCore def tk_call_with_enc(*args) _tk_call_core(true, *args) end + + def _tk_call_to_list_core(depth, arg_enc, val_enc, *args) + args = _conv_args([], arg_enc, *args) + val = _tk_call_core(false, *args) + if !depth.kind_of?(Integer) || depth == 0 + tk_split_simplelist(val, false, val_enc) + else + tk_split_list(val, depth, false, val_enc) + end + end + #private :_tk_call_to_list_core + + def tk_call_to_list(*args) + _tk_call_to_list_core(-1, nil, true, *args) + end + + def tk_call_to_list_without_enc(*args) + _tk_call_to_list_core(-1, false, false, *args) + end + + def tk_call_to_list_with_enc(*args) + _tk_call_to_list_core(-1, true, true, *args) + end + + def tk_call_to_simplelist(*args) + _tk_call_to_list_core(0, nil, true, *args) + end + + def tk_call_to_simplelist_without_enc(*args) + _tk_call_to_list_core(0, false, false, *args) + end + + def tk_call_to_simplelist_with_enc(*args) + _tk_call_to_list_core(0, true, true, *args) + end end @@ -3391,6 +3426,25 @@ class TkObject