mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ruby.c (opt_W_getter): made a hooked variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d7baa40cac
commit
3e30cdad08
2 changed files with 11 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Jun 17 23:02:18 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (opt_W_getter): made a hooked variable.
|
||||
|
||||
Tue Jun 17 22:04:47 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* enc/euc_jp.c (property_name_to_ctype): core dumped when sizeof(int)
|
||||
|
|
12
ruby.c
12
ruby.c
|
@ -1446,14 +1446,16 @@ verbose_setter(VALUE val, ID id, VALUE *variable)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
opt_W_getter(VALUE val, ID id)
|
||||
opt_W_getter(VALUE val, ID id, VALUE *variable)
|
||||
{
|
||||
if (ruby_verbose == Qnil)
|
||||
switch (*variable) {
|
||||
case Qnil:
|
||||
return INT2FIX(0);
|
||||
if (ruby_verbose == Qfalse)
|
||||
case Qfalse:
|
||||
return INT2FIX(1);
|
||||
if (ruby_verbose == Qtrue)
|
||||
case Qtrue:
|
||||
return INT2FIX(2);
|
||||
}
|
||||
return Qnil; /* not reached */
|
||||
}
|
||||
|
||||
|
@ -1463,7 +1465,7 @@ ruby_prog_init(void)
|
|||
rb_define_hooked_variable("$VERBOSE", &ruby_verbose, 0, verbose_setter);
|
||||
rb_define_hooked_variable("$-v", &ruby_verbose, 0, verbose_setter);
|
||||
rb_define_hooked_variable("$-w", &ruby_verbose, 0, verbose_setter);
|
||||
rb_define_virtual_variable("$-W", opt_W_getter, 0);
|
||||
rb_define_hooked_variable("$-W", &ruby_verbose, opt_W_getter, 0);
|
||||
rb_define_variable("$DEBUG", &ruby_debug);
|
||||
rb_define_variable("$-d", &ruby_debug);
|
||||
|
||||
|
|
Loading…
Reference in a new issue