Permalink
Browse files

* string.c (rb_str_index): wrong increment for non alphanumeric

  string.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 144fb05 commit b0d7895cab3ef8b405c9cf271e5e82f8dcf9258e matz committed Oct 16, 2001
Showing with 47 additions and 21 deletions.
  1. +5 −0 ChangeLog
  2. +7 −2 ToDo
  3. +26 −8 array.c
  4. +0 −4 io.c
  5. +1 −1 lib/complex.rb
  6. +1 −1 misc/ruby-mode.el
  7. +3 −1 object.c
  8. +2 −2 string.c
  9. +2 −2 version.h
View
5 ChangeLog
@@ -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.
View
9 ToDo
@@ -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
View
34 array.c
@@ -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);
View
4 io.c
@@ -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;
View
2 lib/complex.rb
@@ -290,7 +290,7 @@ def to_s
end
def hash
- @real ^ @image
+ @real.hash ^ @image.hash
end
def inspect
View
2 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))))
View
4 object.c
@@ -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;
}
View
4 string.c
@@ -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) {
View
4 version.h
@@ -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

0 comments on commit b0d7895

Please sign in to comment.