* struct.c (make_struct): remove redefining constant when
conflict. [ruby-dev:24210] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7cf8256075
commit
880d7af47a
@ -1,3 +1,8 @@
|
|||||||
|
Fri Sep 3 17:47:58 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* struct.c (make_struct): remove redefining constant when
|
||||||
|
conflict. [ruby-dev:24210]
|
||||||
|
|
||||||
Fri Sep 3 11:31:44 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
Fri Sep 3 11:31:44 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/lib/tk.rb: Tk.after makes TkCore::INTERP.tk_cmd_tbl grow
|
* ext/tk/lib/tk.rb: Tk.after makes TkCore::INTERP.tk_cmd_tbl grow
|
||||||
|
8
bignum.c
8
bignum.c
@ -1752,15 +1752,17 @@ rb_big_or(xx, yy)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_big_xor(x, y)
|
rb_big_xor(xx, yy)
|
||||||
VALUE x, y;
|
VALUE xx, yy;
|
||||||
{
|
{
|
||||||
|
volatile VALUE x, y;
|
||||||
VALUE z;
|
VALUE z;
|
||||||
BDIGIT *ds1, *ds2, *zds;
|
BDIGIT *ds1, *ds2, *zds;
|
||||||
long i, l1, l2;
|
long i, l1, l2;
|
||||||
char sign;
|
char sign;
|
||||||
|
|
||||||
y = rb_to_int(y);
|
x = xx;
|
||||||
|
y = rb_to_int(yy);
|
||||||
if (FIXNUM_P(y)) {
|
if (FIXNUM_P(y)) {
|
||||||
y = rb_int2big(FIX2LONG(y));
|
y = rb_int2big(FIX2LONG(y));
|
||||||
}
|
}
|
||||||
|
34
eval.c
34
eval.c
@ -1717,37 +1717,6 @@ rb_eval_cmd(cmd, arg, level)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
superclass(self, node)
|
|
||||||
VALUE self;
|
|
||||||
NODE *node;
|
|
||||||
{
|
|
||||||
VALUE val = Qnil; /* OK */
|
|
||||||
int state;
|
|
||||||
|
|
||||||
PUSH_TAG(PROT_NONE);
|
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
|
||||||
val = rb_eval(self, node);
|
|
||||||
}
|
|
||||||
POP_TAG();
|
|
||||||
if (state) {
|
|
||||||
switch (nd_type(node)) {
|
|
||||||
case NODE_COLON2:
|
|
||||||
rb_raise(rb_eTypeError, "undefined superclass `%s'",
|
|
||||||
rb_id2name(node->nd_mid));
|
|
||||||
case NODE_CONST:
|
|
||||||
rb_raise(rb_eTypeError, "undefined superclass `%s'",
|
|
||||||
rb_id2name(node->nd_vid));
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
JUMP_TAG(state);
|
|
||||||
}
|
|
||||||
rb_check_inheritable(val);
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ruby_cbase (ruby_cref->nd_clss)
|
#define ruby_cbase (ruby_cref->nd_clss)
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -3772,7 +3741,8 @@ rb_eval(self, n)
|
|||||||
rb_raise(rb_eTypeError, "no outer class/module");
|
rb_raise(rb_eTypeError, "no outer class/module");
|
||||||
}
|
}
|
||||||
if (node->nd_super) {
|
if (node->nd_super) {
|
||||||
super = superclass(self, node->nd_super);
|
super = rb_eval(self, node->nd_super);
|
||||||
|
rb_check_inheritable(super);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
super = 0;
|
super = 0;
|
||||||
|
23
math.c
23
math.c
@ -331,6 +331,28 @@ math_log(obj, x)
|
|||||||
return rb_float_new(d);
|
return rb_float_new(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* call-seq:
|
||||||
|
* Math.log2(numeric) => float
|
||||||
|
*
|
||||||
|
* Returns the base 2 logarithm of <i>numeric</i>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
math_log2(obj, x)
|
||||||
|
VALUE obj, x;
|
||||||
|
{
|
||||||
|
double d;
|
||||||
|
|
||||||
|
Need_Float(x);
|
||||||
|
errno = 0;
|
||||||
|
d = log2(RFLOAT(x)->value);
|
||||||
|
if (errno) {
|
||||||
|
rb_sys_fail("log2");
|
||||||
|
}
|
||||||
|
return rb_float_new(d);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* Math.log10(numeric) => float
|
* Math.log10(numeric) => float
|
||||||
@ -511,6 +533,7 @@ Init_Math()
|
|||||||
|
|
||||||
rb_define_module_function(rb_mMath, "exp", math_exp, 1);
|
rb_define_module_function(rb_mMath, "exp", math_exp, 1);
|
||||||
rb_define_module_function(rb_mMath, "log", math_log, 1);
|
rb_define_module_function(rb_mMath, "log", math_log, 1);
|
||||||
|
rb_define_module_function(rb_mMath, "log2", math_log, 1);
|
||||||
rb_define_module_function(rb_mMath, "log10", math_log10, 1);
|
rb_define_module_function(rb_mMath, "log10", math_log10, 1);
|
||||||
rb_define_module_function(rb_mMath, "sqrt", math_sqrt, 1);
|
rb_define_module_function(rb_mMath, "sqrt", math_sqrt, 1);
|
||||||
|
|
||||||
|
8
struct.c
8
struct.c
@ -177,6 +177,10 @@ make_struct(name, member, klass)
|
|||||||
if (!rb_is_const_id(id)) {
|
if (!rb_is_const_id(id)) {
|
||||||
rb_name_error(id, "identifier %s needs to be constant", cname);
|
rb_name_error(id, "identifier %s needs to be constant", cname);
|
||||||
}
|
}
|
||||||
|
if (rb_const_defined_at(klass, id)) {
|
||||||
|
rb_warn("redefining constant Struct::%s", cname);
|
||||||
|
rb_mod_remove_const(klass, ID2SYM(id));
|
||||||
|
}
|
||||||
nstr = rb_define_class_under(klass, cname, klass);
|
nstr = rb_define_class_under(klass, cname, klass);
|
||||||
}
|
}
|
||||||
rb_iv_set(nstr, "__size__", LONG2NUM(RARRAY(member)->len));
|
rb_iv_set(nstr, "__size__", LONG2NUM(RARRAY(member)->len));
|
||||||
@ -455,6 +459,10 @@ inspect_struct(s)
|
|||||||
if (NIL_P(member)) {
|
if (NIL_P(member)) {
|
||||||
rb_bug("non-initialized struct");
|
rb_bug("non-initialized struct");
|
||||||
}
|
}
|
||||||
|
if (RSTRUCT(s)->len != RARRAY(member)->len) {
|
||||||
|
rb_raise(rb_eTypeError, "struct size differs (%d required %d given)",
|
||||||
|
RARRAY(member)->len, RSTRUCT(s)->len);
|
||||||
|
}
|
||||||
|
|
||||||
str = rb_str_buf_new2("#<struct ");
|
str = rb_str_buf_new2("#<struct ");
|
||||||
rb_str_cat2(str, cname);
|
rb_str_cat2(str, cname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user