[Feature:trunk] IO#binmode?

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

IO#binmode? e$B$H$$$&%a%=%C%I$,$"$k$H$&$l$7$$$3$H$,$"$k$s$8$c$Je(B
e$B$$$+$H$$$&5$$,$7$^$7$?!#e(B

Windowse$B$H$+$8$c$J$$$H0UL#$J$$$G$9$,!#e(B

1.9.0-2e$B$N8e$K$J$k$H;W$$$^$9$,!"F~$l$F$b$$$$$G$7$g$&$+e(B?

Index: io.c

— io.c (revision 17388)
+++ io.c (working copy)
@@ -3167,6 +3167,20 @@ rb_io_binmode_m(VALUE io)
return io;
}

+/*

    • call-seq:
    • ios.binmode?    => true or false
      
    • Returns true if ios is binmode.
  • */
    +static VALUE
    +rb_io_binmode_p(VALUE io)
    +{
  • rb_io_t *fptr;
  • GetOpenFile(io, fptr);
  • return fptr->mode & FMODE_BINMODE ? Qtrue : Qfalse;
    +}

static const char*
rb_io_flags_mode(int flags)
{
@@ -7703,6 +7717,7 @@ Init_IO(void)
rb_define_method(rb_cIO, “isatty”, rb_io_isatty, 0);
rb_define_method(rb_cIO, “tty?”, rb_io_isatty, 0);
rb_define_method(rb_cIO, “binmode”, rb_io_binmode_m, 0);

  • rb_define_method(rb_cIO, “binmode?”, rb_io_binmode_p, 0);
    rb_define_method(rb_cIO, “sysseek”, rb_io_sysseek, -1);

    rb_define_method(rb_cIO, “ioctl”, rb_io_ioctl, -1);

e$B$=$l$G$O!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:35148] [Feature:trunk] IO#binmode?”
on Wed, 18 Jun 2008 00:37:35 +0900, “U.Nakamura”
[email protected] writes:

|IO#binmode? e$B$H$$$&%a%=%C%I$,$“$k$H$&$l$7$$$3$H$,$”$k$s$8$c$Je(B
|e$B$$$+$H$$$&5$$,$7$^$7$?!#e(B
|# Windowse$B$H$+$8$c$J$$$H0UL#$J$$$G$9$,!#e(B
|
|1.9.0-2e$B$N8e$K$J$k$H;W$$$^$9$,!"F~$l$F$b$$$$$G$7$g$&$+e(B?

e$B$I$&$>!#e(B

e$B%A%1%C%He(B #177 e$B$,99?7$5$l$^$7$?!#e(B (by Usaku NAKAMURA)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r17507.

http://redmine.ruby-lang.org/issues/show/177