From 9ba3d42046af4721998adfe3c6bd6bc9220234f4 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 29 Jan 1998 08:18:03 +0000 Subject: *** empty log message *** git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@57 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 12 ++++++++++++ class.c | 2 ++ io.c | 39 +++++++++++---------------------------- object.c | 2 +- sample/rbc.rb | 10 +++++----- sample/ruby-mode.el | 5 ++++- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 436061191b..4ebf2df356 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Thu Jan 29 14:18:40 1998 Yukihiro Matsumoto + + * class.c (mod_ancestors): should not include singleton classes. + + * object.c (obj_type): should not return internal class. + + * io.c (io_reopen): unwillingly closes stdio streams. + +Thu Jan 29 11:50:35 1998 Toshihiko SHIMOKAWA + + * ext/socket/socket.c (udp_addrsetup): forgot to use htons(). + Fri Jan 23 14:19:28 1998 Yukihiro Matsumoto * version 1.1b6 released. diff --git a/class.c b/class.c index 6f6a9bc5b8..4e6ef327e5 100644 --- a/class.c +++ b/class.c @@ -267,6 +267,8 @@ mod_ancestors(mod) VALUE p; for (p = mod; p; p = RCLASS(p)->super) { + if (FL_TEST(p, FL_SINGLETON)) + continue; if (BUILTIN_TYPE(p) == T_ICLASS) { ary_push(ary, RBASIC(p)->class); } diff --git a/io.c b/io.c index 546ec45d18..0975ab8f11 100644 --- a/io.c +++ b/io.c @@ -1144,18 +1144,21 @@ io_reopen(io, nfile) mode = io_mode_string(fptr); fd = fileno(fptr->f); - if (fileno(fptr->f) < 3) /* need to keep stdio */ + if (fileno(fptr->f) < 3) { + /* need to keep stdio */ + dup2(fileno(orig->f), fd); + } + else { fclose(fptr->f); - dup2(fileno(orig->f), fd); - fptr->f = rb_fdopen(fd, mode); + fptr->f = rb_fdopen(fd, mode); + } if (fptr->f2) { fd = fileno(fptr->f2); - if (fileno(fptr->f2) < 3) - fclose(fptr->f2); + fclose(fptr->f2); if (orig->f2) { dup2(fileno(orig->f2), fd); - fptr->f = rb_fdopen(fd, "w"); + fptr->f2 = rb_fdopen(fd, "w"); } else { fptr->f2 = 0; @@ -1397,32 +1400,12 @@ io_errset(val, id) { OpenFile *fptr; int fd; + FILE *f; if (TYPE(val) != T_FILE) { TypeError("$stderr must be IO Object"); } - GetOpenFile(val, fptr); - io_writable(fptr); - rb_stderr = val; - - fd = fileno(fptr->f2?fptr->f2:fptr->f); - if (fd != 2) { - FILE *f; - - fflush(stderr); - dup2(fd, 2); - f = rb_fdopen(2, io_mode_string(fptr)); - if (fptr->f2) { - if (fileno(fptr->f2) < 3) /* need to keep stdio */ - fclose(fptr->f2); - fptr->f2 = f; - } - else { - if (fileno(fptr->f) < 3) - fclose(fptr->f); - fptr->f = f; - } - } + io_reopen(rb_stderr, val); } static VALUE diff --git a/object.c b/object.c index 18c011c3e5..1ba155cbfa 100644 --- a/object.c +++ b/object.c @@ -81,7 +81,7 @@ obj_type(obj) { VALUE cl = CLASS_OF(obj); - if (FL_TEST(cl, FL_SINGLETON)) { + while (FL_TEST(cl, FL_SINGLETON) || TYPE(cl) == T_ICLASS) { cl = RCLASS(cl)->super; } return cl; diff --git a/sample/rbc.rb b/sample/rbc.rb index 485b558adb..f1a1f0ba0a 100644 --- a/sample/rbc.rb +++ b/sample/rbc.rb @@ -2,8 +2,8 @@ # # rbc.rb - # $Release Version: 0.6 $ -# $Revision: 1.1.1.1 $ -# $Date: 1998/01/16 04:14:56 $ +# $Revision: 1.1.1.1.2.1 $ +# $Date: 1998/01/16 12:36:10 $ # by Keiju ISHITSUKA(Nippon Rational Inc.) # # -- @@ -32,7 +32,7 @@ require "e2mmap.rb" $stdout.sync = TRUE module BC_APPLICATION__ - RCS_ID='-$Header: /home/cvsroot/ruby/sample/rbc.rb,v 1.1.1.1 1998/01/16 04:14:56 matz Exp $-' + RCS_ID='-$Header: /home/cvsroot/ruby/sample/rbc.rb,v 1.1.1.1.2.1 1998/01/16 12:36:10 matz Exp $-' extend Exception2MessageMapper def_exception :UnrecognizedSwitch, "Unrecognized switch: %s" @@ -120,9 +120,9 @@ module BC_APPLICATION__ if line != "\n" begin if CONFIG[:INSPECT] - print (cont._=eval(line, bind)).inspect, "\n" + print((cont._=eval(line, bind)).inspect, "\n") else - print (cont._=eval(line, bind)), "\n" + print((cont._=eval(line, bind)), "\n") end rescue # $! = 'exception raised' unless $! diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el index fdf016c52b..a09205e859 100644 --- a/sample/ruby-mode.el +++ b/sample/ruby-mode.el @@ -8,7 +8,10 @@ (defconst ruby-mode-revision "$Revision$") -(defconst ruby-mode-version "$Id$") +(defconst ruby-mode-version + (progn + (string-match "[0-9.]+" ruby-mode-revision) + (substring ruby-mode-revision (match-beginning 0) (match-end 0)))) (defconst ruby-block-beg-re "class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin\\|do" -- cgit v1.2.3