mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (str_extend): shuould allow interpolation of $-x.
* bignum.c (rb_big_eq): convert Bignum to Float, instead of reverse. * time.c (time_localtime): getting tm should not be prohibited for frozen time objects. * time.c (time_gmtime): ditto. * version.c (Init_version): freeze RUBY_VERSION, RUBY_RELEASE_DATE, and RUBY_PLATFORM. * file.c (Init_File): freeze File::SEPARATOR, ALT_SEPARATOR and PATH_SEPARATOR. * file.c (rb_stat_cmp): should check operand type before calling get_stat(). * eval.c (rb_eval_cmd): should not invoke "call" with a block on any occasion. * numeric.c (fix_aref): idx may be a Bignum. * numeric.c (num_remainder): a bug in Numeric#remainder. * eval.c (rb_exec_end_proc): END might be called within END block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b072916358
commit
35b21a12c0
11 changed files with 124 additions and 39 deletions
43
ChangeLog
43
ChangeLog
|
@ -1,3 +1,46 @@
|
||||||
|
Mon Oct 29 07:57:31 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (str_extend): shuould allow interpolation of $-x.
|
||||||
|
|
||||||
|
Sat Oct 27 23:01:19 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* bignum.c (rb_big_eq): convert Bignum to Float, instead of
|
||||||
|
reverse.
|
||||||
|
|
||||||
|
Fri Oct 26 06:19:29 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* time.c (time_localtime): getting tm should not be prohibited for
|
||||||
|
frozen time objects.
|
||||||
|
|
||||||
|
* time.c (time_gmtime): ditto.
|
||||||
|
|
||||||
|
* version.c (Init_version): freeze RUBY_VERSION,
|
||||||
|
RUBY_RELEASE_DATE, and RUBY_PLATFORM.
|
||||||
|
|
||||||
|
* file.c (Init_File): freeze File::SEPARATOR, ALT_SEPARATOR and
|
||||||
|
PATH_SEPARATOR.
|
||||||
|
|
||||||
|
* file.c (rb_stat_cmp): should check operand type before calling
|
||||||
|
get_stat().
|
||||||
|
|
||||||
|
Thu Oct 25 10:28:15 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_eval_cmd): should not invoke "call" with a block on
|
||||||
|
any occasion.
|
||||||
|
|
||||||
|
Wed Oct 24 03:25:31 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* numeric.c (fix_aref): idx may be a Bignum.
|
||||||
|
|
||||||
|
Mon Oct 22 18:53:55 2001 Masahiro Tanaka <masa@stars.gsfc.nasa.gov>
|
||||||
|
|
||||||
|
* numeric.c (num_remainder): a bug in Numeric#remainder.
|
||||||
|
|
||||||
|
Mon Oct 22 15:21:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_exec_end_proc): END might be called within END
|
||||||
|
block.
|
||||||
|
|
||||||
Fri Oct 19 23:40:37 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
Fri Oct 19 23:40:37 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||||
|
|
||||||
* variable.c (remove_trace): should not access already freed area.
|
* variable.c (remove_trace): should not access already freed area.
|
||||||
|
|
3
bignum.c
3
bignum.c
|
@ -591,8 +591,7 @@ rb_big_eq(x, y)
|
||||||
case T_BIGNUM:
|
case T_BIGNUM:
|
||||||
break;
|
break;
|
||||||
case T_FLOAT:
|
case T_FLOAT:
|
||||||
y = dbl2big(RFLOAT(y)->value);
|
return (rb_big2dbl(x) == RFLOAT(y)->value)?Qtrue:Qfalse;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
18
eval.c
18
eval.c
|
@ -1319,8 +1319,10 @@ rb_eval_cmd(cmd, arg)
|
||||||
volatile int safe = ruby_safe_level;
|
volatile int safe = ruby_safe_level;
|
||||||
|
|
||||||
if (TYPE(cmd) != T_STRING) {
|
if (TYPE(cmd) != T_STRING) {
|
||||||
return rb_funcall2(cmd, rb_intern("call"),
|
PUSH_ITER(ITER_NOT);
|
||||||
RARRAY(arg)->len, RARRAY(arg)->ptr);
|
val = rb_funcall2(cmd, rb_intern("call"), RARRAY(arg)->len, RARRAY(arg)->ptr);
|
||||||
|
POP_ITER();
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
saved_scope = ruby_scope;
|
saved_scope = ruby_scope;
|
||||||
|
@ -5877,10 +5879,10 @@ rb_f_at_exit()
|
||||||
void
|
void
|
||||||
rb_exec_end_proc()
|
rb_exec_end_proc()
|
||||||
{
|
{
|
||||||
struct end_proc_data *link;
|
struct end_proc_data *link, *save;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
link = end_procs;
|
save = link = end_procs;
|
||||||
while (link) {
|
while (link) {
|
||||||
rb_protect((VALUE(*)())link->func, link->data, &status);
|
rb_protect((VALUE(*)())link->func, link->data, &status);
|
||||||
if (status) {
|
if (status) {
|
||||||
|
@ -5888,6 +5890,14 @@ rb_exec_end_proc()
|
||||||
}
|
}
|
||||||
link = link->next;
|
link = link->next;
|
||||||
}
|
}
|
||||||
|
link = end_procs;
|
||||||
|
while (link != save) {
|
||||||
|
rb_protect((VALUE(*)())link->func, link->data, &status);
|
||||||
|
if (status) {
|
||||||
|
error_handle(status);
|
||||||
|
}
|
||||||
|
link = link->next;
|
||||||
|
}
|
||||||
while (ephemeral_end_procs) {
|
while (ephemeral_end_procs) {
|
||||||
link = ephemeral_end_procs;
|
link = ephemeral_end_procs;
|
||||||
ephemeral_end_procs = link->next;
|
ephemeral_end_procs = link->next;
|
||||||
|
|
|
@ -845,9 +845,11 @@ open_inet(class, h, serv, type)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (type == INET_SERVER) {
|
if (type == INET_SERVER) {
|
||||||
|
#ifndef NT
|
||||||
status = 1;
|
status = 1;
|
||||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
|
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
|
||||||
(char*)&status, sizeof(status));
|
(char*)&status, sizeof(status));
|
||||||
|
#endif
|
||||||
status = bind(fd, res->ai_addr, res->ai_addrlen);
|
status = bind(fd, res->ai_addr, res->ai_addrlen);
|
||||||
syscall = "bind(2)";
|
syscall = "bind(2)";
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,9 @@ module TkComm
|
||||||
def tk_split_list(str)
|
def tk_split_list(str)
|
||||||
return [] if str == ""
|
return [] if str == ""
|
||||||
idx = str.index('{')
|
idx = str.index('{')
|
||||||
|
while idx and idx > 0 and str[idx-1] == ?\\
|
||||||
|
idx = str.index('{', idx+1)
|
||||||
|
end
|
||||||
return tk_tcl2ruby(str) unless idx
|
return tk_tcl2ruby(str) unless idx
|
||||||
|
|
||||||
list = tk_tcl2ruby(str[0,idx])
|
list = tk_tcl2ruby(str[0,idx])
|
||||||
|
@ -102,6 +105,9 @@ module TkComm
|
||||||
def tk_split_simplelist(str)
|
def tk_split_simplelist(str)
|
||||||
return [] if str == ""
|
return [] if str == ""
|
||||||
idx = str.index('{')
|
idx = str.index('{')
|
||||||
|
while idx and idx > 0 and str[idx-1] == ?\\
|
||||||
|
idx = str.index('{', idx+1)
|
||||||
|
end
|
||||||
return str.split unless idx
|
return str.split unless idx
|
||||||
|
|
||||||
list = str[0,idx].split
|
list = str[0,idx].split
|
||||||
|
@ -467,7 +473,15 @@ module TkCore
|
||||||
|
|
||||||
INTERP = TclTkIp.new
|
INTERP = TclTkIp.new
|
||||||
|
|
||||||
INTERP._invoke("proc", "rb_out", "args", "if {[set st [catch {ruby [format \"TkCore.callback %%Q!%s!\" $args]} ret]] != 0} {if {[regsub -all {!} $args {\\!} newargs] == 0} {return -code $st $ret} {if {[set st [catch {ruby [format \"TkCore.callback %%Q!%s!\" $newargs]} ret]] != 0} {return -code $st $ret} {return $ret}}} {return $ret}")
|
INTERP._invoke("proc", "rb_out", "args", <<-'EOL')
|
||||||
|
regsub -all {!} $args {\\!} args
|
||||||
|
regsub -all "{" $args "\\{" args
|
||||||
|
if {[set st [catch {ruby [format "TkCore.callback %%Q!%s!" $args]} ret]] != 0} {
|
||||||
|
return -code $st $ret
|
||||||
|
} {
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
EOL
|
||||||
|
|
||||||
def callback_break
|
def callback_break
|
||||||
fail TkCallbackBreak, "Tk callback returns 'break' status"
|
fail TkCallbackBreak, "Tk callback returns 'break' status"
|
||||||
|
|
9
file.c
9
file.c
|
@ -145,6 +145,7 @@ static VALUE
|
||||||
rb_stat_cmp(self, other)
|
rb_stat_cmp(self, other)
|
||||||
VALUE self, other;
|
VALUE self, other;
|
||||||
{
|
{
|
||||||
|
if (rb_obj_is_kind_of(other, rb_obj_class(self))) {
|
||||||
time_t t1 = get_stat(self)->st_mtime;
|
time_t t1 = get_stat(self)->st_mtime;
|
||||||
time_t t2 = get_stat(other)->st_mtime;
|
time_t t2 = get_stat(other)->st_mtime;
|
||||||
if (t1 == t2)
|
if (t1 == t2)
|
||||||
|
@ -153,6 +154,8 @@ rb_stat_cmp(self, other)
|
||||||
return INT2FIX(-1);
|
return INT2FIX(-1);
|
||||||
else
|
else
|
||||||
return INT2FIX(1);
|
return INT2FIX(1);
|
||||||
|
}
|
||||||
|
rb_raise(rb_eTypeError, "operand is not File::Stat");
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -2335,18 +2338,18 @@ Init_File()
|
||||||
rb_define_singleton_method(rb_cFile, "basename", rb_file_s_basename, -1);
|
rb_define_singleton_method(rb_cFile, "basename", rb_file_s_basename, -1);
|
||||||
rb_define_singleton_method(rb_cFile, "dirname", rb_file_s_dirname, 1);
|
rb_define_singleton_method(rb_cFile, "dirname", rb_file_s_dirname, 1);
|
||||||
|
|
||||||
separator = rb_str_new2("/");
|
separator = rb_obj_freeze(rb_str_new2("/"));
|
||||||
rb_define_const(rb_cFile, "Separator", separator);
|
rb_define_const(rb_cFile, "Separator", separator);
|
||||||
rb_define_const(rb_cFile, "SEPARATOR", separator);
|
rb_define_const(rb_cFile, "SEPARATOR", separator);
|
||||||
rb_define_singleton_method(rb_cFile, "split", rb_file_s_split, 1);
|
rb_define_singleton_method(rb_cFile, "split", rb_file_s_split, 1);
|
||||||
rb_define_singleton_method(rb_cFile, "join", rb_file_s_join, -2);
|
rb_define_singleton_method(rb_cFile, "join", rb_file_s_join, -2);
|
||||||
|
|
||||||
#if defined DOSISH && !defined __CYGWIN__
|
#if defined DOSISH && !defined __CYGWIN__
|
||||||
rb_define_const(rb_cFile, "ALT_SEPARATOR", rb_str_new2("\\"));
|
rb_define_const(rb_cFile, "ALT_SEPARATOR", rb_obj_freeze(rb_str_new2("\\")));
|
||||||
#else
|
#else
|
||||||
rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil);
|
rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil);
|
||||||
#endif
|
#endif
|
||||||
rb_define_const(rb_cFile, "PATH_SEPARATOR", rb_str_new2(PATH_SEP));
|
rb_define_const(rb_cFile, "PATH_SEPARATOR", rb_obj_freeze(rb_str_new2(PATH_SEP)));
|
||||||
|
|
||||||
rb_define_method(rb_cIO, "stat", rb_io_stat, 0); /* this is IO's method */
|
rb_define_method(rb_cIO, "stat", rb_io_stat, 0); /* this is IO's method */
|
||||||
rb_define_method(rb_cFile, "lstat", rb_file_lstat, 0);
|
rb_define_method(rb_cFile, "lstat", rb_file_lstat, 0);
|
||||||
|
|
12
numeric.c
12
numeric.c
|
@ -146,10 +146,11 @@ num_remainder(x, y)
|
||||||
{
|
{
|
||||||
VALUE z = rb_funcall(x, '%', 1, y);
|
VALUE z = rb_funcall(x, '%', 1, y);
|
||||||
|
|
||||||
if ((RTEST(rb_funcall(x, '<', 1, INT2FIX(0))) &&
|
if ((!RTEST(rb_equal(z, INT2FIX(0)))) &&
|
||||||
|
((RTEST(rb_funcall(x, '<', 1, INT2FIX(0))) &&
|
||||||
RTEST(rb_funcall(y, '>', 1, INT2FIX(0)))) ||
|
RTEST(rb_funcall(y, '>', 1, INT2FIX(0)))) ||
|
||||||
(RTEST(rb_funcall(x, '>', 1, INT2FIX(0))) &&
|
(RTEST(rb_funcall(x, '>', 1, INT2FIX(0))) &&
|
||||||
RTEST(rb_funcall(y, '<', 1, INT2FIX(0))))) {
|
RTEST(rb_funcall(y, '<', 1, INT2FIX(0)))))) {
|
||||||
return rb_funcall(z, '-', 1, y);
|
return rb_funcall(z, '-', 1, y);
|
||||||
}
|
}
|
||||||
return z;
|
return z;
|
||||||
|
@ -1302,6 +1303,12 @@ fix_aref(fix, idx)
|
||||||
VALUE fix, idx;
|
VALUE fix, idx;
|
||||||
{
|
{
|
||||||
long val = FIX2LONG(fix);
|
long val = FIX2LONG(fix);
|
||||||
|
|
||||||
|
if (TYPE(idx) == T_BIGNUM) {
|
||||||
|
if (val >= 0) return INT2FIX(0);
|
||||||
|
return INT2FIX(1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
int i = NUM2INT(idx);
|
int i = NUM2INT(idx);
|
||||||
|
|
||||||
if (i < 0 || sizeof(VALUE)*CHAR_BIT-1 < i) {
|
if (i < 0 || sizeof(VALUE)*CHAR_BIT-1 < i) {
|
||||||
|
@ -1311,6 +1318,7 @@ fix_aref(fix, idx)
|
||||||
if (val & (1L<<i))
|
if (val & (1L<<i))
|
||||||
return INT2FIX(1);
|
return INT2FIX(1);
|
||||||
return INT2FIX(0);
|
return INT2FIX(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
6
parse.y
6
parse.y
|
@ -3742,6 +3742,12 @@ str_extend(list, term)
|
||||||
tokadd(c);
|
tokadd(c);
|
||||||
goto fetch_id;
|
goto fetch_id;
|
||||||
|
|
||||||
|
case '-':
|
||||||
|
tokadd(c);
|
||||||
|
c = nextc();
|
||||||
|
tokadd(c);
|
||||||
|
goto fetch_id;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (c == term) {
|
if (c == term) {
|
||||||
list_append(list, NEW_STR(rb_str_new2("#$")));
|
list_append(list, NEW_STR(rb_str_new2("#$")));
|
||||||
|
|
12
time.c
12
time.c
|
@ -564,10 +564,10 @@ time_localtime(time)
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
GetTimeval(time, tobj);
|
GetTimeval(time, tobj);
|
||||||
if (tobj->tm_got && !tobj->gmt) {
|
if (tobj->tm_got) {
|
||||||
return time;
|
if (!tobj->gmt) return time;
|
||||||
}
|
|
||||||
time_modify(time);
|
time_modify(time);
|
||||||
|
}
|
||||||
t = tobj->tv.tv_sec;
|
t = tobj->tv.tv_sec;
|
||||||
tm_tmp = localtime(&t);
|
tm_tmp = localtime(&t);
|
||||||
tobj->tm = *tm_tmp;
|
tobj->tm = *tm_tmp;
|
||||||
|
@ -585,10 +585,10 @@ time_gmtime(time)
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
GetTimeval(time, tobj);
|
GetTimeval(time, tobj);
|
||||||
if (tobj->tm_got && tobj->gmt) {
|
if (tobj->tm_got) {
|
||||||
return time;
|
if (tobj->gmt) return time;
|
||||||
}
|
|
||||||
time_modify(time);
|
time_modify(time);
|
||||||
|
}
|
||||||
t = tobj->tv.tv_sec;
|
t = tobj->tv.tv_sec;
|
||||||
tm_tmp = gmtime(&t);
|
tm_tmp = gmtime(&t);
|
||||||
tobj->tm = *tm_tmp;
|
tobj->tm = *tm_tmp;
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
void
|
void
|
||||||
Init_version()
|
Init_version()
|
||||||
{
|
{
|
||||||
VALUE v = rb_str_new2(RUBY_VERSION);
|
VALUE v = rb_obj_freeze(rb_str_new2(RUBY_VERSION));
|
||||||
VALUE d = rb_str_new2(RUBY_RELEASE_DATE);
|
VALUE d = rb_obj_freeze(rb_str_new2(RUBY_RELEASE_DATE));
|
||||||
VALUE p = rb_str_new2(RUBY_PLATFORM);
|
VALUE p = rb_obj_freeze(rb_str_new2(RUBY_PLATFORM));
|
||||||
|
|
||||||
rb_define_global_const("RUBY_VERSION", v);
|
rb_define_global_const("RUBY_VERSION", v);
|
||||||
rb_define_global_const("RUBY_RELEASE_DATE", d);
|
rb_define_global_const("RUBY_RELEASE_DATE", d);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.6.5"
|
#define RUBY_VERSION "1.6.5"
|
||||||
#define RUBY_RELEASE_DATE "2001-10-22"
|
#define RUBY_RELEASE_DATE "2001-10-29"
|
||||||
#define RUBY_VERSION_CODE 165
|
#define RUBY_VERSION_CODE 165
|
||||||
#define RUBY_RELEASE_CODE 20011022
|
#define RUBY_RELEASE_CODE 20011029
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue