Permalink
Browse files

* ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)

  before detach pid. [ruby-talk:71519]

* eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677],
  [ruby-dev:20202]

* eval.c (BEGIN_CALLARGS): restore outer block by using
  ruby_block->outer.

* eval.c (block_pass): do not alter block->prev, but block->outer.

* array.c (get_inspect_tbl): warning on wrong condition.

* eval.c (localjump_xvalue): renamed exitstatus to exit_value
  since it's not exit "status" after all.

* eval.c (localjump_error): add reason to LocalJumpError.

* compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value
  is nil. now take new 2 arguments.

* time.c (time_cmp): 2003-05-16 fix was incomplete.
  (ruby-bugs-ja:PR#458)


git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 8f0b6b7 commit 293fdb45e57673f78af3c381d9f4d35e305e8440 matz committed May 19, 2003
Showing with 149 additions and 68 deletions.
  1. +31 −0 ChangeLog
  2. +8 −6 array.c
  3. +11 −8 compar.c
  4. +15 −10 enum.c
  5. +45 −17 eval.c
  6. +2 −1 ext/pty/pty.c
  7. +1 −1 intern.h
  8. +3 −3 range.c
  9. +27 −0 sample/test.rb
  10. +6 −22 time.c
View
@@ -1,3 +1,20 @@
+Tue May 20 00:09:41 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)
+ before detach pid. [ruby-talk:71519]
+
+Mon May 19 23:02:10 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677],
+ [ruby-dev:20202]
+
+ * eval.c (BEGIN_CALLARGS): restore outer block by using
+ ruby_block->outer.
+
+ * eval.c (block_pass): do not alter block->prev, but block->outer.
+
+ * array.c (get_inspect_tbl): warning on wrong condition.
+
Mon May 19 16:13:57 2003 Minero Aoki <aamine@loveruby.net>
* class.c: add #include "version.h".
@@ -6,6 +23,19 @@ Mon May 19 16:13:57 2003 Minero Aoki <aamine@loveruby.net>
* string.c: ditto.
+Mon May 19 15:33:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (localjump_xvalue): renamed exitstatus to exit_value
+ since it's not exit "status" after all.
+
+ * eval.c (localjump_error): add reason to LocalJumpError.
+
+ * compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value
+ is nil. now take new 2 arguments.
+
+ * time.c (time_cmp): 2003-05-16 fix was incomplete.
+ (ruby-bugs-ja:PR#458)
+
Mon May 19 14:42:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (rb_mod_cmp): stupid comparison fixed.
@@ -76,6 +106,7 @@ Fri May 16 23:55:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Fri May 16 12:40:40 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (block_pass): chain previous block to the pushing block.
+ [ruby-list:37677]
* time.c (time_cmp): does not compare with numbers for
interchangeability. (ruby-bugs-ja:PR#458)
View
@@ -935,10 +935,12 @@ get_inspect_tbl(create)
{
VALUE inspect_tbl = rb_thread_local_aref(rb_thread_current(), inspect_key);
- if (create && NIL_P(inspect_tbl)) {
- tbl_init:
- inspect_tbl = rb_ary_new();
- rb_thread_local_aset(rb_thread_current(), inspect_key, inspect_tbl);
+ if (NIL_P(inspect_tbl)) {
+ if (create) {
+ tbl_init:
+ inspect_tbl = rb_ary_new();
+ rb_thread_local_aset(rb_thread_current(), inspect_key, inspect_tbl);
+ }
}
else if (TYPE(inspect_tbl) != T_ARRAY) {
rb_warn("invalid inspect_tbl value");
@@ -1084,7 +1086,7 @@ sort_1(a, b)
VALUE *a, *b;
{
VALUE retval = rb_yield(rb_assoc_new(*a, *b));
- return rb_cmpint(retval);
+ return rb_cmpint(retval, *a, *b);
}
static int
@@ -1104,7 +1106,7 @@ sort_2(ap, bp)
}
retval = rb_funcall(a, id_cmp, 1, b);
- return rb_cmpint(retval);
+ return rb_cmpint(retval, a, b);
}
static VALUE
View
@@ -17,9 +17,12 @@ VALUE rb_mComparable;
static ID cmp;
int
-rb_cmpint(val)
- VALUE val;
+rb_cmpint(val, a, b)
+ VALUE val, a, b;
{
+ if (NIL_P(val)) {
+ rb_cmperr(a, b);
+ }
if (FIXNUM_P(val)) return FIX2INT(val);
if (TYPE(val) == T_BIGNUM) {
if (RBIGNUM(val)->sign) return 1;
@@ -43,7 +46,7 @@ rb_cmperr(x, y)
else {
classname = rb_obj_classname(y);
}
- rb_raise(rb_eArgError, "comparison of %s to %s failed",
+ rb_raise(rb_eArgError, "comparison of %s with %s failed",
rb_obj_classname(x), classname);
}
@@ -60,7 +63,7 @@ cmp_equal(x, y)
c = rb_funcall(x, cmp, 1, y);
if (NIL_P(c)) return Qnil;
if (c == INT2FIX(0)) return Qtrue;
- if (rb_cmpint(c) == 0) return Qtrue;
+ if (rb_cmpint(c, x, y) == 0) return Qtrue;
return Qfalse;
}
@@ -71,7 +74,7 @@ cmp_gt(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
if (NIL_P(c)) return cmperr();
- if (rb_cmpint(c) > 0) return Qtrue;
+ if (rb_cmpint(c, x, y) > 0) return Qtrue;
return Qfalse;
}
@@ -82,7 +85,7 @@ cmp_ge(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
if (NIL_P(c)) return cmperr();
- if (rb_cmpint(c) >= 0) return Qtrue;
+ if (rb_cmpint(c, x, y) >= 0) return Qtrue;
return Qfalse;
}
@@ -93,7 +96,7 @@ cmp_lt(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
if (NIL_P(c)) return cmperr();
- if (rb_cmpint(c) < 0) return Qtrue;
+ if (rb_cmpint(c, x, y) < 0) return Qtrue;
return Qfalse;
}
@@ -104,7 +107,7 @@ cmp_le(x, y)
VALUE c = rb_funcall(x, cmp, 1, y);
if (NIL_P(c)) return cmperr();
- if (rb_cmpint(c) <= 0) return Qtrue;
+ if (rb_cmpint(c, x, y) <= 0) return Qtrue;
return Qfalse;
}
View
@@ -156,23 +156,23 @@ collect_all(i, ary)
}
static VALUE
-enum_to_a(obj)
+enum_collect(obj)
VALUE obj;
{
VALUE ary = rb_ary_new();
- rb_iterate(rb_each, obj, collect_all, ary);
+ rb_iterate(rb_each, obj, rb_block_given_p() ? collect_i : collect_all, ary);
return ary;
}
static VALUE
-enum_collect(obj)
+enum_to_a(obj)
VALUE obj;
{
VALUE ary = rb_ary_new();
- rb_iterate(rb_each, obj, rb_block_given_p() ? collect_i : collect_all, ary);
+ rb_iterate(rb_each, obj, collect_all, ary);
return ary;
}
@@ -264,7 +264,7 @@ sort_by_cmp(a, b)
VALUE retval;
retval = rb_funcall(RARRAY(*a)->ptr[0], id_cmp, 1, RARRAY(*b)->ptr[0]);
- return rb_cmpint(retval);
+ return rb_cmpint(retval, *a, *b);
}
static VALUE
@@ -274,7 +274,12 @@ enum_sort_by(obj)
VALUE ary;
long i;
- ary = rb_ary_new2((TYPE(obj) == T_ARRAY) ? RARRAY(obj)->len : 2000);
+ if (TYPE(obj) == T_ARRAY) {
+ ary = rb_ary_new2(RARRAY(obj)->len);
+ }
+ else {
+ ary = rb_ary_new();
+ }
rb_iterate(rb_each, obj, sort_by_i, ary);
if (RARRAY(ary)->len > 1) {
qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE), sort_by_cmp);
@@ -374,7 +379,7 @@ min_i(i, memo)
}
else {
cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
- if (rb_cmpint(cmp) < 0) {
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
memo->u1.value = i;
}
}
@@ -393,7 +398,7 @@ min_ii(i, memo)
}
else {
cmp = rb_yield(rb_assoc_new(i, memo->u1.value));
- if (rb_cmpint(cmp) < 0) {
+ if (rb_cmpint(cmp, i, memo->u1.value) < 0) {
memo->u1.value = i;
}
}
@@ -425,7 +430,7 @@ max_i(i, memo)
}
else {
cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
- if (rb_cmpint(cmp) > 0) {
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
memo->u1.value = i;
}
}
@@ -444,7 +449,7 @@ max_ii(i, memo)
}
else {
cmp = rb_yield(rb_assoc_new(i, memo->u1.value));
- if (rb_cmpint(cmp) > 0) {
+ if (rb_cmpint(cmp, i, memo->u1.value) > 0) {
memo->u1.value = i;
}
}
Oops, something went wrong.

0 comments on commit 293fdb4

Please sign in to comment.