mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* variable.c (rb_const_get): no recursion to show full class path
for modules. * eval.c (rb_set_safe_level): should set safe level in curr_thread as well. * eval.c (safe_setter): ditto. * object.c (rb_obj_is_instance_of): nil belongs to false, not true. * time.c (make_time_t): proper (I hope) daylight saving time handling for both US and Europe. I HATE SUMMER TIME! * eval.c (rb_thread_wait_for): non blocked signal interrupt should stop the interval. * class.c (rb_mod_clone): should copy method bodies too. * bignum.c (bigdivrem): should trim trailing zero bdigits of remainder, even if dd == 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									2c29a1c0e9
								
							
						
					
					
						commit
						0c176f00c1
					
				
					 14 changed files with 264 additions and 152 deletions
				
			
		
							
								
								
									
										29
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,32 @@
 | 
			
		|||
Thu Apr  5 22:40:12 2001  Yukihiro Matsumoto  <matz@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* variable.c (rb_const_get): no recursion to show full class path
 | 
			
		||||
	  for modules.
 | 
			
		||||
 | 
			
		||||
	* eval.c (rb_set_safe_level): should set safe level in curr_thread
 | 
			
		||||
	  as well.
 | 
			
		||||
 | 
			
		||||
	* eval.c (safe_setter): ditto.
 | 
			
		||||
 | 
			
		||||
Thu Apr  5 13:46:06 2001  K.Kosako  <kosako@sofnec.co.jp>
 | 
			
		||||
 | 
			
		||||
	* object.c (rb_obj_is_instance_of): nil belongs to false, not true.
 | 
			
		||||
 | 
			
		||||
Thu Apr  5 02:19:03 2001  Yukihiro Matsumoto  <matz@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* time.c (make_time_t): proper (I hope) daylight saving time
 | 
			
		||||
	  handling for both US and Europe.  I HATE SUMMER TIME!
 | 
			
		||||
 | 
			
		||||
	* eval.c (rb_thread_wait_for): non blocked signal interrupt should
 | 
			
		||||
	  stop the interval.
 | 
			
		||||
 | 
			
		||||
Wed Apr  4 03:47:03 2001  Yukihiro Matsumoto  <matz@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* class.c (rb_mod_clone): should copy method bodies too.
 | 
			
		||||
 | 
			
		||||
	* bignum.c (bigdivrem): should trim trailing zero bdigits of
 | 
			
		||||
	  remainder, even if dd == 0.
 | 
			
		||||
 | 
			
		||||
