matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
41e41d34d1
commit
af328b152b
24
ChangeLog
24
ChangeLog
@ -1,3 +1,8 @@
|
|||||||
|
Wed Nov 8 03:08:53 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (io_fflush): ensure fflush(3) would not block by calling
|
||||||
|
rb_thread_fd_writable().
|
||||||
|
|
||||||
Tue Nov 7 20:29:56 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
Tue Nov 7 20:29:56 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||||
|
|
||||||
* lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.30
|
* lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.30
|
||||||
@ -6,6 +11,25 @@ Tue Nov 7 20:29:56 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
|||||||
|
|
||||||
* lib/net/http.rb: read header when also "100 Continue"
|
* lib/net/http.rb: read header when also "100 Continue"
|
||||||
|
|
||||||
|
Tue Nov 7 04:32:19 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* bignum.c (bigdivrem): use bit shift to make y's MSB set.
|
||||||
|
|
||||||
|
Mon Nov 6 1:22:49 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* error.c (warn_print): do not use err_append(), to ensure output
|
||||||
|
to stderr.
|
||||||
|
|
||||||
|
* error.c (rb_warn): use warn_print() instead of err_print().
|
||||||
|
|
||||||
|
* error.c (rb_warning): ditto.
|
||||||
|
|
||||||
|
* error.c (rb_bug): ditto.
|
||||||
|
|
||||||
|
* eval.c (rb_load): re-raise exceptions during load.
|
||||||
|
|
||||||
|
* time.c (make_time_t): remove useless adjust
|
||||||
|
|
||||||
Thu Nov 2 18:01:16 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Thu Nov 2 18:01:16 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* random.c (rb_f_rand): half-baked float support fixed. This fix
|
* random.c (rb_f_rand): half-baked float support fixed. This fix
|
||||||
|
35
bignum.c
35
bignum.c
@ -830,31 +830,39 @@ bigdivrem(x, y, divp, modp)
|
|||||||
zds = BDIGITS(z);
|
zds = BDIGITS(z);
|
||||||
if (nx==ny) zds[nx+1] = 0;
|
if (nx==ny) zds[nx+1] = 0;
|
||||||
while (!yds[ny-1]) ny--;
|
while (!yds[ny-1]) ny--;
|
||||||
if ((dd = BIGRAD/(BDIGIT_DBL_SIGNED)(yds[ny-1]+1)) != 1) {
|
|
||||||
|
dd = 0;
|
||||||
|
q = yds[ny-1];
|
||||||
|
while ((q & (1<<(BITSPERDIG-1))) == 0) {
|
||||||
|
q <<= 1;
|
||||||
|
dd++;
|
||||||
|
}
|
||||||
|
if (dd) {
|
||||||
yy = rb_big_clone(y);
|
yy = rb_big_clone(y);
|
||||||
tds = BDIGITS(yy);
|
tds = BDIGITS(yy);
|
||||||
j = 0;
|
j = 0;
|
||||||
num = 0;
|
t2 = 0;
|
||||||
while (j<ny) {
|
while (j<ny) {
|
||||||
num += (BDIGIT_DBL)yds[j]*dd;
|
t2 += (BDIGIT_DBL)yds[j]<<dd;
|
||||||
tds[j++] = BIGLO(num);
|
tds[j++] = BIGLO(t2);
|
||||||
num = BIGDN(num);
|
t2 = BIGDN(t2);
|
||||||
}
|
}
|
||||||
yds = tds;
|
yds = tds;
|
||||||
j = 0;
|
j = 0;
|
||||||
num = 0;
|
t2 = 0;
|
||||||
while (j<nx) {
|
while (j<nx) {
|
||||||
num += (BDIGIT_DBL)xds[j]*dd;
|
t2 += (BDIGIT_DBL)xds[j]<<dd;
|
||||||
zds[j++] = BIGLO(num);
|
zds[j++] = BIGLO(t2);
|
||||||
num = BIGDN(num);
|
t2 = BIGDN(t2);
|
||||||
}
|
}
|
||||||
zds[j] = (BDIGIT)num;
|
zds[j] = (BDIGIT)t2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
zds[nx] = 0;
|
zds[nx] = 0;
|
||||||
j = nx;
|
j = nx;
|
||||||
while (j--) zds[j] = xds[j];
|
while (j--) zds[j] = xds[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
j = nx==ny?nx+1:nx;
|
j = nx==ny?nx+1:nx;
|
||||||
do {
|
do {
|
||||||
if (zds[j] == yds[ny-1]) q = BIGRAD-1;
|
if (zds[j] == yds[ny-1]) q = BIGRAD-1;
|
||||||
@ -897,9 +905,10 @@ bigdivrem(x, y, divp, modp)
|
|||||||
zds = BDIGITS(*modp);
|
zds = BDIGITS(*modp);
|
||||||
t2 = 0; i = ny;
|
t2 = 0; i = ny;
|
||||||
while(i--) {
|
while(i--) {
|
||||||
t2 = BIGUP(t2) + zds[i];
|
t2 = (t2 | zds[i]) >> dd;
|
||||||
zds[i] = (BDIGIT)(t2 / dd);
|
q = zds[i];
|
||||||
t2 %= dd;
|
zds[i] = BIGLO(t2);
|
||||||
|
t2 = BIGUP(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RBIGNUM(*modp)->len = ny;
|
RBIGNUM(*modp)->len = ny;
|
||||||
|
19
error.c
19
error.c
@ -100,6 +100,19 @@ rb_compile_error_append(fmt, va_alist)
|
|||||||
err_append(buf);
|
err_append(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
warn_print(fmt, args)
|
||||||
|
const char *fmt;
|
||||||
|
va_list args;
|
||||||
|
{
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
|
err_snprintf(buf, BUFSIZ, fmt, args);
|
||||||
|
fputs(buf, stderr);
|
||||||
|
fputs("\n", stderr);
|
||||||
|
fflush(stderr);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
#ifdef HAVE_STDARG_PROTOTYPES
|
#ifdef HAVE_STDARG_PROTOTYPES
|
||||||
rb_warn(const char *fmt, ...)
|
rb_warn(const char *fmt, ...)
|
||||||
@ -115,7 +128,7 @@ rb_warn(fmt, va_alist)
|
|||||||
snprintf(buf, BUFSIZ, "warning: %s", fmt);
|
snprintf(buf, BUFSIZ, "warning: %s", fmt);
|
||||||
|
|
||||||
va_init_list(args, fmt);
|
va_init_list(args, fmt);
|
||||||
err_print(buf, args);
|
warn_print(buf, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +150,7 @@ rb_warning(fmt, va_alist)
|
|||||||
snprintf(buf, BUFSIZ, "warning: %s", fmt);
|
snprintf(buf, BUFSIZ, "warning: %s", fmt);
|
||||||
|
|
||||||
va_init_list(args, fmt);
|
va_init_list(args, fmt);
|
||||||
err_print(buf, args);
|
warn_print(buf, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +170,7 @@ rb_bug(fmt, va_alist)
|
|||||||
ruby_in_eval = 0;
|
ruby_in_eval = 0;
|
||||||
|
|
||||||
va_init_list(args, fmt);
|
va_init_list(args, fmt);
|
||||||
err_print(buf, args);
|
warn_print(buf, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
ruby_show_version();
|
ruby_show_version();
|
||||||
abort();
|
abort();
|
||||||
|
3
eval.c
3
eval.c
@ -4947,6 +4947,7 @@ rb_load(fname, wrap)
|
|||||||
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
|
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ruby_errinfo = Qnil; /* ensure */
|
||||||
PUSH_VARS();
|
PUSH_VARS();
|
||||||
PUSH_CLASS();
|
PUSH_CLASS();
|
||||||
wrapper = ruby_wrapper;
|
wrapper = ruby_wrapper;
|
||||||
@ -5013,6 +5014,8 @@ rb_load(fname, wrap)
|
|||||||
}
|
}
|
||||||
TMP_PROTECT_END;
|
TMP_PROTECT_END;
|
||||||
if (state) JUMP_TAG(state);
|
if (state) JUMP_TAG(state);
|
||||||
|
if (!NIL_P(ruby_errinfo)) /* exception during load */
|
||||||
|
rb_exc_raise(ruby_errinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -76,14 +76,14 @@ fdbm_s_open(argc, argv, klass)
|
|||||||
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
|
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
|
||||||
}
|
}
|
||||||
if (!dbm) {
|
if (!dbm) {
|
||||||
mode = 0666;
|
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR, 0);
|
||||||
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR, mode);
|
|
||||||
}
|
}
|
||||||
if (!dbm) {
|
if (!dbm) {
|
||||||
dbm = dbm_open(RSTRING(file)->ptr, O_RDONLY, mode);
|
dbm = dbm_open(RSTRING(file)->ptr, O_RDONLY, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbm) {
|
if (!dbm) {
|
||||||
|
printf("mode: %o\n", mode);
|
||||||
if (mode == -1) return Qnil;
|
if (mode == -1) return Qnil;
|
||||||
rb_sys_fail(RSTRING(file)->ptr);
|
rb_sys_fail(RSTRING(file)->ptr);
|
||||||
}
|
}
|
||||||
|
@ -72,10 +72,10 @@ fgdbm_s_open(argc, argv, klass)
|
|||||||
O_RDWR|O_CREAT, mode, MY_FATAL_FUNC);
|
O_RDWR|O_CREAT, mode, MY_FATAL_FUNC);
|
||||||
if (!dbm)
|
if (!dbm)
|
||||||
dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
|
dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
|
||||||
O_RDWR, mode, MY_FATAL_FUNC);
|
O_RDWR, 0, MY_FATAL_FUNC);
|
||||||
if (!dbm)
|
if (!dbm)
|
||||||
dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
|
dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
|
||||||
O_RDONLY, mode, MY_FATAL_FUNC);
|
O_RDONLY, 0, MY_FATAL_FUNC);
|
||||||
|
|
||||||
if (!dbm) {
|
if (!dbm) {
|
||||||
if (mode == -1) return Qnil;
|
if (mode == -1) return Qnil;
|
||||||
|
@ -70,9 +70,9 @@ fsdbm_s_open(argc, argv, klass)
|
|||||||
if (mode >= 0)
|
if (mode >= 0)
|
||||||
dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
|
dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
|
||||||
if (!dbm)
|
if (!dbm)
|
||||||
dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR, mode);
|
dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR, 0);
|
||||||
if (!dbm)
|
if (!dbm)
|
||||||
dbm = sdbm_open(RSTRING(file)->ptr, O_RDONLY, mode);
|
dbm = sdbm_open(RSTRING(file)->ptr, O_RDONLY, 0);
|
||||||
|
|
||||||
if (!dbm) {
|
if (!dbm) {
|
||||||
if (mode == -1) return Qnil;
|
if (mode == -1) return Qnil;
|
||||||
|
@ -768,7 +768,6 @@ ruby_connect(fd, sockaddr, len, socks)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef HAVE_FCNTL
|
#ifdef HAVE_FCNTL
|
||||||
mode &= ~NONBLOCKING;
|
|
||||||
fcntl(fd, F_SETFL, mode);
|
fcntl(fd, F_SETFL, mode);
|
||||||
#endif
|
#endif
|
||||||
return status;
|
return status;
|
||||||
|
39
io.c
39
io.c
@ -123,6 +123,20 @@ extern int ReadDataPending();
|
|||||||
}\
|
}\
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#ifndef EWOULDBLOCK
|
||||||
|
#define EWOULDBLOCK EAGAIN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef O_NDELAY
|
||||||
|
# define NONBLOCKING O_NDELAY
|
||||||
|
#else
|
||||||
|
#ifdef O_NBIO
|
||||||
|
# define NONBLOCKING O_NBIO
|
||||||
|
#else
|
||||||
|
# define NONBLOCKING O_NONBLOCK
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_eof_error()
|
rb_eof_error()
|
||||||
{
|
{
|
||||||
@ -194,6 +208,15 @@ rb_dup(orig)
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
io_fflush(f, path)
|
||||||
|
FILE *f;
|
||||||
|
const char *path;
|
||||||
|
{
|
||||||
|
rb_thread_fd_writable(fileno(f));
|
||||||
|
if (fflush(f) == EOF) rb_sys_fail(path);
|
||||||
|
}
|
||||||
|
|
||||||
/* writing functions */
|
/* writing functions */
|
||||||
static VALUE
|
static VALUE
|
||||||
io_write(io, str)
|
io_write(io, str)
|
||||||
@ -235,7 +258,7 @@ io_write(io, str)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (fptr->mode & FMODE_SYNC) {
|
if (fptr->mode & FMODE_SYNC) {
|
||||||
if (fflush(f) == EOF) rb_sys_fail(fptr->path);
|
io_fflush(f, fptr->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return INT2FIX(n);
|
return INT2FIX(n);
|
||||||
@ -266,8 +289,8 @@ rb_io_flush(io)
|
|||||||
GetOpenFile(io, fptr);
|
GetOpenFile(io, fptr);
|
||||||
rb_io_check_writable(fptr);
|
rb_io_check_writable(fptr);
|
||||||
f = GetWriteFile(fptr);
|
f = GetWriteFile(fptr);
|
||||||
|
|
||||||
if (fflush(f) == EOF) rb_sys_fail(fptr->path);
|
io_fflush(f, fptr->path);
|
||||||
|
|
||||||
return io;
|
return io;
|
||||||
}
|
}
|
||||||
@ -1779,10 +1802,10 @@ io_reopen(io, nfile)
|
|||||||
pos = ftell(orig->f);
|
pos = ftell(orig->f);
|
||||||
}
|
}
|
||||||
if (orig->f2) {
|
if (orig->f2) {
|
||||||
if (fflush(orig->f2) == EOF) rb_sys_fail(orig->path);
|
io_fflush(orig->f2, orig->path);
|
||||||
}
|
}
|
||||||
else if (orig->mode & FMODE_WRITABLE) {
|
else if (orig->mode & FMODE_WRITABLE) {
|
||||||
if (fflush(orig->f) == EOF) rb_sys_fail(orig->path);
|
io_fflush(orig->f, orig->path);
|
||||||
}
|
}
|
||||||
rb_thread_fd_close(fileno(fptr->f));
|
rb_thread_fd_close(fileno(fptr->f));
|
||||||
|
|
||||||
@ -1905,10 +1928,10 @@ rb_io_clone(io)
|
|||||||
MakeOpenFile(clone, fptr);
|
MakeOpenFile(clone, fptr);
|
||||||
|
|
||||||
if (orig->f2) {
|
if (orig->f2) {
|
||||||
if (fflush(orig->f2) == EOF) rb_sys_fail(orig->path);
|
io_fflush(orig->f2, orig->path);
|
||||||
}
|
}
|
||||||
else if (orig->mode & FMODE_WRITABLE) {
|
else if (orig->mode & FMODE_WRITABLE) {
|
||||||
if (fflush(orig->f) == EOF) rb_sys_fail(orig->path);
|
io_fflush(orig->f, orig->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy OpenFile structure */
|
/* copy OpenFile structure */
|
||||||
@ -2033,7 +2056,7 @@ rb_io_putc(io, ch)
|
|||||||
if (fputc(c, f) == EOF)
|
if (fputc(c, f) == EOF)
|
||||||
rb_sys_fail(fptr->path);
|
rb_sys_fail(fptr->path);
|
||||||
if (fptr->mode & FMODE_SYNC) {
|
if (fptr->mode & FMODE_SYNC) {
|
||||||
if (fflush(f) == EOF) rb_sys_fail(fptr->path);
|
io_fflush(f, fptr->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
|
@ -5,8 +5,8 @@ class String
|
|||||||
printf STDERR, "feel free for some warnings:\n" if $VERBOSE
|
printf STDERR, "feel free for some warnings:\n" if $VERBOSE
|
||||||
|
|
||||||
def _regex_quote(str)
|
def _regex_quote(str)
|
||||||
str.gsub(/\W/){|s|
|
str.gsub(/[][.\\|*?+{}()]/n){|s|
|
||||||
if s == "-" then s elsif s == "\\" then "\\\\" else "\\\\#{s}" end
|
if s == "\\" then "\\\\" else "\\\\#{s}" end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
private :_regex_quote
|
private :_regex_quote
|
||||||
@ -93,7 +93,7 @@ class String
|
|||||||
|
|
||||||
def _expand_ch str
|
def _expand_ch str
|
||||||
a = []
|
a = []
|
||||||
str.scan(/(.|\n)-(.|\n)|(.|\n)/) do |r|
|
str.scan(/(.)-(.)|(.)/m) do |r|
|
||||||
if $3
|
if $3
|
||||||
a.push $3
|
a.push $3
|
||||||
elsif $1.length != $2.length
|
elsif $1.length != $2.length
|
||||||
|
@ -41,7 +41,7 @@ module Open3
|
|||||||
pi = [pw[1], pr[0], pe[0]]
|
pi = [pw[1], pr[0], pe[0]]
|
||||||
if defined? yield
|
if defined? yield
|
||||||
begin
|
begin
|
||||||
return yield *pi
|
return yield(*pi)
|
||||||
ensure
|
ensure
|
||||||
pi.each{|p| p.close unless p.closed?}
|
pi.each{|p| p.close unless p.closed?}
|
||||||
end
|
end
|
||||||
|
5
time.c
5
time.c
@ -328,11 +328,6 @@ make_time_t(tptr, utc_or_local)
|
|||||||
tm = localtime(&guess);
|
tm = localtime(&guess);
|
||||||
if (!tm) goto error;
|
if (!tm) goto error;
|
||||||
guess -= tm->tm_gmtoff;
|
guess -= tm->tm_gmtoff;
|
||||||
tm = localtime(&guess);
|
|
||||||
if (!tm) goto error;
|
|
||||||
if (tm->tm_hour != tptr->tm_hour) {
|
|
||||||
guess += (tptr->tm_hour - tm->tm_hour)*3600;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
struct tm gt, lt;
|
struct tm gt, lt;
|
||||||
long tzsec;
|
long tzsec;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define RUBY_VERSION "1.6.2"
|
#define RUBY_VERSION "1.6.2"
|
||||||
#define RUBY_RELEASE_DATE "2000-11-04"
|
#define RUBY_RELEASE_DATE "2000-11-08"
|
||||||
#define RUBY_VERSION_CODE 162
|
#define RUBY_VERSION_CODE 162
|
||||||
#define RUBY_RELEASE_CODE 20001104
|
#define RUBY_RELEASE_CODE 20001108
|
||||||
|
Loading…
x
Reference in New Issue
Block a user