[#20083] non-block IO with TCPSocket — dn <daisuke@...>

初投稿の中村と申します。よろしくお願いします。

19 messages 2000/01/06
[#20084] Re: non-block IO with TCPSocket — Tomoyuki Kosimizu <greentea@...2.so-net.ne.jp> 2000/01/06

越水です。

[#20091] Re: non-block IO with TCPSocket — とみたまさひろ <tommy@...> 2000/01/06

とみたです。

[#20133] おききしたーいでーす — akimaru <akimaru@...>

17 messages 2000/01/09
[#20138] Re: おききしたーいでーす — akimaru <akimaru@...> 2000/01/09

[#20237] Ruby/Tk multi interpreter — nagai@...

永井@知能.九工大です.

21 messages 2000/01/17
[#20242] Re: Ruby/Tk multi interpreter — nagai@... 2000/01/17

永井@知能.九工大です.

[#20248] Re: Ruby/Tk multi interpreter — Hideto ISHIBASHI <s34204@...> 2000/01/17

石橋秀仁です。

[#20254] Re: Ruby/Tk multi interpreter — nagai@... 2000/01/18

永井@知能.九工大です.

[#20271] Re: Ruby/Tk multi interpreter — Hideto ISHIBASHI <s34204@...> 2000/01/18

石橋秀仁です。

[#20249] FTP.open err for Windows95 — "Y Kataoka" <kataoka@...>

初めまして、片岡@KLUGと申します。

18 messages 2000/01/17
[#20252] Re: FTP.open err for Windows95 — "NAKAMURA, Hiroshi" <nakahiro@...> 2000/01/18

なひです.

[#20342] How to build ruby(current) with cygwin — KORIYAMA Naohiro <kory@...2.so-net.ne.jp>

はじめまして、こおりやまです。

19 messages 2000/01/23
[#20362] Re: How to build ruby(current) with cygwin — WATANABE Hirofumi <Hirofumi.Watanabe@...> 2000/01/24

わたなべです.

[#20422] Re: How to build ruby(current) with cygwin — Masaki Suketa<CQN02273@...> 2000/01/29

Win32OLE の作者の助田です.

[#20394] ruby-1.4.3 port to HPUX 11.00 — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

15 messages 2000/01/26

[ruby-list:20125] Re: 改行コード

From: nobu.nakada@...
Date: 2000-01-09 02:34:17 UTC
List: ruby-list #20125
なかだです。

At Sun, 19 Dec 1999 15:49:21 +0900,
Nobuyoshi-Nakada wrote:
>   何やらめんどくさそうなので、デフォルトをバイナリにするオプショ
> ンとかがあると DOSish な人には便利かも知れませんね。私関係ないの
> で、手は出しませんが。:-p

  とか寝言をほざいてたら、なんか人事ではなくなりそう(;_;)なので作っ
てしまいました。

  自宅だと DOS/Windows 環境がないのでテストしてませんが。


diff -ru2p dist/ChangeLog build/ChangeLog
--- dist/ChangeLog	Sat Jan  8 21:59:19 2000
+++ build/ChangeLog	Sun Jan  9 11:26:28 2000
@@ -1,2 +1,15 @@
+Sun Jan  9 11:19:49 2000  Nobuyoshi Nakada  <nobu.nakada@nifty.ne.jp>
+
+	* intern.h,io.c (rb_io_set_default_fmode, rb_io_get_default_fmode):
+	  added.
+
+	* io.c (rb_io_mode_flags, rb_io_mode_flags2): defaulted `flags' to
+	  `default_fmode'.
+
+	* io.c (Init_IO): added new attribute `binmode' to class IO.
+
+	* ruby.c(usage, proc_options): added `-B' command line option to
+	  default IO mode to binary.
+
 Fri Jan  7 00:59:29 2000  Masahiro Tomita  <tommy@tmtm.org>
 
diff -ru2p dist/intern.h build/intern.h
--- dist/intern.h	Wed Jan  5 19:30:22 2000
+++ build/intern.h	Sun Jan  9 11:03:00 2000
@@ -184,4 +184,6 @@ /* io.c */
 VALUE rb_io_eof _((VALUE));
 VALUE rb_io_binmode _((VALUE));
+VALUE rb_io_set_default_fmode _((VALUE, VALUE));
+VALUE rb_io_get_default_fmode _((VALUE));
 VALUE rb_file_open _((const char*, const char*));
 VALUE rb_gets _((void));
diff -ru2p dist/io.c build/io.c
--- dist/io.c	Sat Jan  8 21:59:25 2000
+++ build/io.c	Sun Jan  9 11:00:21 2000
@@ -1129,9 +1129,26 @@ rb_io_binmode(io)
 }
 
+static int default_fmode = 0;
+
+VALUE
+rb_io_set_default_fmode(io, mode)
+    VALUE io, mode;
+{
+    default_fmode = RTEST(mode) ? FMODE_BINMODE : 0;
+    return mode;
+}
+
+VALUE
+rb_io_get_default_fmode(io)
+    VALUE io;
+{
+    return default_fmode & FMODE_BINMODE ? Qtrue : Qfalse;
+}
+
 int
 rb_io_mode_flags(mode)
     const char *mode;
 {
-    int flags = 0;
+    int flags = default_fmode;
 
     switch (mode[0]) {
@@ -1168,15 +1185,15 @@ rb_io_mode_flags2(mode)
     int mode;
 {
-    int flags;
+    int flags = default_fmode;
 
     switch (mode & (O_RDONLY|O_WRONLY|O_RDWR)) {
       case O_RDONLY:	
-	flags = FMODE_READABLE;
+	flags |= FMODE_READABLE;
 	break;
       case O_WRONLY:
-	flags = FMODE_WRITABLE;
+	flags |= FMODE_WRITABLE;
 	break;
       case O_RDWR:
-	flags = FMODE_WRITABLE|FMODE_READABLE;
+	flags |= FMODE_WRITABLE|FMODE_READABLE;
 	break;
     }
@@ -3216,4 +3233,6 @@ Init_IO()
     rb_define_singleton_method(rb_cIO, "select", rb_f_select, -1);
     rb_define_singleton_method(rb_cIO, "pipe", rb_io_s_pipe, 0);
+    rb_define_singleton_method(rb_cIO, "binmode", rb_io_get_default_fmode, 0);
+    rb_define_singleton_method(rb_cIO, "binmode=", rb_io_set_default_fmode, 1);
 
     rb_output_fs = Qnil;
diff -ru2p dist/ruby.c build/ruby.c
--- dist/ruby.c	Wed Jan  5 19:30:24 2000
+++ build/ruby.c	Sun Jan  9 11:00:16 2000
@@ -79,4 +79,5 @@ usage(name)
 "-0[octal]       specify record separator (\\0, if no argument)",
 "-a              autosplit mode with -n or -p (splits $_ into $F)",
+"-B              set IO.binmode to true",
 "-c              check syntax only",
 "-Cdirectory     cd to directory, before executing your script",
@@ -540,4 +541,9 @@ proc_options(argc, argv)
 	    }
 	    break;
+
+	  case 'B':
+	    rb_io_set_default_fmode(rb_cIO, Qtrue);
+	    s++;
+	    goto reswitch;
 
 	  case '*':

-- 
そうだ 強気に ちょっと インチキに☆彡
    中田 "Bugるくらいがちょうどいいかも;-)" 伸悦

In This Thread