summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--ToDo1
-rw-r--r--array.c10
-rw-r--r--configure.in3
-rw-r--r--dln.c2
-rw-r--r--eval.c61
-rw-r--r--ext/extmk.rb.in3
-rw-r--r--io.c28
-rw-r--r--lib/Env.rb14
-rw-r--r--lib/README1
-rw-r--r--lib/importenv.rb1
-rw-r--r--lib/mkmf.rb3
-rw-r--r--missing/flock.c4
-rw-r--r--parse.y15
-rw-r--r--version.h4
15 files changed, 88 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index 419afc4..c20d2d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Feb 26 00:04:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (proc_call): should not modify ruby_block->frame.iter
+ based on ruby_frame->iter altered by PUSH_ITER().
+
Mon Feb 26 05:27:52 2001 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/net/telnet.rb: #telnetmode(), #binmode(): bug fix.
@@ -18,6 +23,11 @@ Sun Feb 25 02:45:30 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* file.c (rb_file_s_rename): avoid Cygwin's bug.
+Sat Feb 24 23:32:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_thread_fd_close): should save current context before
+ raising exception.
+
Sat Feb 24 22:14:00 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* win32/win32.c (myrename): fix error handling.
@@ -29,6 +39,12 @@ Sat Feb 24 13:58:48 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: change copyright.
+Sat Feb 24 03:15:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (set_stdin): preserve original stdin.
+
+ * io.c (set_outfile): preserve original stdout/stderr.
+
Fri Feb 23 08:28:58 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/protocol.rb: clear read buffer after reopen.
diff --git a/ToDo b/ToDo
index c144100..476e559 100644
--- a/ToDo
+++ b/ToDo
@@ -75,6 +75,7 @@ Standard Libraries
* Hash::new{default} or recommend Hash#fetch?
* new user-defined marshal scheme. _dump(dumper), _load(restorer)
* warn, warning for Ruby level
+* hash etc. should handle self referenceing array/hash
Extension Libraries
diff --git a/array.c b/array.c
index 768b7e8..5695851 100644
--- a/array.c
+++ b/array.c
@@ -283,14 +283,8 @@ rb_ary_push_m(argc, argv, ary)
rb_raise(rb_eArgError, "wrong # of arguments(at least 1)");
}
if (argc > 0) {
- long len = RARRAY(ary)->len;
-
- --argc;
- /* make rooms by copying the last item */
- rb_ary_store(ary, len + argc, argv[argc]);
-
- if (argc) { /* if any rest */
- MEMCPY(RARRAY(ary)->ptr + len, argv, VALUE, argc);
+ while (argc--) {
+ rb_ary_push(ary, *argv++);
}
}
return ary;
diff --git a/configure.in b/configure.in
index 9d42330..ebdb0fd 100644
--- a/configure.in
+++ b/configure.in
@@ -270,7 +270,8 @@ check(tm, y, m, d, h, s)
struct tm *tm;
int y, m, d, h, s;
{
- if (tm->tm_year != y ||
+ if (!tm ||
+ tm->tm_year != y ||
tm->tm_mon != m-1 ||
tm->tm_mday != d ||
tm->tm_hour != h ||
diff --git a/dln.c b/dln.c
index a64b408..98b97af 100644
--- a/dln.c
+++ b/dln.c
@@ -1204,7 +1204,7 @@ aix_loaderror(const char *pathname)
if (nerr == load_errtab[i].errno && load_errtab[i].errstr)
ERRBUF_APPEND(load_errtab[i].errstr);
}
- while (ISDIGIT(*message[i])) message[i]++;
+ while (isdigit(*message[i])) message[i]++;
ERRBUF_APPEND(message[i]);
ERRBUF_APPEND("\n");
}
diff --git a/eval.c b/eval.c
index fc46baa..0008961 100644
--- a/eval.c
+++ b/eval.c
@@ -3608,24 +3608,6 @@ rb_yield_0(val, self, klass, acheck)
pop_state:
POP_ITER();
POP_CLASS();
-#if 0
- if (ruby_dyna_vars && (block->flags & BLOCK_D_SCOPE) &&
- (!(ruby_scope->flags & SCOPE_DONT_RECYCLE) ||
- !(block->tag->flags & BLOCK_DYNAMIC) ||
- !FL_TEST(ruby_dyna_vars, DVAR_DONT_RECYCLE))) {
- struct RVarmap *vars, *tmp;
-
- if (ruby_dyna_vars->id == 0) {
- vars = ruby_dyna_vars->next;
- rb_gc_force_recycle((VALUE)ruby_dyna_vars);
- while (vars && vars->id != 0) {
- tmp = vars->next;
- rb_gc_force_recycle((VALUE)vars);
- vars = tmp;
- }
- }
- }
-#else
if (ruby_dyna_vars && (block->flags & BLOCK_D_SCOPE) &&
!FL_TEST(ruby_dyna_vars, DVAR_DONT_RECYCLE)) {
struct RVarmap *vars = ruby_dyna_vars;
@@ -3640,7 +3622,6 @@ rb_yield_0(val, self, klass, acheck)
}
}
}
-#endif
POP_VARS();
ruby_block = block;
ruby_frame = ruby_frame->prev;
@@ -6182,7 +6163,7 @@ proc_new(klass)
struct RVarmap *vars;
if (!rb_block_given_p() && !rb_f_block_given_p()) {
- rb_raise(rb_eArgError, "tried to create Procedure-Object without a block");
+ rb_raise(rb_eArgError, "tried to create Proc object without a block");
}
proc = Data_Make_Struct(klass, struct BLOCK, blk_mark, blk_free, data);
@@ -6280,10 +6261,20 @@ proc_call(proc, args)
Data_Get_Struct(proc, struct BLOCK, data);
orphan = blk_orphan(data);
+ if (orphan) {/* orphan procedure */
+ if (rb_block_given_p()) {
+ ruby_block->frame.iter = ITER_CUR;
+ }
+ else {
+ ruby_block->frame.iter = ITER_NOT;
+ }
+ }
+
/* PUSH BLOCK from data */
old_block = ruby_block;
_block = *data;
ruby_block = &_block;
+
PUSH_ITER(ITER_CUR);
ruby_frame->iter = ITER_CUR;
@@ -6291,15 +6282,6 @@ proc_call(proc, args)
args = callargs(args);
}
- if (orphan) {/* orphan procedure */
- if (rb_block_given_p()) {
- ruby_block->frame.iter = ITER_CUR;
- }
- else {
- ruby_block->frame.iter = ITER_NOT;
- }
- }
-
PUSH_TAG(PROT_NONE);
state = EXEC_TAG();
if (state == 0) {
@@ -6993,6 +6975,8 @@ rb_thread_check(data)
return (rb_thread_t)RDATA(data)->data;
}
+static VALUE rb_thread_raise _((int, VALUE*, rb_thread_t));
+
static int th_raise_argc;
static VALUE th_raise_argv[2];
static char *th_raise_file;
@@ -7176,20 +7160,15 @@ void
rb_thread_fd_close(fd)
int fd;
{
- rb_thread_t th;
+ rb_thread_t th, curr = curr_thread;
- FOREACH_THREAD(th) {
+ FOREACH_THREAD_FROM(curr, th) {
if ((th->wait_for & WAIT_FD) && fd == th->fd) {
- th_raise_argc = 1;
- th_raise_argv[0] = rb_exc_new2(rb_eIOError, "stream closed");
- th_raise_file = ruby_sourcefile;
- th_raise_line = ruby_sourceline;
- curr_thread = th;
- rb_thread_ready(th);
- rb_thread_restore_context(curr_thread, RESTORE_RAISE);
+ VALUE exc = rb_exc_new2(rb_eIOError, "stream closed");
+ rb_thread_raise(1, &exc, th);
}
}
- END_FOREACH(th);
+ END_FOREACH_FROM(curr, th);
}
static void
@@ -7976,8 +7955,6 @@ catch_timer(sig)
int rb_thread_tick = THREAD_TICK;
#endif
-static VALUE rb_thread_raise _((int, VALUE*, rb_thread_t));
-
#define SCOPE_SHARED FL_USER1
#if defined(HAVE_SETITIMER)
@@ -8460,7 +8437,7 @@ rb_thread_inspect(thread)
void
rb_thread_atfork()
{
-#if 0 /* enable on 1.7 */
+#if 1 /* enable on 1.7 */
rb_thread_t th;
if (rb_thread_alone()) return;
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index 8dd457f..11eb87b 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -511,6 +511,9 @@ EOS
mfile.print "
.c.@OBJEXT@:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(subst /,\\\\,$<)
+
+.cc.@OBJEXT@ .cpp.@OBJEXT@ .cxx.@OBJEXT@ .C.@OBJEXT@:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(subst /,\\\\,$<)
"
end
diff --git a/io.c b/io.c
index 3c25f28..075c520 100644
--- a/io.c
+++ b/io.c
@@ -81,6 +81,7 @@ VALUE rb_eIOError;
VALUE rb_stdin, rb_stdout, rb_stderr, rb_defout;
static VALUE orig_stdin, orig_stdout, orig_stderr;
+static int saved_fd[3] = {0, 1, 2};
VALUE rb_output_fs;
VALUE rb_rs;
@@ -1187,7 +1188,12 @@ rb_io_sysread(io, len)
}
str = rb_str_new(0, ilen);
+ 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;
@@ -2212,7 +2218,15 @@ set_stdin(val, id, var)
GetOpenFile(val, fptr);
rb_io_check_readable(fptr);
- dup2(fileno(fptr->f), 0);
+ if (fileno(fptr->f) == 0 && saved_fd[0] != 0) {
+ dup2(saved_fd[0], 0);
+ close(saved_fd[0]);
+ saved_fd[0] = 0;
+ }
+ else {
+ saved_fd[0] = dup(0);
+ dup2(fileno(fptr->f), 0);
+ }
*var = val;
}
@@ -2226,6 +2240,7 @@ set_outfile(val, var, orig, stdf)
{
OpenFile *fptr;
FILE *f;
+ int fd;
if (val == *var) return;
@@ -2243,7 +2258,16 @@ set_outfile(val, var, orig, stdf)
GetOpenFile(val, fptr);
rb_io_check_writable(fptr);
f = GetWriteFile(fptr);
- dup2(fileno(f), fileno(stdf));
+ fd = fileno(stdf);
+ if (fileno(fptr->f) == fd && saved_fd[fd] != fd) {
+ dup2(saved_fd[fd], fd);
+ close(saved_fd[fd]);
+ saved_fd[fd] = fd;
+ }
+ else {
+ saved_fd[fd] = dup(fd);
+ dup2(fileno(fptr->f), fd);
+ }
*var = val;
}
diff --git a/lib/Env.rb b/lib/Env.rb
index 7101b84..452a286 100644
--- a/lib/Env.rb
+++ b/lib/Env.rb
@@ -6,19 +6,7 @@
# $USER = "matz"
# p ENV["USER"]
-for k,v in ENV
- next unless /^[a-zA-Z][_a-zA-Z0-9]*/ =~ k
- eval <<EOS
- $#{k} = %q!#{v}!
- trace_var "$#{k}", proc{|v|
- ENV[%q!#{k}!] = v;
- $#{k} = %q!#{v}!
- if v == nil
- untrace_var "$#{k}"
- end
- }
-EOS
-end
+require 'importenv'
if __FILE__ == $0
p $TERM
diff --git a/lib/README b/lib/README
index de6a43a..aa031c0 100644
--- a/lib/README
+++ b/lib/README
@@ -35,7 +35,6 @@ profile.rb ruby profiler
pstore.rb persistent object strage using marshal
rational.rb rational number support
readbytes.rb define IO#readbytes
-shell.rb shell like operation under Ruby (imcomplete)
shellwords.rb split into words like shell
singleton.rb singleton design pattern library
sync.rb 2 phase lock
diff --git a/lib/importenv.rb b/lib/importenv.rb
index 586f376..435d6f9 100644
--- a/lib/importenv.rb
+++ b/lib/importenv.rb
@@ -29,4 +29,3 @@ if __FILE__ == $0
$TERM = "foo"
p ENV["TERM"]
end
-
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 0f04794..4eb77a9 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -503,6 +503,9 @@ EOMF
.c.#{$OBJEXT}:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(subst /,\\\\,$<)
+
+.cc.#{$OBJEXT} .cpp.#{$OBJEXT} .cxx.#{$OBJEXT} .C.#{$OBJEXT}:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(subst /,\\\\,$<)
"
end
diff --git a/missing/flock.c b/missing/flock.c
index 259e227..e293ca0 100644
--- a/missing/flock.c
+++ b/missing/flock.c
@@ -99,6 +99,8 @@ flock(fd, operation)
/* LOCK_SH - get a shared lock */
case LOCK_SH:
+ rb_notimplement();
+ return -1;
/* LOCK_EX - get an exclusive lock */
case LOCK_EX:
i = lockf (fd, F_LOCK, 0);
@@ -106,6 +108,8 @@ flock(fd, operation)
/* LOCK_SH|LOCK_NB - get a non-blocking shared lock */
case LOCK_SH|LOCK_NB:
+ rb_notimplement();
+ return -1;
/* LOCK_EX|LOCK_NB - get a non-blocking exclusive lock */
case LOCK_EX|LOCK_NB:
i = lockf (fd, F_TLOCK, 0);
diff --git a/parse.y b/parse.y
index 4f6095b..7e4f1a3 100644
--- a/parse.y
+++ b/parse.y
@@ -1271,7 +1271,12 @@ primary : literal
cref_pop();
class_nest--;
}
- | kCLASS tLSHFT expr term
+ | kCLASS tLSHFT expr
+ {
+ $<num>$ = in_def;
+ in_def = 0;
+ }
+ term
{
$<num>$ = in_single;
in_single = 0;
@@ -1279,10 +1284,6 @@ primary : literal
cref_push();
local_push();
}
- {
- $<num>$ = in_def;
- in_def = 0;
- }
compstmt
kEND
{
@@ -1291,8 +1292,8 @@ primary : literal
local_pop();
cref_pop();
class_nest--;
- in_single = $<num>5;
- in_def = $<num>6;
+ in_def = $<num>4;
+ in_single = $<num>6;
}
| kMODULE cname
{
diff --git a/version.h b/version.h
index 97a1b58..674afab 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.0"
-#define RUBY_RELEASE_DATE "2001-02-24"
+#define RUBY_RELEASE_DATE "2001-02-26"
#define RUBY_VERSION_CODE 170
-#define RUBY_RELEASE_CODE 20010224
+#define RUBY_RELEASE_CODE 20010226