summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog30
-rw-r--r--ToDo5
-rw-r--r--array.c3
-rw-r--r--eval.c3
-rw-r--r--io.c20
-rw-r--r--parse.y15
-rw-r--r--sprintf.c5
-rw-r--r--st.c6
-rw-r--r--time.c8
9 files changed, 68 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 01ae9453a1..5f3cd1e7a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+Tue Dec 12 15:45:42 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (newline_node): cancel newline unification.
+
+Mon Dec 11 23:01:57 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): supports cases `?' precedes EOF and newline.
+
+Mon Dec 11 12:11:25 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (call_end_proc): some frame members were left
+ uninitialized.
+
+Mon Dec 11 01:14:58 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (rb_io_fptr_finalize): do not fclose stdin, stdout and
+ stderr at exit.
+
+Sat Dec 9 17:34:48 2000 Tachino Nobuhiro <tachino@open.nm.fujitsu.co.jp>
+
+ * time.c (time_cmp): should check with kind_of?, not instance_of?
+
+ * time.c (time_eql): ditto.
+
+ * time.c (time_minus): ditto.
+
+Fri Dec 8 17:23:25 2000 Tachino Nobuhiro <tachino@open.nm.fujitsu.co.jp>
+
+ * sprintf.c (rb_f_sprintf): proper string precision treat.
+
Fri Dec 8 10:44:05 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_mod_remove_cvar): Module#remove_class_variable
diff --git a/ToDo b/ToDo
index 0f9b9f55e0..5d46a525eb 100644
--- a/ToDo
+++ b/ToDo
@@ -28,6 +28,7 @@ Language Spec.
+ variables appears within block may have independent values.
* Regexp: make /o thread safe.
* decide if begin with rescue or ensure make do..while loop.
+* a +1 to be a+1, not a(+1).
Hacking Interpreter
@@ -98,7 +99,9 @@ Standard Libraries
* IO#for_fd in general
* Array#&, Array#| to allow duplication. ???
- fork_and_kill_other_threads.
-* way to specify immortal (fork endurance) thread.
+* way to specify immortal (fork endurance) thread;
+* or raise ForkException to every thread but fork caller.
+* Array#fetch
Extension Libraries
diff --git a/array.c b/array.c
index 2794e8dbf9..5e91ae9293 100644
--- a/array.c
+++ b/array.c
@@ -1437,9 +1437,8 @@ rb_ary_diff(ary1, ary2)
}
static VALUE
-ary_make_hash(ary1, ary2, func)
+ary_make_hash(ary1, ary2)
VALUE ary1, ary2;
- int (*func)();
{
VALUE hash = rb_hash_new();
int i, n;
diff --git a/eval.c b/eval.c
index 2e90e78f32..e206ae5700 100644
--- a/eval.c
+++ b/eval.c
@@ -5635,6 +5635,9 @@ call_end_proc(data)
{
PUSH_ITER(ITER_NOT);
PUSH_FRAME();
+ ruby_frame->self = ruby_frame->prev->self;
+ ruby_frame->last_func = 0;
+ ruby_frame->last_class = 0;
proc_call(data, Qundef);
POP_FRAME();
POP_ITER();
diff --git a/io.c b/io.c
index 8c9ccc0ee4..91d44c87d1 100644
--- a/io.c
+++ b/io.c
@@ -1013,13 +1013,10 @@ fptr_finalize(fptr)
}
}
-void
-rb_io_fptr_finalize(fptr)
+static void
+rb_io_fptr_cleanup(fptr)
OpenFile *fptr;
{
- if (!fptr) return;
- if (!fptr->f && !fptr->f2) return;
-
if (fptr->finalize) {
(*fptr->finalize)(fptr);
}
@@ -1034,6 +1031,17 @@ rb_io_fptr_finalize(fptr)
}
}
+void
+rb_io_fptr_finalize(fptr)
+ OpenFile *fptr;
+{
+ if (!fptr) return;
+ if (!fptr->f && !fptr->f2) return;
+ if (fileno(fptr->f) < 3) return;
+
+ rb_io_fptr_cleanup(fptr);
+}
+
static void
rb_io_fptr_close(fptr)
OpenFile *fptr;
@@ -1044,7 +1052,7 @@ rb_io_fptr_close(fptr)
if (!fptr->f && !fptr->f2) return;
fd = fileno(fptr->f);
- rb_io_fptr_finalize(fptr);
+ rb_io_fptr_cleanup(fptr);
rb_thread_fd_close(fd);
}
diff --git a/parse.y b/parse.y
index 1121306313..d77e04d381 100644
--- a/parse.y
+++ b/parse.y
@@ -1914,7 +1914,6 @@ yyerror(msg)
}
static int heredoc_end;
-static int last_newline;
int ruby_in_compile = 0;
int ruby__end__seen;
@@ -1954,7 +1953,6 @@ yycompile(f, line)
ruby__end__seen = 0;
ruby_eval_tree = 0;
heredoc_end = 0;
- last_newline = 0;
ruby_sourcefile = f;
ruby_in_compile = 1;
n = yyparse();
@@ -2814,7 +2812,7 @@ yylex()
/* white spaces */
case ' ': case '\t': case '\f': case '\r':
case '\13': /* '\v' */
- space_seen = 1;
+ space_seen++;
goto retry;
case '#': /* it's a comment */
@@ -2982,6 +2980,10 @@ yylex()
return '?';
}
c = nextc();
+ if (c == -1 || c == 10) {
+ rb_compile_error("incomplete character syntax");
+ return 0;
+ }
if (lex_state == EXPR_ARG && ISSPACE(c)){
pushback(c);
lex_state = EXPR_BEG;
@@ -3294,8 +3296,8 @@ yylex()
}
pushback(c);
if (lex_state == EXPR_ARG && space_seen) {
- arg_ambiguous();
if (!ISSPACE(c)) {
+ arg_ambiguous();
return parse_regx('/', '/');
}
}
@@ -3847,10 +3849,9 @@ newline_node(node)
{
NODE *nl = 0;
if (node) {
- if (nd_line(node) == last_newline) return node;
nl = NEW_NEWLINE(node);
fixpos(nl, node);
- last_newline = nl->nd_nth = nd_line(node);
+ nl->nd_nth = nd_line(node);
}
return nl;
}
@@ -4645,7 +4646,7 @@ top_local_setup()
i = ruby_scope->local_tbl?ruby_scope->local_tbl[0]:0;
if (i < len) {
- if (i == 0 || ruby_scope->flag == SCOPE_ALLOCA) {
+ if (i == 0 || (ruby_scope->flag & SCOPE_MALLOC) == 0) {
VALUE *vars = ALLOC_N(VALUE, len+1);
if (ruby_scope->local_vars) {
*vars++ = ruby_scope->local_vars[-1];
diff --git a/sprintf.c b/sprintf.c
index a3350b4578..756de87ed9 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -320,10 +320,7 @@ rb_f_sprintf(argc, argv)
len = RSTRING(str)->len;
if (flags&FPREC) {
if (prec < len) {
- CHECK(prec);
- memcpy(&buf[blen], RSTRING(str)->ptr, prec);
- blen += prec;
- break;
+ len = prec;
}
}
if (flags&FWIDTH) {
diff --git a/st.c b/st.c
index f14c69f271..e40c6e1017 100644
--- a/st.c
+++ b/st.c
@@ -62,10 +62,10 @@ static void rehash();
#define alloc(type) (type*)xmalloc((unsigned)sizeof(type))
#define Calloc(n,s) (char*)xcalloc((n),(s))
-#define EQUAL(table, x, y) ((*table->type->compare)(x, y) == 0)
+#define EQUAL(table,x,y) ((x)==(y) || (*table->type->compare)((x),(y)) == 0)
-#define do_hash(key, table) (unsigned int)(*(table)->type->hash)((key))
-#define do_hash_bin(key, table) (do_hash(key, table)&(table)->num_bins)
+#define do_hash(key,table) (unsigned int)(*(table)->type->hash)((key))
+#define do_hash_bin(key,table) (do_hash(key, table)&(table)->num_bins)
/*
* MINSIZE is the minimum size of a dictionary.
diff --git a/time.c b/time.c
index 6cd6a0daff..0e2fa0f97b 100644
--- a/time.c
+++ b/time.c
@@ -469,7 +469,7 @@ time_cmp(time1, time2)
}
}
- if (rb_obj_is_instance_of(time2, rb_cTime)) {
+ if (rb_obj_is_kind_of(time2, rb_cTime)) {
GetTimeval(time2, tobj2);
if (tobj1->tv.tv_sec == tobj2->tv.tv_sec) {
if (tobj1->tv.tv_usec == tobj2->tv.tv_usec) return INT2FIX(0);
@@ -492,7 +492,7 @@ time_eql(time1, time2)
struct time_object *tobj1, *tobj2;
GetTimeval(time1, tobj1);
- if (rb_obj_is_instance_of(time2, rb_cTime)) {
+ if (rb_obj_is_kind_of(time2, rb_cTime)) {
GetTimeval(time2, tobj2);
if (tobj1->tv.tv_sec == tobj2->tv.tv_sec) {
if (tobj1->tv.tv_usec == tobj2->tv.tv_usec) return Qtrue;
@@ -676,7 +676,7 @@ time_minus(time1, time2)
double f;
GetTimeval(time1, tobj);
- if (rb_obj_is_instance_of(time2, rb_cTime)) {
+ if (rb_obj_is_kind_of(time2, rb_cTime)) {
struct time_object *tobj2;
GetTimeval(time2, tobj2);
@@ -945,7 +945,7 @@ static VALUE
time_s_times(obj)
VALUE obj;
{
-#ifdef HAVE_TIMES
+#if defined(HAVE_TIMES) && !defined(__CHECKER__)
#ifndef HZ
# ifdef CLK_TCK
# define HZ CLK_TCK