1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* file.c (null_device): move from io.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-08-27 06:26:41 +00:00
parent 9614d22b5d
commit 909477ec1d
4 changed files with 18 additions and 15 deletions

View file

@ -1,3 +1,7 @@
Fri Aug 27 15:26:33 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (null_device): move from io.c.
Fri Aug 27 12:47:44 2010 Kenta Murata <mrkn@mrkn.jp> Fri Aug 27 12:47:44 2010 Kenta Murata <mrkn@mrkn.jp>
* math.c (math_atan2): change the behavior when x and y are zero. * math.c (math_atan2): change the behavior when x and y are zero.

2
NEWS
View file

@ -19,7 +19,7 @@ with all sufficient information, see the ChangeLog file.
* Float * Float
* new constants: * new constants:
* IO::NULL * File::NULL
name of NULL device. name of NULL device.
* io/console * io/console

13
file.c
View file

@ -5191,6 +5191,17 @@ define_filetest_function(const char *name, VALUE (*func)(ANYARGS), int argc)
rb_define_singleton_method(rb_cFile, name, func, argc); rb_define_singleton_method(rb_cFile, name, func, argc);
} }
static const char null_device[] =
#if defined DOSISH
"NUL"
#elif defined AMIGA || defined __amigaos__
"NIL"
#elif defined __VMS
"NL:"
#else
"/dev/null"
#endif
;
/* /*
* A <code>File</code> is an abstraction of any file object accessible * A <code>File</code> is an abstraction of any file object accessible
@ -5327,6 +5338,8 @@ Init_File(void)
rb_file_const("LOCK_UN", INT2FIX(LOCK_UN)); rb_file_const("LOCK_UN", INT2FIX(LOCK_UN));
rb_file_const("LOCK_NB", INT2FIX(LOCK_NB)); rb_file_const("LOCK_NB", INT2FIX(LOCK_NB));
rb_file_const("NULL", rb_obj_freeze(rb_usascii_str_new2(null_device)));
rb_define_method(rb_cFile, "path", rb_file_path, 0); rb_define_method(rb_cFile, "path", rb_file_path, 0);
rb_define_method(rb_cFile, "to_path", rb_file_path, 0); rb_define_method(rb_cFile, "to_path", rb_file_path, 0);
rb_define_global_function("test", rb_f_test, -1); rb_define_global_function("test", rb_f_test, -1);

14
io.c
View file

@ -9639,18 +9639,6 @@ rb_get_argv(void)
return ARGF.argv; return ARGF.argv;
} }
static const char null_device[] =
#if defined DOSISH
"NUL"
#elif defined AMIGA || defined __amigaos__
"NIL"
#elif defined __VMS
"NL:"
#else
"/dev/null"
#endif
;
/* /*
* Document-class: IOError * Document-class: IOError
* *
@ -9984,8 +9972,6 @@ Init_IO(void)
rb_define_method(rb_cIO, "autoclose?", rb_io_autoclose_p, 0); rb_define_method(rb_cIO, "autoclose?", rb_io_autoclose_p, 0);
rb_define_method(rb_cIO, "autoclose=", rb_io_set_autoclose, 1); rb_define_method(rb_cIO, "autoclose=", rb_io_set_autoclose, 1);
rb_define_const(rb_cIO, "NULL", rb_obj_freeze(rb_usascii_str_new2(null_device)));
rb_define_variable("$stdin", &rb_stdin); rb_define_variable("$stdin", &rb_stdin);
rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO, "<STDIN>"); rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO, "<STDIN>");
rb_define_hooked_variable("$stdout", &rb_stdout, 0, stdout_setter); rb_define_hooked_variable("$stdout", &rb_stdout, 0, stdout_setter);