summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--ToDo1
-rw-r--r--array.c2
-rw-r--r--bignum.c4
-rw-r--r--class.c2
-rw-r--r--doc/NEWS12
-rw-r--r--error.c2
-rw-r--r--eval.c6
-rw-r--r--ext/tcltklib/extconf.rb4
-rw-r--r--gc.c2
-rw-r--r--hash.c2
-rw-r--r--intern.h2
-rw-r--r--io.c2
-rw-r--r--numeric.c9
-rw-r--r--object.c9
-rw-r--r--parse.y4
-rw-r--r--process.c2
-rw-r--r--range.c2
-rw-r--r--re.c12
-rw-r--r--string.c23
-rw-r--r--version.c4
21 files changed, 77 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index 17b0827..e540408 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,15 @@ Thu Jan 10 11:42:47 2002 Usaku Nakamura <usa@ruby-lang.org>
* win32/resource.rb: Modify copyright in resource script.
+Thu Jan 10 07:15:44 2002 takuma ozawa <metal@mine.ne.jp>
+
+ * re.c (match_select): should propagate taintness.
+
+Thu Jan 10 00:54:57 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_set_default): Hash#default= should return the
+ new value.
+
Wed Jan 9 20:21:09 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* misc/ruby-mode.el (ruby-calculate-indent): indentation after
@@ -56,6 +65,13 @@ Wed Jan 9 20:21:09 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* misc/ruby-mode.el (font-lock-defaults): unless XEmacs, set
font-lock variables in ruby-mode-hook.
+Tue Jan 8 15:56:20 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_to_i): accepts optional base argument. [new]
+
+ * numeric.c (rb_fix2str): should not handle negative fixnum values
+ int32 via calling sprintf() directly.
+
Tue Jan 8 15:54:02 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* eval.c (rb_add_method): clear replaced method from the cache.
diff --git a/ToDo b/ToDo
index 2a66723..d76822c 100644
--- a/ToDo
+++ b/ToDo
@@ -33,6 +33,7 @@ Language Spec.
* 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
+* private instance variable (as in Python?) @_foo in class Foo => @_Foo_foo
Hacking Interpreter
diff --git a/array.c b/array.c
index 22fbf92..e13ad25 100644
--- a/array.c
+++ b/array.c
@@ -6,7 +6,7 @@
$Date$
created at: Fri Aug 6 09:46:12 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
diff --git a/bignum.c b/bignum.c
index ffdd24d..e80b5b5 100644
--- a/bignum.c
+++ b/bignum.c
@@ -6,7 +6,7 @@
$Date$
created at: Fri Jun 10 00:48:55 JST 1994
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
**********************************************************************/
@@ -351,7 +351,7 @@ rb_str2inum(str, base)
p[len] = '\0';
s = p;
}
- if (len != strlen(s)) {
+ if (base == 0 && len != strlen(s)) {
rb_raise(rb_eArgError, "string for Integer contains null byte");
}
return rb_cstr2inum(s, base);
diff --git a/class.c b/class.c
index 070b413..fac0965 100644
--- a/class.c
+++ b/class.c
@@ -6,7 +6,7 @@
$Date$
created at: Tue Aug 10 15:05:44 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
**********************************************************************/
diff --git a/doc/NEWS b/doc/NEWS
index 26dff87..9eefb80 100644
--- a/doc/NEWS
+++ b/doc/NEWS
@@ -1,3 +1,11 @@
+: String#to_i
+
+ Accepts optional base argument.
+
+: Integer#to_s
+
+ Accepts optional base argument.
+
: TCPServer#listen, UNIXServer#listen
Added.
@@ -14,10 +22,6 @@
if $/ == '\n', chops off last newlines (any of \n, \r, \r\n).
-: IO#puts
-
- do not treat Array specially.
-
: Module::new/Class::new
takes block.
diff --git a/error.c b/error.c
index d8dab15..c30374f 100644
--- a/error.c
+++ b/error.c
@@ -6,7 +6,7 @@
$Date$
created at: Mon Aug 9 16:11:34 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
**********************************************************************/
diff --git a/eval.c b/eval.c
index d1a8e06..607c42b 100644
--- a/eval.c
+++ b/eval.c
@@ -6,7 +6,7 @@
$Date$
created at: Thu Jun 10 14:22:17 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
@@ -317,8 +317,7 @@ remove_method(klass, mid)
}
rb_clear_cache_by_id(mid);
if (FL_TEST(klass, FL_SINGLETON)) {
- rb_funcall(rb_iv_get(klass, "__attached__"),
- singleton_removed, 1, ID2SYM(mid));
+ rb_funcall(rb_iv_get(klass, "__attached__"), singleton_removed, 1, ID2SYM(mid));
}
else {
rb_funcall(klass, removed, 1, ID2SYM(mid));
@@ -680,6 +679,7 @@ dvar_asgn_internal(id, value, curr)
while (vars) {
if (curr && vars->id == 0) {
+ /* first null is a dvar header */
n++;
if (n == 2) break;
}
diff --git a/ext/tcltklib/extconf.rb b/ext/tcltklib/extconf.rb
index f732c16..fd98b1e 100644
--- a/ext/tcltklib/extconf.rb
+++ b/ext/tcltklib/extconf.rb
@@ -18,7 +18,7 @@ tcllib = with_config("tcllib")
stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
def find_tcl(tcllib, stubs)
- paths = ["/usr/local/lib", "/usr/pkg", "/usr/lib"]
+ paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
func = stubs ? "Tcl_InitStubs" : "Tcl_FindExecutable"
if tcllib
find_library(tcllib, func, *paths)
@@ -40,7 +40,7 @@ def find_tcl(tcllib, stubs)
end
def find_tk(tklib, stubs)
- paths = ["/usr/local/lib", "/usr/pkg", "/usr/lib"]
+ paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"]
func = stubs ? "Tk_InitStubs" : "Tk_Init"
if tklib
find_library(tklib, func, *paths)
diff --git a/gc.c b/gc.c
index 5c474d3..fe274d0 100644
--- a/gc.c
+++ b/gc.c
@@ -6,7 +6,7 @@
$Date$
created at: Tue Oct 5 09:44:46 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
diff --git a/hash.c b/hash.c
index b91ce7f..6c4f8cb 100644
--- a/hash.c
+++ b/hash.c
@@ -347,7 +347,7 @@ rb_hash_set_default(hash, ifnone)
rb_hash_modify(hash);
RHASH(hash)->ifnone = ifnone;
FL_UNSET(hash, HASH_PROC_DEFAULT);
- return hash;
+ return ifnone;
}
static int
diff --git a/intern.h b/intern.h
index a83804f..f3c6b62 100644
--- a/intern.h
+++ b/intern.h
@@ -6,7 +6,7 @@
$Date$
created at: Thu Jun 10 14:22:17 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
diff --git a/io.c b/io.c
index 48a23c9..4e31016 100644
--- a/io.c
+++ b/io.c
@@ -6,7 +6,7 @@
$Date$
created at: Fri Oct 15 18:08:59 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
diff --git a/numeric.c b/numeric.c
index 29f733b..3d01a64 100644
--- a/numeric.c
+++ b/numeric.c
@@ -954,15 +954,20 @@ rb_fix2str(x, base)
VALUE x;
int base;
{
- char fmt[4], buf[22];
+ char fmt[4], buf[22], *b = buf;
+ long val = FIX2LONG(x);
fmt[0] = '%'; fmt[1] = 'l'; fmt[3] = '\0';
if (base == 10) fmt[2] = 'd';
else if (base == 16) fmt[2] = 'x';
else if (base == 8) fmt[2] = 'o';
else rb_raise(rb_eArgError, "illegal radix %d", base);
+ if (val < 0) {
+ val = -val;
+ *b++ = '-';
+ }
- sprintf(buf, fmt, FIX2LONG(x));
+ sprintf(b, fmt, val);
return rb_str_new2(buf);
}
diff --git a/object.c b/object.c
index 87f241f..fc2bd23 100644
--- a/object.c
+++ b/object.c
@@ -6,7 +6,7 @@
$Date$
created at: Thu Jul 15 12:01:24 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
@@ -831,19 +831,12 @@ rb_obj_private_methods(obj)
return rb_class_private_instance_methods(1, argv, CLASS_OF(obj));
}
-struct arg_to {
- VALUE val;
- const char *s;
- ID m;
-};
-
static VALUE
convert_type(val, tname, method, raise)
VALUE val;
const char *tname, *method;
int raise;
{
- struct arg_to arg1, arg2;
ID m;
m = rb_intern(method);
diff --git a/parse.y b/parse.y
index c65633b..ce7eae9 100644
--- a/parse.y
+++ b/parse.y
@@ -6,7 +6,7 @@
$Date$
created at: Fri May 28 18:02:42 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
**********************************************************************/
@@ -4280,7 +4280,7 @@ gettable(id)
else if (id == k__FILE__) {
VALUE f = rb_str_new2(ruby_sourcefile);
OBJ_FREEZE(f);
- return NEW_STR(f);
+ return NEW_LIT(f);
}
else if (id == k__LINE__) {
return NEW_LIT(INT2FIX(ruby_sourceline));
diff --git a/process.c b/process.c
index 67437d7..8aea0fb 100644
--- a/process.c
+++ b/process.c
@@ -6,7 +6,7 @@
$Date$
created at: Tue Aug 10 14:30:50 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
diff --git a/range.c b/range.c
index cd14138..5039d45 100644
--- a/range.c
+++ b/range.c
@@ -6,7 +6,7 @@
$Date$
created at: Thu Aug 19 17:46:47 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
**********************************************************************/
diff --git a/re.c b/re.c
index 91d920b..5e73ddb 100644
--- a/re.c
+++ b/re.c
@@ -829,6 +829,7 @@ match_select(argc, argv, match)
VALUE result = rb_ary_new();
int i;
long idx;
+ int taint = OBJ_TAINTED(match);
for (i=0; i<argc; i++) {
idx = NUM2LONG(argv[i]);
@@ -837,8 +838,9 @@ match_select(argc, argv, match)
rb_ary_push(result, Qnil);
}
else {
- rb_ary_push(result, rb_str_new(ptr+regs->beg[idx],
- regs->end[idx]-regs->beg[idx]));
+ VALUE str = rb_str_new(ptr+regs->beg[i], regs->end[i]-regs->beg[i]);
+ if (taint) OBJ_TAINT(str);
+ rb_ary_push(result, str);
}
}
return result;
@@ -981,15 +983,11 @@ static VALUE
rb_reg_equal(re1, re2)
VALUE re1, re2;
{
- int min;
-
if (re1 == re2) return Qtrue;
if (TYPE(re2) != T_REGEXP) return Qfalse;
rb_reg_check(re1); rb_reg_check(re2);
if (RREGEXP(re1)->len != RREGEXP(re2)->len) return Qfalse;
- min = RREGEXP(re1)->len;
- if (min > RREGEXP(re2)->len) min = RREGEXP(re2)->len;
- if (memcmp(RREGEXP(re1)->str, RREGEXP(re2)->str, min) == 0 &&
+ if (memcmp(RREGEXP(re1)->str, RREGEXP(re2)->str, RREGEXP(re1)->len) == 0 &&
rb_reg_cur_kcode(re1) == rb_reg_cur_kcode(re2) &&
RREGEXP(re1)->ptr->options == RREGEXP(re2)->ptr->options) {
return Qtrue;
diff --git a/string.c b/string.c
index 77794d9..39c0415 100644
--- a/string.c
+++ b/string.c
@@ -6,7 +6,7 @@
$Date$
created at: Mon Aug 9 17:12:58 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
Copyright (C) 2000 Information-technology Promotion Agency, Japan
@@ -1748,10 +1748,25 @@ rb_str_include(str, arg)
}
static VALUE
-rb_str_to_i(str)
+rb_str_to_i(argc, argv, str)
+ int argc;
+ VALUE *argv;
VALUE str;
{
- return rb_str2inum(str, 10);
+ VALUE b;
+ int base;
+
+ rb_scan_args(argc, argv, "01", &b);
+ if (argc == 0) base = 10;
+ else base = NUM2INT(b);
+
+ switch (base) {
+ case 2: case 8: case 10: case 16:
+ break;
+ default:
+ rb_raise(rb_eArgError, "illegal radix %d", base);
+ }
+ return rb_str2inum(str, base);
}
static VALUE
@@ -3158,7 +3173,7 @@ Init_String()
rb_define_method(rb_cString, "rindex", rb_str_rindex, -1);
rb_define_method(rb_cString, "replace", rb_str_replace, 1);
- rb_define_method(rb_cString, "to_i", rb_str_to_i, 0);
+ rb_define_method(rb_cString, "to_i", rb_str_to_i, -1);
rb_define_method(rb_cString, "to_f", rb_str_to_f, 0);
rb_define_method(rb_cString, "to_s", rb_str_to_s, 0);
rb_define_method(rb_cString, "to_str", rb_str_to_s, 0);
diff --git a/version.c b/version.c
index 838266d..25c6440 100644
--- a/version.c
+++ b/version.c
@@ -6,7 +6,7 @@
$Date$
created at: Thu Sep 30 20:08:01 JST 1993
- Copyright (C) 1993-2001 Yukihiro Matsumoto
+ Copyright (C) 1993-2002 Yukihiro Matsumoto
**********************************************************************/
@@ -40,6 +40,6 @@ ruby_show_version()
void
ruby_show_copyright()
{
- printf("ruby - Copyright (C) 1993-2001 Yukihiro Matsumoto\n");
+ printf("ruby - Copyright (C) 1993-2002 Yukihiro Matsumoto\n");
exit(0);
}