1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-09-15 06:00:30 +00:00
parent f57e5b0dc6
commit bbf2ad4ed8
9 changed files with 80 additions and 23 deletions

View file

@ -1,10 +1,27 @@
Wed Sep 13 17:11:19 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* stable version 1.6.0 released.
Thu Sep 14 02:46:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_thread_yield): array strip should be done in this
function.
Wed Sep 13 17:01:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* bignum.c (rb_big_eq): imcomplete value compare of bignums.
Wed Sep 13 06:39:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_mod_class_variables): Module#class_variables added.
Wed Sep 13 06:09:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/cgi.rb: bug fix: CGI::header(): output status header.
Tue Sep 12 22:34:20 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
Wed Sep 13 01:09:12 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* stable version 1.6.0 released.
* parse.y (yylex): allow global variables like '$__a'.
Tue Sep 12 22:28:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
@ -17,8 +34,8 @@ Tue Sep 12 16:01:58 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
Tue Sep 12 15:37:55 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_yield_0): stripped array too much, should be just for
proc_call().
* eval.c (rb_yield_0): stripped array too much, should remove just
for proc_call().
Tue Sep 12 07:05:24 2000 Wakou Aoyama <wakou@fsinet.or.jp>
@ -98,7 +115,7 @@ Sun Sep 3 23:44:04 2000 Noriaki Harada <tenmei@maoh.office.ne.jp>
Sun Sep 3 11:31:53 2000 Takaaki Tateishi <ttate@jaist.ac.jp>
* parse.y (rescue): no assignment was done if rescue body as
* parse.y (rescue): no assignment was done if rescue body was
empty.
Sat Sep 2 10:52:21 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
@ -146,8 +163,7 @@ Wed Aug 30 23:21:20 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* numeric.c (rb_num2long): use rb_Integer() instead of independent
convert routine.
* eval.c (rb_rescue2): now arbitrary number of exception types can
be specified.
* eval.c (rb_rescue2): now takes arbitrary number of exception types.
* object.c (rb_convert_type): use rb_rescue2 now to handle NameError.

View file

@ -562,7 +562,7 @@ rb_big_eq(x, y)
}
if (RBIGNUM(x)->sign != RBIGNUM(y)->sign) return Qfalse;
if (RBIGNUM(x)->len != RBIGNUM(y)->len) return Qfalse;
if (memcmp(BDIGITS(x),BDIGITS(y),RBIGNUM(y)->len) != 0) return Qfalse;
if (MEMCMP(BDIGITS(x),BDIGITS(y),USHORT,RBIGNUM(y)->len) != 0) return Qfalse;
return Qtrue;
}

19
eval.c
View file

