mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									5a8bfc39f1
								
							
						
					
					
						commit
						4f51d81418
					
				
					 14 changed files with 90 additions and 50 deletions
				
			
		
							
								
								
									
										22
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,7 +1,27 @@
 | 
			
		|||
Tue Jul  4 13:16:02 2000  Yukihiro Matsumoto  <matz@netlab.co.jp>
 | 
			
		||||
 | 
			
		||||
	* util.c (rb_type): should add T_UNDEF.
 | 
			
		||||
 | 
			
		||||
Tue Jul  4 09:30:35 2000  Yukihiro Matsumoto  <matz@netlab.co.jp>
 | 
			
		||||
 | 
			
		||||
	* parse.y (here_document): supports EOF right after terminator.
 | 
			
		||||
 | 
			
		||||
	* random.c (rb_f_rand): argument is now optional (rand(max=0)). 
 | 
			
		||||
 | 
			
		||||
Tue Jul  4 01:50:49 2000  WATANABE Hirofumi  <eban@os.rim.or.jp>
 | 
			
		||||
 | 
			
		||||
	* win32/ruby.def: remove ruby_mktemp.
 | 
			
		||||
 | 
			
		||||
Tue Jul  4 01:27:13 2000  Yukihiro Matsumoto  <matz@netlab.co.jp>
 | 
			
		||||
 | 
			
		||||
	* eval.c (rb_rescue2): new function to rescue arbitrary exception.
 | 
			
		||||
 | 
			
		||||
	* numeric.c (do_coerce): should catch NameError explicitly.
 | 
			
		||||
 | 
			
		||||
Tue Jul  4 00:15:23 2000  Dave Thomas  <Dave@thomases.com>
 | 
			
		||||
 | 
			
		||||
	* numeric.c (Init_Numeric): forgot to register Numeric#remainder.
 | 
			
		||||
 | 
			
		||||
Mon Jul  3 18:35:41 2000  WATANABE Hirofumi  <eban@os.rim.or.jp>
 | 
			
		||||
 | 
			
		||||
	* lib/mkmf.rb: use null device if it exists for cross-compiling.
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +38,7 @@ Mon Jul  3 16:47:22 2000  WATANABE Hirofumi  <eban@os.rim.or.jp>
 | 
			
		|||
 | 
			
		||||
	* cygwin/GNUmakefile: librubys.a -> lib$(RUBY_INSTALL_NAME)s.a
 | 
			
		||||
 | 
			
		||||
	* configure.in: use AC_CANONICAL_{TARGET,HOST,BUILD}.
 | 
			
		||||
	* configure.in: use AC_CANONICAL_{HOST,TARGET,BUILD}.
 | 
			
		||||
 | 
			
		||||
Mon Jul  3 13:15:02 2000  Yukihiro Matsumoto  <matz@netlab.co.jp>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								ToDo
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								ToDo
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -6,7 +6,7 @@ Language Spec.
 | 
			
		|||
- %w(a\ b\ c abc) => ["a b c", "abc"]
 | 
			
		||||
- objectify symbols
 | 
			
		||||
- class variable (prefix @@)
 | 
			
		||||
- rescue RuntimeError in err ??
 | 
			
		||||
- rescue RuntimeError =>n err
 | 
			
		||||
* operator !! for rescue. ???
 | 
			
		||||
* objectify characters
 | 
			
		||||
* ../... outside condition invokes operator method too.
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +73,8 @@ Standard Libraries
 | 
			
		|||
- 'w' template for pack/unpack
 | 
			
		||||
- alternative for interator? => block_given?
 | 
			
		||||
- regex - /p (make obsolete), /m (new)
 | 
			
		||||
- consistent /, %, divmod
 | 
			
		||||
* Enumerable#sort_by for Schwartzian transformation
 | 
			
		||||
* String#scanf(?)
 | 
			
		||||
* Object#fmt(?)
 | 
			
		||||
