summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-12-18 09:46:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-12-18 09:46:21 +0000
commit117b7d5c47f31b02cf891c792f919afceaddd080 (patch)
treed927327cf133d6c690b582751a5e535fb48c0495
parent652f744cba955435d0c69f17fa42c3c7b88bcbe9 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog36
-rw-r--r--class.c1
-rw-r--r--eval.c57
-rw-r--r--hash.c1
-rw-r--r--instruby.rb1
-rw-r--r--intern.h3
-rw-r--r--lib/README4
-rw-r--r--lib/date.rb4
-rw-r--r--missing/vsnprintf.c7
-rw-r--r--parse.y8
-rw-r--r--time.c4
-rw-r--r--version.h4
12 files changed, 110 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index bfe58f0e68..cc61d22c58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+Mon Dec 18 18:10:30 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * time.c (time_plus): usec might underflow (ruby-bugs-ja:#PR33).
+
+Mon Dec 18 08:11:20 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * hash.c (rb_hash_set_default): should call rb_hash_modify().
+
+Sat Dec 16 02:58:26 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
+
+ * eval.c (rb_eval): should clear ruby_errinfo on retry.
+
+ * eval.c (rb_rescue2): ditto.
+
+Thu Dec 14 13:06:18 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * class.c (rb_include_module): prohibit fronzen class/module.
+
+ * eval.c (rb_frozen_class_p): make external.
+
+ * intern.h (rb_frozen_class_p): prototyped.
+
+ * intern.h (rb_undef): prototyped not but rb_undef_method()
+ which is also in ruby.h.
+
Thu Dec 14 09:20:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/cgi.rb: support -T1 on ruby 1.6.2
@@ -6,6 +31,17 @@ Thu Dec 14 09:20:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/net/telnet.rb: ditto.
+Wed Dec 13 23:27:06 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): handles case statement without expr, which
+ looks for any TRUE (non nil, non false) when expression.
+
+ * parse.y (primary): case expression should not be compstmt, but
+ mere expr.
+
+ * parse.y (primary): case without following expression is now
+ separated rule.
+
Wed Dec 13 12:41:27 2000 WATANABE Hirofumi <eban@ruby-lang.org>
* ruby.c (proc_options): accept "--^M" for DOS line endings.
diff --git a/class.c b/class.c
index 544652a4ab..2eedb262dc 100644
--- a/class.c
+++ b/class.c
@@ -241,6 +241,7 @@ rb_include_module(klass, module)
return;
}
}
+ rb_frozen_class_p(klass);
RCLASS(klass)->super =
include_class_new(module, RCLASS(klass)->super);
klass = RCLASS(klass)->super;
diff --git a/eval.c b/eval.c
index e206ae5700..ee2881fbc7 100644
--- a/eval.c
+++ b/eval.c
@@ -1459,8 +1459,8 @@ rb_mod_s_constants()
return ary;
}
-static void
-frozen_class_p(klass)
+void
+rb_frozen_class_p(klass)
VALUE klass;
{
char *desc = "something(?!)";
@@ -1495,7 +1495,7 @@ rb_undef(klass, id)
if (rb_safe_level() >= 4 && !OBJ_TAINTED(klass)) {
rb_raise(rb_eSecurityError, "Insecure: can't undef");
}
- frozen_class_p(klass);
+ rb_frozen_class_p(klass);
if (id == __id__ || id == __send__) {
rb_warn("undefining `%s' may cause serious problem",
rb_id2name(id));
@@ -1541,7 +1541,7 @@ rb_alias(klass, name, def)
VALUE origin;
NODE *orig, *body;
- frozen_class_p(klass);
+ rb_frozen_class_p(klass);
if (name == def) return;
if (klass == rb_cObject) {
rb_secure(4);
@@ -2054,16 +2054,49 @@ rb_eval(self, n)
}
goto again;
+ case NODE_WHEN:
+ while (node) {
+ NODE *tag;
+
+ if (nd_type(node) != NODE_WHEN) goto again;
+ tag = node->nd_head;
+ while (tag) {
+ if (trace_func) {
+ call_trace_func("line", tag->nd_file, nd_line(tag), self,
+ ruby_frame->last_func,
+ ruby_frame->last_class);
+ }
+ ruby_sourcefile = tag->nd_file;
+ ruby_sourceline = nd_line(tag);
+ if (nd_type(tag->nd_head) == NODE_WHEN) {
+ VALUE v = rb_eval(self, tag->nd_head->nd_head);
+ int i;
+
+ if (TYPE(v) != T_ARRAY) v = rb_Array(v);
+ for (i=0; i<RARRAY(v)->len; i++) {
+ if (RTEST(RARRAY(v)->ptr[i])) {
+ node = node->nd_body;
+ goto again;
+ }
+ }
+ tag = tag->nd_next;
+ continue;
+ }
+ if (RTEST(rb_eval(self, tag->nd_head))) {
+ node = node->nd_body;
+ goto again;
+ }
+ tag = tag->nd_next;
+ }
+ node = node->nd_next;
+ }
+ RETURN(Qnil);
+
case NODE_CASE:
{
VALUE val;
- if (node->nd_head) {
- val = rb_eval(self, node->nd_head);
- }
- else {
- val = Qtrue;
- }
+ val = rb_eval(self, node->nd_head);
node = node->nd_body;
while (node) {
NODE *tag;
@@ -2287,6 +2320,7 @@ rb_eval(self, n)
POP_TAG();
if (state == TAG_RETRY) {
state = 0;
+ ruby_errinfo = Qnil;
goto retry_entry;
}
if (state != TAG_RAISE) {
@@ -2858,7 +2892,7 @@ rb_eval(self, n)
rb_warn("redefining `%s' may cause serious problem",
rb_id2name(node->nd_mid));
}
- frozen_class_p(ruby_class);
+ rb_frozen_class_p(ruby_class);
body = search_method(ruby_class, node->nd_mid, &origin);
if (body){
if (RTEST(ruby_verbose) && ruby_class == origin && body->nd_cnt == 0) {
@@ -3821,6 +3855,7 @@ rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
POP_TAG();
if (state == TAG_RETRY) {
state = 0;
+ ruby_errinfo = Qnil;
goto retry_entry;
}
}
diff --git a/hash.c b/hash.c
index cc58f608cc..513eeb4347 100644
--- a/hash.c
+++ b/hash.c
@@ -333,6 +333,7 @@ static VALUE
rb_hash_set_default(hash, ifnone)
VALUE hash, ifnone;
{
+ rb_hash_modify(hash);
RHASH(hash)->ifnone = ifnone;
return hash;
}
diff --git a/instruby.rb b/instruby.rb
index 0e3dbbed03..265b854eb4 100644
--- a/instruby.rb
+++ b/instruby.rb
@@ -3,6 +3,7 @@
load "./rbconfig.rb"
include Config
+File.umask(0)
destdir = ARGV[0] || ''
$:.unshift CONFIG["srcdir"]+"/lib"
diff --git a/intern.h b/intern.h
index 1b55522921..7d8b0de130 100644
--- a/intern.h
+++ b/intern.h
@@ -90,7 +90,8 @@ VALUE rb_class_protected_instance_methods _((int, VALUE*, VALUE));
VALUE rb_class_private_instance_methods _((int, VALUE*, VALUE));
VALUE rb_obj_singleton_methods _((VALUE));
void rb_define_method_id _((VALUE, ID, VALUE (*)(), int));
-void rb_undef_method _((VALUE, const char*));
+void rb_frozen_class_p _((VALUE));
+void rb_undef _((VALUE, ID));
void rb_define_protected_method _((VALUE, const char*, VALUE (*)(), int));
void rb_define_private_method _((VALUE, const char*, VALUE (*)(), int));
void rb_define_singleton_method _((VALUE,const char*,VALUE(*)(),int));
diff --git a/lib/README b/lib/README
index 765c380f7d..de6a43af09 100644
--- a/lib/README
+++ b/lib/README
@@ -4,8 +4,8 @@ README this file
base64.rb encode/decode base64 (obsolete)
cgi-lib.rb decode CGI data
complex.rb complex number suppor
-date.rb date object (compatible)
-date2.rb yet another (better) date object
+date.rb date object
+date2.rb date object (compatible)
debug.rb ruby debugger
delegate.rb delegate messages to other object
e2mmap.rb exception utilities
diff --git a/lib/date.rb b/lib/date.rb
index 8c83db0155..4abf75f431 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -1,5 +1,5 @@
-# date2.rb: Written by Tadayoshi Funaba 1998-2000
-# $Id: date2.rb,v 1.22 2000-07-16 10:23:40+09 tadf Exp $
+# date.rb: Written by Tadayoshi Funaba 1998-2000
+# $Id: date.rb,v 1.22 2000-07-16 10:23:40+09 tadf Exp $
class Date
diff --git a/missing/vsnprintf.c b/missing/vsnprintf.c
index b29f14c0ec..d297209d06 100644
--- a/missing/vsnprintf.c
+++ b/missing/vsnprintf.c
@@ -34,6 +34,13 @@
* SUCH DAMAGE.
*/
+/*
+ * IMPORTANT NOTE:
+ * --------------
+ * From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
+ * paragraph 3 above is now null and void.
+ */
+
/* SNPRINTF.C
* fjc 7-31-97 Modified by Mib Software to be a standalone snprintf.c module.
* http://www.mibsoftware.com
diff --git a/parse.y b/parse.y
index d77e04d381..6dbb364c55 100644
--- a/parse.y
+++ b/parse.y
@@ -1203,14 +1203,18 @@ primary : literal
$$ = NEW_UNTIL(cond($3), $6, 1);
fixpos($$, $3);
}
- | kCASE compstmt
+ | kCASE expr opt_terms
case_body
kEND
{
value_expr($2);
- $$ = NEW_CASE($2, $3);
+ $$ = NEW_CASE($2, $4);
fixpos($$, $2);
}
+ | kCASE opt_terms case_body kEND
+ {
+ $$ = $3;
+ }
| kFOR block_var kIN {COND_PUSH;} expr do {COND_POP;}
compstmt
kEND
diff --git a/time.c b/time.c
index 0e2fa0f97b..2ef06eb6f7 100644
--- a/time.c
+++ b/time.c
@@ -659,6 +659,10 @@ time_plus(time1, time2)
sec++;
usec -= 1000000;
}
+ if (usec < 0) { /* usec underflow */
+ sec--;
+ usec += 1000000;
+ }
time2 = rb_time_new(sec, usec);
if (tobj->gmt) {
GetTimeval(time2, tobj);
diff --git a/version.h b/version.h
index e7d3133ff9..0891bff976 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.2"
-#define RUBY_RELEASE_DATE "2000-12-13"
+#define RUBY_RELEASE_DATE "2000-12-18"
#define RUBY_VERSION_CODE 162
-#define RUBY_RELEASE_CODE 20001213
+#define RUBY_RELEASE_CODE 20001218