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@1037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1db8e80b29
commit
2a1b0ff232
9 changed files with 77 additions and 22 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Sat Nov 11 22:57:38 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* parse.y (arg): uniformed treatment of -a**b, where a is a
|
||||
number literal; hacky but behavior appears uniformed.
|
||||
|
||||
* parse.y (newline_node): reduce newline node (one per line).
|
||||
|
||||
* random.c (rb_f_srand): should be prohibited in safe level
|
||||
greater than 4.
|
||||
|
||||
Sat Nov 11 08:34:18 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||
|
||||
* lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.31.
|
||||
|
@ -8,7 +18,9 @@ Sat Nov 11 08:34:18 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
|||
|
||||
Fri Nov 10 16:15:53 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* error.c: T_SYMBOL was misplaced my T_UNDEF.
|
||||
* numeric.c (rb_num2long): use to_int, not to_i.
|
||||
|
||||
* error.c: T_SYMBOL was misplaced by T_UNDEF.
|
||||
|
||||
* parse.y (yylex): eval("^") caused infinite loop.
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd chroot\
|
|||
truncate chsize times utimes fcntl lockf lstat symlink readlink\
|
||||
setitimer setruid seteuid setreuid setrgid setegid setregid pause\
|
||||
getpgrp setpgrp getpgid setpgid getgroups getpriority getrlimit\
|
||||
dlopen sigprocmask sigaction _setjmp setsid telldir seekdir)
|
||||
dlopen sigprocmask sigaction _setjmp setsid telldir seekdir fchmod)
|
||||
AC_STRUCT_TIMEZONE
|
||||
AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
|
||||
[AC_TRY_LINK([#include <time.h>
|
||||
|
|
8
file.c
8
file.c
|
@ -940,12 +940,12 @@ rb_file_chmod(obj, vmode)
|
|||
mode = NUM2INT(vmode);
|
||||
|
||||
GetOpenFile(obj, fptr);
|
||||
#if defined(DJGPP) || defined(NT) || defined(__BEOS__) || defined(__EMX__)
|
||||
if (!fptr->path) return Qnil;
|
||||
if (chmod(fptr->path, mode) == -1)
|
||||
#ifdef HAVE_FCHMOD
|
||||
if (fchmod(fileno(fptr->f), mode) == -1)
|
||||
rb_sys_fail(fptr->path);
|
||||
#else
|
||||
if (fchmod(fileno(fptr->f), mode) == -1)
|
||||
if (!fptr->path) return Qnil;
|
||||
if (chmod(fptr->path, mode) == -1)
|
||||
rb_sys_fail(fptr->path);
|
||||
#endif
|
||||
|
||||
|
|
1
intern.h
1
intern.h
|
@ -227,6 +227,7 @@ VALUE rb_obj_untaint _((VALUE));
|
|||
VALUE rb_obj_freeze _((VALUE));
|
||||
VALUE rb_obj_id _((VALUE));
|
||||
VALUE rb_convert_type _((VALUE,int,const char*,const char*));
|
||||
VALUE rb_to_int _((VALUE));
|
||||
VALUE rb_Integer _((VALUE));
|
||||
VALUE rb_Float _((VALUE));
|
||||
VALUE rb_String _((VALUE));
|
||||
|
|
4
io.c
4
io.c
|
@ -2481,7 +2481,11 @@ next_argv()
|
|||
fw = rb_fopen(fn, "w");
|
||||
#ifndef NO_SAFE_RENAME
|
||||
fstat(fileno(fw), &st2);
|
||||
#ifdef HAVE_FCHMOD
|
||||
fchmod(fileno(fw), st.st_mode);
|
||||
#else
|
||||
chmod(fn, st.st_mode);
|
||||
#endif
|
||||
if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) {
|
||||
fchown(fileno(fw), st.st_uid, st.st_gid);
|
||||
}
|
||||
|
|
|
@ -1564,6 +1564,7 @@ Init_Numeric()
|
|||
rb_define_method(rb_cInteger, "next", int_succ, 0);
|
||||
rb_define_method(rb_cInteger, "chr", int_chr, 0);
|
||||
rb_define_method(rb_cInteger, "to_i", int_to_i, 0);
|
||||
rb_define_method(rb_cInteger, "to_int", int_to_i, 0);
|
||||
rb_define_method(rb_cInteger, "floor", int_to_i, 0);
|
||||
rb_define_method(rb_cInteger, "ceil", int_to_i, 0);
|
||||
rb_define_method(rb_cInteger, "round", int_to_i, 0);
|
||||
|
|
41
object.c
41
object.c
|
@ -871,12 +871,37 @@ rb_convert_type(val, type, tname, method)
|
|||
return val;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_to_integer(val, method)
|
||||
VALUE val;
|
||||
char *method;
|
||||
{
|
||||
struct arg_to arg1, arg2;
|
||||
|
||||
|
||||
arg1.val = arg2.val = val;
|
||||
arg1.s = method;
|
||||
arg2.s = "Integer";
|
||||
val = rb_rescue2(to_type, (VALUE)&arg1, fail_to_type, (VALUE)&arg2,
|
||||
rb_eStandardError, rb_eNameError, 0);
|
||||
if (!rb_obj_is_kind_of(val, rb_cInteger)) {
|
||||
rb_raise(rb_eTypeError, "%s#%s_i should return Integer",
|
||||
method, rb_class2name(CLASS_OF(arg1.val)));
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_to_int(val)
|
||||
VALUE val;
|
||||
{
|
||||
return rb_to_integer(val, "to_int");
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_Integer(val)
|
||||
VALUE val;
|
||||
{
|
||||
struct arg_to arg1, arg2;
|
||||
|
||||
switch (TYPE(val)) {
|
||||
case T_FLOAT:
|
||||
if (RFLOAT(val)->value <= (double)FIXNUM_MAX
|
||||
|
@ -897,17 +922,7 @@ rb_Integer(val)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
arg1.val = arg2.val = val;
|
||||
arg1.s = "to_i";
|
||||
arg2.s = "Integer";
|
||||
val = rb_rescue2(to_type, (VALUE)&arg1, fail_to_type, (VALUE)&arg2,
|
||||
rb_eStandardError, rb_eNameError, 0);
|
||||
if (!rb_obj_is_kind_of(val, rb_cInteger)) {
|
||||
rb_raise(rb_eTypeError, "%s#to_i should return Integer",
|
||||
rb_class2name(CLASS_OF(arg1.val)));
|
||||
}
|
||||
return val;
|
||||
return rb_to_integer(val, "to_i");
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
24
parse.y
24
parse.y
|
@ -749,7 +749,26 @@ arg : lhs '=' arg
|
|||
}
|
||||
| arg tPOW arg
|
||||
{
|
||||
int need_negate = Qfalse;
|
||||
|
||||
if (nd_type($1) == NODE_LIT) {
|
||||
|
||||
switch (TYPE($1->nd_lit)) {
|
||||
case T_FIXNUM:
|
||||
case T_FLOAT:
|
||||
case T_BIGNUM:
|
||||
if (RTEST(rb_funcall($1->nd_lit,'<',1,INT2FIX(0)))) {
|
||||
$1->nd_lit = rb_funcall($1->nd_lit,rb_intern("-@"),0,0);
|
||||
need_negate = Qtrue;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
$$ = call_op($1, tPOW, 1, $3);
|
||||
if (need_negate) {
|
||||
$$ = call_op($$, tUMINUS, 0, 0);
|
||||
}
|
||||
}
|
||||
| tUPLUS arg
|
||||
{
|
||||
|
@ -1891,6 +1910,7 @@ yyerror(msg)
|
|||
}
|
||||
|
||||
static int heredoc_end;
|
||||
static int last_newline;
|
||||
|
||||
int ruby_in_compile = 0;
|
||||
int ruby__end__seen;
|
||||
|
@ -1930,6 +1950,7 @@ yycompile(f, line)
|
|||
ruby__end__seen = 0;
|
||||
ruby_eval_tree = 0;
|
||||
heredoc_end = 0;
|
||||
last_newline = 0;
|
||||
ruby_sourcefile = f;
|
||||
ruby_in_compile = 1;
|
||||
n = yyparse();
|
||||
|
@ -3823,9 +3844,10 @@ newline_node(node)
|
|||
{
|
||||
NODE *nl = 0;
|
||||
if (node) {
|
||||
if (nd_line(node) == last_newline) return node;
|
||||
nl = NEW_NEWLINE(node);
|
||||
fixpos(nl, node);
|
||||
nl->nd_nth = nd_line(node);
|
||||
last_newline = nl->nd_nth = nd_line(node);
|
||||
}
|
||||
return nl;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.6.2"
|
||||
#define RUBY_RELEASE_DATE "2000-11-10"
|
||||
#define RUBY_RELEASE_DATE "2000-11-13"
|
||||
#define RUBY_VERSION_CODE 162
|
||||
#define RUBY_RELEASE_CODE 20001110
|
||||
#define RUBY_RELEASE_CODE 20001113
|
||||
|
|
Loading…
Reference in a new issue