mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* commit miss; and tcltklib fix too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8c0cbb7350
commit
ab6b478615
8 changed files with 59 additions and 24 deletions
|
@ -264,7 +264,7 @@ module TkComm
|
|||
end
|
||||
def uninstall_cmd(id)
|
||||
id = $1 if /rb_out (c\d+)/ =~ id
|
||||
Tk_CMDTBL[id] = nil
|
||||
Tk_CMDTBL.delete(id)
|
||||
end
|
||||
private :install_cmd, :uninstall_cmd
|
||||
|
||||
|
@ -282,7 +282,7 @@ module TkComm
|
|||
end
|
||||
|
||||
def uninstall_win()
|
||||
Tk_WINDOWS[@path] = nil
|
||||
Tk_WINDOWS.delete(@path)
|
||||
end
|
||||
|
||||
class Event
|
||||
|
@ -2188,7 +2188,7 @@ module TkOption
|
|||
METHOD_TBL = {}
|
||||
ADD_METHOD = #{add}
|
||||
SAFE_MODE = #{safe}
|
||||
%w(#{func_str}).each{|f| METHOD_TBL[f.intern] = nil }
|
||||
%w(#{func_str}).each{|f| METHOD_TBL.delete(f.intern) }
|
||||
end
|
||||
EOD
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class TkAfter
|
|||
|
||||
def set_next_callback(args)
|
||||
if @running == false || @proc_max == 0 || @do_loop == 0
|
||||
Tk_CBTBL[@id] = nil ;# for GC
|
||||
Tk_CBTBL.delete(@id) ;# for GC
|
||||
@running = false
|
||||
return
|
||||
end
|
||||
|
@ -72,7 +72,7 @@ class TkAfter
|
|||
if @do_loop < 0 || (@do_loop -= 1) > 0
|
||||
@current_pos = 0
|
||||
else
|
||||
Tk_CBTBL[@id] = nil ;# for GC
|
||||
Tk_CBTBL.delete(@id) ;# for GC
|
||||
@running = false
|
||||
return
|
||||
end
|
||||
|
@ -272,7 +272,7 @@ class TkAfter
|
|||
@running = false
|
||||
tk_call 'after', 'cancel', @after_id if @after_id
|
||||
@after_id = nil
|
||||
Tk_CBTBL[@id] = nil ;# for GC
|
||||
Tk_CBTBL.delete(@id) ;# for GC
|
||||
self
|
||||
end
|
||||
alias stop cancel
|
||||
|
|
|
@ -504,7 +504,7 @@ class TkcTag<TkObject
|
|||
|
||||
def delete
|
||||
@c.delete @id
|
||||
CTagID_TBL[@cpath][@id] = nil if CTagID_TBL[@cpath]
|
||||
CTagID_TBL[@cpath].delete(@id) if CTagID_TBL[@cpath]
|
||||
end
|
||||
alias remove delete
|
||||
alias destroy delete
|
||||
|
@ -688,7 +688,7 @@ class TkcItem<TkObject
|
|||
|
||||
def delete
|
||||
@c.delete @id
|
||||
CItemID_TBL[@path][@id] = nil if CItemID_TBL[@path]
|
||||
CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
|
||||
end
|
||||
alias remove delete
|
||||
alias destroy delete
|
||||
|
@ -763,7 +763,7 @@ class TkImage<TkObject
|
|||
end
|
||||
|
||||
def delete
|
||||
Tk_IMGTBL[@id] = nil if @id
|
||||
Tk_IMGTBL.delete(@id) if @id
|
||||
tk_call('image', 'delete', @path)
|
||||
end
|
||||
def height
|
||||
|
|
|
@ -564,7 +564,7 @@ class TkFont
|
|||
end
|
||||
|
||||
def delete_core_tk4x
|
||||
Tk_FontNameTBL[@id] = nil
|
||||
Tk_FontNameTBL.delete(@id)
|
||||
Tk_FontUseTBL.delete_if{|key,value| value == self}
|
||||
end
|
||||
|
||||
|
@ -581,7 +581,7 @@ class TkFont
|
|||
tk_call('font', 'delete', @compoundfont)
|
||||
rescue
|
||||
end
|
||||
Tk_FontNameTBL[@id] = nil
|
||||
Tk_FontNameTBL.delete(@id)
|
||||
Tk_FontUseTBL.delete_if{|key,value| value == self}
|
||||
end
|
||||
|
||||
|
@ -610,7 +610,7 @@ class TkFont
|
|||
tk_call(w, 'configure', '-font', @latinfont)
|
||||
end
|
||||
rescue
|
||||
Tk_FontUseTBL[w] = nil
|
||||
Tk_FontUseTBL.delete(w)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ class TkFont
|
|||
tk_call(w, 'configure', '-kanjifont', @kanjifont)
|
||||
end
|
||||
rescue
|
||||
Tk_FontUseTBL[w] = nil
|
||||
Tk_FontUseTBL.delete(w)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
|
|
@ -685,7 +685,7 @@ class TkTextTag<TkObject
|
|||
|
||||
def destroy
|
||||
tk_call @t.path, 'tag', 'delete', @id
|
||||
TTagID_TBL[@tpath][@id] = nil if CTagID_TBL[@tpath]
|
||||
TTagID_TBL[@tpath].delete(@id) if CTagID_TBL[@tpath]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ class TkVirtualEvent<TkObject
|
|||
def delete(*sequences)
|
||||
if sequences == []
|
||||
tk_call('event', 'delete', "<#{@id}>")
|
||||
TkVirtualEventTBL[@id] = nil
|
||||
TkVirtualEventTBL.delete(@id)
|
||||
else
|
||||
tk_call('event', 'delete', "<#{@id}>",
|
||||
*(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>"}) )
|
||||
TkVirtualEventTBL[@id] = nil if info == []
|
||||
TkVirtualEventTBL.delete(@id) if info == []
|
||||
end
|
||||
self
|
||||
end
|
||||
|
|
41
gc.c
41
gc.c
|
@ -848,12 +848,12 @@ gc_sweep()
|
|||
{
|
||||
RVALUE *p, *pend, *final_list;
|
||||
int freed = 0;
|
||||
int i, used = heaps_used;
|
||||
int i, j;
|
||||
|
||||
if (ruby_in_compile && ruby_parser_stack_on_heap()) {
|
||||
/* should not reclaim nodes during compilation
|
||||
if yacc's semantic stack is not allocated on machine stack */
|
||||
for (i = 0; i < used; i++) {
|
||||
for (i = 0; i < heaps_used; i++) {
|
||||
p = heaps[i]; pend = p + heaps_limits[i];
|
||||
while (p < pend) {
|
||||
if (!(p->as.basic.flags&FL_MARK) && BUILTIN_TYPE(p) == T_NODE)
|
||||
|
@ -869,8 +869,10 @@ gc_sweep()
|
|||
freelist = 0;
|
||||
final_list = deferred_final_list;
|
||||
deferred_final_list = 0;
|
||||
for (i = 0; i < used; i++) {
|
||||
for (i = 0; i < heaps_used; i++) {
|
||||
int n = 0;
|
||||
RVALUE *free = freelist;
|
||||
RVALUE *final = final_list;
|
||||
|
||||
p = heaps[i]; pend = p + heaps_limits[i];
|
||||
while (p < pend) {
|
||||
|
@ -899,7 +901,18 @@ gc_sweep()
|
|||
}
|
||||
p++;
|
||||
}
|
||||
freed += n;
|
||||
if (n == heaps_limits[i] && freed + n > FREE_MIN) {
|
||||
RVALUE *pp;
|
||||
|
||||
heaps_limits[i] = 0;
|
||||
for (pp = final_list; pp != final; pp = pp->as.free.next) {
|
||||
p->as.free.flags |= FL_SINGLETON; /* freeing page mark */
|
||||
}
|
||||
freelist = free; /* cancel this page from freelist */
|
||||
}
|
||||
else {
|
||||
freed += n;
|
||||
}
|
||||
}
|
||||
if (freed < FREE_MIN) {
|
||||
add_heap();
|
||||
|
@ -918,9 +931,23 @@ gc_sweep()
|
|||
for (p = final_list; p; p = tmp) {
|
||||
tmp = p->as.free.next;
|
||||
run_final((VALUE)p);
|
||||
p->as.free.flags = 0;
|
||||
p->as.free.next = freelist;
|
||||
freelist = p;
|
||||
if (!FL_TEST(p, FL_SINGLETON)) { /* not freeing page */
|
||||
p->as.free.flags = 0;
|
||||
p->as.free.next = freelist;
|
||||
freelist = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = j = 0; j < heaps_used; i++) {
|
||||
if (heaps_limits[i] == 0) {
|
||||
free(heaps[i]);
|
||||
heaps_used--;
|
||||
}
|
||||
else {
|
||||
if (i != j) {
|
||||
heaps[j] = heaps[i];
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
10
object.c
10
object.c
|
@ -83,6 +83,14 @@ rb_class_real(cl)
|
|||
return cl;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_obj_type(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
rb_warn("`type' is deprecated; use `class'");
|
||||
return rb_class_real(CLASS_OF(obj));
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_obj_class(obj)
|
||||
VALUE obj;
|
||||
|
@ -1292,7 +1300,7 @@ Init_Object()
|
|||
rb_define_method(rb_mKernel, "hash", rb_obj_id, 0);
|
||||
rb_define_method(rb_mKernel, "id", rb_obj_id, 0);
|
||||
rb_define_method(rb_mKernel, "__id__", rb_obj_id, 0);
|
||||
rb_define_method(rb_mKernel, "type", rb_obj_class, 0);
|
||||
rb_define_method(rb_mKernel, "type", rb_obj_type, 0);
|
||||
rb_define_method(rb_mKernel, "class", rb_obj_class, 0);
|
||||
|
||||
rb_define_method(rb_mKernel, "clone", rb_obj_clone, 0);
|
||||
|
|
Loading…
Reference in a new issue