diff --git a/ChangeLog b/ChangeLog index 9a9641e0b8..b2d381a34c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +Tue May 6 14:39:36 2003 Yukihiro Matsumoto + + * object.c (rb_obj_methods): list singleton methods if recur + argument is false; list all methods otherwise. + + * numeric.c (num_step): double epsilon to make "1.1.step(1.5,0.1)" + to work. + +Mon May 5 21:19:25 2003 Koji Arai + + * ext/gdbm/gdbm.c (fgdbm_values_at): new method to replace + select(index..). + + * ext/sdbm/init.c (fsdbm_values_at): ditto. + + * ext/dbm/dbm.c (fdbm_values_at): ditto. + + * ext/dbm/dbm.c (DBM::VERSION): defined. + + * ext/gdbm/testgdbm.rb: replace select with values_at. + + * ext/sdbm/testsdbm.rb: ditto. + + * ext/dbm/testdbm.rb: ditto. + + * ext/dbm/testdbm.rb (setup): DBM.open(path, 0400) cause EACCESS + on Berkeley DB[234]. + Mon May 5 22:57:07 2003 Tadayoshi Funaba * sample/cal.rb: use values_at instead of select. @@ -48,8 +76,6 @@ Sat May 3 11:00:12 2003 Yukihiro Matsumoto warnings to show migration path. The default will be reversed on Jan 2004. - * numeric.c (num_step): "1.1.step(1.5,0.1)" to work. - Sat May 3 00:58:53 2003 Yukihiro Matsumoto * object.c (rb_obj_methods): now accepts recurse parameter. diff --git a/class.c b/class.c index c0d7c1ed5f..4b93841d9f 100644 --- a/class.c +++ b/class.c @@ -589,7 +589,6 @@ rb_class_protected_instance_methods(argc, argv, mod) recur = Qtrue; #endif } - if (argc == 0) recur = Qtrue; return method_list(mod, RTEST(recur), ins_methods_prot_i); } @@ -609,7 +608,6 @@ rb_class_private_instance_methods(argc, argv, mod) recur = Qtrue; #endif } - if (argc == 0) recur = Qtrue; return method_list(mod, RTEST(recur), ins_methods_priv_i); } @@ -624,14 +622,11 @@ rb_class_public_instance_methods(argc, argv, mod) rb_scan_args(argc, argv, "01", &recur); if (argc == 0) { #if RUBY_RELEASE_CODE < 20040101 - rb_warn("instance_methods parameter will default to 'true' in Jan 2004"); + rb_warn("public_instance_methods parameter will default to 'true' in Jan 2004"); #else recur = Qtrue; #endif - rb_warn("public_instance_methods parameter will default to 'true' in Jan 2004"); - /* recur = Qtrue; */ } - if (argc == 0) recur = Qtrue; return method_list(mod, RTEST(recur), ins_methods_pub_i); } @@ -641,10 +636,10 @@ rb_obj_singleton_methods(argc, argv, obj) VALUE *argv; VALUE obj; { - VALUE all, ary, klass; + VALUE recur, ary, klass; st_table *list; - rb_scan_args(argc, argv, "01", &all); + rb_scan_args(argc, argv, "01", &recur); if (argc == 0) { #if RUBY_RELEASE_CODE < 20040101 rb_warn("singleton_methods parameter will default to 'true' in Jan 2004"); @@ -658,7 +653,7 @@ rb_obj_singleton_methods(argc, argv, obj) st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list); klass = RCLASS(klass)->super; } - if (RTEST(all)) { + if (RTEST(recur)) { while (klass && TYPE(klass) == T_ICLASS) { st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list); klass = RCLASS(klass)->super; diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c index 6eb7cfcd20..c422394405 100644 --- a/ext/dbm/dbm.c +++ b/ext/dbm/dbm.c @@ -254,6 +254,8 @@ fdbm_select(argc, argv, obj) } } else { + rb_warn("DBM#select(index..) is deprecated; use DBM#values_at"); + for (i=0; i 0) { rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc); } + result = rb_ary_new(); rb_hash_foreach(hash, select_i, result); return result; } diff --git a/numeric.c b/numeric.c index e0a6011d5b..b5d275f892 100644 --- a/numeric.c +++ b/numeric.c @@ -905,14 +905,14 @@ num_step(argc, argv, from) } } else if (TYPE(from) == T_FLOAT || TYPE(to) == T_FLOAT || TYPE(step) == T_FLOAT) { - const double epsilon = DBL_EPSILON; + const double epsilon = DBL_EPSILON * 2; double beg = NUM2DBL(from); double end = NUM2DBL(to); double unit = NUM2DBL(step); double n = (end - beg)/unit; long i; - n = floor(n + n*epsilon + 1); + n = floor(n + n*epsilon) + 1; for (i=0; i 0) { + rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc); + } else { struct re_registers *regs = RMATCH(match)->regs; VALUE target = RMATCH(match)->str; @@ -1000,7 +1003,7 @@ match_select(argc, argv, match) for (i=0; inum_regs; i++) { VALUE str = rb_str_substr(target, regs->beg[i], regs->end[i]-regs->beg[i]); if (taint) OBJ_TAINT(str); - if (rb_yield(str)) { + if (RTEST(rb_yield(str))) { rb_ary_push(result, str); } } diff --git a/struct.c b/struct.c index d3467bc67b..128ac27ab2 100644 --- a/struct.c +++ b/struct.c @@ -541,6 +541,8 @@ rb_struct_values_at(argc, argv, s) for (i=0; i