* Integer#{bin,oct,hex,heX}
 | 
			
		||||
| 
						 | 
				
			
			@ -113,5 +115,4 @@ Things To Do Before 1.6
 | 
			
		|||
 | 
			
		||||
* fix spec. for the following:
 | 
			
		||||
 | 
			
		||||
  * alternative for $! (exception? in? =>? :?)
 | 
			
		||||
  * mkmf.rb - create_makefile("net/socket")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								eval.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								eval.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -3679,9 +3679,9 @@ handle_rescue(self, node)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_rescue(b_proc, data1, r_proc, data2)
 | 
			
		||||
rb_rescue2(b_proc, data1, eclass, r_proc, data2)
 | 
			
		||||
    VALUE (*b_proc)(), (*r_proc)();
 | 
			
		||||
    VALUE data1, data2;
 | 
			
		||||
    VALUE data1, eclass, data2;
 | 
			
		||||
{
 | 
			
		||||
    int state;
 | 
			
		||||
    volatile VALUE result;
 | 
			
		||||
| 
						 | 
				
			
			@ -3692,7 +3692,7 @@ rb_rescue(b_proc, data1, r_proc, data2)
 | 
			
		|||
      retry_entry:
 | 
			
		||||
	result = (*b_proc)(data1);
 | 
			
		||||
    }
 | 
			
		||||
    else if (state == TAG_RAISE && rb_obj_is_kind_of(ruby_errinfo, rb_eStandardError)) {
 | 
			
		||||
    else if (state == TAG_RAISE && rb_obj_is_kind_of(ruby_errinfo, eclass)) {
 | 
			
		||||
	if (r_proc) {
 | 
			
		||||
	    PUSH_TAG(PROT_NONE);
 | 
			
		||||
	    if ((state = EXEC_TAG()) == 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -3718,6 +3718,14 @@ rb_rescue(b_proc, data1, r_proc, data2)
 | 
			
		|||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_rescue(b_proc, data1, r_proc, data2)
 | 
			
		||||
    VALUE (*b_proc)(), (*r_proc)();
 | 
			
		||||
    VALUE data1, data2;
 | 
			
		||||
{
 | 
			
		||||
    return rb_rescue2(b_proc, data1, rb_eStandardError, r_proc, data2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_protect(proc, data, state)
 | 
			
		||||
    VALUE (*proc)();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -519,7 +519,7 @@ mkipaddr0(addr, buf, len)
 | 
			
		|||
 | 
			
		||||
    error = getnameinfo(addr, SA_LEN(addr), buf, len, NULL, 0, NI_NUMERICHOST);
 | 
			
		||||
    if (error) {
 | 
			
		||||
	rb_raise(rb_eSocket, "%s", gai_strerror(error));
 | 
			
		||||
	rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -605,7 +605,7 @@ ip_addrsetup(host, port)
 | 
			
		|||
	if (hostp && hostp[strlen(hostp)-1] == '\n') {
 | 
			
		||||
	    rb_raise(rb_eSocket, "newline at the end of hostname");
 | 
			
		||||
	}
 | 
			
		||||
	rb_raise(rb_eSocket, "%s", gai_strerror(error));
 | 
			
		||||
	rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return res;
 | 
			
		||||
| 
						 | 
				
			
			@ -662,14 +662,14 @@ ipaddr(sockaddr)
 | 
			
		|||
	error = getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
 | 
			
		||||
			    NULL, 0, 0);
 | 
			
		||||
	if (error) {
 | 
			
		||||
	    rb_raise(rb_eSocket, "%s", gai_strerror(error));
 | 
			
		||||
	    rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
 | 
			
		||||
	}
 | 
			
		||||
	addr1 = rb_tainted_str_new2(hbuf);
 | 
			
		||||
    }
 | 
			
		||||
    error = getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
 | 
			
		||||
			pbuf, sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV);
 | 
			
		||||
    if (error) {
 | 
			
		||||
	rb_raise(rb_eSocket, "%s", gai_strerror(error));
 | 
			
		||||
	rb_raise(rb_eSocket, "getnameinfo %s", gai_strerror(error));
 | 
			
		||||
    }
 | 
			
		||||
    addr2 = rb_tainted_str_new2(hbuf);
 | 
			
		||||
    if (do_not_reverse_lookup) {
 | 
			
		||||
| 
						 | 
				
			
			@ -809,7 +809,7 @@ open_inet(class, h, serv, type)
 | 
			
		|||
    }
 | 
			
		||||
    error = getaddrinfo(host, portp, &hints, &res0);
 | 
			
		||||
    if (error) {
 | 
			
		||||
	rb_raise(rb_eSocket, "%s", gai_strerror(error));
 | 
			
		||||
	rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fd = -1;
 | 
			
		||||
| 
						 | 
				
			
			@ -1856,7 +1856,7 @@ sock_s_getaddrinfo(argc, argv)
 | 
			
		|||
    }
 | 
			
		||||
    error = getaddrinfo(hptr, pptr, &hints, &res);
 | 
			
		||||
    if (error) {
 | 
			
		||||
	rb_raise(rb_eSocket, "%s", gai_strerror(error));
 | 
			
		||||
	rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = mkaddrinfo(res);
 | 
			
		||||
| 
						 | 
				
			
			@ -1962,7 +1962,7 @@ sock_s_getnameinfo(argc, argv)
 | 
			
		|||
	}
 | 
			
		||||
#endif
 | 
			
		||||
	error = getaddrinfo(hptr, pptr, &hints, &res);
 | 
			
		||||
	if (error) goto error_exit;
 | 
			
		||||
	if (error) goto error_exit_addr;
 | 
			
		||||
	sap = res->ai_addr;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
| 
						 | 
				
			
			@ -1971,7 +1971,7 @@ sock_s_getnameinfo(argc, argv)
 | 
			
		|||
 | 
			
		||||
    error = getnameinfo(sap, SA_LEN(sap), hbuf, sizeof(hbuf),
 | 
			
		||||
			pbuf, sizeof(pbuf), fl);
 | 
			
		||||
    if (error) goto error_exit;
 | 
			
		||||
    if (error) goto error_exit_name;
 | 
			
		||||
    if (res) {
 | 
			
		||||
	for (r = res->ai_next; r; r = r->ai_next) {
 | 
			
		||||
	    char hbuf2[1024], pbuf2[1024];
 | 
			
		||||
| 
						 | 
				
			
			@ -1979,7 +1979,7 @@ sock_s_getnameinfo(argc, argv)
 | 
			
		|||
	    sap = r->ai_addr;
 | 
			
		||||
	    error = getnameinfo(sap, SA_LEN(sap), hbuf2, sizeof(hbuf2),
 | 
			
		||||
				pbuf2, sizeof(pbuf2), fl);
 | 
			
		||||
	    if (error) goto error_exit;
 | 
			
		||||
	    if (error) goto error_exit_name;
 | 
			
		||||
	    if (strcmp(hbuf, hbuf2) != 0|| strcmp(pbuf, pbuf2) != 0) {
 | 
			
		||||
		freeaddrinfo(res);
 | 
			
		||||
		rb_raise(rb_eSocket, "sockaddr resolved to multiple nodename");
 | 
			
		||||
| 
						 | 
				
			
			@ -1989,9 +1989,13 @@ sock_s_getnameinfo(argc, argv)
 | 
			
		|||
    }
 | 
			
		||||
    return rb_assoc_new(rb_tainted_str_new2(hbuf), rb_tainted_str_new2(pbuf));
 | 
			
		||||
 | 
			
		||||
  error_exit:
 | 
			
		||||
  error_exit_addr:
 | 
			
		||||
    if (res) freeaddrinfo(res);
 | 
			
		||||
    rb_raise(rb_eSocket, "%s", gai_strerror(error));
 | 
			
		||||
    rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
 | 
			
		||||
 | 
			
		||||
  error_exit_name:
 | 
			
		||||
    if (res) freeaddrinfo(res);
 | 
			
		||||
    rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE mConst;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								gc.c
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								gc.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -43,12 +43,11 @@ static void run_final();
 | 
			
		|||
#if defined(MSDOS) || defined(__human68k__)
 | 
			
		||||
#define GC_MALLOC_LIMIT 100000
 | 
			
		||||
#else
 | 
			
		||||
#define GC_MALLOC_LIMIT 400000
 | 
			
		||||
#define GC_MALLOC_LIMIT 4000000
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static unsigned long malloc_memories = 0;
 | 
			
		||||
static unsigned long alloc_objects = 0;
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
mem_error(mesg)
 | 
			
		||||
| 
						 | 
				
			
			@ -282,7 +281,6 @@ rb_newobj()
 | 
			
		|||
      retry:
 | 
			
		||||
	obj = (VALUE)freelist;
 | 
			
		||||
	freelist = freelist->as.free.next;
 | 
			
		||||
	alloc_objects++;
 | 
			
		||||
	return obj;
 | 
			
		||||
    }
 | 
			
		||||
    if (dont_gc || during_gc || rb_prohibit_interrupt) add_heap();
 | 
			
		||||
| 
						 | 
				
			
			@ -914,7 +912,6 @@ rb_gc()
 | 
			
		|||
# define STACK_END (stack_end)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    alloc_objects = 0;
 | 
			
		||||
    malloc_memories = 0;
 | 
			
		||||
 | 
			
		||||
    if (during_gc) return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								io.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								io.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2938,11 +2938,7 @@ rb_io_s_pipe()
 | 
			
		|||
    r = prep_stdio(rb_fdopen(pipes[0], "r"), FMODE_READABLE, rb_cIO);
 | 
			
		||||
    w = prep_stdio(rb_fdopen(pipes[1], "w"), FMODE_WRITABLE|FMODE_SYNC, rb_cIO);
 | 
			
		||||
 | 
			
		||||
    ary = rb_ary_new2(2);
 | 
			
		||||
    rb_ary_push(ary, r);
 | 
			
		||||
    rb_ary_push(ary, w);
 | 
			
		||||
 | 
			
		||||
    return ary;
 | 
			
		||||
    return rb_assoc_new(r, w);
 | 
			
		||||
#else
 | 
			
		||||
    rb_notimplement();
 | 
			
		||||
    return Qnil;		/* not reached */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -547,12 +547,15 @@ The variable ruby-indent-level controls the amount of indentation.
 | 
			
		|||
	    (setq bol (point))
 | 
			
		||||
	    (end-of-line)
 | 
			
		||||
	    (skip-chars-backward " \t")
 | 
			
		||||
	    (and (re-search-backward "#" (save-excursion
 | 
			
		||||
					   (beginning-of-line)
 | 
			
		||||
					   (point)) t)
 | 
			
		||||
		 (setq state (ruby-parse-region parse-start (point)))
 | 
			
		||||
		 (nth 0 state)
 | 
			
		||||
		 (goto-char (nth 0 state)))
 | 
			
		||||
	    (let ((pos (point)))
 | 
			
		||||
	      (and 
 | 
			
		||||
	       (re-search-backward "#" (save-excursion
 | 
			
		||||
					 (beginning-of-line)
 | 
			
		||||
					 (point)) t)
 | 
			
		||||
	       (skip-chars-backward " \t")
 | 
			
		||||
	       (setq state (ruby-parse-region parse-start (point)))
 | 
			
		||||
	       (nth 0 state)
 | 
			
		||||
	       (goto-char pos)))
 | 
			
		||||
	    (or (bobp) (forward-char -1))
 | 
			
		||||
	    (and
 | 
			
		||||
	     (or (and (looking-at ruby-symbol-re)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ do_coerce(x, y)
 | 
			
		|||
    VALUE a[2];
 | 
			
		||||
 | 
			
		||||
    a[0] = *x; a[1] = *y;
 | 
			
		||||
    ary = rb_rescue(coerce_body, (VALUE)a, coerce_rescue, (VALUE)a);
 | 
			
		||||
    ary = rb_rescue2(coerce_body, (VALUE)a, rb_eNameError, coerce_rescue, (VALUE)a);
 | 
			
		||||
    if (TYPE(ary) != T_ARRAY || RARRAY(ary)->len != 2) {
 | 
			
		||||
	rb_raise(rb_eTypeError, "coerce must return [x, y]");
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -136,7 +136,7 @@ static VALUE
 | 
			
		|||
num_remainder(x, y)
 | 
			
		||||
    VALUE x, y;
 | 
			
		||||
{
 | 
			
		||||
    rb_warn("remainder is deprecated; use % opearator");
 | 
			
		||||
    rb_warn("remainder is deprecated; use %% opearator");
 | 
			
		||||
    return rb_funcall(x, '%', 1, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -353,8 +353,7 @@ static VALUE
 | 
			
		|||
flo_divmod(x, y)
 | 
			
		||||
    VALUE x, y;
 | 
			
		||||
{
 | 
			
		||||
    double fy;
 | 
			
		||||
    VALUE div, mod;
 | 
			
		||||
    double fy, div, mod;
 | 
			
		||||
 | 
			
		||||
    switch (TYPE(y)) {
 | 
			
		||||
      case T_FIXNUM:
 | 
			
		||||
| 
						 | 
				
			
			@ -1508,6 +1507,7 @@ Init_Numeric()
 | 
			
		|||
    rb_define_method(rb_cNumeric, "===", num_equal, 1);
 | 
			
		||||
    rb_define_method(rb_cNumeric, "eql?", num_eql, 1);
 | 
			
		||||
    rb_define_method(rb_cNumeric, "divmod", num_divmod, 1);
 | 
			
		||||
    rb_define_method(rb_cNumeric, "remainder", num_remainder, 1);
 | 
			
		||||
    rb_define_method(rb_cNumeric, "abs", num_abs, 0);
 | 
			
		||||
 | 
			
		||||
    rb_define_method(rb_cNumeric, "integer?", num_int_p, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										7
									
								
								parse.y
									
										
									
									
									
								
							
							
						
						
									
										7
									
								
								parse.y
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2627,8 +2627,11 @@ here_document(term, indent)
 | 
			
		|||
		p++;
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
	if (strncmp(eos, p, len) == 0 && (p[len] == '\n' || p[len] == '\r')) {
 | 
			
		||||
	    break;
 | 
			
		||||
	if (strncmp(eos, p, len) == 0) {
 | 
			
		||||
	    if (p[len] == '\n' || p[len] == '\r')
 | 
			
		||||
		break;
 | 
			
		||||
	    if (len == RSTRING(line)->len)
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	lex_pbeg = lex_p = RSTRING(line)->ptr;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								random.c
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								random.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -130,11 +130,15 @@ rb_f_srand(argc, argv, obj)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_f_rand(obj, vmax)
 | 
			
		||||
    VALUE obj, vmax;
 | 
			
		||||
rb_f_rand(argc, argv, obj)
 | 
			
		||||
    int argc;
 | 
			
		||||
    VALUE *argv;
 | 
			
		||||
    VALUE obj;
 | 
			
		||||
{
 | 
			
		||||
    VALUE vmax;
 | 
			
		||||
    long val, max;
 | 
			
		||||
 | 
			
		||||
    rb_scan_args(argc, argv, "01", &vmax);
 | 
			
		||||
    if (first) {
 | 
			
		||||
	struct timeval tv;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -148,9 +152,14 @@ rb_f_rand(obj, vmax)
 | 
			
		|||
	/* fall through */
 | 
			
		||||
      case T_BIGNUM:
 | 
			
		||||
	return rb_big_rand(vmax, RANDOM_NUMBER);
 | 
			
		||||
      case T_NIL:
 | 
			
		||||
	max = 0;
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
	max = NUM2LONG(vmax);
 | 
			
		||||
	break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    max = NUM2LONG(vmax);
 | 
			
		||||
    if (max == 0) {
 | 
			
		||||
	return rb_float_new(RANDOM_NUMBER);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -164,5 +173,5 @@ void
 | 
			
		|||
Init_Random()
 | 
			
		||||
{
 | 
			
		||||
    rb_define_global_function("srand", rb_f_srand, -1);
 | 
			
		||||
    rb_define_global_function("rand", rb_f_rand, 1);
 | 
			
		||||
    rb_define_global_function("rand", rb_f_rand, -1);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								ruby.h
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								ruby.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -467,6 +467,7 @@ VALUE rb_yield _((VALUE));
 | 
			
		|||
int rb_block_given_p _((void));
 | 
			
		||||
VALUE rb_iterate _((VALUE(*)(),VALUE,VALUE(*)(),VALUE));
 | 
			
		||||
VALUE rb_rescue _((VALUE(*)(),VALUE,VALUE(*)(),VALUE));
 | 
			
		||||
VALUE rb_rescue2 _((VALUE(*)(),VALUE,VALUE,VALUE(*)(),VALUE));
 | 
			
		||||
VALUE rb_ensure _((VALUE(*)(),VALUE,VALUE(*)(),VALUE));
 | 
			
		||||
VALUE rb_catch _((const char*,VALUE(*)(),VALUE));
 | 
			
		||||
void rb_throw _((const char*,VALUE)) NORETURN;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -609,14 +609,10 @@ ok($good)
 | 
			
		|||
 | 
			
		||||
b = 10**80
 | 
			
		||||
a = b * 9 + 7
 | 
			
		||||
ok(7 == a % b)
 | 
			
		||||
ok(7-b == a % (-b))
 | 
			
		||||
ok(b-7 == (-a) % b)
 | 
			
		||||
ok(-7 ==(-a) % (-b))
 | 
			
		||||
ok(7 ==a.remainder(b))
 | 
			
		||||
ok(7 ==a.remainder(-b))
 | 
			
		||||
ok(-7 == (-a).remainder(b))
 | 
			
		||||
ok(-7 == (-a).remainder(-b))
 | 
			
		||||
ok(7 ==a % b)
 | 
			
		||||
ok(7 ==a % -b)
 | 
			
		||||
ok(-7 == (-a) % b)
 | 
			
		||||
ok(-7 == (-a) % (-b))
 | 
			
		||||
 | 
			
		||||
check "string & char"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								util.c
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								util.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -40,6 +40,7 @@ rb_type(obj)
 | 
			
		|||
    if (obj == Qnil) return T_NIL;
 | 
			
		||||
    if (obj == Qfalse) return T_FALSE;
 | 
			
		||||
    if (obj == Qtrue) return T_TRUE;
 | 
			
		||||
    if (obj == Qundef) return T_UNDEF;
 | 
			
		||||
    if (SYMBOL_P(obj)) return T_SYMBOL;
 | 
			
		||||
 | 
			
		||||
    return BUILTIN_TYPE(obj);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -296,6 +296,7 @@ EXPORTS
 | 
			
		|||
	rb_yield
 | 
			
		||||
	rb_iterate
 | 
			
		||||
	rb_rescue
 | 
			
		||||
	rb_rescue2
 | 
			
		||||
	rb_protect
 | 
			
		||||
	rb_ensure
 | 
			
		||||
	rb_with_disable_interrupt
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue