[前][次][番号順一覧][スレッド一覧]

ruby-changes:10274

From: yugui <ko1@a...>
Date: Wed, 28 Jan 2009 18:22:17 +0900 (JST)
Subject: [ruby-changes:10274] Ruby:r21817 (ruby_1_9_1): merges r21715 and r21718 from trunk into ruby_1_9_1.

yugui	2009-01-28 18:20:46 +0900 (Wed, 28 Jan 2009)

  New Revision: 21817

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21817

  Log:
    merges r21715 and r21718 from trunk into ruby_1_9_1.
    * io.c (rb_io_ungetbyte, rb_io_ungetc): clears EOF flag.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/io.c
    branches/ruby_1_9_1/ruby.c

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 21816)
+++ ruby_1_9_1/ChangeLog	(revision 21817)
@@ -1,3 +1,15 @@
+Wed Jan 21 21:43:50 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (rb_io_ungetbyte, rb_io_ungetc): allows nil to reset EOF
+	  flag with ungetting nothing.
+
+	* ruby.c (load_file_internal): rests EOF flag to make possible to
+	  load from stdin after reading data.
+
+Wed Jan 21 15:32:15 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (rb_io_ungetbyte, rb_io_ungetc): clears EOF flag.
+
 Wed Jan 21 13:58:17 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/io.h (FMODE_EOF): EOF flag on TTY.
Index: ruby_1_9_1/io.c
===================================================================
--- ruby_1_9_1/io.c	(revision 21816)
+++ ruby_1_9_1/io.c	(revision 21817)
@@ -354,7 +354,8 @@
 }
 
 #define io_set_eof(fptr) (void)(((fptr)->mode & FMODE_TTY) && ((fptr)->mode |= FMODE_EOF))
-#define io_seek(fptr, ofs, whence) (fptr->mode &= ~FMODE_EOF, lseek(flush_before_seek(fptr)->fd, ofs, whence))
+#define io_unset_eof(fptr) (fptr->mode &= ~FMODE_EOF)
+#define io_seek(fptr, ofs, whence) (io_unset_eof(fptr), lseek(flush_before_seek(fptr)->fd, ofs, whence))
 #define io_tell(fptr) lseek(flush_before_seek(fptr)->fd, 0, SEEK_CUR)
 
 #ifndef SEEK_CUR
@@ -2845,6 +2846,7 @@
 
     GetOpenFile(io, fptr);
     rb_io_check_readable(fptr);
+    io_unset_eof(fptr);
     if (NIL_P(b)) return Qnil;
     if (FIXNUM_P(b)) {
 	char cc = FIX2INT(b);
@@ -2881,6 +2883,7 @@
 
     GetOpenFile(io, fptr);
     rb_io_check_readable(fptr);
+    io_unset_eof(fptr);
     if (NIL_P(c)) return Qnil;
     if (FIXNUM_P(c)) {
 	int cc = FIX2INT(c);
Index: ruby_1_9_1/ruby.c
===================================================================
--- ruby_1_9_1/ruby.c	(revision 21816)
+++ ruby_1_9_1/ruby.c	(revision 21817)
@@ -1552,6 +1552,7 @@
 	    rb_io_ungetbyte(f, c);
 	}
 	require_libraries(opt);	/* Why here? unnatural */
+	rb_io_ungetbyte(f, Qnil);
     }
     if (opt->src.enc.index >= 0) {
 	enc = rb_enc_from_index(opt->src.enc.index);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]