diff --git a/ChangeLog b/ChangeLog index c6518a7741..69326a226f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Wed Aug 29 02:18:53 2001 Yukihiro Matsumoto + + * parse.y (yylex): ternary ? can be followed by newline. + +Tue Aug 28 00:40:48 2001 Yukihiro Matsumoto + + * eval.c (rb_f_require): should check static linked libraries + before raising exception. + +Fri Aug 24 15:17:40 2001 Yukihiro Matsumoto + + * array.c (rb_ary_equal): check identiry equality first. + + * string.c (rb_str_equal): ditto. + + * struct.c (rb_struct_equal): ditto. + Fri Aug 24 14:38:17 2001 Usaku Nakamura * dln.c (dln_strerror): fix a bug that sometimes made null message on @@ -5,6 +22,18 @@ Fri Aug 24 14:38:17 2001 Usaku Nakamura * win32/win32.c (mystrerror): ditto. +Fri Aug 24 03:15:07 2001 Yukihiro Matsumoto + + * numeric.c (Init_Numeric): undef Integer::new. + +Fri Aug 24 00:46:44 2001 Yukihiro Matsumoto + + * eval.c (rb_eval): NODE_WHILE should update result for each + conditional evaluation. + + * eval.c (rb_eval): NODE_UNTIL should return last evaluated value + (or value given to break). + Thu Aug 23 21:59:38 2001 Nobuyoshi Nakada * enum.c (sort_by_i): fix typo. diff --git a/array.c b/array.c index 66f61fcb1d..6e085ae923 100644 --- a/array.c +++ b/array.c @@ -1388,6 +1388,7 @@ rb_ary_equal(ary1, ary2) { long i; + if (ary1 == ary2) return Qtrue; if (TYPE(ary2) != T_ARRAY) return Qfalse; if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse; for (i=0; ilen; i++) { diff --git a/bignum.c b/bignum.c index 489514451a..57a6958047 100644 --- a/bignum.c +++ b/bignum.c @@ -1420,8 +1420,6 @@ Init_Bignum() { rb_cBignum = rb_define_class("Bignum", rb_cInteger); - rb_undef_method(CLASS_OF(rb_cBignum), "new"); - rb_define_method(rb_cBignum, "to_s", rb_big_to_s, 0); rb_define_method(rb_cBignum, "coerce", rb_big_coerce, 1); rb_define_method(rb_cBignum, "-@", rb_big_uminus, 0); diff --git a/doc/NEWS b/doc/NEWS index 18c532a1e0..113e4545e1 100644 --- a/doc/NEWS +++ b/doc/NEWS @@ -1,3 +1,11 @@ +: Enum#sort_by + + Added. + +: Signal + + new module, has module functions Signal::trap and Signal::list. + : Curses Updated. New methods and constants for using the mouse, character diff --git a/eval.c b/eval.c index f88510e15c..0ca486c207 100644 --- a/eval.c +++ b/eval.c @@ -2280,7 +2280,7 @@ rb_eval(self, n) rb_eval(self, node->nd_body); while_next: ; - } while (RTEST(rb_eval(self, node->nd_cond))); + } while (RTEST(result = rb_eval(self, node->nd_cond))); break; case TAG_REDO: @@ -2311,7 +2311,7 @@ rb_eval(self, n) rb_eval(self, node->nd_body); until_next: ; - } while (!RTEST(rb_eval(self, node->nd_cond))); + } while (!RTEST(result = rb_eval(self, node->nd_cond))); break; case TAG_REDO: @@ -2329,7 +2329,7 @@ rb_eval(self, n) until_out: POP_TAG(); if (state) JUMP_TAG(state); - RETURN(Qnil); + RETURN(result); case NODE_BLOCK_PASS: result = block_pass(self, node); @@ -3976,7 +3976,7 @@ handle_rescue(self, node) if (!rb_obj_is_kind_of(argv[0], rb_cModule)) { rb_raise(rb_eTypeError, "class or module required for rescue clause"); } - if (rb_funcall(*argv, eqq, 1, ruby_errinfo)) return 1; + if (RTEST(rb_funcall(*argv, eqq, 1, ruby_errinfo))) return 1; argv++; } return 0; @@ -5494,6 +5494,8 @@ rb_f_require(obj, fname) fname = rb_find_file(tmp); goto load_dyna; } + if (rb_feature_p(RSTRING(fname)->ptr, Qfalse)) + return Qfalse; rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr); load_dyna: @@ -8329,9 +8331,6 @@ rb_thread_start_0(fn, arg, th_arg) while (saved_block) { struct BLOCK *tmp = saved_block; - if (curr_thread == main_thread) { - printf("free(%p)\n", saved_block); - } if (tmp->frame.argc > 0) free(tmp->frame.argv); saved_block = tmp->prev; diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index b97902e3fc..72db3db403 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -740,7 +740,7 @@ if $extlist.size > 0 if File.exist?(f) $extinit += format("\ \tInit_%s();\n\ -\trb_provide(\"%s.so\");\n\ +\trb_provide(\"%s\");\n\ ", t, s) $extobjs += "ext/" $extobjs += f diff --git a/intern.h b/intern.h index fe08ea49f5..3f25ae8d44 100644 --- a/intern.h +++ b/intern.h @@ -357,6 +357,7 @@ VALUE rb_struct_alloc _((VALUE, VALUE)); VALUE rb_struct_aref _((VALUE, VALUE)); VALUE rb_struct_aset _((VALUE, VALUE, VALUE)); VALUE rb_struct_getmember _((VALUE, ID)); +VALUE rb_struct_iv_get _((VALUE, char*)); /* time.c */ VALUE rb_time_new(ANYARGS); /* variable.c */ diff --git a/marshal.c b/marshal.c index 5a8e4232b0..8caad612c2 100644 --- a/marshal.c +++ b/marshal.c @@ -26,7 +26,7 @@ typedef unsigned short BDIGIT; #define SIZEOF_BDIGITS SIZEOF_SHORT #endif -#define BITSPERSHORT (sizeof(short)*CHAR_BIT) +#define BITSPERSHORT (2*CHAR_BIT) #define SHORTMASK ((1<> (i*8)) & 0xff, arg); - } + w_byte((x >> 0) & 0xff, arg); + w_byte((x >> 8) & 0xff, arg); } static void @@ -145,7 +142,7 @@ w_long(x, arg) int i, len = 0; #if SIZEOF_LONG > 4 - if (!(RSHIFT(x, 32) == 0 || RSHIFT(x, 32) == -1)) { + if (!(RSHIFT(x, 31) == 0 || RSHIFT(x, 31) == -1)) { /* big long does not fit in 4 bytes */ rb_raise(rb_eTypeError, "long too big to dump"); } @@ -452,7 +449,7 @@ w_object(obj, arg, limit) w_unique(rb_class2name(CLASS_OF(obj)), arg); w_long(len, arg); - mem = rb_ivar_get(rb_obj_class(obj), rb_intern("__member__")); + mem = rb_struct_iv_get(rb_obj_class(obj), "__member__"); if (mem == Qnil) { rb_raise(rb_eTypeError, "uninitialized struct"); } @@ -601,12 +598,9 @@ r_short(arg) struct load_arg *arg; { unsigned short x; - int i; - x = 0; - for (i=0; i 0) { @@ -646,7 +648,7 @@ r_long(arg) if (c > sizeof(long)) long_toobig(c); x = -1; for (i=0;iklass = c; @@ -838,7 +841,7 @@ r_object(arg) #if SIZEOF_BDIGITS == SIZEOF_SHORT big->len = len; #else - big->len = (len + 1) * sizeof(short) / sizeof(BDIGIT); + big->len = (len + 1) * 2 / sizeof(BDIGIT); #endif big->digits = digits = ALLOC_N(BDIGIT, big->len); while (len > 0) { @@ -847,7 +850,7 @@ r_object(arg) int shift = 0; int i; - for (i=0; isuper; - if (obj == 0 || obj == rb_cStruct) + if (rb_ivar_defined(c, id)) + return rb_ivar_get(c, id); + c = RCLASS(c)->super; + if (c == 0 || c == rb_cStruct) return Qnil; } } @@ -40,7 +40,7 @@ rb_struct_s_members(obj) VALUE member, ary; VALUE *p, *pend; - member = iv_get(obj, "__member__"); + member = rb_struct_iv_get(obj, "__member__"); if (NIL_P(member)) { rb_bug("uninitialized struct"); } @@ -69,7 +69,7 @@ rb_struct_getmember(obj, id) VALUE member, slot; long i; - member = iv_get(rb_obj_class(obj), "__member__"); + member = rb_struct_iv_get(rb_obj_class(obj), "__member__"); if (NIL_P(member)) { rb_bug("uninitialized struct"); } @@ -130,7 +130,7 @@ rb_struct_set(obj, val) VALUE member, slot; long i; - member = iv_get(rb_obj_class(obj), "__member__"); + member = rb_struct_iv_get(rb_obj_class(obj), "__member__"); if (NIL_P(member)) { rb_bug("non-initialized struct"); } @@ -255,7 +255,7 @@ rb_struct_initialize(self, values) long n; rb_struct_modify(self); - size = iv_get(klass, "__size__"); + size = rb_struct_iv_get(klass, "__size__"); n = FIX2LONG(size); if (n < RARRAY(values)->len) { rb_raise(rb_eArgError, "struct size differs"); @@ -280,7 +280,7 @@ struct_alloc(argc, argv, klass) NEWOBJ(st, struct RStruct); OBJSETUP(st, klass, T_STRUCT); - size = iv_get(klass, "__size__"); + size = rb_struct_iv_get(klass, "__size__"); n = FIX2LONG(size); st->ptr = ALLOC_N(VALUE, n); @@ -311,7 +311,7 @@ rb_struct_new(klass, va_alist) long size, i; va_list args; - sz = iv_get(klass, "__size__"); + sz = rb_struct_iv_get(klass, "__size__"); size = FIX2LONG(sz); mem = ALLOCA_N(VALUE, size); va_init_list(args, klass); @@ -355,7 +355,7 @@ inspect_struct(s) VALUE str, member; long i; - member = iv_get(rb_obj_class(s), "__member__"); + member = rb_struct_iv_get(rb_obj_class(s), "__member__"); if (NIL_P(member)) { rb_bug("non-initialized struct"); } @@ -426,7 +426,7 @@ rb_struct_aref_id(s, id) VALUE member; long i, len; - member = iv_get(rb_obj_class(s), "__member__"); + member = rb_struct_iv_get(rb_obj_class(s), "__member__"); if (NIL_P(member)) { rb_bug("non-initialized struct"); } @@ -470,7 +470,7 @@ rb_struct_aset_id(s, id, val) VALUE member; long i, len; - member = iv_get(rb_obj_class(s), "__member__"); + member = rb_struct_iv_get(rb_obj_class(s), "__member__"); if (NIL_P(member)) { rb_bug("non-initialized struct"); } @@ -516,6 +516,7 @@ rb_struct_equal(s, s2) { long i; + if (s == s2) return Qtrue; if (TYPE(s2) != T_STRUCT) return Qfalse; if (rb_obj_class(s) != rb_obj_class(s2)) return Qfalse; if (RSTRUCT(s)->len != RSTRUCT(s2)->len) { diff --git a/version.h b/version.h index 33f7b376cf..fb48826cd8 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.1" -#define RUBY_RELEASE_DATE "2001-08-24" +#define RUBY_RELEASE_DATE "2001-08-29" #define RUBY_VERSION_CODE 171 -#define RUBY_RELEASE_CODE 20010824 +#define RUBY_RELEASE_CODE 20010829