* time.c (time_timeval): negative time interval shoule not be
allowed. * eval.c (proc_call): ignore block to `call' always, despite of being orphan or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
df2d69b49a
commit
64fb417473
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
Tue Feb 27 16:38:15 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* time.c (time_timeval): negative time interval shoule not be
|
||||||
|
allowed.
|
||||||
|
|
||||||
|
* eval.c (proc_call): ignore block to `call' always, despite of
|
||||||
|
being orphan or not.
|
||||||
|
|
||||||
|
Mon Feb 26 16:20:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* ruby.c (proc_options): call ruby_show_version() just once.
|
||||||
|
|
||||||
|
* dir.c (dir_s_open): returns the value from a block (if given).
|
||||||
|
|
||||||
Mon Feb 26 00:04:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Feb 26 00:04:52 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (proc_call): should not modify ruby_block->frame.iter
|
* eval.c (proc_call): should not modify ruby_block->frame.iter
|
||||||
|
3
dir.c
3
dir.c
@ -280,8 +280,7 @@ dir_s_open(klass, dirname)
|
|||||||
|
|
||||||
dir_initialize(dir, dirname);
|
dir_initialize(dir, dirname);
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
rb_ensure(rb_yield, dir, dir_close, dir);
|
return rb_ensure(rb_yield, dir, dir_close, dir);
|
||||||
return Qnil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir;
|
return dir;
|
||||||
|
11
eval.c
11
eval.c
@ -198,7 +198,6 @@ print_undef(klass, id)
|
|||||||
rb_class2name(klass));
|
rb_class2name(klass));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define CACHE_SIZE 0x800
|
#define CACHE_SIZE 0x800
|
||||||
#define CACHE_MASK 0x7ff
|
#define CACHE_MASK 0x7ff
|
||||||
#define EXPR1(c,m) ((((c)>>3)^(m))&CACHE_MASK)
|
#define EXPR1(c,m) ((((c)>>3)^(m))&CACHE_MASK)
|
||||||
@ -6261,19 +6260,11 @@ proc_call(proc, args)
|
|||||||
Data_Get_Struct(proc, struct BLOCK, data);
|
Data_Get_Struct(proc, struct BLOCK, data);
|
||||||
orphan = blk_orphan(data);
|
orphan = blk_orphan(data);
|
||||||
|
|
||||||
if (orphan) {/* orphan procedure */
|
|
||||||
if (rb_block_given_p()) {
|
|
||||||
ruby_block->frame.iter = ITER_CUR;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ruby_block->frame.iter = ITER_NOT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PUSH BLOCK from data */
|
/* PUSH BLOCK from data */
|
||||||
old_block = ruby_block;
|
old_block = ruby_block;
|
||||||
_block = *data;
|
_block = *data;
|
||||||
ruby_block = &_block;
|
ruby_block = &_block;
|
||||||
|
ruby_block->frame.iter = ITER_NOT;
|
||||||
|
|
||||||
PUSH_ITER(ITER_CUR);
|
PUSH_ITER(ITER_CUR);
|
||||||
ruby_frame->iter = ITER_CUR;
|
ruby_frame->iter = ITER_CUR;
|
||||||
|
4
ruby.c
4
ruby.c
@ -430,6 +430,10 @@ proc_options(argc, argv)
|
|||||||
goto reswitch;
|
goto reswitch;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
|
if (verbose) {
|
||||||
|
s++;
|
||||||
|
goto reswitch;
|
||||||
|
}
|
||||||
ruby_show_version();
|
ruby_show_version();
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
case 'w':
|
case 'w':
|
||||||
|
28
time.c
28
time.c
@ -106,39 +106,37 @@ time_timeval(time, interval)
|
|||||||
int interval;
|
int interval;
|
||||||
{
|
{
|
||||||
struct timeval t;
|
struct timeval t;
|
||||||
|
char *tstr = interval ? "time interval" : "time";
|
||||||
|
|
||||||
|
#ifndef NEGATIVE_TIME_T
|
||||||
|
interval = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (TYPE(time)) {
|
switch (TYPE(time)) {
|
||||||
case T_FIXNUM:
|
case T_FIXNUM:
|
||||||
t.tv_sec = FIX2LONG(time);
|
t.tv_sec = FIX2LONG(time);
|
||||||
#ifndef NEGATIVE_TIME_T
|
if (interval && t.tv_sec < 0)
|
||||||
if (t.tv_sec < 0)
|
rb_raise(rb_eArgError, "%s must be positive", tstr);
|
||||||
rb_raise(rb_eArgError, "time must be positive");
|
|
||||||
#endif
|
|
||||||
t.tv_usec = 0;
|
t.tv_usec = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_FLOAT:
|
case T_FLOAT:
|
||||||
#ifndef NEGATIVE_TIME_T
|
if (interval && RFLOAT(time)->value < 0.0)
|
||||||
if (RFLOAT(time)->value < 0.0)
|
rb_raise(rb_eArgError, "%s must be positive", tstr);
|
||||||
rb_raise(rb_eArgError, "time must be positive");
|
|
||||||
#endif
|
|
||||||
t.tv_sec = (time_t)RFLOAT(time)->value;
|
t.tv_sec = (time_t)RFLOAT(time)->value;
|
||||||
t.tv_usec = (time_t)((RFLOAT(time)->value - (double)t.tv_sec)*1e6);
|
t.tv_usec = (time_t)((RFLOAT(time)->value - (double)t.tv_sec)*1e6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_BIGNUM:
|
case T_BIGNUM:
|
||||||
t.tv_sec = NUM2LONG(time);
|
t.tv_sec = NUM2LONG(time);
|
||||||
#ifndef NEGATIVE_TIME_T
|
if (interval && t.tv_sec < 0)
|
||||||
if (t.tv_sec < 0)
|
rb_raise(rb_eArgError, "%s must be positive", tstr);
|
||||||
rb_raise(rb_eArgError, "time must be positive");
|
|
||||||
#endif
|
|
||||||
t.tv_usec = 0;
|
t.tv_usec = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rb_raise(rb_eTypeError, "can't convert %s into Time%s",
|
rb_raise(rb_eTypeError, "can't convert %s into %s",
|
||||||
rb_class2name(CLASS_OF(time)),
|
rb_class2name(CLASS_OF(time)), tstr);
|
||||||
interval ? " interval" : "");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user