Tue Apr  3 15:29:10 2001  Akinori MUSHA  <knu@iDaemons.org>
 | 
			
		||||
 | 
			
		||||
	* Makefile.in: Introduce MAINLIBS.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								bignum.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								bignum.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -917,10 +917,10 @@ bigdivrem(x, y, divp, modp)
 | 
			
		|||
    }
 | 
			
		||||
    if (modp) {			/* just normalize remainder */
 | 
			
		||||
	*modp = rb_big_clone(z);
 | 
			
		||||
	zds = BDIGITS(*modp);
 | 
			
		||||
	while (!zds[ny-1]) ny--;
 | 
			
		||||
	if (dd) {
 | 
			
		||||
	    zds = BDIGITS(*modp);
 | 
			
		||||
	    while (ny-- && !zds[ny]) ;
 | 
			
		||||
	    t2 = 0; i = ++ny;
 | 
			
		||||
	    t2 = 0; i = ny;
 | 
			
		||||
	    while(i--) {
 | 
			
		||||
		t2 = (t2 | zds[i]) >> dd;
 | 
			
		||||
		q = zds[i];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										56
									
								
								class.c
									
										
									
									
									
								
							
							
						
						
									
										56
									
								
								class.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -33,16 +33,6 @@ rb_class_new(super)
 | 
			
		|||
    return (VALUE)klass;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_singleton_class_new(super)
 | 
			
		||||
    VALUE super;
 | 
			
		||||
{
 | 
			
		||||
    VALUE klass = rb_class_new(super);
 | 
			
		||||
 | 
			
		||||
    FL_SET(klass, FL_SINGLETON);
 | 
			
		||||
    return klass;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
clone_method(mid, body, tbl)
 | 
			
		||||
    ID mid;
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +43,47 @@ clone_method(mid, body, tbl)
 | 
			
		|||
    return ST_CONTINUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_mod_clone(module)
 | 
			
		||||
    VALUE module;
 | 
			
		||||
{
 | 
			
		||||
    NEWOBJ(clone, struct RClass);
 | 
			
		||||
    CLONESETUP(clone, module);
 | 
			
		||||
 | 
			
		||||
    clone->super = RCLASS(module)->super;
 | 
			
		||||
    if (RCLASS(module)->iv_tbl) {
 | 
			
		||||
	clone->iv_tbl = st_copy(RCLASS(module)->iv_tbl);
 | 
			
		||||
    }
 | 
			
		||||
    if (RCLASS(module)->m_tbl) {
 | 
			
		||||
	clone->m_tbl = st_init_numtable();
 | 
			
		||||
	st_foreach(RCLASS(module)->m_tbl, clone_method, clone->m_tbl);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return (VALUE)clone;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_mod_dup(mod)
 | 
			
		||||
    VALUE mod;
 | 
			
		||||
{
 | 
			
		||||
    VALUE dup = rb_mod_clone(mod);
 | 
			
		||||
    OBJSETUP(dup, RBASIC(mod)->klass, BUILTIN_TYPE(mod));
 | 
			
		||||
    if (FL_TEST(mod, FL_SINGLETON)) {
 | 
			
		||||
	FL_SET(dup, FL_SINGLETON);
 | 
			
		||||
    }
 | 
			
		||||
    return dup;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_singleton_class_new(super)
 | 
			
		||||
    VALUE super;
 | 
			
		||||
{
 | 
			
		||||
    VALUE klass = rb_class_new(super);
 | 
			
		||||
 | 
			
		||||
    FL_SET(klass, FL_SINGLETON);
 | 
			
		||||
    return klass;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_singleton_class_clone(klass)
 | 
			
		||||
    VALUE klass;
 | 
			
		||||
| 
						 | 
				
			
			@ -222,6 +253,11 @@ rb_include_module(klass, module)
 | 
			
		|||
    VALUE p;
 | 
			
		||||
    int changed = 0;
 | 
			
		||||
 | 
			
		||||
    rb_frozen_class_p(klass);
 | 
			
		||||
    if (!OBJ_TAINTED(klass)) {
 | 
			
		||||
	rb_secure(4);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    rb_frozen_class_p(klass);
 | 
			
		||||
    if (!OBJ_TAINTED(klass)) {
 | 
			
		||||
	rb_secure(4);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										157
									
								
								eval.c
									
										
									
									
									
								
							
							
						
						
									
										157
									
								
								eval.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -128,33 +128,8 @@ int ruby_safe_level = 0;
 | 
			
		|||
   4 - no global (non-tainted) variable modification/no direct output
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
rb_set_safe_level(level)
 | 
			
		||||
    int level;
 | 
			
		||||
{
 | 
			
		||||
    if (level > ruby_safe_level) {
 | 
			
		||||
	ruby_safe_level = level;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
safe_getter()
 | 
			
		||||
{
 | 
			
		||||
    return INT2FIX(ruby_safe_level);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
safe_setter(val)
 | 
			
		||||
    VALUE val;
 | 
			
		||||
{
 | 
			
		||||
    int level = NUM2INT(val);
 | 
			
		||||
 | 
			
		||||
    if (level < ruby_safe_level) {
 | 
			
		||||
	rb_raise(rb_eSecurityError, "tried to downgrade safe level from %d to %d",
 | 
			
		||||
		 ruby_safe_level, level);
 | 
			
		||||
    }
 | 
			
		||||
    ruby_safe_level = level;
 | 
			
		||||
}
 | 
			
		||||
static VALUE safe_getter _((void));
 | 
			
		||||
static void safe_setter _((VALUE val));
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
rb_secure(level)
 | 
			
		||||
| 
						 | 
				
			
			@ -821,6 +796,11 @@ static VALUE ruby_wrapper;	/* security wrapper */
 | 
			
		|||
 | 
			
		||||
#define POP_CLASS() ruby_class = _class; }
 | 
			
		||||
 | 
			
		||||
static NODE *ruby_cref = 0;
 | 
			
		||||
static NODE *top_cref;
 | 
			
		||||
#define PUSH_CREF(c) ruby_cref = rb_node_newnode(NODE_CREF,(c),0,ruby_cref)
 | 
			
		||||
#define POP_CREF() ruby_cref = ruby_cref->nd_next
 | 
			
		||||
 | 
			
		||||
#define PUSH_SCOPE() {			\
 | 
			
		||||
    volatile int _vmode = scope_vmode;	\
 | 
			
		||||
    struct SCOPE * volatile _old;	\
 | 
			
		||||
| 
						 | 
				
			
			@ -1047,7 +1027,9 @@ ruby_init()
 | 
			
		|||
	rb_call_inits();
 | 
			
		||||
	ruby_class = rb_cObject;
 | 
			
		||||
	ruby_frame->self = ruby_top_self;
 | 
			
		||||
	ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,rb_cObject,0,0);
 | 
			
		||||
	top_cref = rb_node_newnode(NODE_CREF,rb_cObject,0,0);
 | 
			
		||||
	ruby_cref = top_cref;
 | 
			
		||||
	ruby_frame->cbase = (VALUE)ruby_cref;
 | 
			
		||||
	rb_define_global_const("TOPLEVEL_BINDING", rb_f_binding(ruby_top_self));
 | 
			
		||||
#ifdef __MACOS__
 | 
			
		||||
	_macruby_init();
 | 
			
		||||
| 
						 | 
				
			
			@ -1605,6 +1587,23 @@ rb_mod_alias_method(mod, newname, oldname)
 | 
			
		|||
    return mod;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static NODE*
 | 
			
		||||
copy_node_scope(node, rval)
 | 
			
		||||
    NODE *node;
 | 
			
		||||
    VALUE rval;
 | 
			
		||||
{
 | 
			
		||||
    NODE *copy = rb_node_newnode(NODE_SCOPE,0,rval,node->nd_next);
 | 
			
		||||
 | 
			
		||||
    if (node->nd_tbl) {
 | 
			
		||||
	copy->nd_tbl = ALLOC_N(ID, node->nd_tbl[0]+1);
 | 
			
		||||
	MEMCPY(copy->nd_tbl, node->nd_tbl, ID, node->nd_tbl[0]+1);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	copy->nd_tbl = 0;
 | 
			
		||||
    }
 | 
			
		||||
    return copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef C_ALLOCA
 | 
			
		||||
# define TMP_PROTECT NODE * volatile tmp__protect_tmp=0
 | 
			
		||||
# define TMP_ALLOC(n)							\
 | 
			
		||||
| 
						 | 
				
			
			@ -2533,6 +2532,7 @@ rb_eval(self, n)
 | 
			
		|||
      case NODE_SCOPE:
 | 
			
		||||
	{
 | 
			
		||||
	    struct FRAME frame;
 | 
			
		||||
	    NODE *saved_cref = 0;
 | 
			
		||||
 | 
			
		||||
	    frame = *ruby_frame;
 | 
			
		||||
	    frame.tmp = ruby_frame;
 | 
			
		||||
| 
						 | 
				
			
			@ -2540,7 +2540,11 @@ rb_eval(self, n)
 | 
			
		|||
 | 
			
		||||
	    PUSH_SCOPE();
 | 
			
		||||
	    PUSH_TAG(PROT_NONE);
 | 
			
		||||
	    if (node->nd_rval) ruby_frame->cbase = node->nd_rval;
 | 
			
		||||
	    if (node->nd_rval) {
 | 
			
		||||
		saved_cref = ruby_cref;
 | 
			
		||||
		ruby_cref = (NODE*)node->nd_rval;
 | 
			
		||||
		ruby_frame->cbase = node->nd_rval;
 | 
			
		||||
	    }
 | 
			
		||||
	    if (node->nd_tbl) {
 | 
			
		||||
		VALUE *vars = ALLOCA_N(VALUE, node->nd_tbl[0]+1);
 | 
			
		||||
		*vars++ = (VALUE)node;
 | 
			
		||||
| 
						 | 
				
			
			@ -2558,6 +2562,8 @@ rb_eval(self, n)
 | 
			
		|||
	    POP_TAG();
 | 
			
		||||
	    POP_SCOPE();
 | 
			
		||||
	    ruby_frame = frame.tmp;
 | 
			
		||||
	    if (saved_cref)
 | 
			
		||||
		ruby_cref = saved_cref;
 | 
			
		||||
	    if (state) JUMP_TAG(state);
 | 
			
		||||
	}
 | 
			
		||||
	break;
 | 
			
		||||
| 
						 | 
				
			
			@ -2896,7 +2902,7 @@ rb_eval(self, n)
 | 
			
		|||
 | 
			
		||||
      case NODE_DEFN:
 | 
			
		||||
	if (node->nd_defn) {
 | 
			
		||||
	    NODE *body;
 | 
			
		||||
	    NODE *body,  *defn;
 | 
			
		||||
	    VALUE origin;
 | 
			
		||||
	    int noex;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2938,11 +2944,13 @@ rb_eval(self, n)
 | 
			
		|||
	    if (body && origin == ruby_class && body->nd_noex & NOEX_UNDEF) {
 | 
			
		||||
		noex |= NOEX_UNDEF;
 | 
			
		||||
	    }
 | 
			
		||||
	    rb_add_method(ruby_class, node->nd_mid, node->nd_defn, noex);
 | 
			
		||||
 | 
			
		||||
	    defn = copy_node_scope(node->nd_defn, ruby_cref);
 | 
			
		||||
	    rb_add_method(ruby_class, node->nd_mid, defn, noex);
 | 
			
		||||
	    rb_clear_cache_by_id(node->nd_mid);
 | 
			
		||||
	    if (scope_vmode == SCOPE_MODFUNC) {
 | 
			
		||||
		rb_add_method(rb_singleton_class(ruby_class),
 | 
			
		||||
			      node->nd_mid, node->nd_defn, NOEX_PUBLIC);
 | 
			
		||||
			      node->nd_mid, defn, NOEX_PUBLIC);
 | 
			
		||||
		rb_funcall(ruby_class, singleton_added, 1, ID2SYM(node->nd_mid));
 | 
			
		||||
	    }
 | 
			
		||||
	    if (FL_TEST(ruby_class, FL_SINGLETON)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -2960,7 +2968,7 @@ rb_eval(self, n)
 | 
			
		|||
	if (node->nd_defn) {
 | 
			
		||||
	    VALUE recv = rb_eval(self, node->nd_recv);
 | 
			
		||||
	    VALUE klass;
 | 
			
		||||
	    NODE *body = 0;
 | 
			
		||||
	    NODE *body = 0, *defn;
 | 
			
		||||
 | 
			
		||||
	    if (rb_safe_level() >= 4 && !OBJ_TAINTED(recv)) {
 | 
			
		||||
		rb_raise(rb_eSecurityError, "Insecure; can't define singleton method");
 | 
			
		||||
| 
						 | 
				
			
			@ -2982,7 +2990,9 @@ rb_eval(self, n)
 | 
			
		|||
		    rb_warning("redefine %s", rb_id2name(node->nd_mid));
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
	    rb_add_method(klass, node->nd_mid, node->nd_defn, 
 | 
			
		||||
	    defn = copy_node_scope(node->nd_defn, ruby_cref);
 | 
			
		||||
	    defn->nd_rval = (VALUE)ruby_cref;
 | 
			
		||||
	    rb_add_method(klass, node->nd_mid, defn, 
 | 
			
		||||
			  NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
 | 
			
		||||
	    rb_clear_cache_by_id(node->nd_mid);
 | 
			
		||||
	    rb_funcall(recv, singleton_added, 1, ID2SYM(node->nd_mid));
 | 
			
		||||
| 
						 | 
				
			
			@ -3180,16 +3190,11 @@ module_setup(module, n)
 | 
			
		|||
    frame.tmp = ruby_frame;
 | 
			
		||||
    ruby_frame = &frame;
 | 
			
		||||
 | 
			
		||||
    /* fill c-ref */
 | 
			
		||||
    node->nd_clss = module;
 | 
			
		||||
    node = node->nd_body;
 | 
			
		||||
 | 
			
		||||
    PUSH_CLASS();
 | 
			
		||||
    ruby_class = module;
 | 
			
		||||
    PUSH_SCOPE();
 | 
			
		||||
    PUSH_VARS();
 | 
			
		||||
 | 
			
		||||
    if (node->nd_rval) ruby_frame->cbase = node->nd_rval;
 | 
			
		||||
    if (node->nd_tbl) {
 | 
			
		||||
	VALUE *vars = TMP_ALLOC(node->nd_tbl[0]+1);
 | 
			
		||||
	*vars++ = (VALUE)node;
 | 
			
		||||
| 
						 | 
				
			
			@ -3202,6 +3207,8 @@ module_setup(module, n)
 | 
			
		|||
	ruby_scope->local_tbl  = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    PUSH_CREF(module);
 | 
			
		||||
    ruby_frame->cbase = (VALUE)ruby_cref;
 | 
			
		||||
    PUSH_TAG(PROT_NONE);
 | 
			
		||||
    if ((state = EXEC_TAG()) == 0) {
 | 
			
		||||
	if (trace_func) {
 | 
			
		||||
| 
						 | 
				
			
			@ -3212,6 +3219,7 @@ module_setup(module, n)
 | 
			
		|||
	result = rb_eval(ruby_class, node->nd_next);
 | 
			
		||||
    }
 | 
			
		||||
    POP_TAG();
 | 
			
		||||
    POP_CREF();
 | 
			
		||||
    POP_VARS();
 | 
			
		||||
    POP_SCOPE();
 | 
			
		||||
    POP_CLASS();
 | 
			
		||||
| 
						 | 
				
			
			@ -4313,14 +4321,19 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
 | 
			
		|||
	result = proc_call(body->nd_cval, rb_ary_new4(argc, argv));
 | 
			
		||||
	break;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
      case NODE_SCOPE:
 | 
			
		||||
	{
 | 
			
		||||
	    int state;
 | 
			
		||||
	    VALUE *local_vars;	/* OK */
 | 
			
		||||
	    NODE *saved_cref = 0;
 | 
			
		||||
 | 
			
		||||
	    PUSH_SCOPE();
 | 
			
		||||
 | 
			
		||||
	    if (body->nd_rval) ruby_frame->cbase = body->nd_rval;
 | 
			
		||||
	    if (body->nd_rval) {
 | 
			
		||||
		saved_cref = ruby_cref;
 | 
			
		||||
		ruby_cref = (NODE*)body->nd_rval;
 | 
			
		||||
		ruby_frame->cbase = body->nd_rval;
 | 
			
		||||
	    }
 | 
			
		||||
	    if (body->nd_tbl) {
 | 
			
		||||
		local_vars = TMP_ALLOC(body->nd_tbl[0]+1);
 | 
			
		||||
		*local_vars++ = (VALUE)body;
 | 
			
		||||
| 
						 | 
				
			
			@ -4413,6 +4426,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
 | 
			
		|||
	    POP_TAG();
 | 
			
		||||
	    POP_VARS();
 | 
			
		||||
	    POP_SCOPE();
 | 
			
		||||
	    ruby_cref = saved_cref;
 | 
			
		||||
	    if (trace_func) {
 | 
			
		||||
		char *file = ruby_frame->prev->file;
 | 
			
		||||
		int line = ruby_frame->prev->line;
 | 
			
		||||
| 
						 | 
				
			
			@ -4436,6 +4450,11 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
 | 
			
		|||
		break;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
	break;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
	rb_bug("unknown node type %d", nd_type(body));
 | 
			
		||||
	break;
 | 
			
		||||
    }
 | 
			
		||||
    POP_FRAME();
 | 
			
		||||
    POP_ITER();
 | 
			
		||||
| 
						 | 
				
			
			@ -5074,6 +5093,7 @@ rb_load(fname, wrap)
 | 
			
		|||
    volatile ID last_func;
 | 
			
		||||
    volatile VALUE wrapper = 0;
 | 
			
		||||
    volatile VALUE self = ruby_top_self;
 | 
			
		||||
    NODE *saved_cref = ruby_cref;
 | 
			
		||||
    TMP_PROTECT;
 | 
			
		||||
 | 
			
		||||
    if (wrap) {
 | 
			
		||||
| 
						 | 
				
			
			@ -5091,6 +5111,7 @@ rb_load(fname, wrap)
 | 
			
		|||
    PUSH_VARS();
 | 
			
		||||
    PUSH_CLASS();
 | 
			
		||||
    wrapper = ruby_wrapper;
 | 
			
		||||
    ruby_cref = top_cref;
 | 
			
		||||
    if (!wrap) {
 | 
			
		||||
	rb_secure(4);		/* should alter global state */
 | 
			
		||||
	ruby_class = rb_cObject;
 | 
			
		||||
| 
						 | 
				
			
			@ -5101,6 +5122,7 @@ rb_load(fname, wrap)
 | 
			
		|||
	ruby_class = ruby_wrapper = rb_module_new();
 | 
			
		||||
	self = rb_obj_clone(ruby_top_self);
 | 
			
		||||
	rb_extend_object(self, ruby_class);
 | 
			
		||||
	PUSH_CREF(ruby_wrapper);
 | 
			
		||||
    }
 | 
			
		||||
    PUSH_FRAME();
 | 
			
		||||
    ruby_frame->last_func = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -5143,6 +5165,7 @@ rb_load(fname, wrap)
 | 
			
		|||
	    free(ruby_scope->local_tbl);
 | 
			
		||||
    }
 | 
			
		||||
    POP_TAG();
 | 
			
		||||
    ruby_cref = saved_cref;
 | 
			
		||||
    POP_SCOPE();
 | 
			
		||||
    POP_FRAME();
 | 
			
		||||
    POP_CLASS();
 | 
			
		||||
| 
						 | 
				
			
			@ -6321,8 +6344,10 @@ proc_eq(self, other)
 | 
			
		|||
{
 | 
			
		||||
    struct BLOCK *data, *data2;
 | 
			
		||||
 | 
			
		||||
    if (self == other) return Qtrue;
 | 
			
		||||
    if (TYPE(other) != T_DATA) return Qfalse;
 | 
			
		||||
    if (RDATA(other)->dmark != (RUBY_DATA_FUNC)blk_mark) Qfalse;
 | 
			
		||||
    if (RDATA(other)->dmark != (RUBY_DATA_FUNC)blk_mark) return Qfalse;
 | 
			
		||||
    if (CLASS_OF(self) != CLASS_OF(other)) return Qfalse;
 | 
			
		||||
    Data_Get_Struct(self, struct BLOCK, data);
 | 
			
		||||
    Data_Get_Struct(other, struct BLOCK, data2);
 | 
			
		||||
    if (data->tag == data2->tag) return Qtrue;
 | 
			
		||||
| 
						 | 
				
			
			@ -6556,8 +6581,8 @@ method_call(argc, argv, method)
 | 
			
		|||
    Data_Get_Struct(method, struct METHOD, data);
 | 
			
		||||
    PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
 | 
			
		||||
    PUSH_TAG(PROT_NONE);
 | 
			
		||||
    if (OBJ_TAINTED(method)) {
 | 
			
		||||
	if (ruby_safe_level < 4) ruby_safe_level = 4;
 | 
			
		||||
    if (OBJ_TAINTED(method) && ruby_safe_level < 4) {
 | 
			
		||||
	ruby_safe_level = 4;
 | 
			
		||||
    }
 | 
			
		||||
    if ((state = EXEC_TAG()) == 0) {
 | 
			
		||||
	result = rb_call0(data->klass,data->recv,data->id,argc,argv,data->body,0);
 | 
			
		||||
| 
						 | 
				
			
			@ -6841,6 +6866,7 @@ struct thread {
 | 
			
		|||
    struct tag *tag;
 | 
			
		||||
    VALUE klass;
 | 
			
		||||
    VALUE wrapper;
 | 
			
		||||
    NODE *cref;
 | 
			
		||||
 | 
			
		||||
    int flags;		/* misc. states (vmode/rb_trap_immediate/raised) */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -6884,6 +6910,37 @@ struct thread {
 | 
			
		|||
#define FOREACH_THREAD(x) FOREACH_THREAD_FROM(curr_thread,x)
 | 
			
		||||
#define END_FOREACH(x)    END_FOREACH_FROM(curr_thread,x)
 | 
			
		||||
 | 
			
		||||
/* $SAFE accessor */
 | 
			
		||||
void
 | 
			
		||||
rb_set_safe_level(level)
 | 
			
		||||
    int level;
 | 
			
		||||
{
 | 
			
		||||
    if (level > ruby_safe_level) {
 | 
			
		||||
	ruby_safe_level = level;
 | 
			
		||||
	curr_thread->safe = level;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
safe_getter()
 | 
			
		||||
{
 | 
			
		||||
    return INT2FIX(ruby_safe_level);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
safe_setter(val)
 | 
			
		||||
    VALUE val;
 | 
			
		||||
{
 | 
			
		||||
    int level = NUM2INT(val);
 | 
			
		||||
 | 
			
		||||
    if (level < ruby_safe_level) {
 | 
			
		||||
	rb_raise(rb_eSecurityError, "tried to downgrade safe level from %d to %d",
 | 
			
		||||
		 ruby_safe_level, level);
 | 
			
		||||
    }
 | 
			
		||||
    ruby_safe_level = level;
 | 
			
		||||
    curr_thread->safe = level;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Return the current time as a floating-point number */
 | 
			
		||||
static double
 | 
			
		||||
timeofday()
 | 
			
		||||
| 
						 | 
				
			
			@ -7026,6 +7083,7 @@ rb_thread_save_context(th)
 | 
			
		|||
    th->scope = ruby_scope;
 | 
			
		||||
    th->klass = ruby_class;
 | 
			
		||||
    th->wrapper = ruby_wrapper;
 | 
			
		||||
    th->cref = ruby_cref;
 | 
			
		||||
    th->dyna_vars = ruby_dyna_vars;
 | 
			
		||||
    th->block = ruby_block;
 | 
			
		||||
    th->flags &= THREAD_FLAGS_MASK;
 | 
			
		||||
| 
						 | 
				
			
			@ -7116,6 +7174,7 @@ rb_thread_restore_context(th, exit)
 | 
			
		|||
    ruby_scope = th->scope;
 | 
			
		||||
    ruby_class = th->klass;
 | 
			
		||||
    ruby_wrapper = th->wrapper;
 | 
			
		||||
    ruby_cref = th->cref;
 | 
			
		||||
    ruby_dyna_vars = th->dyna_vars;
 | 
			
		||||
    ruby_block = th->block;
 | 
			
		||||
    scope_vmode = th->flags&SCOPE_MASK;
 | 
			
		||||
| 
						 | 
				
			
			@ -7516,7 +7575,14 @@ rb_thread_wait_for(time)
 | 
			
		|||
	    n = select(0, 0, 0, 0, &time);
 | 
			
		||||
	    TRAP_END;
 | 
			
		||||
	    if (n == 0) return;
 | 
			
		||||
 | 
			
		||||
	    if (n < 0) {
 | 
			
		||||
		switch (errno) {
 | 
			
		||||
		  case EINTR:
 | 
			
		||||
		    return;
 | 
			
		||||
		  default:
 | 
			
		||||
		    rb_sys_fail("sleep");
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
#ifndef linux
 | 
			
		||||
	    d = limit - timeofday();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -7920,6 +7986,7 @@ rb_thread_abort_exc_set(thread, val)
 | 
			
		|||
    th->scope = 0;\
 | 
			
		||||
    th->klass = 0;\
 | 
			
		||||
    th->wrapper = 0;\
 | 
			
		||||
    th->cref = ruby_cref;\
 | 
			
		||||
    th->dyna_vars = ruby_dyna_vars;\
 | 
			
		||||
    th->block = 0;\
 | 
			
		||||
    th->iter = 0;\
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -351,7 +351,7 @@ module TkComm
 | 
			
		|||
    end
 | 
			
		||||
    if context.kind_of? Array
 | 
			
		||||
      context = context.collect{|ev|
 | 
			
		||||
	if context.kind_of? TkVirtualEvent
 | 
			
		||||
	if ev.kind_of? TkVirtualEvent
 | 
			
		||||
	  ev.path
 | 
			
		||||
	else
 | 
			
		||||
	  ev
 | 
			
		||||
| 
						 | 
				
			
			@ -397,8 +397,18 @@ module TkComm
 | 
			
		|||
	end
 | 
			
		||||
      }
 | 
			
		||||
    else
 | 
			
		||||
      tk_split_list(tk_call(*what)).collect{|seq|
 | 
			
		||||
	seq[1..-2].gsub(/></,',')
 | 
			
		||||
      tk_split_simplelist(tk_call(*what)).collect!{|seq|
 | 
			
		||||
	l = seq.scan(/<*[^<>]+>*/).collect!{|subseq|
 | 
			
		||||
	  case (subseq)
 | 
			
		||||
	  when /^<<[^<>]+>>$/
 | 
			
		||||
	    TkVirtualEvent.getobj(subseq[1..-2])
 | 
			
		||||
	  when /^<[^<>]+>$/
 | 
			
		||||
	    subseq[1..-2]
 | 
			
		||||
	  else
 | 
			
		||||
	    subseq.split('')
 | 
			
		||||
	  end
 | 
			
		||||
	}.flatten
 | 
			
		||||
	(l.size == 1) ? l[0] : l
 | 
			
		||||
      }
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -1046,6 +1056,12 @@ class TkBindTag
 | 
			
		|||
    BTagID_TBL[id]? BTagID_TBL[id]: id
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  ALL = self.new
 | 
			
		||||
  ALL.instance_eval {
 | 
			
		||||
    @id = 'all'
 | 
			
		||||
    BTagID_TBL[@id] = self
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  def initialize(*args)
 | 
			
		||||
    @id = Tk_BINDTAG_ID[0]
 | 
			
		||||
    Tk_BINDTAG_ID[0] = Tk_BINDTAG_ID[0].succ
 | 
			
		||||
| 
						 | 
				
			
			@ -1063,20 +1079,11 @@ class TkBindTag
 | 
			
		|||
end
 | 
			
		||||
 | 
			
		||||
class TkBindTagAll<TkBindTag
 | 
			
		||||
  BindTagALL = []
 | 
			
		||||
  def TkBindTagAll.new(*args)
 | 
			
		||||
    if BindTagALL[0]
 | 
			
		||||
      BindTagALL[0].bind(*args) if args != []
 | 
			
		||||
    else
 | 
			
		||||
      new = super()
 | 
			
		||||
      BindTagALL[0] = new
 | 
			
		||||
    end
 | 
			
		||||
    BindTagALL[0]
 | 
			
		||||
  end
 | 
			
		||||
    $stderr.puts "Warning: TkBindTagALL is obsolete. Use TkBindTag::ALL\n"
 | 
			
		||||
 | 
			
		||||
  def initialize(*args)
 | 
			
		||||
    @id = 'all'
 | 
			
		||||
    BindTagALL[0].bind(*args) if args != []
 | 
			
		||||
    TkBindTag::ALL.bind(*args) if args != []
 | 
			
		||||
    TkBindTag::ALL
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2575,7 +2582,7 @@ class TkWindow<TkObject
 | 
			
		|||
 | 
			
		||||
  def bindtags(taglist=nil)
 | 
			
		||||
    if taglist
 | 
			
		||||
      fail unless taglist.kind_of? Array
 | 
			
		||||
      fail ArgumentError unless taglist.kind_of? Array
 | 
			
		||||
      tk_call('bindtags', path, taglist)
 | 
			
		||||
    else
 | 
			
		||||
      list(tk_call('bindtags', path)).collect{|tag|
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,12 +7,27 @@ require 'tk'
 | 
			
		|||
class TkVirtualEvent<TkObject
 | 
			
		||||
  extend Tk
 | 
			
		||||
 | 
			
		||||
  TkVirturlEventID = [0]
 | 
			
		||||
  TkVirturlEventTBL = {}
 | 
			
		||||
  TkVirtualEventID = [0]
 | 
			
		||||
  TkVirtualEventTBL = {}
 | 
			
		||||
 | 
			
		||||
  class PreDefVirtEvent<self
 | 
			
		||||
    def initialize(event)
 | 
			
		||||
      @path = @id = event
 | 
			
		||||
      TkVirtualEvent::TkVirtualEventTBL[@id] = self
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def TkVirtualEvent.getobj(event)
 | 
			
		||||
    obj = TkVirturlEventTBL[event]
 | 
			
		||||
    obj ? obj : event
 | 
			
		||||
    obj = TkVirtualEventTBL[event]
 | 
			
		||||
    if obj
 | 
			
		||||
      obj
 | 
			
		||||
    else
 | 
			
		||||
      if tk_call('event', 'info').index("<#{event}>")
 | 
			
		||||
	PreDefVirtEvent.new(event)
 | 
			
		||||
      else
 | 
			
		||||
	fail ArgumentError, "undefined virtual event '<#{event}>'"
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def TkVirtualEvent.info
 | 
			
		||||
| 
						 | 
				
			
			@ -22,8 +37,8 @@ class TkVirtualEvent<TkObject
 | 
			
		|||
  end
 | 
			
		||||
 | 
			
		||||
  def initialize(*sequences)
 | 
			
		||||
    @path = @id = format("<VirtEvent%.4d>", TkVirturlEventID[0])
 | 
			
		||||
    TkVirturlEventID[0] += 1
 | 
			
		||||
    @path = @id = format("<VirtEvent%.4d>", TkVirtualEventID[0])
 | 
			
		||||
    TkVirtualEventID[0] += 1
 | 
			
		||||
    add(*sequences)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +46,7 @@ class TkVirtualEvent<TkObject
 | 
			
		|||
    if sequences != []
 | 
			
		||||
      tk_call('event', 'add', "<#{@id}>", 
 | 
			
		||||
	      *(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>"}) )
 | 
			
		||||
      TkVirturlEventTBL[@id] = self
 | 
			
		||||
      TkVirtualEventTBL[@id] = self
 | 
			
		||||
    end
 | 
			
		||||
    self
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -39,11 +54,11 @@ class TkVirtualEvent<TkObject
 | 
			
		|||
  def delete(*sequences)
 | 
			
		||||
    if sequences == []
 | 
			
		||||
      tk_call('event', 'delete', "<#{@id}>")
 | 
			
		||||
      TkVirturlEventTBL[@id] = nil
 | 
			
		||||
      TkVirtualEventTBL[@id] = nil
 | 
			
		||||
    else
 | 
			
		||||
      tk_call('event', 'delete', "<#{@id}>", 
 | 
			
		||||
	      *(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>"}) )
 | 
			
		||||
      TkVirturlEventTBL[@id] = nil if info == []
 | 
			
		||||
      TkVirtualEventTBL[@id] = nil if info == []
 | 
			
		||||
    end
 | 
			
		||||
    self
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										3
									
								
								file.c
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								file.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -757,7 +757,8 @@ test_sticky(obj, fname)
 | 
			
		|||
    VALUE obj, fname;
 | 
			
		||||
{
 | 
			
		||||
#ifdef S_ISVTX
 | 
			
		||||
    return check3rdbyte(STR2CSTR(fname), S_ISVTX);
 | 
			
		||||
    Check_SafeStr(fname);
 | 
			
		||||
    return check3rdbyte(RSTRING(fname)->ptr, S_ISVTX);
 | 
			
		||||
#else
 | 
			
		||||
    return Qnil;
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								intern.h
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								intern.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -78,6 +78,8 @@ VALUE rb_big_lshift _((VALUE, VALUE));
 | 
			
		|||
VALUE rb_big_rand _((VALUE, double));
 | 
			
		||||
/* class.c */
 | 
			
		||||
VALUE rb_class_new _((VALUE));
 | 
			
		||||
VALUE rb_mod_clone _((VALUE));
 | 
			
		||||
VALUE rb_mod_dup _((VALUE));
 | 
			
		||||
VALUE rb_singleton_class_new _((VALUE));
 | 
			
		||||
VALUE rb_singleton_class_clone _((VALUE));
 | 
			
		||||
void rb_singleton_class_attached _((VALUE,VALUE));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								node.h
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								node.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -237,7 +237,7 @@ typedef struct RNode {
 | 
			
		|||
#define NEW_CFUNC(f,c) rb_node_newnode(NODE_CFUNC,f,c,0)
 | 
			
		||||
#define NEW_IFUNC(f,c) rb_node_newnode(NODE_IFUNC,f,c,0)
 | 
			
		||||
#define NEW_RFUNC(b1,b2) NEW_SCOPE(block_append(b1,b2))
 | 
			
		||||
#define NEW_SCOPE(b) rb_node_newnode(NODE_SCOPE,local_tbl(),cur_cref,(b))
 | 
			
		||||
#define NEW_SCOPE(b) rb_node_newnode(NODE_SCOPE,local_tbl(),0,(b))
 | 
			
		||||
#define NEW_BLOCK(a) rb_node_newnode(NODE_BLOCK,a,0,0)
 | 
			
		||||
#define NEW_IF(c,t,e) rb_node_newnode(NODE_IF,c,t,e)
 | 
			
		||||
#define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
 | 
			
		||||
| 
						 | 
				
			
			@ -309,14 +309,12 @@ typedef struct RNode {
 | 
			
		|||
#define NEW_ALIAS(n,o) rb_node_newnode(NODE_ALIAS,o,n,0)
 | 
			
		||||
#define NEW_VALIAS(n,o) rb_node_newnode(NODE_VALIAS,o,n,0)
 | 
			
		||||
#define NEW_UNDEF(i) rb_node_newnode(NODE_UNDEF,0,i,0)
 | 
			
		||||
#define NEW_CLASS(n,b,s) rb_node_newnode(NODE_CLASS,n,NEW_CBODY(b),(s))
 | 
			
		||||
#define NEW_SCLASS(r,b) rb_node_newnode(NODE_SCLASS,r,NEW_CBODY(b),0)
 | 
			
		||||
#define NEW_MODULE(n,b) rb_node_newnode(NODE_MODULE,n,NEW_CBODY(b),0)
 | 
			
		||||
#define NEW_CLASS(n,b,s) rb_node_newnode(NODE_CLASS,n,NEW_SCOPE(b),(s))
 | 
			
		||||
#define NEW_SCLASS(r,b) rb_node_newnode(NODE_SCLASS,r,NEW_SCOPE(b),0)
 | 
			
		||||
#define NEW_MODULE(n,b) rb_node_newnode(NODE_MODULE,n,NEW_SCOPE(b),0)
 | 
			
		||||
#define NEW_COLON2(c,i) rb_node_newnode(NODE_COLON2,c,i,0)
 | 
			
		||||
#define NEW_COLON3(i) rb_node_newnode(NODE_COLON3,0,i,0)
 | 
			
		||||
#define NEW_CREF0() (cur_cref=RNODE(ruby_frame->cbase))
 | 
			
		||||
#define NEW_CREF() (cur_cref=rb_node_newnode(NODE_CREF,0,0,cur_cref))
 | 
			
		||||
#define NEW_CBODY(b) (cur_cref->nd_body=NEW_SCOPE(b),cur_cref)
 | 
			
		||||
#define NEW_CREF(c) (rb_node_newnode(NODE_CREF,0,0,c))
 | 
			
		||||
#define NEW_DOT2(b,e) rb_node_newnode(NODE_DOT2,b,e,0)
 | 
			
		||||
#define NEW_DOT3(b,e) rb_node_newnode(NODE_DOT3,b,e,0)
 | 
			
		||||
#define NEW_ATTRSET(a) rb_node_newnode(NODE_ATTRSET,a,0,0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										36
									
								
								object.c
									
										
									
									
									
								
							
							
						
						
									
										36
									
								
								object.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -229,12 +229,10 @@ rb_obj_is_instance_of(obj, c)
 | 
			
		|||
	return Qfalse;
 | 
			
		||||
 | 
			
		||||
      case T_FALSE:
 | 
			
		||||
	if (obj) return Qfalse;
 | 
			
		||||
	return Qtrue;
 | 
			
		||||
	return RTEST(obj) ? Qfalse : Qtrue;
 | 
			
		||||
 | 
			
		||||
      case T_TRUE:
 | 
			
		||||
	if (obj) return Qtrue;
 | 
			
		||||
	return Qfalse;
 | 
			
		||||
	return RTEST(obj) ? Qtrue : Qfalse;
 | 
			
		||||
 | 
			
		||||
      default:
 | 
			
		||||
	rb_raise(rb_eTypeError, "class or module required");
 | 
			
		||||
| 
						 | 
				
			
			@ -518,36 +516,6 @@ sym_to_s(sym)
 | 
			
		|||
    return rb_str_new2(rb_id2name(SYM2ID(sym)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_mod_clone(module)
 | 
			
		||||
    VALUE module;
 | 
			
		||||
{
 | 
			
		||||
    NEWOBJ(clone, struct RClass);
 | 
			
		||||
    CLONESETUP(clone, module);
 | 
			
		||||
 | 
			
		||||
    clone->super = RCLASS(module)->super;
 | 
			
		||||
    if (RCLASS(module)->iv_tbl) {
 | 
			
		||||
	clone->iv_tbl = st_copy(RCLASS(module)->iv_tbl);
 | 
			
		||||
    }
 | 
			
		||||
    if (RCLASS(module)->m_tbl) {
 | 
			
		||||
	clone->m_tbl = st_copy(RCLASS(module)->m_tbl);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return (VALUE)clone;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_mod_dup(mod)
 | 
			
		||||
    VALUE mod;
 | 
			
		||||
{
 | 
			
		||||
    VALUE dup = rb_mod_clone(mod);
 | 
			
		||||
    OBJSETUP(dup, RBASIC(mod)->klass, BUILTIN_TYPE(mod));
 | 
			
		||||
    if (FL_TEST(mod, FL_SINGLETON)) {
 | 
			
		||||
	FL_SET(dup, FL_SINGLETON);
 | 
			
		||||
    }
 | 
			
		||||
    return dup;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_mod_to_s(klass)
 | 
			
		||||
    VALUE klass;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										19
									
								
								parse.y
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								parse.y
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -132,10 +132,6 @@ static struct RVarmap *dyna_push();
 | 
			
		|||
static void dyna_pop();
 | 
			
		||||
static int dyna_in_block();
 | 
			
		||||
 | 
			
		||||
#define cref_push() NEW_CREF()
 | 
			
		||||
static void cref_pop();
 | 
			
		||||
static NODE *cur_cref;
 | 
			
		||||
 | 
			
		||||
static void top_local_init();
 | 
			
		||||
static void top_local_setup();
 | 
			
		||||
%}
 | 
			
		||||
| 
						 | 
				
			
			@ -269,7 +265,6 @@ program		:  {
 | 
			
		|||
		        $<vars>$ = ruby_dyna_vars;
 | 
			
		||||
			lex_state = EXPR_BEG;
 | 
			
		||||
                        top_local_init();
 | 
			
		||||
			NEW_CREF0(); /* initialize constant c-ref */
 | 
			
		||||
			if ((VALUE)ruby_class == rb_cObject) class_nest = 0;
 | 
			
		||||
			else class_nest = 1;
 | 
			
		||||
		    }
 | 
			
		||||
| 
						 | 
				
			
			@ -288,7 +283,6 @@ program		:  {
 | 
			
		|||
			}
 | 
			
		||||
			ruby_eval_tree = block_append(ruby_eval_tree, $2);
 | 
			
		||||
                        top_local_setup();
 | 
			
		||||
			cur_cref = 0;
 | 
			
		||||
			class_nest = 0;
 | 
			
		||||
		        ruby_dyna_vars = $<vars>1;
 | 
			
		||||
		    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1248,7 +1242,6 @@ primary		: literal
 | 
			
		|||
			if (in_def || in_single)
 | 
			
		||||
			    yyerror("class definition in method body");
 | 
			
		||||
			class_nest++;
 | 
			
		||||
			cref_push();
 | 
			
		||||
			local_push();
 | 
			
		||||
		        $<num>$ = ruby_sourceline;
 | 
			
		||||
		    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1258,7 +1251,6 @@ primary		: literal
 | 
			
		|||
		        $$ = NEW_CLASS($2, $5, $3);
 | 
			
		||||
		        nd_set_line($$, $<num>4);
 | 
			
		||||
		        local_pop();
 | 
			
		||||
			cref_pop();
 | 
			
		||||
			class_nest--;
 | 
			
		||||
		    }
 | 
			
		||||
		| kCLASS tLSHFT expr
 | 
			
		||||
| 
						 | 
				
			
			@ -1271,7 +1263,6 @@ primary		: literal
 | 
			
		|||
		        $<num>$ = in_single;
 | 
			
		||||
		        in_single = 0;
 | 
			
		||||
			class_nest++;
 | 
			
		||||
			cref_push();
 | 
			
		||||
			local_push();
 | 
			
		||||
		    }
 | 
			
		||||
		  compstmt
 | 
			
		||||
| 
						 | 
				
			
			@ -1280,7 +1271,6 @@ primary		: literal
 | 
			
		|||
		        $$ = NEW_SCLASS($3, $7);
 | 
			
		||||
		        fixpos($$, $3);
 | 
			
		||||
		        local_pop();
 | 
			
		||||
			cref_pop();
 | 
			
		||||
			class_nest--;
 | 
			
		||||
		        in_def = $<num>4;
 | 
			
		||||
		        in_single = $<num>6;
 | 
			
		||||
| 
						 | 
				
			
			@ -1290,7 +1280,6 @@ primary		: literal
 | 
			
		|||
			if (in_def || in_single)
 | 
			
		||||
			    yyerror("module definition in method body");
 | 
			
		||||
			class_nest++;
 | 
			
		||||
			cref_push();
 | 
			
		||||
			local_push();
 | 
			
		||||
		        $<num>$ = ruby_sourceline;
 | 
			
		||||
		    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1300,7 +1289,6 @@ primary		: literal
 | 
			
		|||
		        $$ = NEW_MODULE($2, $4);
 | 
			
		||||
		        nd_set_line($$, $<num>3);
 | 
			
		||||
		        local_pop();
 | 
			
		||||
			cref_pop();
 | 
			
		||||
			class_nest--;
 | 
			
		||||
		    }
 | 
			
		||||
		| kDEF fname
 | 
			
		||||
| 
						 | 
				
			
			@ -4748,12 +4736,6 @@ dyna_in_block()
 | 
			
		|||
    return (lvtbl->dlev > 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
cref_pop()
 | 
			
		||||
{
 | 
			
		||||
    cur_cref = cur_cref->nd_next;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
rb_parser_append_print()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -4837,7 +4819,6 @@ Init_sym()
 | 
			
		|||
{
 | 
			
		||||
    sym_tbl = st_init_strtable_with_size(200);
 | 
			
		||||
    sym_rev_tbl = st_init_numtable_with_size(200);
 | 
			
		||||
    rb_global_variable((VALUE*)&cur_cref);
 | 
			
		||||
    rb_global_variable((VALUE*)&lex_lastline);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										9
									
								
								time.c
									
										
									
									
									
								
							
							
						
						
									
										9
									
								
								time.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -352,8 +352,13 @@ make_time_t(tptr, utc_or_local)
 | 
			
		|||
	}
 | 
			
		||||
	tm = localtime(&guess);
 | 
			
		||||
	if (!tm) goto error;
 | 
			
		||||
	if (tptr->tm_hour != tm->tm_hour) {
 | 
			
		||||
	    guess -= 3600;
 | 
			
		||||
	if (lt.tm_isdst != tm->tm_isdst || tptr->tm_hour != tm->tm_hour) {
 | 
			
		||||
	    oguess = guess - 3600;
 | 
			
		||||
	    tm = localtime(&oguess);
 | 
			
		||||
	    if (!tm) goto error;
 | 
			
		||||
	    if (tptr->tm_hour == tm->tm_hour) {
 | 
			
		||||
		guess = oguess;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
	if (guess < 0) {
 | 
			
		||||
	    goto out_of_range;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										11
									
								
								variable.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								variable.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1064,10 +1064,11 @@ rb_const_get(klass, id)
 | 
			
		|||
    VALUE klass;
 | 
			
		||||
    ID id;
 | 
			
		||||
{
 | 
			
		||||
    VALUE value;
 | 
			
		||||
    VALUE tmp;
 | 
			
		||||
    VALUE value, tmp;
 | 
			
		||||
    int mod_retry = 0;
 | 
			
		||||
 | 
			
		||||
    tmp = klass;
 | 
			
		||||
  retry:
 | 
			
		||||
    while (tmp) {
 | 
			
		||||
	if (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl,id,&value)) {
 | 
			
		||||
	    return value;
 | 
			
		||||
| 
						 | 
				
			
			@ -1075,8 +1076,10 @@ rb_const_get(klass, id)
 | 
			
		|||
	if (tmp == rb_cObject && top_const_get(id, &value)) return value;
 | 
			
		||||
	tmp = RCLASS(tmp)->super;
 | 
			
		||||
    }
 | 
			
		||||
    if (BUILTIN_TYPE(klass) == T_MODULE) {
 | 
			
		||||
	return rb_const_get(rb_cObject, id);
 | 
			
		||||
    if (!mod_retry && BUILTIN_TYPE(klass) == T_MODULE) {
 | 
			
		||||
	mod_retry = 1;
 | 
			
		||||
	tmp = rb_cObject;
 | 
			
		||||
	goto retry;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Uninitialized constant */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
#define RUBY_VERSION "1.6.3"
 | 
			
		||||
#define RUBY_RELEASE_DATE "2001-04-03"
 | 
			
		||||
#define RUBY_RELEASE_DATE "2001-04-06"
 | 
			
		||||
#define RUBY_VERSION_CODE 163
 | 
			
		||||
#define RUBY_RELEASE_CODE 20010403
 | 
			
		||||
#define RUBY_RELEASE_CODE 20010406
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue