mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1f297b8bfc
commit
f54418b71f
20 changed files with 909 additions and 183 deletions
74
ChangeLog
74
ChangeLog
|
@ -1,7 +1,79 @@
|
||||||
|
Mon Nov 27 17:00:35 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_eval): should not redefine builtin classes/modules
|
||||||
|
from within wrapped load.
|
||||||
|
|
||||||
|
Mon Nov 27 08:57:33 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (call_end_proc): should be isolated from outer block.
|
||||||
|
|
||||||
|
Mon Nov 27 00:10:08 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (rb_io_ctl): call ioctl/fcntl for fptr->f2 too.
|
||||||
|
|
||||||
|
* process.c (rb_f_fork): call rb_thread_atfork() after creating
|
||||||
|
child process.
|
||||||
|
|
||||||
|
* eval.c (rb_thread_atfork): kill all other threads immediately,
|
||||||
|
then turn the current thread into the main thread.
|
||||||
|
|
||||||
|
Sat Nov 25 23:12:22 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (ruby_run): move calling point of rb_trap_exit after
|
||||||
|
cleaning up threads.
|
||||||
|
|
||||||
|
* eval.c (ruby_finalize): new function to call EXIT trap, END
|
||||||
|
procs and GC finalizers.
|
||||||
|
|
||||||
|
* eval.c (rb_exec_end_proc): prevent recursion.
|
||||||
|
|
||||||
|
* gc.c (rb_gc_call_finalizer_at_exit): ditto.
|
||||||
|
|
||||||
|
* signal.c (rb_trap_exit): ditto. made static.
|
||||||
|
|
||||||
|
* process.c (rb_f_fork): should swallow all exceptions from block
|
||||||
|
execution.
|
||||||
|
|
||||||
|
* process.c (fork_rescue): should call ruby_finalize().
|
||||||
|
|
||||||
|
* parse.y (yycompile): rb_gc() removed. I don't remember why I put
|
||||||
|
this here. test code?
|
||||||
|
|
||||||
|
Fri Nov 24 22:03:48 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* range.c (EXCL): exclusive infomation is now stored in an
|
||||||
|
instance variable. this enables proper marshal dump.
|
||||||
|
|
||||||
|
* process.c (proc_waitpid): should clear rb_last_status ($?) if
|
||||||
|
no pid was given by waitpid(2).
|
||||||
|
|
||||||
|
Thu Nov 23 01:35:38 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* process.c (proc_waitpid2): returns nil if no pid found.
|
||||||
|
|
||||||
|
Wed Nov 22 23:45:15 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* range.c (range_eq): new method. Compares start and end of range
|
||||||
|
respectively.
|
||||||
|
|
||||||
|
Wed Nov 22 11:01:32 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* variable.c (rb_mod_class_variables): should honor singleton
|
||||||
|
class variable rule defined yesterday.
|
||||||
|
|
||||||
|
Tue Nov 21 23:24:14 2000 Mitsuteru S Nakao <nakao@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* numeric.c (flodivmod): missing second operand (typo).
|
||||||
|
|
||||||
Tue Nov 21 03:39:41 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Nov 21 03:39:41 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* marshal.c (marshal_load): marshal format compatibility check
|
||||||
|
revised. greater minor revision is UPWARD compatibile;
|
||||||
|
downward compatibility is not assured.
|
||||||
|
|
||||||
* eval.c (is_defined): clarify class variable behavior for
|
* eval.c (is_defined): clarify class variable behavior for
|
||||||
singleton classes.
|
singleton classes. class variables within singleton class
|
||||||
|
should be treated like within singleton method.
|
||||||
|
|
||||||
Mon Nov 20 13:45:21 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Nov 20 13:45:21 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
|
2
config.sub
vendored
2
config.sub
vendored
|
@ -989,7 +989,7 @@ case $os in
|
||||||
-xenix)
|
-xenix)
|
||||||
os=-xenix
|
os=-xenix
|
||||||
;;
|
;;
|
||||||
-*mint | -*MiNT)
|
-mint* | -MiNT*)
|
||||||
os=-mint
|
os=-mint
|
||||||
;;
|
;;
|
||||||
-uxpds)
|
-uxpds)
|
||||||
|
|
107
eval.c
107
eval.c
|
@ -1114,6 +1114,39 @@ ruby_options(argc, argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rb_exec_end_proc _((void));
|
||||||
|
|
||||||
|
void
|
||||||
|
ruby_finalize()
|
||||||
|
{
|
||||||
|
rb_trap_exit();
|
||||||
|
rb_exec_end_proc();
|
||||||
|
rb_gc_call_finalizer_at_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ruby_stop(ex)
|
||||||
|
int ex;
|
||||||
|
{
|
||||||
|
int state;
|
||||||
|
|
||||||
|
PUSH_TAG(PROT_NONE);
|
||||||
|
PUSH_ITER(ITER_NOT);
|
||||||
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
|
rb_thread_cleanup();
|
||||||
|
rb_thread_wait_other_threads();
|
||||||
|
}
|
||||||
|
else if (ex == 0) {
|
||||||
|
ex = state;
|
||||||
|
}
|
||||||
|
POP_ITER();
|
||||||
|
POP_TAG();
|
||||||
|
|
||||||
|
ex = error_handle(ex);
|
||||||
|
ruby_finalize();
|
||||||
|
exit(ex);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ruby_run()
|
ruby_run()
|
||||||
{
|
{
|
||||||
|
@ -1133,23 +1166,7 @@ ruby_run()
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
|
|
||||||
if (state && !ex) ex = state;
|
if (state && !ex) ex = state;
|
||||||
PUSH_TAG(PROT_NONE);
|
ruby_stop(ex);
|
||||||
PUSH_ITER(ITER_NOT);
|
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
|
||||||
rb_trap_exit();
|
|
||||||
rb_thread_cleanup();
|
|
||||||
rb_thread_wait_other_threads();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ex = state;
|
|
||||||
}
|
|
||||||
POP_ITER();
|
|
||||||
POP_TAG();
|
|
||||||
|
|
||||||
ex = error_handle(ex);
|
|
||||||
rb_exec_end_proc();
|
|
||||||
rb_gc_call_finalizer_at_exit();
|
|
||||||
exit(ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2955,17 +2972,12 @@ rb_eval(self, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
klass = 0;
|
klass = 0;
|
||||||
if ((ruby_class == rb_cObject || ruby_class == ruby_wrapper) &&
|
if ((ruby_class == rb_cObject) && rb_autoload_defined(node->nd_cname)) {
|
||||||
rb_autoload_defined(node->nd_cname)) {
|
|
||||||
rb_autoload_load(node->nd_cname);
|
rb_autoload_load(node->nd_cname);
|
||||||
}
|
}
|
||||||
if (rb_const_defined_at(ruby_class, node->nd_cname)) {
|
if (rb_const_defined_at(ruby_class, node->nd_cname)) {
|
||||||
klass = rb_const_get(ruby_class, node->nd_cname);
|
klass = rb_const_get(ruby_class, node->nd_cname);
|
||||||
}
|
}
|
||||||
if (!klass && ruby_class == ruby_wrapper &&
|
|
||||||
rb_const_defined_at(rb_cObject, node->nd_cname)) {
|
|
||||||
klass = rb_const_get(rb_cObject, node->nd_cname);
|
|
||||||
}
|
|
||||||
if (klass) {
|
if (klass) {
|
||||||
if (TYPE(klass) != T_CLASS) {
|
if (TYPE(klass) != T_CLASS) {
|
||||||
rb_raise(rb_eTypeError, "%s is not a class",
|
rb_raise(rb_eTypeError, "%s is not a class",
|
||||||
|
@ -3013,17 +3025,12 @@ rb_eval(self, n)
|
||||||
rb_raise(rb_eTypeError, "no outer class/module");
|
rb_raise(rb_eTypeError, "no outer class/module");
|
||||||
}
|
}
|
||||||
module = 0;
|
module = 0;
|
||||||
if ((ruby_class == rb_cObject || ruby_class == ruby_wrapper) &&
|
if ((ruby_class == rb_cObject) && rb_autoload_defined(node->nd_cname)) {
|
||||||
rb_autoload_defined(node->nd_cname)) {
|
|
||||||
rb_autoload_load(node->nd_cname);
|
rb_autoload_load(node->nd_cname);
|
||||||
}
|
}
|
||||||
if (rb_const_defined_at(ruby_class, node->nd_cname)) {
|
if (rb_const_defined_at(ruby_class, node->nd_cname)) {
|
||||||
module = rb_const_get(ruby_class, node->nd_cname);
|
module = rb_const_get(ruby_class, node->nd_cname);
|
||||||
}
|
}
|
||||||
if (!module && ruby_class == ruby_wrapper &&
|
|
||||||
rb_const_defined_at(rb_cObject, node->nd_cname)) {
|
|
||||||
module = rb_const_get(rb_cObject, node->nd_cname);
|
|
||||||
}
|
|
||||||
if (module) {
|
if (module) {
|
||||||
if (TYPE(module) != T_MODULE) {
|
if (TYPE(module) != T_MODULE) {
|
||||||
rb_raise(rb_eTypeError, "%s is not a module",
|
rb_raise(rb_eTypeError, "%s is not a module",
|
||||||
|
@ -3208,11 +3215,14 @@ rb_exit(status)
|
||||||
int status;
|
int status;
|
||||||
{
|
{
|
||||||
if (prot_tag) {
|
if (prot_tag) {
|
||||||
|
VALUE exit;
|
||||||
|
|
||||||
exit_status = status;
|
exit_status = status;
|
||||||
rb_exc_raise(rb_exc_new(rb_eSystemExit, 0, 0));
|
exit = rb_exc_new(rb_eSystemExit, 0, 0);
|
||||||
|
rb_iv_set(exit, "status", INT2NUM(status));
|
||||||
|
rb_exc_raise(exit);
|
||||||
}
|
}
|
||||||
rb_exec_end_proc();
|
ruby_finalize();
|
||||||
rb_gc_call_finalizer_at_exit();
|
|
||||||
exit(status);
|
exit(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5602,7 +5612,11 @@ static void
|
||||||
call_end_proc(data)
|
call_end_proc(data)
|
||||||
VALUE data;
|
VALUE data;
|
||||||
{
|
{
|
||||||
|
PUSH_ITER(ITER_NOT);
|
||||||
|
PUSH_FRAME();
|
||||||
proc_call(data, Qundef);
|
proc_call(data, Qundef);
|
||||||
|
POP_FRAME();
|
||||||
|
POP_ITER();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -5625,24 +5639,28 @@ rb_f_at_exit()
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
rb_exec_end_proc()
|
rb_exec_end_proc()
|
||||||
{
|
{
|
||||||
struct end_proc_data *link;
|
struct end_proc_data *link;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
while (end_procs) {
|
||||||
link = end_procs;
|
link = end_procs;
|
||||||
while (link) {
|
end_procs = link->next;
|
||||||
rb_protect((VALUE(*)())link->func, link->data, &status);
|
rb_protect((VALUE(*)())link->func, link->data, &status);
|
||||||
if (status) {
|
if (status) {
|
||||||
error_handle(status);
|
error_handle(status);
|
||||||
}
|
}
|
||||||
link = link->next;
|
free(link);
|
||||||
}
|
}
|
||||||
while (ephemeral_end_procs) {
|
while (ephemeral_end_procs) {
|
||||||
link = ephemeral_end_procs;
|
link = ephemeral_end_procs;
|
||||||
ephemeral_end_procs = link->next;
|
ephemeral_end_procs = link->next;
|
||||||
rb_protect((VALUE(*)())link->func, link->data, &status);
|
rb_protect((VALUE(*)())link->func, link->data, &status);
|
||||||
|
if (status) {
|
||||||
|
error_handle(status);
|
||||||
|
}
|
||||||
free(link);
|
free(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6915,6 +6933,7 @@ rb_thread_remove(th)
|
||||||
rb_thread_t th;
|
rb_thread_t th;
|
||||||
{
|
{
|
||||||
if (th->status == THREAD_KILLED) return;
|
if (th->status == THREAD_KILLED) return;
|
||||||
|
|
||||||
rb_thread_ready(th);
|
rb_thread_ready(th);
|
||||||
th->status = THREAD_KILLED;
|
th->status = THREAD_KILLED;
|
||||||
th->prev->next = th->next;
|
th->prev->next = th->next;
|
||||||
|
@ -7816,6 +7835,7 @@ rb_thread_start_0(fn, arg, th_arg)
|
||||||
}
|
}
|
||||||
POP_TAG();
|
POP_TAG();
|
||||||
status = th->status;
|
status = th->status;
|
||||||
|
if (th == main_thread) ruby_stop(state);
|
||||||
rb_thread_remove(th);
|
rb_thread_remove(th);
|
||||||
if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
|
if (state && status != THREAD_TO_KILL && !NIL_P(ruby_errinfo)) {
|
||||||
th->flags |= THREAD_RAISED;
|
th->flags |= THREAD_RAISED;
|
||||||
|
@ -8214,6 +8234,23 @@ rb_thread_inspect(thread)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rb_thread_atfork()
|
||||||
|
{
|
||||||
|
rb_thread_t th;
|
||||||
|
|
||||||
|
if (rb_thread_alone()) return;
|
||||||
|
FOREACH_THREAD(th) {
|
||||||
|
if (th != curr_thread) {
|
||||||
|
th->status = THREAD_KILLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END_FOREACH(th);
|
||||||
|
main_thread = curr_thread;
|
||||||
|
curr_thread->next = curr_thread;
|
||||||
|
curr_thread->prev = curr_thread;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE rb_cCont;
|
static VALUE rb_cCont;
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
426
ext/tk/lib/tk.rb
426
ext/tk/lib/tk.rb
|
@ -485,6 +485,56 @@ module TkCore
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def after_idle(cmd=Proc.new)
|
||||||
|
myid = _curr_cmd_id
|
||||||
|
cmdid = install_cmd(cmd)
|
||||||
|
tk_call('after','idle',cmdid)
|
||||||
|
end
|
||||||
|
|
||||||
|
def clock_clicks(ms=nil)
|
||||||
|
if ms
|
||||||
|
tk_call('clock','clicks','-milliseconds').to_i
|
||||||
|
else
|
||||||
|
tk_call('clock','clicks').to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def clock_format(clk, form=nil)
|
||||||
|
if form
|
||||||
|
tk_call('clock','format',clk,'-format',form).to_i
|
||||||
|
else
|
||||||
|
tk_call('clock','format',clk).to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def clock_formatGMT(clk, form=nil)
|
||||||
|
if form
|
||||||
|
tk_call('clock','format',clk,'-format',form,'-gmt','1').to_i
|
||||||
|
else
|
||||||
|
tk_call('clock','format',clk,'-gmt','1').to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def clock_scan(str, base=nil)
|
||||||
|
if base
|
||||||
|
tk_call('clock','scan',str,'-base',base).to_i
|
||||||
|
else
|
||||||
|
tk_call('clock','scan',str).to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def clock_scanGMT(str, base=nil)
|
||||||
|
if base
|
||||||
|
tk_call('clock','scan',str,'-base',base,'-gmt','1').to_i
|
||||||
|
else
|
||||||
|
tk_call('clock','scan',str,'-gmt','1').to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def clock_seconds
|
||||||
|
tk_call('clock','seconds').to_i
|
||||||
|
end
|
||||||
|
|
||||||
def TkCore.callback(arg)
|
def TkCore.callback(arg)
|
||||||
arg = Array(tk_split_list(arg))
|
arg = Array(tk_split_list(arg))
|
||||||
_get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg))
|
_get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg))
|
||||||
|
@ -1762,10 +1812,28 @@ module TkPack
|
||||||
tk_call 'pack', 'forget' *args
|
tk_call 'pack', 'forget' *args
|
||||||
end
|
end
|
||||||
|
|
||||||
def propagate(master, bool=None)
|
def info(slave)
|
||||||
bool(tk_call('pack', 'propagate', master.epath, bool))
|
ilist = list(tk_call('pack', 'info', slave.epath))
|
||||||
|
info = {}
|
||||||
|
while key = ilist.shift
|
||||||
|
info[key[1..-1]] = ilist.shift
|
||||||
end
|
end
|
||||||
module_function :configure, :forget, :propagate
|
return info
|
||||||
|
end
|
||||||
|
|
||||||
|
def propagate(master, bool=None)
|
||||||
|
if bool == None
|
||||||
|
bool(tk_call('pack', 'propagate', master.epath))
|
||||||
|
else
|
||||||
|
tk_call('pack', 'propagate', master.epath, bool)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def slaves(master)
|
||||||
|
list(tk_call('pack', 'slaves', master.epath))
|
||||||
|
end
|
||||||
|
|
||||||
|
module_function :configure, :forget, :info, :propagate, :slaves
|
||||||
end
|
end
|
||||||
|
|
||||||
module TkGrid
|
module TkGrid
|
||||||
|
@ -1795,6 +1863,32 @@ module TkGrid
|
||||||
tk_call "grid", 'rowconfigure', master, index, *hash_kv(args)
|
tk_call "grid", 'rowconfigure', master, index, *hash_kv(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def columnconfiginfo(master, index, slot=nil)
|
||||||
|
if slot
|
||||||
|
tk_call 'grid', 'columnconfigure', master, index, "-#{slot}"
|
||||||
|
else
|
||||||
|
ilist = list(tk_call('grid', 'columnconfigure', master, index))
|
||||||
|
info = {}
|
||||||
|
while key = ilist.shift
|
||||||
|
info[key[1..-1]] = ilist.shift
|
||||||
|
end
|
||||||
|
info
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def rowconfiginfo(master, index, slot=nil)
|
||||||
|
if slot
|
||||||
|
tk_call 'grid', 'rowconfigure', master, index, "-#{slot}"
|
||||||
|
else
|
||||||
|
ilist = list(tk_call('grid', 'rowconfigure', master, index))
|
||||||
|
info = {}
|
||||||
|
while key = ilist.shift
|
||||||
|
info[key[1..-1]] = ilist.shift
|
||||||
|
end
|
||||||
|
info
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def add(widget, *args)
|
def add(widget, *args)
|
||||||
configure(widget, *args)
|
configure(widget, *args)
|
||||||
end
|
end
|
||||||
|
@ -1812,7 +1906,11 @@ module TkGrid
|
||||||
end
|
end
|
||||||
|
|
||||||
def propagate(master, bool=None)
|
def propagate(master, bool=None)
|
||||||
bool(tk_call('grid', 'propagate', master.epath, bool))
|
if bool == None
|
||||||
|
bool(tk_call('grid', 'propagate', master.epath))
|
||||||
|
else
|
||||||
|
tk_call('grid', 'propagate', master.epath, bool)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove(*args)
|
def remove(*args)
|
||||||
|
@ -1823,13 +1921,63 @@ module TkGrid
|
||||||
tk_call 'grid', 'size', master
|
tk_call 'grid', 'size', master
|
||||||
end
|
end
|
||||||
|
|
||||||
def slaves(args)
|
def slaves(master, args)
|
||||||
list(tk_call('grid', 'slaves', *hash_kv(args)))
|
list(tk_call('grid', 'slaves', master, *hash_kv(args)))
|
||||||
end
|
end
|
||||||
|
|
||||||
module_function :bbox, :forget, :propagate, :info
|
module_function :bbox, :forget, :propagate, :info
|
||||||
module_function :remove, :size, :slaves, :location
|
module_function :remove, :size, :slaves, :location
|
||||||
module_function :configure, :columnconfigure, :rowconfigure
|
module_function :configure, :columnconfigure, :rowconfigure
|
||||||
|
module_function :columnconfiginfo, :rowconfiginfo
|
||||||
|
end
|
||||||
|
|
||||||
|
module TkPlace
|
||||||
|
include Tk
|
||||||
|
extend Tk
|
||||||
|
|
||||||
|
def configure(win, slot, value=None)
|
||||||
|
if slot.kind_of? Hash
|
||||||
|
tk_call 'place', 'configure', win.epath, *hash_kv(slot)
|
||||||
|
else
|
||||||
|
tk_call 'place', 'configure', win.epath, "-#{slot}", value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def configinfo(win, slot = nil)
|
||||||
|
# for >= Tk8.4a2 ?
|
||||||
|
if slot
|
||||||
|
conf = tk_split_list(tk_call('place', 'configure',
|
||||||
|
win.epath, "-#{slot}") )
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
else
|
||||||
|
tk_split_simplelist(tk_call('place', 'configure',
|
||||||
|
win.epath)).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def forget(win)
|
||||||
|
tk_call 'place', 'forget', win
|
||||||
|
end
|
||||||
|
|
||||||
|
def info(win)
|
||||||
|
ilist = list(tk_call('place', 'info', win.epath))
|
||||||
|
info = {}
|
||||||
|
while key = ilist.shift
|
||||||
|
info[key[1..-1]] = ilist.shift
|
||||||
|
end
|
||||||
|
return info
|
||||||
|
end
|
||||||
|
|
||||||
|
def slaves(master)
|
||||||
|
list(tk_call('place', 'slaves', master.epath))
|
||||||
|
end
|
||||||
|
|
||||||
|
module_function :configure, :configinfo, :forget, :info, :slaves
|
||||||
end
|
end
|
||||||
|
|
||||||
module TkOption
|
module TkOption
|
||||||
|
@ -1993,8 +2141,13 @@ class TkObject<TkKernel
|
||||||
end
|
end
|
||||||
|
|
||||||
def cget(slot)
|
def cget(slot)
|
||||||
|
case slot
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
tk_call path, 'cget', "-#{slot}"
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_call path, 'cget', "-#{slot}"
|
tk_tcl2ruby tk_call path, 'cget', "-#{slot}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def configure(slot, value=None)
|
def configure(slot, value=None)
|
||||||
if slot.kind_of? Hash
|
if slot.kind_of? Hash
|
||||||
|
@ -2028,17 +2181,43 @@ class TkObject<TkKernel
|
||||||
fontobj
|
fontobj
|
||||||
else
|
else
|
||||||
if slot
|
if slot
|
||||||
|
case slot
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
conf = tk_split_simplelist(tk_send('configure', "-#{slot}") )
|
||||||
|
else
|
||||||
conf = tk_split_list(tk_send('configure', "-#{slot}") )
|
conf = tk_split_list(tk_send('configure', "-#{slot}") )
|
||||||
|
end
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
conf
|
conf
|
||||||
else
|
else
|
||||||
ret = tk_split_list(tk_send('configure') ).collect{|conf|
|
ret = tk_split_simplelist(tk_send('configure') ).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
|
case conf[0]
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
else
|
||||||
|
if conf[3]
|
||||||
|
if conf[3].index('{')
|
||||||
|
conf[3] = tk_split_list(conf[3])
|
||||||
|
else
|
||||||
|
conf[3] = tk_tcl2ruby(conf[3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if conf[4]
|
||||||
|
if conf[4].index('{')
|
||||||
|
conf[4] = tk_split_list(conf[4])
|
||||||
|
else
|
||||||
|
conf[4] = tk_tcl2ruby(conf[4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
if ret.assoc('font')
|
fontconf = ret.assoc('font')
|
||||||
|
if fontconf
|
||||||
ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
|
ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
|
||||||
ret.push(['font', fontobj])
|
fontconf[4] = fontobj
|
||||||
|
ret.push(fontconf)
|
||||||
else
|
else
|
||||||
ret
|
ret
|
||||||
end
|
end
|
||||||
|
@ -2093,6 +2272,36 @@ class TkWindow<TkObject
|
||||||
tk_call 'pack', 'forget', epath
|
tk_call 'pack', 'forget', epath
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
alias pack_forget unpack
|
||||||
|
|
||||||
|
def pack_config(slot, value=None)
|
||||||
|
if slot.kind_of? Hash
|
||||||
|
tk_call 'pack', 'configure', epath, *hash_kv(slot)
|
||||||
|
else
|
||||||
|
tk_call 'pack', 'configure', epath, "-#{slot}", value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def pack_info()
|
||||||
|
ilist = list(tk_call('pack', 'info', epath))
|
||||||
|
info = {}
|
||||||
|
while key = ilist.shift
|
||||||
|
info[key[1..-1]] = ilist.shift
|
||||||
|
end
|
||||||
|
return info
|
||||||
|
end
|
||||||
|
|
||||||
|
def pack_propagate(mode = nil)
|
||||||
|
if mode
|
||||||
|
tk_call('pack', 'propagate', epath, mode)
|
||||||
|
else
|
||||||
|
bool(tk_call('pack', 'propagate', epath))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def pack_slaves()
|
||||||
|
list(tk_call('pack', 'slaves', epath))
|
||||||
|
end
|
||||||
|
|
||||||
def grid(keys = nil)
|
def grid(keys = nil)
|
||||||
tk_call 'grid', epath, *hash_kv(keys)
|
tk_call 'grid', epath, *hash_kv(keys)
|
||||||
|
@ -2103,6 +2312,81 @@ class TkWindow<TkObject
|
||||||
tk_call 'grid', 'forget', epath
|
tk_call 'grid', 'forget', epath
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
alias grid_forget ungrid
|
||||||
|
|
||||||
|
def grid_bbox(*args)
|
||||||
|
list(tk_call('grid', 'bbox', epath, *args))
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_config(slot, value=None)
|
||||||
|
if slot.kind_of? Hash
|
||||||
|
tk_call 'grid', 'configure', epath, *hash_kv(slot)
|
||||||
|
else
|
||||||
|
tk_call 'grid', 'configure', epath, "-#{slot}", value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_columnconfig(index, keys)
|
||||||
|
tk_call('grid', 'columnconfigure', epath, index, hash_kv(keys))
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_rowconfig(index, keys)
|
||||||
|
tk_call('grid', 'rowconfigure', epath, index, hash_kv(keys))
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_columnconfiginfo(index, slot=nil)
|
||||||
|
if slot
|
||||||
|
tk_call('grid', 'columnconfigure', epath, index, "-#{slot}")
|
||||||
|
else
|
||||||
|
ilist = list(tk_call('grid', 'columnconfigure', epath, index))
|
||||||
|
info = {}
|
||||||
|
while key = ilist.shift
|
||||||
|
info[key[1..-1]] = ilist.shift
|
||||||
|
end
|
||||||
|
info
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_rowconfiginfo(index, slot=nil)
|
||||||
|
if slot
|
||||||
|
tk_call('grid', 'rowconfigure', epath, index, "-#{slot}")
|
||||||
|
else
|
||||||
|
ilist = list(tk_call('grid', 'rowconfigure', epath, index))
|
||||||
|
info = {}
|
||||||
|
while key = ilist.shift
|
||||||
|
info[key[1..-1]] = ilist.shift
|
||||||
|
end
|
||||||
|
info
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_info()
|
||||||
|
list(tk_call('grid', 'info', epath))
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_location(x, y)
|
||||||
|
list(tk_call('grid', 'location', epath, x, y))
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_propagate(mode=nil)
|
||||||
|
if mode
|
||||||
|
tk_call('grid', 'propagate', epath, bool)
|
||||||
|
else
|
||||||
|
bool(tk_call('grid', 'propagate', epath))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_remove()
|
||||||
|
tk_call 'grid', 'remove', epath
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_size()
|
||||||
|
tk_call 'grid', 'size', epath
|
||||||
|
end
|
||||||
|
|
||||||
|
def grid_slaves(args)
|
||||||
|
list(tk_call('grid', 'slaves', epath, *hash_kv(args)))
|
||||||
|
end
|
||||||
|
|
||||||
def place(keys = nil)
|
def place(keys = nil)
|
||||||
tk_call 'place', epath, *hash_kv(keys)
|
tk_call 'place', epath, *hash_kv(keys)
|
||||||
|
@ -2115,8 +2399,28 @@ class TkWindow<TkObject
|
||||||
end
|
end
|
||||||
alias place_forget unplace
|
alias place_forget unplace
|
||||||
|
|
||||||
def place_config(keys)
|
def place_config(slot, value=None)
|
||||||
tk_call "place", 'configure', epath, *hash_kv(keys)
|
if slot.kind_of? Hash
|
||||||
|
tk_call 'place', 'configure', epath, *hash_kv(slot)
|
||||||
|
else
|
||||||
|
tk_call 'place', 'configure', epath, "-#{slot}", value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def place_configinfo(slot = nil)
|
||||||
|
# for >= Tk8.4a2 ?
|
||||||
|
if slot
|
||||||
|
conf = tk_split_list(tk_call('place', 'configure', epath, "-#{slot}") )
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
else
|
||||||
|
tk_split_simplelist(tk_call('place',
|
||||||
|
'configure', epath)).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
|
conf[0] = conf[0][1..-1]
|
||||||
|
conf
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def place_info()
|
def place_info()
|
||||||
|
@ -2128,19 +2432,6 @@ class TkWindow<TkObject
|
||||||
return info
|
return info
|
||||||
end
|
end
|
||||||
|
|
||||||
def pack_slaves()
|
|
||||||
list(tk_call('pack', 'slaves', epath))
|
|
||||||
end
|
|
||||||
|
|
||||||
def pack_info()
|
|
||||||
ilist = list(tk_call('pack', 'info', epath))
|
|
||||||
info = {}
|
|
||||||
while key = ilist.shift
|
|
||||||
info[key[1..-1]] = ilist.shift
|
|
||||||
end
|
|
||||||
return info
|
|
||||||
end
|
|
||||||
|
|
||||||
def place_slaves()
|
def place_slaves()
|
||||||
list(tk_call('place', 'slaves', epath))
|
list(tk_call('place', 'slaves', epath))
|
||||||
end
|
end
|
||||||
|
@ -2160,7 +2451,9 @@ class TkWindow<TkObject
|
||||||
elsif args.length == 1
|
elsif args.length == 1
|
||||||
case args[0]
|
case args[0]
|
||||||
when 'global'
|
when 'global'
|
||||||
tk_call 'grab', 'set', '-global', path
|
return(tk_call 'grab', 'set', '-global', path)
|
||||||
|
when 'release'
|
||||||
|
return(tk_call 'grab', 'release', path)
|
||||||
else
|
else
|
||||||
val = tk_call('grab', args[0], path)
|
val = tk_call('grab', args[0], path)
|
||||||
end
|
end
|
||||||
|
@ -2360,9 +2653,9 @@ class TkButton<TkLabel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkRadiobutton<TkButton
|
class TkRadioButton<TkButton
|
||||||
WidgetClassNames['Radiobutton'] = self
|
WidgetClassNames['Radiobutton'] = self
|
||||||
def TkRadiobutton.to_eval
|
def TkRadioButton.to_eval
|
||||||
'Radiobutton'
|
'Radiobutton'
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self
|
||||||
|
@ -2378,11 +2671,11 @@ class TkRadiobutton<TkButton
|
||||||
configure 'variable', tk_trace_variable(v)
|
configure 'variable', tk_trace_variable(v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
TkRadioButton = TkRadiobutton
|
TkRadiobutton = TkRadioButton
|
||||||
|
|
||||||
class TkCheckbutton<TkRadiobutton
|
class TkCheckButton<TkRadioButton
|
||||||
WidgetClassNames['Checkbutton'] = self
|
WidgetClassNames['Checkbutton'] = self
|
||||||
def TkCheckbutton.to_eval
|
def TkCheckButton.to_eval
|
||||||
'Checkbutton'
|
'Checkbutton'
|
||||||
end
|
end
|
||||||
def create_self
|
def create_self
|
||||||
|
@ -2392,7 +2685,7 @@ class TkCheckbutton<TkRadiobutton
|
||||||
tk_send 'toggle'
|
tk_send 'toggle'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
TkCheckButton = TkCheckbutton
|
TkCheckbutton = TkCheckButton
|
||||||
|
|
||||||
class TkMessage<TkLabel
|
class TkMessage<TkLabel
|
||||||
WidgetClassNames['Message'] = self
|
WidgetClassNames['Message'] = self
|
||||||
|
@ -2403,7 +2696,6 @@ class TkMessage<TkLabel
|
||||||
tk_call 'message', @path
|
tk_call 'message', @path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
TkRadiobutton = TkRadioButton
|
|
||||||
|
|
||||||
class TkScale<TkWindow
|
class TkScale<TkWindow
|
||||||
WidgetClassName = 'Scale'.freeze
|
WidgetClassName = 'Scale'.freeze
|
||||||
|
@ -2432,7 +2724,6 @@ class TkScale<TkWindow
|
||||||
set val
|
set val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
TkCheckbutton = TkCheckButton
|
|
||||||
|
|
||||||
class TkScrollbar<TkWindow
|
class TkScrollbar<TkWindow
|
||||||
WidgetClassName = 'Scrollbar'.freeze
|
WidgetClassName = 'Scrollbar'.freeze
|
||||||
|
@ -2547,8 +2838,13 @@ class TkListbox<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def itemcget(index, key)
|
def itemcget(index, key)
|
||||||
|
case key
|
||||||
|
when 'text', 'label', 'show'
|
||||||
|
tk_send 'itemcget', index, "-#{key}"
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_send 'itemcget', index, "-#{key}"
|
tk_tcl2ruby tk_send 'itemcget', index, "-#{key}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def itemconfigure(index, key, val=None)
|
def itemconfigure(index, key, val=None)
|
||||||
if key.kind_of? Hash
|
if key.kind_of? Hash
|
||||||
if (key['font'] || key['kanjifont'] ||
|
if (key['font'] || key['kanjifont'] ||
|
||||||
|
@ -2570,12 +2866,36 @@ class TkListbox<TkTextWin
|
||||||
|
|
||||||
def itemconfiginfo(index, key=nil)
|
def itemconfiginfo(index, key=nil)
|
||||||
if key
|
if key
|
||||||
|
case key
|
||||||
|
when 'text', 'label', 'show'
|
||||||
|
conf = tk_split_simplelist(tk_send('itemconfigure',index,"-#{key}"))
|
||||||
|
else
|
||||||
conf = tk_split_list(tk_send('itemconfigure',index,"-#{key}"))
|
conf = tk_split_list(tk_send('itemconfigure',index,"-#{key}"))
|
||||||
|
end
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
conf
|
conf
|
||||||
else
|
else
|
||||||
tk_split_list(tk_send('itemconfigure', index)).collect{|conf|
|
tk_split_simplelist(tk_send('itemconfigure', index)).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
|
case conf[0]
|
||||||
|
when 'text', 'label', 'show'
|
||||||
|
else
|
||||||
|
if conf[3]
|
||||||
|
if conf[3].index('{')
|
||||||
|
conf[3] = tk_split_list(conf[3])
|
||||||
|
else
|
||||||
|
conf[3] = tk_tcl2ruby(conf[3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if conf[4]
|
||||||
|
if conf[4].index('{')
|
||||||
|
conf[4] = tk_split_list(conf[4])
|
||||||
|
else
|
||||||
|
conf[4] = tk_tcl2ruby(conf[4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -2743,8 +3063,13 @@ class TkMenu<TkWindow
|
||||||
number(tk_send('yposition', index))
|
number(tk_send('yposition', index))
|
||||||
end
|
end
|
||||||
def entrycget(index, key)
|
def entrycget(index, key)
|
||||||
|
case key
|
||||||
|
when 'text', 'label', 'show'
|
||||||
|
tk_send 'entrycget', index, "-#{key}"
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_send 'entrycget', index, "-#{key}"
|
tk_tcl2ruby tk_send 'entrycget', index, "-#{key}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def entryconfigure(index, key, val=None)
|
def entryconfigure(index, key, val=None)
|
||||||
if key.kind_of? Hash
|
if key.kind_of? Hash
|
||||||
if (key['font'] || key['kanjifont'] ||
|
if (key['font'] || key['kanjifont'] ||
|
||||||
|
@ -2766,12 +3091,36 @@ class TkMenu<TkWindow
|
||||||
|
|
||||||
def entryconfiginfo(index, key=nil)
|
def entryconfiginfo(index, key=nil)
|
||||||
if key
|
if key
|
||||||
|
case key
|
||||||
|
when 'text', 'label', 'show'
|
||||||
|
conf = tk_split_simplelist(tk_send('entryconfigure',index,"-#{key}"))
|
||||||
|
else
|
||||||
conf = tk_split_list(tk_send('entryconfigure',index,"-#{key}"))
|
conf = tk_split_list(tk_send('entryconfigure',index,"-#{key}"))
|
||||||
|
end
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
conf
|
conf
|
||||||
else
|
else
|
||||||
tk_split_list(tk_send('entryconfigure', index)).collect{|conf|
|
tk_split_simplelist(tk_send('entryconfigure', index)).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
|
case conf[0]
|
||||||
|
when 'text', 'label', 'show'
|
||||||
|
else
|
||||||
|
if conf[3]
|
||||||
|
if conf[3].index('{')
|
||||||
|
conf[3] = tk_split_list(conf[3])
|
||||||
|
else
|
||||||
|
conf[3] = tk_tcl2ruby(conf[3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if conf[4]
|
||||||
|
if conf[4].index('{')
|
||||||
|
conf[4] = tk_split_list(conf[4])
|
||||||
|
else
|
||||||
|
conf[4] = tk_tcl2ruby(conf[4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -2977,8 +3326,15 @@ autoload :TkEntry, 'tkentry'
|
||||||
autoload :TkSpinbox, 'tkentry'
|
autoload :TkSpinbox, 'tkentry'
|
||||||
autoload :TkText, 'tktext'
|
autoload :TkText, 'tktext'
|
||||||
autoload :TkDialog, 'tkdialog'
|
autoload :TkDialog, 'tkdialog'
|
||||||
|
autoload :TkWarning, 'tkdialog'
|
||||||
autoload :TkMenubar, 'tkmenubar'
|
autoload :TkMenubar, 'tkmenubar'
|
||||||
autoload :TkAfter, 'tkafter'
|
autoload :TkAfter, 'tkafter'
|
||||||
autoload :TkPalette, 'tkpalette'
|
autoload :TkPalette, 'tkpalette'
|
||||||
autoload :TkFont, 'tkfont'
|
autoload :TkFont, 'tkfont'
|
||||||
autoload :TkVirtualEvent, 'tkvirtevent'
|
autoload :TkVirtualEvent, 'tkvirtevent'
|
||||||
|
autoload :TkBgError, 'tkbgerror'
|
||||||
|
autoload :TkManageFocus, 'tkmngfocus'
|
||||||
|
autoload :TkPalette, 'tkpalette'
|
||||||
|
autoload :TkWinDDE, 'tkwinpkg'
|
||||||
|
autoload :TkWinRegistry, 'tkwinpkg'
|
||||||
|
autoload :TkMacResource, 'tkmacpkg'
|
||||||
|
|
|
@ -274,8 +274,20 @@ class TkCanvas<TkWindow
|
||||||
end
|
end
|
||||||
|
|
||||||
def itemcget(tagOrId, option)
|
def itemcget(tagOrId, option)
|
||||||
|
case option
|
||||||
|
when 'dash', 'activedash', 'disableddash'
|
||||||
|
conf = tk_send('itemcget', tagid(tagOrId), "-#{option}")
|
||||||
|
if conf =~ /^[0-9]/
|
||||||
|
list(conf)
|
||||||
|
else
|
||||||
|
conf
|
||||||
|
end
|
||||||
|
when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
|
||||||
|
tk_send 'itemcget', tagid(tagOrId), "-#{option}"
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_send 'itemcget', tagid(tagOrId), "-#{option}"
|
tk_tcl2ruby tk_send 'itemcget', tagid(tagOrId), "-#{option}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def itemconfigure(tagOrId, key, value=None)
|
def itemconfigure(tagOrId, key, value=None)
|
||||||
if key.kind_of? Hash
|
if key.kind_of? Hash
|
||||||
|
@ -308,12 +320,55 @@ class TkCanvas<TkWindow
|
||||||
|
|
||||||
def itemconfiginfo(tagOrId, key=nil)
|
def itemconfiginfo(tagOrId, key=nil)
|
||||||
if key
|
if key
|
||||||
conf = tk_split_list(tk_send 'itemconfigure', tagid(tagOrId), "-#{key}")
|
case key
|
||||||
|
when 'dash', 'activedash', 'disableddash'
|
||||||
|
conf = tk_split_simplelist(tk_send 'itemconfigure',
|
||||||
|
tagid(tagOrId), "-#{key}")
|
||||||
|
if conf[3] && conf[3] =~ /^[0-9]/
|
||||||
|
conf[3] = list(conf[3])
|
||||||
|
end
|
||||||
|
if conf[4] && conf[4] =~ /^[0-9]/
|
||||||
|
conf[4] = list(conf[4])
|
||||||
|
end
|
||||||
|
when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
|
||||||
|
conf = tk_split_simplelist(tk_send 'itemconfigure',
|
||||||
|
tagid(tagOrId), "-#{key}")
|
||||||
|
else
|
||||||
|
conf = tk_split_list(tk_send 'itemconfigure',
|
||||||
|
tagid(tagOrId), "-#{key}")
|
||||||
|
end
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
conf
|
conf
|
||||||
else
|
else
|
||||||
tk_split_list(tk_send 'itemconfigure', tagid(tagOrId)).collect{|conf|
|
tk_split_simplelist(tk_send 'itemconfigure',
|
||||||
|
tagid(tagOrId)).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
|
case conf[0]
|
||||||
|
when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
|
||||||
|
when 'dash', 'activedash', 'disableddash'
|
||||||
|
if conf[3] && conf[3] =~ /^[0-9]/
|
||||||
|
conf[3] = list(conf[3])
|
||||||
|
end
|
||||||
|
if conf[4] && conf[4] =~ /^[0-9]/
|
||||||
|
conf[4] = list(conf[4])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if conf[3]
|
||||||
|
if conf[3].index('{')
|
||||||
|
conf[3] = tk_split_list(conf[3])
|
||||||
|
else
|
||||||
|
conf[3] = tk_tcl2ruby(conf[3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if conf[4]
|
||||||
|
if conf[4].index('{')
|
||||||
|
conf[4] = tk_split_list(conf[4])
|
||||||
|
else
|
||||||
|
conf[4] = tk_tcl2ruby(conf[4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -820,8 +875,13 @@ class TkPhotoImage<TkImage
|
||||||
end
|
end
|
||||||
|
|
||||||
def cget(option)
|
def cget(option)
|
||||||
|
case option
|
||||||
|
when 'data', 'flie'
|
||||||
|
tk_send 'cget', option
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_send 'cget', option
|
tk_tcl2ruby tk_send 'cget', option
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def copy(source, *opts)
|
def copy(source, *opts)
|
||||||
args = opts.collect{|term|
|
args = opts.collect{|term|
|
||||||
|
|
|
@ -9,8 +9,8 @@ TopLevel = TkToplevel
|
||||||
Frame = TkFrame
|
Frame = TkFrame
|
||||||
Label = TkLabel
|
Label = TkLabel
|
||||||
Button = TkButton
|
Button = TkButton
|
||||||
Radiobutton = TkRadiobutton
|
Radiobutton = TkRadioButton
|
||||||
Checkbutton = TkCheckbutton
|
Checkbutton = TkCheckButton
|
||||||
Message = TkMessage
|
Message = TkMessage
|
||||||
Entry = TkEntry
|
Entry = TkEntry
|
||||||
Text = TkText
|
Text = TkText
|
||||||
|
|
|
@ -14,6 +14,47 @@ class TkEntry<TkLabel
|
||||||
WidgetClassName
|
WidgetClassName
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class ValidateCmd
|
||||||
|
include TkComm
|
||||||
|
|
||||||
|
class ValidateArgs
|
||||||
|
def initialize(d,i,s,v,pp,ss,vv,ww)
|
||||||
|
@action = d
|
||||||
|
@index = i
|
||||||
|
@current = s
|
||||||
|
@type = v
|
||||||
|
@value = pp
|
||||||
|
@string = ss
|
||||||
|
@triggered = vv
|
||||||
|
@widget = ww
|
||||||
|
end
|
||||||
|
attr :action
|
||||||
|
attr :index
|
||||||
|
attr :current
|
||||||
|
attr :type
|
||||||
|
attr :value
|
||||||
|
attr :string
|
||||||
|
attr :triggered
|
||||||
|
attr :widget
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize(cmd = Proc.new, args=nil)
|
||||||
|
if args
|
||||||
|
@id = install_cmd(proc{|*arg|
|
||||||
|
TkUtil.eval_cmd cmd, *arg
|
||||||
|
}) + " " + args
|
||||||
|
else
|
||||||
|
@id = install_cmd(proc{|arg|
|
||||||
|
TkUtil.eval_cmd cmd, ValidateArgs.new(*arg)
|
||||||
|
}) + ' %d %i %s %v %P %S %V %W'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_eval
|
||||||
|
@id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def create_self
|
def create_self
|
||||||
tk_call 'entry', @path
|
tk_call 'entry', @path
|
||||||
end
|
end
|
||||||
|
@ -26,6 +67,47 @@ class TkEntry<TkLabel
|
||||||
tk_send 'delete', s, e
|
tk_send 'delete', s, e
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def configure(slot, value=None)
|
||||||
|
if slot.kind_of? Hash
|
||||||
|
if slot['vcmd'].kind_of? Array
|
||||||
|
cmd, *args = slot['vcmd']
|
||||||
|
slot['vcmd'] = ValidateCmd.new(cmd, args.join(' '))
|
||||||
|
elsif slot['vcmd'].kind_of? Proc
|
||||||
|
slot['vcmd'] = ValidateCmd.new(slot['vcmd'])
|
||||||
|
end
|
||||||
|
if slot['validatecommand'].kind_of? Array
|
||||||
|
cmd, *args = slot['validatecommand']
|
||||||
|
slot['validatecommand'] = ValidateCmd.new(cmd, args.join(' '))
|
||||||
|
elsif slot['validatecommand'].kind_of? Proc
|
||||||
|
slot['validatecommand'] = ValidateCmd.new(slot['validatecommand'])
|
||||||
|
end
|
||||||
|
if slot['invcmd'].kind_of? Array
|
||||||
|
cmd, *args = slot['invcmd']
|
||||||
|
slot['invcmd'] = ValidateCmd.new(cmd, args.join(' '))
|
||||||
|
elsif slot['invcmd'].kind_of? Proc
|
||||||
|
slot['invcmd'] = ValidateCmd.new(slot['invcmd'])
|
||||||
|
end
|
||||||
|
if slot['invalidcommand'].kind_of? Array
|
||||||
|
cmd, *args = slot['invalidcommand']
|
||||||
|
slot['invalidcommand'] = ValidateCmd.new(cmd, args.join(' '))
|
||||||
|
elsif slot['invalidcommand'].kind_of? Proc
|
||||||
|
slot['invalidcommand'] = ValidateCmd.new(slot['invalidcommand'])
|
||||||
|
end
|
||||||
|
super(slot)
|
||||||
|
else
|
||||||
|
if (slot == 'vcmd' || slot == 'validatecommand' ||
|
||||||
|
slot == 'invcmd' || slot == 'invalidcommand')
|
||||||
|
if value.kind_of? Array
|
||||||
|
cmd, *args = value
|
||||||
|
value = ValidateCmd.new(cmd, args.join(' '))
|
||||||
|
elsif value.kind_of? Proc
|
||||||
|
value = ValidateCmd.new(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
super(slot, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def cursor
|
def cursor
|
||||||
tk_send 'index', 'insert'
|
tk_send 'index', 'insert'
|
||||||
end
|
end
|
||||||
|
@ -75,47 +157,6 @@ class TkEntry<TkLabel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ValidateCmd
|
|
||||||
include TkComm
|
|
||||||
|
|
||||||
class ValidateArgs
|
|
||||||
def initialize(d,i,s,v,pp,ss,vv,ww)
|
|
||||||
@action = d
|
|
||||||
@index = i
|
|
||||||
@current = s
|
|
||||||
@type = v
|
|
||||||
@value = pp
|
|
||||||
@string = ss
|
|
||||||
@triggered = vv
|
|
||||||
@widget = ww
|
|
||||||
end
|
|
||||||
attr :action
|
|
||||||
attr :index
|
|
||||||
attr :current
|
|
||||||
attr :type
|
|
||||||
attr :value
|
|
||||||
attr :string
|
|
||||||
attr :triggered
|
|
||||||
attr :widget
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize(cmd = Proc.new, args=nil)
|
|
||||||
if args
|
|
||||||
@id = install_cmd(proc{|*arg|
|
|
||||||
TkUtil.eval_cmd cmd, *arg
|
|
||||||
}) + " " + args
|
|
||||||
else
|
|
||||||
@id = install_cmd(proc{|arg|
|
|
||||||
TkUtil.eval_cmd cmd, ValidateArgs.new(*arg)
|
|
||||||
}) + ' %d %i %s %v %P %S %V %W'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_eval
|
|
||||||
@id
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def validatecommand(cmd = ValidateCmd.new, args = nil)
|
def validatecommand(cmd = ValidateCmd.new, args = nil)
|
||||||
if cmd.kind_of?(ValidateCmd)
|
if cmd.kind_of?(ValidateCmd)
|
||||||
configure('validatecommand', cmd)
|
configure('validatecommand', cmd)
|
||||||
|
|
|
@ -270,8 +270,13 @@ class TkText<TkTextWin
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_cget(tag, key)
|
def tag_cget(tag, key)
|
||||||
|
case key
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
tk_call @path, 'tag', 'cget', tag, "-#{key}"
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_call @path, 'tag', 'cget', tag, "-#{key}"
|
tk_tcl2ruby tk_call @path, 'tag', 'cget', tag, "-#{key}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def tag_configure(tag, key, val=None)
|
def tag_configure(tag, key, val=None)
|
||||||
if key.kind_of? Hash
|
if key.kind_of? Hash
|
||||||
|
@ -294,12 +299,36 @@ class TkText<TkTextWin
|
||||||
|
|
||||||
def tag_configinfo(tag, key=nil)
|
def tag_configinfo(tag, key=nil)
|
||||||
if key
|
if key
|
||||||
|
case key
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
conf = tk_split_simplelist(tk_send('tag','configure',tag,"-#{key}"))
|
||||||
|
else
|
||||||
conf = tk_split_list(tk_send('tag','configure',tag,"-#{key}"))
|
conf = tk_split_list(tk_send('tag','configure',tag,"-#{key}"))
|
||||||
|
end
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
conf
|
conf
|
||||||
else
|
else
|
||||||
tk_split_list(tk_send('tag', 'configure', tag)).collect{|conf|
|
tk_split_simplelist(tk_send('tag', 'configure', tag)).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
|
case conf[0]
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
else
|
||||||
|
if conf[3]
|
||||||
|
if conf[3].index('{')
|
||||||
|
conf[3] = tk_split_list(conf[3])
|
||||||
|
else
|
||||||
|
conf[3] = tk_tcl2ruby(conf[3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if conf[4]
|
||||||
|
if conf[4].index('{')
|
||||||
|
conf[4] = tk_split_list(conf[4])
|
||||||
|
else
|
||||||
|
conf[4] = tk_tcl2ruby(conf[4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -674,8 +703,13 @@ class TkTextTag<TkObject
|
||||||
end
|
end
|
||||||
|
|
||||||
def cget(key)
|
def cget(key)
|
||||||
|
case key
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
tk_call @t.path, 'tag', 'cget', @id, "-#{key}"
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_call @t.path, 'tag', 'cget', @id, "-#{key}"
|
tk_tcl2ruby tk_call @t.path, 'tag', 'cget', @id, "-#{key}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def configure(key, val=None)
|
def configure(key, val=None)
|
||||||
@t.tag_configure @id, key, val
|
@t.tag_configure @id, key, val
|
||||||
|
@ -853,8 +887,13 @@ class TkTextWindow<TkObject
|
||||||
end
|
end
|
||||||
|
|
||||||
def cget(slot)
|
def cget(slot)
|
||||||
|
case slot
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
tk_call @t.path, 'window', 'cget', @index, "-#{slot}"
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_call @t.path, 'window', 'cget', @index, "-#{slot}"
|
tk_tcl2ruby tk_call @t.path, 'window', 'cget', @index, "-#{slot}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def configure(slot, value=None)
|
def configure(slot, value=None)
|
||||||
if slot.kind_of? Hash
|
if slot.kind_of? Hash
|
||||||
|
@ -899,14 +938,39 @@ class TkTextWindow<TkObject
|
||||||
|
|
||||||
def configinfo(slot = nil)
|
def configinfo(slot = nil)
|
||||||
if slot
|
if slot
|
||||||
|
case slot
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
conf = tk_split_simplelist(tk_call @t.path, 'window', 'configure',
|
||||||
|
@index, "-#{slot}")
|
||||||
|
else
|
||||||
conf = tk_split_list(tk_call @t.path, 'window', 'configure',
|
conf = tk_split_list(tk_call @t.path, 'window', 'configure',
|
||||||
@index, "-#{slot}")
|
@index, "-#{slot}")
|
||||||
|
end
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
conf
|
conf
|
||||||
else
|
else
|
||||||
tk_split_list(tk_call @t.path, 'window', 'configure',
|
tk_split_simplelist(tk_call @t.path, 'window', 'configure',
|
||||||
@index).collect{|conf|
|
@index).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
|
case conf[0]
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
else
|
||||||
|
if conf[3]
|
||||||
|
if conf[3].index('{')
|
||||||
|
conf[3] = tk_split_list(conf[3])
|
||||||
|
else
|
||||||
|
conf[3] = tk_tcl2ruby(conf[3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if conf[4]
|
||||||
|
if conf[4].index('{')
|
||||||
|
conf[4] = tk_split_list(conf[4])
|
||||||
|
else
|
||||||
|
conf[4] = tk_tcl2ruby(conf[4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -944,8 +1008,13 @@ class TkTextImage<TkObject
|
||||||
end
|
end
|
||||||
|
|
||||||
def cget(slot)
|
def cget(slot)
|
||||||
|
case slot
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
tk_call @t.path, 'image', 'cget', @index, "-#{slot}"
|
||||||
|
else
|
||||||
tk_tcl2ruby tk_call @t.path, 'image', 'cget', @index, "-#{slot}"
|
tk_tcl2ruby tk_call @t.path, 'image', 'cget', @index, "-#{slot}"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def configure(slot, value=None)
|
def configure(slot, value=None)
|
||||||
if slot.kind_of? Hash
|
if slot.kind_of? Hash
|
||||||
|
@ -968,14 +1037,39 @@ class TkTextImage<TkObject
|
||||||
|
|
||||||
def configinfo(slot = nil)
|
def configinfo(slot = nil)
|
||||||
if slot
|
if slot
|
||||||
|
case slot
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
conf = tk_split_simplelist(tk_call @t.path, 'image', 'configure',
|
||||||
|
@index, "-#{slot}")
|
||||||
|
else
|
||||||
conf = tk_split_list(tk_call @t.path, 'image', 'configure',
|
conf = tk_split_list(tk_call @t.path, 'image', 'configure',
|
||||||
@index, "-#{slot}")
|
@index, "-#{slot}")
|
||||||
|
end
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
conf
|
conf
|
||||||
else
|
else
|
||||||
tk_split_list(tk_call @t.path, 'image', 'configure',
|
tk_split_simplelist(tk_call @t.path, 'image', 'configure',
|
||||||
@index).collect{|conf|
|
@index).collect{|conflist|
|
||||||
|
conf = tk_split_simplelist(conflist)
|
||||||
conf[0] = conf[0][1..-1]
|
conf[0] = conf[0][1..-1]
|
||||||
|
case conf[0]
|
||||||
|
when 'text', 'label', 'show', 'data', 'flie'
|
||||||
|
else
|
||||||
|
if conf[3]
|
||||||
|
if conf[3].index('{')
|
||||||
|
conf[3] = tk_split_list(conf[3])
|
||||||
|
else
|
||||||
|
conf[3] = tk_tcl2ruby(conf[3])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if conf[4]
|
||||||
|
if conf[4].index('{')
|
||||||
|
conf[4] = tk_split_list(conf[4])
|
||||||
|
else
|
||||||
|
conf[4] = tk_tcl2ruby(conf[4])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
conf
|
conf
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
14
gc.c
14
gc.c
|
@ -61,7 +61,7 @@ mem_error(mesg)
|
||||||
|
|
||||||
void *
|
void *
|
||||||
ruby_xmalloc(size)
|
ruby_xmalloc(size)
|
||||||
size_t size;
|
long size;
|
||||||
{
|
{
|
||||||
void *mem;
|
void *mem;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ ruby_xmalloc(size)
|
||||||
|
|
||||||
void *
|
void *
|
||||||
ruby_xcalloc(n, size)
|
ruby_xcalloc(n, size)
|
||||||
size_t n, size;
|
long n, size;
|
||||||
{
|
{
|
||||||
void *mem;
|
void *mem;
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ ruby_xcalloc(n, size)
|
||||||
void *
|
void *
|
||||||
ruby_xrealloc(ptr, size)
|
ruby_xrealloc(ptr, size)
|
||||||
void *ptr;
|
void *ptr;
|
||||||
size_t size;
|
long size;
|
||||||
{
|
{
|
||||||
void *mem;
|
void *mem;
|
||||||
|
|
||||||
|
@ -1240,9 +1240,11 @@ rb_gc_call_finalizer_at_exit()
|
||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
if (BUILTIN_TYPE(p) == T_DATA &&
|
if (BUILTIN_TYPE(p) == T_DATA &&
|
||||||
DATA_PTR(p) && RANY(p)->as.data.dfree) {
|
DATA_PTR(p) && RANY(p)->as.data.dfree) {
|
||||||
|
p->as.free.flag = 0;
|
||||||
(*RANY(p)->as.data.dfree)(DATA_PTR(p));
|
(*RANY(p)->as.data.dfree)(DATA_PTR(p));
|
||||||
}
|
}
|
||||||
else if (BUILTIN_TYPE(p) == T_FILE) {
|
else if (BUILTIN_TYPE(p) == T_FILE) {
|
||||||
|
p->as.free.flag = 0;
|
||||||
rb_io_fptr_finalize(RANY(p)->as.file.fptr);
|
rb_io_fptr_finalize(RANY(p)->as.file.fptr);
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
|
@ -1310,14 +1312,14 @@ Init_GC()
|
||||||
|
|
||||||
void*
|
void*
|
||||||
xmalloc(size)
|
xmalloc(size)
|
||||||
size_t size;
|
long size;
|
||||||
{
|
{
|
||||||
return ruby_xmalloc(size);
|
return ruby_xmalloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
void*
|
||||||
xcalloc(n,size)
|
xcalloc(n,size)
|
||||||
size_t n,size;
|
long n,size;
|
||||||
{
|
{
|
||||||
return ruby_xcalloc(n, size);
|
return ruby_xcalloc(n, size);
|
||||||
}
|
}
|
||||||
|
@ -1325,7 +1327,7 @@ xcalloc(n,size)
|
||||||
void*
|
void*
|
||||||
xrealloc(ptr,size)
|
xrealloc(ptr,size)
|
||||||
void *ptr;
|
void *ptr;
|
||||||
size_t size;
|
long size;
|
||||||
{
|
{
|
||||||
return ruby_xrealloc(ptr, size);
|
return ruby_xrealloc(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
4
intern.h
4
intern.h
|
@ -140,8 +140,9 @@ VALUE rb_class_new_instance _((int, VALUE*, VALUE));
|
||||||
VALUE rb_f_lambda _((void));
|
VALUE rb_f_lambda _((void));
|
||||||
VALUE rb_protect _((VALUE (*)(), VALUE, int*));
|
VALUE rb_protect _((VALUE (*)(), VALUE, int*));
|
||||||
void rb_set_end_proc _((void (*)(), VALUE));
|
void rb_set_end_proc _((void (*)(), VALUE));
|
||||||
void rb_exec_end_proc _((void));
|
|
||||||
void rb_mark_end_proc _((void));
|
void rb_mark_end_proc _((void));
|
||||||
|
void ruby_finalize _((void));
|
||||||
|
void ruby_stop _((int));
|
||||||
void rb_gc_mark_threads _((void));
|
void rb_gc_mark_threads _((void));
|
||||||
void rb_thread_start_timer _((void));
|
void rb_thread_start_timer _((void));
|
||||||
void rb_thread_stop_timer _((void));
|
void rb_thread_stop_timer _((void));
|
||||||
|
@ -167,6 +168,7 @@ VALUE rb_thread_current _((void));
|
||||||
VALUE rb_thread_main _((void));
|
VALUE rb_thread_main _((void));
|
||||||
VALUE rb_thread_local_aref _((VALUE, ID));
|
VALUE rb_thread_local_aref _((VALUE, ID));
|
||||||
VALUE rb_thread_local_aset _((VALUE, ID, VALUE));
|
VALUE rb_thread_local_aset _((VALUE, ID, VALUE));
|
||||||
|
void rb_thread_atfork _((void));
|
||||||
/* file.c */
|
/* file.c */
|
||||||
int eaccess _((const char*, int));
|
int eaccess _((const char*, int));
|
||||||
VALUE rb_file_s_expand_path _((int, VALUE *));
|
VALUE rb_file_s_expand_path _((int, VALUE *));
|
||||||
|
|
50
io.c
50
io.c
|
@ -2763,6 +2763,32 @@ rb_f_select(argc, argv, obj)
|
||||||
return res; /* returns an empty array on interrupt */
|
return res; /* returns an empty array on interrupt */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
io_cntl(fd,cmd,narg,io_p)
|
||||||
|
int fd, cmd, io_p;
|
||||||
|
long narg;
|
||||||
|
{
|
||||||
|
int retval;
|
||||||
|
|
||||||
|
#ifdef HAVE_FCNTL
|
||||||
|
TRAP_BEG;
|
||||||
|
# if defined(__CYGWIN__)
|
||||||
|
retval = io_p?ioctl(fd, cmd, (void*)narg):fcntl(fd, cmd, narg);
|
||||||
|
# else
|
||||||
|
retval = io_p?ioctl(fd, cmd, narg):fcntl(fd, cmd, narg);
|
||||||
|
# endif
|
||||||
|
TRAP_END;
|
||||||
|
#else
|
||||||
|
if (!io_p) {
|
||||||
|
rb_notimplement();
|
||||||
|
}
|
||||||
|
TRAP_BEG;
|
||||||
|
retval = ioctl(fd, cmd, narg);
|
||||||
|
TRAP_END;
|
||||||
|
#endif
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_io_ctl(io, req, arg, io_p)
|
rb_io_ctl(io, req, arg, io_p)
|
||||||
VALUE io, req, arg;
|
VALUE io, req, arg;
|
||||||
|
@ -2772,7 +2798,6 @@ rb_io_ctl(io, req, arg, io_p)
|
||||||
int cmd = NUM2ULONG(req);
|
int cmd = NUM2ULONG(req);
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int fd;
|
|
||||||
long narg = 0;
|
long narg = 0;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
@ -2812,27 +2837,16 @@ rb_io_ctl(io, req, arg, io_p)
|
||||||
RSTRING(arg)->ptr[len] = 17; /* a little sanity check here */
|
RSTRING(arg)->ptr[len] = 17; /* a little sanity check here */
|
||||||
narg = (long)RSTRING(arg)->ptr;
|
narg = (long)RSTRING(arg)->ptr;
|
||||||
}
|
}
|
||||||
fd = fileno(fptr->f);
|
retval = io_cntl(fileno(fptr->f), cmd, narg, io_p);
|
||||||
#ifdef HAVE_FCNTL
|
|
||||||
TRAP_BEG;
|
|
||||||
# if defined(__CYGWIN__)
|
|
||||||
retval = io_p?ioctl(fd, cmd, (void*)narg):fcntl(fd, cmd, narg);
|
|
||||||
# else
|
|
||||||
retval = io_p?ioctl(fd, cmd, narg):fcntl(fd, cmd, narg);
|
|
||||||
# endif
|
|
||||||
TRAP_END;
|
|
||||||
#else
|
|
||||||
if (!io_p) {
|
|
||||||
rb_notimplement();
|
|
||||||
}
|
|
||||||
TRAP_BEG;
|
|
||||||
retval = ioctl(fd, cmd, narg);
|
|
||||||
TRAP_END;
|
|
||||||
#endif
|
|
||||||
if (retval < 0) rb_sys_fail(fptr->path);
|
if (retval < 0) rb_sys_fail(fptr->path);
|
||||||
if (TYPE(arg) == T_STRING && RSTRING(arg)->ptr[len] != 17) {
|
if (TYPE(arg) == T_STRING && RSTRING(arg)->ptr[len] != 17) {
|
||||||
rb_raise(rb_eArgError, "return value overflowed string");
|
rb_raise(rb_eArgError, "return value overflowed string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fptr->f2) { /* call on f2 too; ignore result */
|
||||||
|
io_cntl(fileno(fptr->f2), cmd, narg, io_p);
|
||||||
|
}
|
||||||
|
|
||||||
return INT2NUM(retval);
|
return INT2NUM(retval);
|
||||||
#else
|
#else
|
||||||
rb_notimplement();
|
rb_notimplement();
|
||||||
|
|
|
@ -331,7 +331,7 @@ flodivmod(x, y, divp, modp)
|
||||||
{
|
{
|
||||||
double z;
|
double z;
|
||||||
|
|
||||||
modf(x/y, &);
|
modf(x/y, &z);
|
||||||
mod = x - z * x;
|
mod = x - z * x;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
1
parse.y
1
parse.y
|
@ -1956,7 +1956,6 @@ yycompile(f, line)
|
||||||
n = yyparse();
|
n = yyparse();
|
||||||
ruby_debug_lines = 0;
|
ruby_debug_lines = 0;
|
||||||
compile_for_eval = 0;
|
compile_for_eval = 0;
|
||||||
rb_gc();
|
|
||||||
ruby_in_compile = 0;
|
ruby_in_compile = 0;
|
||||||
cond_nest = 0;
|
cond_nest = 0;
|
||||||
cond_stack = 0;
|
cond_stack = 0;
|
||||||
|
|
31
process.c
31
process.c
|
@ -217,7 +217,10 @@ proc_waitpid(argc, argv)
|
||||||
|
|
||||||
if ((pid = rb_waitpid(NUM2INT(vpid), flags, &status)) < 0)
|
if ((pid = rb_waitpid(NUM2INT(vpid), flags, &status)) < 0)
|
||||||
rb_sys_fail(0);
|
rb_sys_fail(0);
|
||||||
if (pid == 0) return Qnil;
|
if (pid == 0) {
|
||||||
|
rb_last_status = Qnil;
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
return INT2FIX(pid);
|
return INT2FIX(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,6 +230,7 @@ proc_waitpid2(argc, argv)
|
||||||
VALUE *argv;
|
VALUE *argv;
|
||||||
{
|
{
|
||||||
VALUE pid = proc_waitpid(argc, argv);
|
VALUE pid = proc_waitpid(argc, argv);
|
||||||
|
if (NIL_P(pid)) return Qnil;
|
||||||
return rb_assoc_new(pid, rb_last_status);
|
return rb_assoc_new(pid, rb_last_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,6 +530,21 @@ rb_f_exec(argc, argv)
|
||||||
return Qnil; /* dummy */
|
return Qnil; /* dummy */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
fork_rescue(data, errinfo)
|
||||||
|
VALUE data, errinfo;
|
||||||
|
{
|
||||||
|
int status = 1;
|
||||||
|
|
||||||
|
if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
|
||||||
|
VALUE st = rb_iv_get(errinfo, "status");
|
||||||
|
|
||||||
|
status = NUM2INT(st);
|
||||||
|
}
|
||||||
|
ruby_finalize();
|
||||||
|
_exit(status);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_f_fork(obj)
|
rb_f_fork(obj)
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
|
@ -539,9 +558,17 @@ rb_f_fork(obj)
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
after_exec();
|
after_exec();
|
||||||
#endif
|
#endif
|
||||||
|
rb_thread_atfork();
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
rb_yield(Qnil);
|
#if 0
|
||||||
|
rb_rescue2(rb_yield, Qnil, fork_rescue, 0, rb_eException, 0);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
#else
|
||||||
|
int status;
|
||||||
|
|
||||||
|
rb_protect(rb_yield, Qnil, &status);
|
||||||
|
ruby_stop(status);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
||||||
|
|
29
range.c
29
range.c
|
@ -13,10 +13,10 @@
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
|
|
||||||
VALUE rb_cRange;
|
VALUE rb_cRange;
|
||||||
static ID id_cmp, id_beg, id_end;
|
static ID id_cmp, id_beg, id_end, id_excl;
|
||||||
|
|
||||||
#define EXCL(r) FL_TEST((r), FL_USER1)
|
#define EXCL(r) RTEST(rb_ivar_get((r), id_excl))
|
||||||
#define SET_EXCL(r) FL_SET((r), FL_USER1)
|
#define SET_EXCL(r,v) rb_ivar_set((r), id_excl, (v)?Qtrue:Qfalse)
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
range_check(args)
|
range_check(args)
|
||||||
|
@ -46,10 +46,7 @@ range_init(obj, beg, end, exclude_end)
|
||||||
rb_eStandardError, rb_eNameError, 0);
|
rb_eStandardError, rb_eNameError, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exclude_end) {
|
SET_EXCL(obj, exclude_end);
|
||||||
SET_EXCL(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
rb_ivar_set(obj, id_beg, beg);
|
rb_ivar_set(obj, id_beg, beg);
|
||||||
rb_ivar_set(obj, id_end, end);
|
rb_ivar_set(obj, id_end, end);
|
||||||
}
|
}
|
||||||
|
@ -89,6 +86,22 @@ range_exclude_end_p(range)
|
||||||
return EXCL(range)?Qtrue:Qfalse;
|
return EXCL(range)?Qtrue:Qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
range_eq(range, obj)
|
||||||
|
VALUE range, obj;
|
||||||
|
{
|
||||||
|
if (!rb_obj_is_kind_of(obj, rb_cRange)) return Qfalse;
|
||||||
|
|
||||||
|
if (!rb_equal(rb_ivar_get(range, id_beg), rb_ivar_get(obj, id_beg)))
|
||||||
|
return Qfalse;
|
||||||
|
if (!rb_equal(rb_ivar_get(range, id_end), rb_ivar_get(obj, id_end)))
|
||||||
|
return Qfalse;
|
||||||
|
|
||||||
|
if (EXCL(range) != EXCL(obj)) return Qfalse;
|
||||||
|
|
||||||
|
return Qtrue;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
range_eqq(range, obj)
|
range_eqq(range, obj)
|
||||||
VALUE range, obj;
|
VALUE range, obj;
|
||||||
|
@ -338,6 +351,7 @@ Init_Range()
|
||||||
rb_cRange = rb_define_class("Range", rb_cObject);
|
rb_cRange = rb_define_class("Range", rb_cObject);
|
||||||
rb_include_module(rb_cRange, rb_mEnumerable);
|
rb_include_module(rb_cRange, rb_mEnumerable);
|
||||||
rb_define_method(rb_cRange, "initialize", range_initialize, -1);
|
rb_define_method(rb_cRange, "initialize", range_initialize, -1);
|
||||||
|
rb_define_method(rb_cRange, "==", range_eq, 1);
|
||||||
rb_define_method(rb_cRange, "===", range_eqq, 1);
|
rb_define_method(rb_cRange, "===", range_eqq, 1);
|
||||||
rb_define_method(rb_cRange, "each", range_each, 0);
|
rb_define_method(rb_cRange, "each", range_each, 0);
|
||||||
rb_define_method(rb_cRange, "first", range_first, 0);
|
rb_define_method(rb_cRange, "first", range_first, 0);
|
||||||
|
@ -355,4 +369,5 @@ Init_Range()
|
||||||
id_cmp = rb_intern("<=>");
|
id_cmp = rb_intern("<=>");
|
||||||
id_beg = rb_intern("begin");
|
id_beg = rb_intern("begin");
|
||||||
id_end = rb_intern("end");
|
id_end = rb_intern("end");
|
||||||
|
id_excl = rb_intern("excl");
|
||||||
}
|
}
|
||||||
|
|
6
ruby.h
6
ruby.h
|
@ -380,9 +380,9 @@ struct RBignum {
|
||||||
#define xrealloc ruby_xrealloc
|
#define xrealloc ruby_xrealloc
|
||||||
#define xfree ruby_xfree
|
#define xfree ruby_xfree
|
||||||
|
|
||||||
void *xmalloc _((size_t));
|
void *xmalloc _((long));
|
||||||
void *xcalloc _((size_t,size_t));
|
void *xcalloc _((long,long));
|
||||||
void *xrealloc _((void*,size_t));
|
void *xrealloc _((void*,long));
|
||||||
void xfree _((void*));
|
void xfree _((void*));
|
||||||
|
|
||||||
#define ALLOC_N(type,n) (type*)xmalloc(sizeof(type)*(n))
|
#define ALLOC_N(type,n) (type*)xmalloc(sizeof(type)*(n))
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
|
|
||||||
(display (fib 20))
|
(display (fib 20))
|
||||||
(newline)
|
(newline)
|
||||||
|
(quit)
|
||||||
|
|
5
signal.c
5
signal.c
|
@ -391,7 +391,10 @@ rb_trap_exit()
|
||||||
{
|
{
|
||||||
#ifndef MACOS_UNUSE_SIGNAL
|
#ifndef MACOS_UNUSE_SIGNAL
|
||||||
if (trap_list[0]) {
|
if (trap_list[0]) {
|
||||||
rb_eval_cmd(trap_list[0], rb_ary_new3(1, INT2FIX(0)));
|
VALUE trap_exit = trap_list[0];
|
||||||
|
|
||||||
|
trap_list[0] = 0;
|
||||||
|
rb_eval_cmd(trap_exit, rb_ary_new3(1, INT2FIX(0)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1480,6 +1480,10 @@ rb_mod_class_variables(obj)
|
||||||
if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)
|
if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)
|
||||||
rb_raise(rb_eSecurityError, "Insecure: can't get metainfo");
|
rb_raise(rb_eSecurityError, "Insecure: can't get metainfo");
|
||||||
|
|
||||||
|
if (FL_TEST(obj, FL_SINGLETON)) {
|
||||||
|
obj = rb_cvar_singleton(rb_iv_get(obj, "__attached__"));
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (RCLASS(obj)->iv_tbl) {
|
if (RCLASS(obj)->iv_tbl) {
|
||||||
st_foreach(RCLASS(obj)->iv_tbl, cv_i, ary);
|
st_foreach(RCLASS(obj)->iv_tbl, cv_i, ary);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.6.2"
|
#define RUBY_VERSION "1.6.2"
|
||||||
#define RUBY_RELEASE_DATE "2000-11-21"
|
#define RUBY_RELEASE_DATE "2000-11-27"
|
||||||
#define RUBY_VERSION_CODE 162
|
#define RUBY_VERSION_CODE 162
|
||||||
#define RUBY_RELEASE_CODE 20001121
|
#define RUBY_RELEASE_CODE 20001127
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue