summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-04-11 10:03:01 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-04-11 10:03:01 +0000
commit5527b3b961a76f2de03a5e42b80a99d8f9b44bdf (patch)
tree5ff49695caf66116c44adbd1a331e53eeab4dd43
parent3a202ff2b4b39e910c7b99e2993ac5e5e12f2ad1 (diff)
* 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. * dir.c (glob_helper): should have proceed link when link->path was non existing symbolic link. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog16
-rw-r--r--configure.in2
-rw-r--r--eval.c2
-rw-r--r--lib/cgi.rb26
-rw-r--r--math.c27
-rw-r--r--object.c2
-rw-r--r--parse.y4
-rw-r--r--variable.c16
8 files changed, 68 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 4228f4534b3..6248c970333 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,22 @@ Thu Apr 11 09:31:19 2002 Takaaki Tateishi <ttate@kt.jaist.ac.jp>
* ext/dl/sym.c: ditto.
+Thu Apr 11 07:57:48 2002 Michal Rokos <m.rokos@sh.cvut.cz>
+
+ * 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 <ttate@kt.jaist.ac.jp>
* ext/dl: Add dl.txt instead of README and README.html.
diff --git a/configure.in b/configure.in
index e4aa4463405..b4d0b5110f7 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 <time.h>],
diff --git a/eval.c b/eval.c
index 28064c8625c..82068f140fe 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 84d545f464e..05b59193628 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")
# <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
- # <INPUT TYPE="checkbox" SELECTED NAME="name" VALUE="bar">bar
+ # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="bar">bar
# <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz
checkbox_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
# <INPUT TYPE="checkbox" NAME="name" VALUE="1">Foo
- # <INPUT TYPE="checkbox" SELECTED NAME="name" VALUE="2">Bar
+ # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="2">Bar
# <INPUT TYPE="checkbox" NAME="name" VALUE="Baz">Baz
checkbox_group({ "NAME" => "name",
@@ -1213,7 +1213,7 @@ convert string charset, and set language to "ja".
# <INPUT TYPE="file" NAME="name" SIZE="40">
file_field("name", 40, 100)
- # <INPUT TYPE="file" NAME="name" SIZE="40", MAXLENGTH="100">
+ # <INPUT TYPE="file" NAME="name" SIZE="40" MAXLENGTH="100">
file_field({ "NAME" => "name", "SIZE" => 40 })
# <INPUT TYPE="file" NAME="name" SIZE="40">
@@ -1372,7 +1372,7 @@ The hash keys are case sensitive. Ask the samples.
# <INPUT TYPE="image" SRC="url">
image_button("url", "name", "string")
- # <INPUT TYPE="image" SRC="url" NAME="name", ALT="string">
+ # <INPUT TYPE="image" SRC="url" NAME="name" ALT="string">
image_button({ "SRC" => "url", "ATL" => "strng" })
# <INPUT TYPE="image" SRC="url" ALT="string">
@@ -1393,10 +1393,10 @@ The hash keys are case sensitive. Ask the samples.
=begin
=== IMG ELEMENT
img("src", "alt", 100, 50)
- # <IMG SRC="src" ALT="alt" WIDTH="100", HEIGHT="50">
+ # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50">
img({ "SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50 })
- # <IMG SRC="src" ALT="alt" WIDTH="100", HEIGHT="50">
+ # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50">
=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.
# <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="40">
password_field("password", "value", 80, 200)
- # <INPUT TYPE="password" NAME="name" VALUE="value", SIZE="80", MAXLENGTH="200">
+ # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200">
password_field({ "NAME" => "name", "VALUE" => "value" })
# <INPUT TYPE="password" NAME="name" VALUE="value">
@@ -1536,10 +1536,10 @@ The hash keys are case sensitive. Ask the samples.
=begin
=== RADIO_BUTTON
radio_button("name", "value")
- # <INPUT TYPE="radio" NAME="name", VALUE="value">
+ # <INPUT TYPE="radio" NAME="name" VALUE="value">
radio_button("name", "value", true)
- # <INPUT TYPE="radio" NAME="name", VALUE="value", CHECKED>
+ # <INPUT TYPE="radio" NAME="name" VALUE="value" CHECKED>
radio_button({ "NAME" => "name", "VALUE" => "value", "ID" => "foo" })
# <INPUT TYPE="radio" 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")
# <INPUT TYPE="radio" NAME="name" VALUE="foo">foo
- # <INPUT TYPE="radio" SELECTED NAME="name" VALUE="bar">bar
+ # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="bar">bar
# <INPUT TYPE="radio" NAME="name" VALUE="baz">baz
radio_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
# <INPUT TYPE="radio" NAME="name" VALUE="1">Foo
- # <INPUT TYPE="radio" SELECTED NAME="name" VALUE="2">Bar
+ # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="2">Bar
# <INPUT TYPE="radio" NAME="name" VALUE="Baz">Baz
radio_group({ "NAME" => "name",
@@ -1672,10 +1672,10 @@ The hash keys are case sensitive. Ask the samples.
# <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="40">
text_field("name", "value", 80)
- # <INPUT TYPE="text" NAME="name" VALUE="value", SIZE="80">
+ # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80">
text_field("name", "value", 80, 200)
- # <INPUT TYPE="text" NAME="name" VALUE="value", SIZE="80", MAXLENGTH="200">
+ # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200">
text_field({ "NAME" => "name", "VALUE" => "value" })
# <INPUT TYPE="text" NAME="name" VALUE="value">
diff --git a/math.c b/math.c
index c900a0b7aa0..ba5a12128a3 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 a954d8ad884..dd3ad41664d 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 ae2d97d212c..2217cacfe7a 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 9a25caa2a72..339df10db1f 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;