From: Yukihiro Matsumoto <
[email protected]>
Subject: Re: Run TCL in ruby
Date: Thu, 13 Jan 2005 08:25:39 +0900
Message-ID: said:
If no need for Tk, an IP without Tk can be created.
To do that, please call TclTkIp.new(nil, false).
^^^^^
TclTkIP#_split_tklist(str), _merge_tklist(str, ...) and
_conv_listelement(str) may be useful (see MANUAL.eng of tcltklib).
If use Ruby/Tk, module methods of TkComm may be useful too.
* NOTE: This method list is based on Ruby-1.8.2.
tk_tcl2ruby(val)
Tcl string -> Ruby object
# If seems to a number, then returns Numeric.
# Or If seems to a widget path, returns a widget object.
# So, sometimes wrong estimated object.
tk_split_list(val)
Tcl list -> Ruby array (each element converted by tk_tcl2ruby())
# do recursive call, if sub-string seems to a list.
tk_split_simplelist(val)
Tcl list -> Ruby array of string
# do NOT recursive call.
array2tk_list(ary)
Ruby array -> Tcl list
_symbolkey2str(hash)
return new Hash of which Symbol keys are changed to String keys.
# {:key=>val, ... } -> {'key'=>val, ... }
hash_kv(hash)
{key=>val, key=>val, ...} -> ['-key', val, '-key', val, ...]
# to treat option arguments
bool(str)
Tcl string -> Ruby boolean (true/false)
number(str)
Tcl string -> Ruby numeric
string(str)
Tcl string -> Ruby string
# If str is wrapped by '{' and '}', then remove them.
# Else, no operation.
num_or_str(str)
Tcl string -> Ruby numeric or string
# If str seems to a number, then returns number(str).
# Else, returns string(str).
list(str)
same to tk_split_list(str)
simplelist(str)
same to tk_split_simplelist(str)
window(str)
Tcl widget path -> Ruby widget object
procedure(str)
Tcl callback str -> Ruby procedure object
# If str is entried as a callback (e.g. 'rb_out ...';
# see install_cmd()), returns a procedure.
# Else, returns str.
install_cmd(cmd)
Entries cmd as a callback and returns a string which should be
passed to Tcl interpreter.
_get_eval_string(obj)
Ruby obj -> Tcl string