@ -815,8 +815,8 @@ static rb_thread_t curr_thread = 0;
static VALUE rb_eval _((VALUE,NODE*));
static VALUE eval _((VALUE,VALUE,VALUE,char*,int));
static NODE *compile _((VALUE, char*, int));
static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int));
static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int));
static VALUE rb_call _((VALUE,VALUE,ID,int,VALUE*,int));
static VALUE module_setup _((VALUE,NODE*));
@ -2226,7 +2226,7 @@ rb_eval(self, n)
else {
result = Qnil;
}
result = rb_yield_0(result, 0, 0, Qfalse);
result = rb_yield_0(result, 0, 0, 0);
break;
case NODE_RESCUE:
@ -3503,14 +3503,14 @@ VALUE
rb_yield(val)
VALUE val;
{
return rb_yield_0(val, 0, 0, Qfalse);
return rb_yield_0(val, 0, 0, 0);
}
static VALUE
rb_f_loop()
{
for (;;) {
rb_yield_0(Qnil, 0, 0, Qfalse);
rb_yield_0(Qnil, 0, 0, 0);
CHECK_INTS;
}
return Qnil; /* dummy */
@ -4809,7 +4809,7 @@ yield_under_i(self)
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
result = rb_yield_0(self, self, ruby_class, Qfalse);
result = rb_yield_0(self, self, ruby_class, 0);
}
POP_TAG();
ruby_block = old_block;
@ -4819,7 +4819,7 @@ yield_under_i(self)
}
/* static block, no need to restore */
ruby_block->frame.cbase = ruby_frame->cbase;
return rb_yield_0(self, self, ruby_class, Qfalse);
return rb_yield_0(self, self, ruby_class, 0);
}
/* block eval under the class/module context */
@ -5452,9 +5452,6 @@ errat_setter(val, id, var)
set_backtrace(ruby_errinfo, val);
}
VALUE rb_f_global_variables();
VALUE f_instance_variables();
static VALUE
rb_f_local_variables()
{
@ -7781,7 +7778,7 @@ rb_thread_yield(arg, th)
rb_thread_t th;
{
scope_dup(ruby_block->scope);
return rb_yield_0(callargs(arg), 0, 0, Qfalse);
return rb_yield_0(callargs(arg), 0, 0, Qtrue);
}
static VALUE
@ -8335,7 +8332,7 @@ rb_f_catch(dmy, tag)
t = rb_to_id(tag);
PUSH_TAG(t);
if ((state = EXEC_TAG()) == 0) {
val = rb_yield_0(tag, 0, 0, Qfalse);
val = rb_yield_0(tag, 0, 0, 0);
}
else if (state == TAG_THROW && t == prot_tag->dst) {
val = prot_tag->retval;

View file

@ -372,6 +372,7 @@ VALUE rb_cvar_get _((VALUE, ID));
int rb_cvar_defined_singleton _((VALUE, ID));
void rb_cvar_set_singleton _((VALUE, ID, VALUE));
VALUE rb_cvar_get_singleton _((VALUE, ID));
VALUE rb_mod_class_variables _((VALUE));
/* version.c */
void ruby_show_version _((void));
void ruby_show_copyright _((void));

View file

@ -1176,6 +1176,7 @@ Init_Object()
rb_define_method(rb_cModule, "const_defined?", rb_mod_const_defined, 1);
rb_define_private_method(rb_cModule, "remove_const", rb_mod_remove_const, 1);
rb_define_private_method(rb_cModule, "method_added", rb_obj_dummy, 1);
rb_define_method(rb_cModule, "class_variables", rb_mod_class_variables, 0);
rb_define_method(rb_cClass, "new", rb_class_new_instance, -1);
rb_define_method(rb_cClass, "superclass", rb_class_superclass, 0);

10
parse.y
View file

@ -3397,7 +3397,15 @@ yylex()
case '~': /* $~: match-data */
/* fall through */
case '_': /* $_: last read line string */
local_cnt(c);
c = nextc();
if (is_identchar(c)) {
tokadd('$');
tokadd('_');
break;
}
pushback(c);
c = '_';
local_cnt('_');
/* fall through */
case '*': /* $*: argv */
case '$': /* $$: pid */

1
ruby.h
View file

@ -394,6 +394,7 @@ void xfree _((void*));
#define MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
#define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
#define MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
#define MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
void rb_glob _((char*,void(*)(),VALUE));

View file

@ -3,6 +3,6 @@ cmd = ARGV.join(" ")
b = Time.now
system(cmd)
e = Time.now
ut, st, cut, cst = Time.times
ut, st, cut, cst = Time.times.to_a
total = (e - b).to_f
printf STDERR, "%11.1f real %11.1f user %11.1f sys\n", total, cut, cst

View file

@ -1167,11 +1167,10 @@ rb_mod_const_of(mod, ary)
VALUE mod;
VALUE ary;
{
rb_mod_const_at(mod, ary);
for (;;) {
rb_mod_const_at(mod, ary);
mod = RCLASS(mod)->super;
if (!mod) break;
rb_mod_const_at(mod, ary);
}
return ary;
}
@ -1488,6 +1487,40 @@ rb_define_class_variable(klass, name, val)
rb_cvar_declare(klass, id, val);
}
static int
cv_i(key, value, ary)
ID key;
VALUE value;
VALUE ary;
{
if (rb_is_class_id(key)) {
VALUE kval = rb_str_new2(rb_id2name(key));
if (!rb_ary_includes(ary, kval)) {
rb_ary_push(ary, kval);
}
}
return ST_CONTINUE;
}
VALUE
rb_mod_class_variables(obj)
VALUE obj;
{
VALUE ary = rb_ary_new();
if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't get metainfo");
for (;;) {
if (RCLASS(obj)->iv_tbl) {
st_foreach(RCLASS(obj)->iv_tbl, cv_i, ary);
}
obj = RCLASS(obj)->super;
if (!obj) break;
}
return ary;
}
VALUE
rb_iv_get(obj, name)
VALUE obj;