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>
|
||||
|
||||
* 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:
|
||||
break;
|
||||
case T_FLOAT:
|
||||
y = dbl2big(RFLOAT(y)->value);
|
||||
break;
|
||||
return (rb_big2dbl(x) == RFLOAT(y)->value)?Qtrue:Qfalse;
|
||||
default:
|
||||
return Qfalse;
|
||||
}
|
||||
|
|
18
eval.c
18
eval.c
|
@ -1319,8 +1319,10 @@ rb_eval_cmd(cmd, arg)
|
|||
volatile int safe = ruby_safe_level;
|
||||
|
||||
if (TYPE(cmd) != T_STRING) {
|
||||
return rb_funcall2(cmd, rb_intern("call"),
|
||||
RARRAY(arg)->len, RARRAY(arg)->ptr);
|
||||
PUSH_ITER(ITER_NOT);
|
||||
val = rb_funcall2(cmd, rb_intern("call"), RARRAY(arg)->len, RARRAY(arg)->ptr);
|
||||
POP_ITER();
|
||||
return val;
|
||||
}
|
||||
|
||||
saved_scope = ruby_scope;
|
||||
|
@ -5877,10 +5879,10 @@ rb_f_at_exit()
|
|||
void
|
||||
rb_exec_end_proc()
|
||||
{
|
||||
struct end_proc_data *link;
|
||||
struct end_proc_data *link, *save;
|
||||
int status;
|
||||
|
||||
link = end_procs;
|
||||
save = link = end_procs;
|
||||
while (link) {
|
||||
rb_protect((VALUE(*)())link->func, link->data, &status);
|
||||
if (status) {
|
||||
|
@ -5888,6 +5890,14 @@ rb_exec_end_proc()
|
|||
}
|
||||
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) {
|
||||
link = ephemeral_end_procs;
|
||||
ephemeral_end_procs = link->next;
|
||||
|
|
|
@ -845,9 +845,11 @@ open_inet(class, h, serv, type)
|
|||
continue;
|
||||
}
|
||||
if (type == INET_SERVER) {
|
||||
#ifndef NT
|
||||
status = 1;
|
||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char*)&status, sizeof(status));
|
||||
#endif
|
||||
status = bind(fd, res->ai_addr, res->ai_addrlen);
|
||||
syscall = "bind(2)";
|
||||
}
|
||||
|
|
|
@ -77,6 +77,9 @@ module TkComm
|
|||
def tk_split_list(str)
|
||||
return [] if str == ""
|
||||
idx = str.index('{')
|
||||
while idx and idx > 0 and str[idx-1] == ?\\
|
||||
idx = str.index('{', idx+1)
|
||||
end
|
||||
return tk_tcl2ruby(str) unless idx
|
||||
|
||||
list = tk_tcl2ruby(str[0,idx])
|
||||
|
@ -102,6 +105,9 @@ module TkComm
|
|||
def tk_split_simplelist(str)
|
||||
return [] if str == ""
|
||||
idx = str.index('{')
|
||||
while idx and idx > 0 and str[idx-1] == ?\\
|
||||
idx = str.index('{', idx+1)
|
||||
end
|
||||
return str.split unless idx
|
||||
|
||||
list = str[0,idx].split
|
||||
|
@ -467,7 +473,15 @@ module TkCore
|
|||
|
||||
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
|
||||
fail TkCallbackBreak, "Tk callback returns 'break' status"
|
||||
|
|
25
file.c
25
file.c
|
@ -145,14 +145,17 @@ static VALUE
|
|||
rb_stat_cmp(self, other)
|
||||
VALUE self, other;
|
||||
{
|
||||
time_t t1 = get_stat(self)->st_mtime;
|
||||
time_t t2 = get_stat(other)->st_mtime;
|
||||
if (t1 == t2)
|
||||
return INT2FIX(0);
|
||||
else if (t1 < t2)
|
||||
return INT2FIX(-1);
|
||||
else
|
||||
return INT2FIX(1);
|
||||
if (rb_obj_is_kind_of(other, rb_obj_class(self))) {
|
||||
time_t t1 = get_stat(self)->st_mtime;
|
||||
time_t t2 = get_stat(other)->st_mtime;
|
||||
if (t1 == t2)
|
||||
return INT2FIX(0);
|
||||
else if (t1 < t2)
|
||||
return INT2FIX(-1);
|
||||
else
|
||||
return INT2FIX(1);
|
||||
}
|
||||
rb_raise(rb_eTypeError, "operand is not File::Stat");
|
||||
}
|
||||
|
||||
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, "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_singleton_method(rb_cFile, "split", rb_file_s_split, 1);
|
||||
rb_define_singleton_method(rb_cFile, "join", rb_file_s_join, -2);
|
||||
|
||||
#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
|
||||
rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil);
|
||||
#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_cFile, "lstat", rb_file_lstat, 0);
|
||||
|
|
28
numeric.c
28
numeric.c
|
@ -146,10 +146,11 @@ num_remainder(x, y)
|
|||
{
|
||||
VALUE z = rb_funcall(x, '%', 1, y);
|
||||
|
||||
if ((RTEST(rb_funcall(x, '<', 1, INT2FIX(0))) &&
|
||||
RTEST(rb_funcall(y, '>', 1, INT2FIX(0)))) ||
|
||||
(RTEST(rb_funcall(x, '>', 1, INT2FIX(0))) &&
|
||||
RTEST(rb_funcall(y, '<', 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(x, '>', 1, INT2FIX(0))) &&
|
||||
RTEST(rb_funcall(y, '<', 1, INT2FIX(0)))))) {
|
||||
return rb_funcall(z, '-', 1, y);
|
||||
}
|
||||
return z;
|
||||
|
@ -1302,15 +1303,22 @@ fix_aref(fix, idx)
|
|||
VALUE fix, idx;
|
||||
{
|
||||
long val = FIX2LONG(fix);
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || sizeof(VALUE)*CHAR_BIT-1 < i) {
|
||||
if (val < 0) return INT2FIX(1);
|
||||
if (TYPE(idx) == T_BIGNUM) {
|
||||
if (val >= 0) return INT2FIX(0);
|
||||
return INT2FIX(1);
|
||||
}
|
||||
else {
|
||||
int i = NUM2INT(idx);
|
||||
|
||||
if (i < 0 || sizeof(VALUE)*CHAR_BIT-1 < i) {
|
||||
if (val < 0) return INT2FIX(1);
|
||||
return INT2FIX(0);
|
||||
}
|
||||
if (val & (1L<<i))
|
||||
return INT2FIX(1);
|
||||
return INT2FIX(0);
|
||||
}
|
||||
if (val & (1L<<i))
|
||||
return INT2FIX(1);
|
||||
return INT2FIX(0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
6
parse.y
6
parse.y
|
@ -3742,6 +3742,12 @@ str_extend(list, term)
|
|||
tokadd(c);
|
||||
goto fetch_id;
|
||||
|
||||
case '-':
|
||||
tokadd(c);
|
||||
c = nextc();
|
||||
tokadd(c);
|
||||
goto fetch_id;
|
||||
|
||||
default:
|
||||
if (c == term) {
|
||||
list_append(list, NEW_STR(rb_str_new2("#$")));
|
||||
|
|
12
time.c
12
time.c
|
@ -564,10 +564,10 @@ time_localtime(time)
|
|||
time_t t;
|
||||
|
||||
GetTimeval(time, tobj);
|
||||
if (tobj->tm_got && !tobj->gmt) {
|
||||
return time;
|
||||
if (tobj->tm_got) {
|
||||
if (!tobj->gmt) return time;
|
||||
time_modify(time);
|
||||
}
|
||||
time_modify(time);
|
||||
t = tobj->tv.tv_sec;
|
||||
tm_tmp = localtime(&t);
|
||||
tobj->tm = *tm_tmp;
|
||||
|
@ -585,10 +585,10 @@ time_gmtime(time)
|
|||
time_t t;
|
||||
|
||||
GetTimeval(time, tobj);
|
||||
if (tobj->tm_got && tobj->gmt) {
|
||||
return time;
|
||||
if (tobj->tm_got) {
|
||||
if (tobj->gmt) return time;
|
||||
time_modify(time);
|
||||
}
|
||||
time_modify(time);
|
||||
t = tobj->tv.tv_sec;
|
||||
tm_tmp = gmtime(&t);
|
||||
tobj->tm = *tm_tmp;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
void
|
||||
Init_version()
|
||||
{
|
||||
VALUE v = rb_str_new2(RUBY_VERSION);
|
||||
VALUE d = rb_str_new2(RUBY_RELEASE_DATE);
|
||||
VALUE p = rb_str_new2(RUBY_PLATFORM);
|
||||
VALUE v = rb_obj_freeze(rb_str_new2(RUBY_VERSION));
|
||||
VALUE d = rb_obj_freeze(rb_str_new2(RUBY_RELEASE_DATE));
|
||||
VALUE p = rb_obj_freeze(rb_str_new2(RUBY_PLATFORM));
|
||||
|
||||
rb_define_global_const("RUBY_VERSION", v);
|
||||
rb_define_global_const("RUBY_RELEASE_DATE", d);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#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_RELEASE_CODE 20011022
|
||||
#define RUBY_RELEASE_CODE 20011029
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue