diff --git a/ChangeLog b/ChangeLog index 4228f4534b..6248c97033 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,22 @@ Thu Apr 11 09:31:19 2002 Takaaki Tateishi * ext/dl/sym.c: ditto. +Thu Apr 11 07:57:48 2002 Michal Rokos + + * eval.c (assign): ruby_verbose should be surrounded by RTEST(). + + * object.c (rb_str2cstr): ditto. + + * parse.y (void_expr): ditto. + + * parse.y (void_stmts): ditto. + + * variable.c (rb_ivar_get): ditto. + + * variable.c (rb_cvar_set): ditto. + + * variable.c (rb_cvar_get): ditto. + Thu Apr 11 07:02:31 2002 Takaaki Tateishi * ext/dl: Add dl.txt instead of README and README.html. diff --git a/configure.in b/configure.in index e4aa446340..b4d0b5110f 100644 --- a/configure.in +++ b/configure.in @@ -308,7 +308,7 @@ AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall chroot fsync\ setrgid setegid setregid setresgid pause lchown lchmod\ getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\ dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod\ - mktime timegm) + mktime timegm cosh sinh tanh) AC_STRUCT_TIMEZONE AC_CACHE_CHECK(for struct tm.tm_gmtoff, rb_cv_member_struct_tm_tm_gmtoff, [AC_TRY_COMPILE([#include ], diff --git a/eval.c b/eval.c index 28064c8625..82068f140f 100644 --- a/eval.c +++ b/eval.c @@ -3935,7 +3935,7 @@ assign(self, lhs, val, pcall) break; case NODE_CVDECL: - if (ruby_verbose && FL_TEST(ruby_cbase, FL_SINGLETON)) { + if (RTEST(ruby_verbose) && FL_TEST(ruby_cbase, FL_SINGLETON)) { rb_warn("declaring singleton class variable"); } rb_cvar_set(cvar_cbase(), lhs->nd_vid, val, Qtrue); diff --git a/lib/cgi.rb b/lib/cgi.rb index 84d545f464..05b5919362 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -1166,12 +1166,12 @@ convert string charset, and set language to "ja". checkbox_group("name", ["foo"], ["bar", true], "baz") # foo - # bar + # bar # baz checkbox_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz") # Foo - # Bar + # Bar # Baz checkbox_group({ "NAME" => "name", @@ -1213,7 +1213,7 @@ convert string charset, and set language to "ja". # file_field("name", 40, 100) - # + # file_field({ "NAME" => "name", "SIZE" => 40 }) # @@ -1372,7 +1372,7 @@ The hash keys are case sensitive. Ask the samples. # image_button("url", "name", "string") - # + # image_button({ "SRC" => "url", "ATL" => "strng" }) # @@ -1393,10 +1393,10 @@ The hash keys are case sensitive. Ask the samples. =begin === IMG ELEMENT img("src", "alt", 100, 50) - # alt + # alt img({ "SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50 }) - # alt + # alt =end def img(src = "", alt = "", width = nil, height = nil) attributes = if src.kind_of?(String) @@ -1450,7 +1450,7 @@ The hash keys are case sensitive. Ask the samples. # password_field("password", "value", 80, 200) - # + # password_field({ "NAME" => "name", "VALUE" => "value" }) # @@ -1536,10 +1536,10 @@ The hash keys are case sensitive. Ask the samples. =begin === RADIO_BUTTON radio_button("name", "value") - # + # radio_button("name", "value", true) - # + # radio_button({ "NAME" => "name", "VALUE" => "value", "ID" => "foo" }) # @@ -1565,12 +1565,12 @@ The hash keys are case sensitive. Ask the samples. radio_group("name", ["foo"], ["bar", true], "baz") # foo - # bar + # bar # baz radio_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz") # Foo - # Bar + # Bar # Baz radio_group({ "NAME" => "name", @@ -1672,10 +1672,10 @@ The hash keys are case sensitive. Ask the samples. # text_field("name", "value", 80) - # + # text_field("name", "value", 80, 200) - # + # text_field({ "NAME" => "name", "VALUE" => "value" }) # diff --git a/math.c b/math.c index c900a0b7aa..ba5a12128a 100644 --- a/math.c +++ b/math.c @@ -88,6 +88,15 @@ math_atan(obj, x) return rb_float_new(atan(RFLOAT(x)->value)); } +#ifndef HAVE_COSH +double +cosh(x) + double x; +{ + return (exp(x) + exp(-x)) / 2; +} +#endif + static VALUE math_cosh(obj, x) VALUE obj, x; @@ -96,6 +105,15 @@ math_cosh(obj, x) return rb_float_new(cosh(RFLOAT(x)->value)); } +#ifndef HAVE_SINH +double +sinh(x) + double x; +{ + return (exp(x) - exp(-x)) / 2; +} +#endif + static VALUE math_sinh(obj, x) VALUE obj, x; @@ -104,6 +122,15 @@ math_sinh(obj, x) return rb_float_new(sinh(RFLOAT(x)->value)); } +#ifndef HAVE_SINH +double +tanh(x) + double x; +{ + return sinh(x) / cosh(x); +} +#endif + static VALUE math_tanh(obj, x) VALUE obj, x; diff --git a/object.c b/object.c index a954d8ad88..dd3ad41664 100644 --- a/object.c +++ b/object.c @@ -1116,7 +1116,7 @@ rb_str2cstr(str, len) { StringValue(str); if (len) *len = RSTRING(str)->len; - else if (ruby_verbose && RSTRING(str)->len != strlen(RSTRING(str)->ptr)) { + else if (RTEST(ruby_verbose) && RSTRING(str)->len != strlen(RSTRING(str)->ptr)) { rb_warn("string contains \\0 character"); } return RSTRING(str)->ptr; diff --git a/parse.y b/parse.y index ae2d97d212..2217cacfe7 100644 --- a/parse.y +++ b/parse.y @@ -4648,7 +4648,7 @@ void_expr(node) { char *useless = 0; - if (!ruby_verbose) return; + if (!RTEST(ruby_verbose)) return; if (!node) return; again: @@ -4742,7 +4742,7 @@ static void void_stmts(node) NODE *node; { - if (!ruby_verbose) return; + if (!RTEST(ruby_verbose)) return; if (!node) return; if (nd_type(node) != NODE_BLOCK) return; diff --git a/variable.c b/variable.c index 9a25caa2a7..339df10db1 100644 --- a/variable.c +++ b/variable.c @@ -353,9 +353,8 @@ static VALUE undef_getter(id) ID id; { - if (ruby_verbose) { - rb_warning("global variable `%s' not initialized", rb_id2name(id)); - } + rb_warning("global variable `%s' not initialized", rb_id2name(id)); + return Qnil; } @@ -945,9 +944,8 @@ rb_ivar_get(obj, id) return generic_ivar_get(obj, id); break; } - if (ruby_verbose) { - rb_warning("instance variable %s not initialized", rb_id2name(id)); - } + rb_warning("instance variable %s not initialized", rb_id2name(id)); + return Qnil; } @@ -1461,11 +1459,11 @@ rb_cvar_set(klass, id, val, warn) if (OBJ_FROZEN(tmp)) rb_error_frozen("class/module"); if (!OBJ_TAINTED(tmp) && rb_safe_level() >= 4) rb_raise(rb_eSecurityError, "Insecure: can't modify class variable"); - if (warn && ruby_verbose && klass != tmp) { + if (warn && RTEST(ruby_verbose) && klass != tmp) { rb_warning("already initialized class variable %s", rb_id2name(id)); } st_insert(RCLASS(tmp)->iv_tbl,id,val); - if (ruby_verbose) { + if (RTEST(ruby_verbose)) { cvar_override_check(id, tmp); } return; @@ -1488,7 +1486,7 @@ rb_cvar_get(klass, id) while (tmp) { if (RCLASS(tmp)->iv_tbl) { if (st_lookup(RCLASS(tmp)->iv_tbl,id,&value)) { - if (ruby_verbose) { + if (RTEST(ruby_verbose)) { cvar_override_check(id, tmp); } return value;