diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ToDo | 9 | ||||
-rw-r--r-- | array.c | 34 | ||||
-rw-r--r-- | io.c | 4 | ||||
-rw-r--r-- | lib/complex.rb | 2 | ||||
-rw-r--r-- | misc/ruby-mode.el | 2 | ||||
-rw-r--r-- | object.c | 4 | ||||
-rw-r--r-- | string.c | 4 | ||||
-rw-r--r-- | version.h | 4 |
9 files changed, 47 insertions, 21 deletions
@@ -3,6 +3,11 @@ Tue Oct 16 00:07:06 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> * parse.y (yylex): disallow alpha-numeric and mbchar for terminator of %string. +Mond Oct 15 18:00:05 2001 Pit Capitain <pit@capitain.de> + + * string.c (rb_str_index): wrong increment for non alphanumeric + string. + Wed Oct 10 03:11:47 2001 Yukihiro Matsumoto <matz@ruby-lang.org> * file.c (rb_stat_clone): should copy internal data too. @@ -1,5 +1,6 @@ Language Spec. +- Class#allocate - basicNew * operator !! for rescue. ??? * objectify characters * ../... outside condition invokes operator method too. @@ -25,11 +26,13 @@ Language Spec. * unify == and eql? again * to_i returns nil if str contains no digit. * raise exception by `` error -* jar like combined library package. +* jar like combined library package. -> RubyGems? * resumable Exception via Exception#resume. * method combination, e.g. before, after, around, etc. * .. or something like defadvice in Emacs. -* Class#allocate - basicNew +* property - for methods, or for objects in general. +* in modifier, to annotate, or to encourage assertion. +* selector namespace - something like generic-flet in CLOS, to help RubyBehevior Hacking Interpreter @@ -49,6 +52,7 @@ Hacking Interpreter * warn for inconsistent local variable usage (lv m and method m at the same time). * MicroRuby * Built-in Interactive Ruby. +* Parser API * trap every method invocation, which can be enabled by e.g. trap_call :method. * unify Errno exceptions of same errno, or new exception comparison scheme. * 2.times{|i| if i==0 then a = 15 else puts eval("a") end} should print nil. @@ -89,6 +93,7 @@ Standard Libraries * warning framework (warn, warning for Ruby level) * marshal should not depend on sprintf/strtod (works bad for locale). * ternary arg pow: a.pow(b,c) == a**b%c +* new caller(), e.g. call_stack; needs better name. Extension Libraries @@ -86,10 +86,11 @@ rb_ary_s_alloc(klass) } VALUE -rb_ary_new2(len) +rb_ary_new0(klass, len) + VALUE klass; long len; { - VALUE ary = rb_obj_alloc(rb_cArray); + VALUE ary = rb_obj_alloc(klass); if (len < 0) { rb_raise(rb_eArgError, "negative array size (or size too big)"); @@ -105,6 +106,14 @@ rb_ary_new2(len) } VALUE +rb_ary_new2(len) + long len; +{ + return rb_ary_new0(rb_cArray, len); +} + + +VALUE rb_ary_new() { return rb_ary_new2(ARY_DEFAULT_SIZE); @@ -408,7 +417,7 @@ rb_ary_subseq(ary, beg, len) VALUE ary; long beg, len; { - VALUE ary2; + VALUE klass, ary2; if (beg > RARRAY(ary)->len) return Qnil; if (beg < 0 || len < 0) return Qnil; @@ -419,12 +428,12 @@ rb_ary_subseq(ary, beg, len) if (len < 0) { len = 0; } - if (len == 0) return rb_ary_new2(0); + klass = rb_obj_class(ary); + if (len == 0) return rb_ary_new0(klass,0); - ary2 = rb_ary_new2(len); + ary2 = rb_ary_new0(klass, len); MEMCPY(RARRAY(ary2)->ptr, RARRAY(ary)->ptr+beg, VALUE, len); RARRAY(ary2)->len = len; - RBASIC(ary2)->klass = rb_obj_class(ary); return ary2; } @@ -1218,6 +1227,15 @@ rb_ary_reject_bang(ary) } static VALUE +rb_ary_reject(ary) + VALUE ary; +{ + ary = rb_ary_dup(ary); + rb_ary_reject_bang(ary); + return ary; +} + +static VALUE rb_ary_delete_if(ary) VALUE ary; { @@ -1340,14 +1358,13 @@ rb_ary_times(ary, times) } len *= RARRAY(ary)->len; - ary2 = rb_ary_new2(len); + ary2 = rb_ary_new0(rb_obj_class(ary), len); RARRAY(ary2)->len = len; for (i=0; i<len; i+=RARRAY(ary)->len) { MEMCPY(RARRAY(ary2)->ptr+i, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len); } OBJ_INFECT(ary2, ary); - RBASIC(ary2)->klass = rb_obj_class(ary); return ary2; } @@ -1760,6 +1777,7 @@ Init_Array() rb_define_method(rb_cArray, "delete", rb_ary_delete, 1); rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at_m, 1); rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0); + rb_define_method(rb_cArray, "reject", rb_ary_reject, 0); rb_define_method(rb_cArray, "reject!", rb_ary_reject_bang, 0); rb_define_method(rb_cArray, "replace", rb_ary_replace, 1); rb_define_method(rb_cArray, "clear", rb_ary_clear, 0); @@ -1231,10 +1231,6 @@ rb_io_sysread(io, len) n = fileno(fptr->f); rb_thread_wait_fd(fileno(fptr->f)); - if (fptr->f == 0) { - fprintf(stderr, "bingo\n"); - exit(1); - } TRAP_BEG; n = read(fileno(fptr->f), RSTRING(str)->ptr, RSTRING(str)->len); TRAP_END; diff --git a/lib/complex.rb b/lib/complex.rb index cb0a3dc564..f0a363f9cb 100644 --- a/lib/complex.rb +++ b/lib/complex.rb @@ -290,7 +290,7 @@ class Complex < Numeric end def hash - @real ^ @image + @real.hash ^ @image.hash end def inspect diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index 2f53e36840..a665685523 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -137,7 +137,7 @@ (ruby-mark-defun) (save-restriction (narrow-to-region (region-beginning) (region-end)) - (while (re-search-forward "^\\s *def\\s *\\([^(\n ]+\\)" nil t) + (while (re-search-forward "^\\s *def\\s *\\([^(\n ]+\\)" nil 'move) (setq method-begin (match-beginning 1)) (setq method-name (buffer-substring method-begin (match-end 1))) (push (cons (concat class-name "#" method-name) (match-beginning 0)) index-alist)))) @@ -595,7 +595,9 @@ rb_mod_initialize(argc, argv, module) VALUE *argv; VALUE module; { - rb_mod_module_eval(0, 0, module); + if (rb_block_given_p()) { + rb_mod_module_eval(0, 0, module); + } return Qnil; } @@ -1011,8 +1011,8 @@ rb_str_succ(orig) sbeg = RSTRING(str)->ptr; s = sbeg + RSTRING(str)->len - 1; c = '\001'; while (sbeg <= s) { - *s += 1; - if (*s-- != 0) break; + if ((*s += 1) != 0) break; + s--; } } if (s < sbeg) { @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.1" -#define RUBY_RELEASE_DATE "2001-10-15" +#define RUBY_RELEASE_DATE "2001-10-16" #define RUBY_VERSION_CODE 171 -#define RUBY_RELEASE_CODE 20011015 +#define RUBY_RELEASE_CODE 20011016 |