From f64949e2764a95e86a3851c07273f88aaac2fc7b Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 7 Sep 2009 08:12:32 +0000 Subject: * io.c (Init_IO): added rdocs for constants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 8ce11234e6..3391bea4d0 100644 --- a/io.c +++ b/io.c @@ -6451,6 +6451,7 @@ rb_file_initialize(int argc, VALUE *argv, VALUE io) return io; } +/* :nodoc: */ static VALUE rb_io_s_new(int argc, VALUE *argv, VALUE klass) { @@ -6519,6 +6520,7 @@ argf_alloc(VALUE klass) #undef rb_argv +/* :nodoc: */ static VALUE argf_initialize(VALUE argf, VALUE argv) { @@ -6528,6 +6530,7 @@ argf_initialize(VALUE argf, VALUE argv) return argf; } +/* :nodoc: */ static VALUE argf_initialize_copy(VALUE argf, VALUE orig) { @@ -9868,28 +9871,36 @@ Init_IO(void) rb_define_method(rb_cFile, "initialize", rb_file_initialize, -1); + /* open for reading only */ rb_file_const("RDONLY", INT2FIX(O_RDONLY)); + /* open for writing only */ rb_file_const("WRONLY", INT2FIX(O_WRONLY)); + /* open for reading and writing */ rb_file_const("RDWR", INT2FIX(O_RDWR)); + /* append on each write */ rb_file_const("APPEND", INT2FIX(O_APPEND)); + /* create file if it does not exist */ rb_file_const("CREAT", INT2FIX(O_CREAT)); + /* error if CREAT and the file exists */ rb_file_const("EXCL", INT2FIX(O_EXCL)); #if defined(O_NDELAY) || defined(O_NONBLOCK) -# ifdef O_NONBLOCK +# ifndef O_NONBLOCK +# define O_NONBLOCK O_NDELAY +# endif + /* do not block on open or for data to become available */ rb_file_const("NONBLOCK", INT2FIX(O_NONBLOCK)); -# else - rb_file_const("NONBLOCK", INT2FIX(O_NDELAY)); -# endif #endif + /* truncate size to 0 */ rb_file_const("TRUNC", INT2FIX(O_TRUNC)); #ifdef O_NOCTTY + /* not to make opened IO the controling terminal device */ rb_file_const("NOCTTY", INT2FIX(O_NOCTTY)); #endif -#ifdef O_BINARY - rb_file_const("BINARY", INT2FIX(O_BINARY)); -#else - rb_file_const("BINARY", INT2FIX(0)); +#ifndef O_BINARY +# define O_BINARY 0 #endif + /* disable line code conversion and make ASCII-8BIT */ + rb_file_const("BINARY", INT2FIX(O_BINARY)); #ifdef O_SYNC rb_file_const("SYNC", INT2FIX(O_SYNC)); #endif @@ -9900,9 +9911,11 @@ Init_IO(void) rb_file_const("RSYNC", INT2FIX(O_RSYNC)); #endif #ifdef O_NOFOLLOW + /* do not follow symlinks */ rb_file_const("NOFOLLOW", INT2FIX(O_NOFOLLOW)); /* FreeBSD, Linux */ #endif #ifdef O_NOATIME + /* do not change atime */ rb_file_const("NOATIME", INT2FIX(O_NOATIME)); /* Linux */ #endif -- cgit v1.2.3