1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2002-04-11 10:03:01 +00:00
parent 3a202ff2b4
commit 5527b3b961
8 changed files with 68 additions and 27 deletions

View file

@ -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.

View file

@ -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>],

2
eval.c
View file

@ -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);

View file

@ -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">

27
math.c
View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;