diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-29 18:26:55 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-29 18:26:55 +0000 |
commit | 24424d3991179ec50837cff97b21f646f7069447 (patch) | |
tree | 5f73958731220fb1eaba3f52421a97d0bb88ce42 /io.c | |
parent | 2579aad6fa276f46cd2841a4a735bebc164c62c0 (diff) | |
download | ruby-24424d3991179ec50837cff97b21f646f7069447.tar.gz ruby-24424d3991179ec50837cff97b21f646f7069447.tar.xz ruby-24424d3991179ec50837cff97b21f646f7069447.zip |
* marshal.c (w_object): if object responds to 'marshal_dump',
Marshal.dump uses it to dump object. unlike '_dump',
marshal_dump returns any kind of object.
* marshal.c (r_object0): restore instance by calling
'marshal_load' method. unlike '_load', it's an instance
method, to handle cyclic reference.
* marshal.c (marshal_load): all objects read from file should be
tainted. [ruby-core:01325]
* lib/timeout.rb (Timeout::timeout): execute immediately if sec is
zero.
* ext/socket/socket.c (socks_init): typo fixed. [ruby-talk:77232]
* ext/socket/extconf.rb: the default value for --enable-socks is
taken from ENV["SOCKS_SERVER"]. [ruby-talk:77232]
* ruby.c (proc_options): add -W option. -W0 to shut up all warning
messages. [ruby-talk:77227]
* error.c (rb_warn): no message will be printed if the value of
$VERBOSE is "nil", i.e. perfect silence.
* ruby.c (verbose_setter): $VERBOSE value is either true, false,
or nil.
* io.c (Init_IO): no "read" check for $stdin. in addition some
function names has been changed.
* regex.c (re_match_exec): incorrect multibyte match.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 36 |
1 files changed, 13 insertions, 23 deletions
@@ -94,7 +94,7 @@ VALUE rb_cIO; VALUE rb_eEOFError; VALUE rb_eIOError; -VALUE rb_stdin, rb_stdout, rb_stderr, rb_defout; +VALUE rb_stdin, rb_stdout, rb_stderr; static VALUE orig_stdout, orig_stderr; VALUE rb_output_fs; @@ -2779,17 +2779,7 @@ must_respond_to(mid, val, id) } static void -set_input_var(val, id, variable) - VALUE val; - ID id; - VALUE *variable; -{ - must_respond_to(id_read, val, id); - *variable = val; -} - -static void -set_output_var(val, id, variable) +stdout_setter(val, id, variable) VALUE val; ID id; VALUE *variable; @@ -2799,22 +2789,22 @@ set_output_var(val, id, variable) } static void -set_defout_var(val, id, variable) +defout_setter(val, id, variable) VALUE val; ID id; VALUE *variable; { - set_output_var(val, id, variable); + stdout_setter(val, id, variable); rb_warn("$defout is obslete; use $stdout instead"); } static void -set_deferr_var(val, id, variable) +deferr_setter(val, id, variable) VALUE val; ID id; VALUE *variable; { - set_output_var(val, id, variable); + stdout_setter(val, id, variable); rb_warn("$deferr is obslete; use $stderr instead"); } @@ -4131,18 +4121,18 @@ Init_IO() rb_define_method(rb_cIO, "inspect", rb_io_inspect, 0); rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO); - rb_define_hooked_variable("$stdin", &rb_stdin, 0, set_input_var); + rb_define_variable("$stdin", &rb_stdin); rb_stdout = prep_stdio(stdout, FMODE_WRITABLE, rb_cIO); - rb_define_hooked_variable("$stdout", &rb_stdout, 0, set_output_var); + rb_define_hooked_variable("$stdout", &rb_stdout, 0, stdout_setter); rb_stderr = prep_stdio(stderr, FMODE_WRITABLE, rb_cIO); - rb_define_hooked_variable("$stderr", &rb_stderr, 0, set_output_var); - rb_define_hooked_variable("$>", &rb_stdout, 0, set_output_var); - rb_defout = orig_stdout = rb_stdout; + rb_define_hooked_variable("$stderr", &rb_stderr, 0, stdout_setter); + rb_define_hooked_variable("$>", &rb_stdout, 0, stdout_setter); + orig_stdout = rb_stdout; orig_stderr = rb_stderr; /* variables to be removed in 1.8.1 */ - rb_define_hooked_variable("$defout", &rb_stdout, 0, set_defout_var); - rb_define_hooked_variable("$deferr", &rb_stderr, 0, set_deferr_var); + rb_define_hooked_variable("$defout", &rb_stdout, 0, defout_setter); + rb_define_hooked_variable("$deferr", &rb_stderr, 0, deferr_setter); /* constants to hold original stdin/stdout/stderr */ rb_define_global_const("STDIN", rb_stdin); |