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@1031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
41e41d34d1
commit
af328b152b
13 changed files with 109 additions and 43 deletions
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>
|
||||
|
||||
* 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"
|
||||
|
||||
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>
|
||||
|
||||
* 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);
|
||||
if (nx==ny) zds[nx+1] = 0;
|
||||
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);
|
||||
tds = BDIGITS(yy);
|
||||
j = 0;
|
||||
num = 0;
|
||||
t2 = 0;
|
||||
while (j<ny) {
|
||||
num += (BDIGIT_DBL)yds[j]*dd;
|
||||
tds[j++] = BIGLO(num);
|
||||
num = BIGDN(num);
|
||||
t2 += (BDIGIT_DBL)yds[j]<<dd;
|
||||
tds[j++] = BIGLO(t2);
|
||||
t2 = BIGDN(t2);
|
||||
}
|
||||
yds = tds;
|
||||
j = 0;
|
||||
num = 0;
|
||||
t2 = 0;
|
||||
while (j<nx) {
|
||||
num += (BDIGIT_DBL)xds[j]*dd;
|
||||
zds[j++] = BIGLO(num);
|
||||
num = BIGDN(num);
|
||||
t2 += (BDIGIT_DBL)xds[j]<<dd;
|
||||
zds[j++] = BIGLO(t2);
|
||||
t2 = BIGDN(t2);
|
||||
}
|
||||
zds[j] = (BDIGIT)num;
|
||||
zds[j] = (BDIGIT)t2;
|
||||
}
|
||||
else {
|
||||
zds[nx] = 0;
|
||||
j = nx;
|
||||
while (j--) zds[j] = xds[j];
|
||||
}
|
||||
|
||||
j = nx==ny?nx+1:nx;
|
||||
do {
|
||||
if (zds[j] == yds[ny-1]) q = BIGRAD-1;
|
||||
|
@ -897,9 +905,10 @@ bigdivrem(x, y, divp, modp)
|
|||
zds = BDIGITS(*modp);
|
||||
t2 = 0; i = ny;
|
||||
while(i--) {
|
||||
t2 = BIGUP(t2) + zds[i];
|
||||
zds[i] = (BDIGIT)(t2 / dd);
|
||||
t2 %= dd;
|
||||
t2 = (t2 | zds[i]) >> dd;
|
||||
q = zds[i];
|
||||
zds[i] = BIGLO(t2);
|
||||
t2 = BIGUP(q);
|
||||
}
|
||||
}
|
||||
RBIGNUM(*modp)->len = ny;
|
||||
|
|
19
error.c
19
error.c
|
@ -100,6 +100,19 @@ rb_compile_error_append(fmt, va_alist)
|
|||
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
|
||||
#ifdef HAVE_STDARG_PROTOTYPES
|
||||
rb_warn(const char *fmt, ...)
|
||||
|
@ -115,7 +128,7 @@ rb_warn(fmt, va_alist)
|
|||
snprintf(buf, BUFSIZ, "warning: %s", fmt);
|
||||
|
||||
va_init_list(args, fmt);
|
||||
err_print(buf, args);
|
||||
warn_print(buf, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
@ -137,7 +150,7 @@ rb_warning(fmt, va_alist)
|
|||
snprintf(buf, BUFSIZ, "warning: %s", fmt);
|
||||
|
||||
va_init_list(args, fmt);
|
||||
err_print(buf, args);
|
||||
warn_print(buf, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
@ -157,7 +170,7 @@ rb_bug(fmt, va_alist)
|
|||
ruby_in_eval = 0;
|
||||
|
||||
va_init_list(args, fmt);
|
||||
err_print(buf, args);
|
||||
warn_print(buf, args);
|
||||
va_end(args);
|
||||
ruby_show_version();
|
||||
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);
|
||||
}
|
||||
|
||||
ruby_errinfo = Qnil; /* ensure */
|
||||
PUSH_VARS();
|
||||
PUSH_CLASS();
|
||||
wrapper = ruby_wrapper;
|
||||
|
@ -5013,6 +5014,8 @@ rb_load(fname, wrap)
|
|||
}
|
||||
TMP_PROTECT_END;
|
||||
if (state) JUMP_TAG(state);
|
||||
if (!NIL_P(ruby_errinfo)) /* exception during load */
|
||||
rb_exc_raise(ruby_errinfo);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -76,14 +76,14 @@ fdbm_s_open(argc, argv, klass)
|
|||
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
|
||||
}
|
||||
if (!dbm) {
|
||||
mode = 0666;
|
||||
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR, mode);
|
||||
dbm = dbm_open(RSTRING(file)->ptr, O_RDWR, 0);
|
||||
}
|
||||
if (!dbm) {
|
||||
dbm = dbm_open(RSTRING(file)->ptr, O_RDONLY, mode);
|
||||
dbm = dbm_open(RSTRING(file)->ptr, O_RDONLY, 0);
|
||||
}
|
||||
|
||||
if (!dbm) {
|
||||
printf("mode: %o\n", mode);
|
||||
if (mode == -1) return Qnil;
|
||||
rb_sys_fail(RSTRING(file)->ptr);
|
||||
}
|
||||
|
|
|
@ -72,10 +72,10 @@ fgdbm_s_open(argc, argv, klass)
|
|||
O_RDWR|O_CREAT, mode, MY_FATAL_FUNC);
|
||||
if (!dbm)
|
||||
dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
|
||||
O_RDWR, mode, MY_FATAL_FUNC);
|
||||
O_RDWR, 0, MY_FATAL_FUNC);
|
||||
if (!dbm)
|
||||
dbm = gdbm_open(RSTRING(file)->ptr, MY_BLOCK_SIZE,
|
||||
O_RDONLY, mode, MY_FATAL_FUNC);
|
||||
O_RDONLY, 0, MY_FATAL_FUNC);
|
||||
|
||||
if (!dbm) {
|
||||
if (mode == -1) return Qnil;
|
||||
|
|
|
@ -70,9 +70,9 @@ fsdbm_s_open(argc, argv, klass)
|
|||
if (mode >= 0)
|
||||
dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR|O_CREAT, mode);
|
||||
if (!dbm)
|
||||
dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR, mode);
|
||||
dbm = sdbm_open(RSTRING(file)->ptr, O_RDWR, 0);
|
||||
if (!dbm)
|
||||
dbm = sdbm_open(RSTRING(file)->ptr, O_RDONLY, mode);
|
||||
dbm = sdbm_open(RSTRING(file)->ptr, O_RDONLY, 0);
|
||||
|
||||
if (!dbm) {
|
||||
if (mode == -1) return Qnil;
|
||||
|
|
|
@ -768,7 +768,6 @@ ruby_connect(fd, sockaddr, len, socks)
|
|||
}
|
||||
}
|
||||
#ifdef HAVE_FCNTL
|
||||
mode &= ~NONBLOCKING;
|
||||
fcntl(fd, F_SETFL, mode);
|
||||
#endif
|
||||
return status;
|
||||
|
|
39
io.c
39
io.c
|
@ -123,6 +123,20 @@ extern int ReadDataPending();
|
|||
}\
|
||||
} 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
|
||||
rb_eof_error()
|
||||
{
|
||||
|
@ -194,6 +208,15 @@ rb_dup(orig)
|
|||
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 */
|
||||
static VALUE
|
||||
io_write(io, str)
|
||||
|
@ -235,7 +258,7 @@ io_write(io, str)
|
|||
}
|
||||
#endif
|
||||
if (fptr->mode & FMODE_SYNC) {
|
||||
if (fflush(f) == EOF) rb_sys_fail(fptr->path);
|
||||
io_fflush(f, fptr->path);
|
||||
}
|
||||
|
||||
return INT2FIX(n);
|
||||
|
@ -266,8 +289,8 @@ rb_io_flush(io)
|
|||
GetOpenFile(io, fptr);
|
||||
rb_io_check_writable(fptr);
|
||||
f = GetWriteFile(fptr);
|
||||
|
||||
if (fflush(f) == EOF) rb_sys_fail(fptr->path);
|
||||
|
||||
io_fflush(f, fptr->path);
|
||||
|
||||
return io;
|
||||
}
|
||||
|
@ -1779,10 +1802,10 @@ io_reopen(io, nfile)
|
|||
pos = ftell(orig->f);
|
||||
}
|
||||
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) {
|
||||
if (fflush(orig->f) == EOF) rb_sys_fail(orig->path);
|
||||
io_fflush(orig->f, orig->path);
|
||||
}
|
||||
rb_thread_fd_close(fileno(fptr->f));
|
||||
|
||||
|
@ -1905,10 +1928,10 @@ rb_io_clone(io)
|
|||
MakeOpenFile(clone, fptr);
|
||||
|
||||
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) {
|
||||
if (fflush(orig->f) == EOF) rb_sys_fail(orig->path);
|
||||
io_fflush(orig->f, orig->path);
|
||||
}
|
||||
|
||||
/* copy OpenFile structure */
|
||||
|
@ -2033,7 +2056,7 @@ rb_io_putc(io, ch)
|
|||
if (fputc(c, f) == EOF)
|
||||
rb_sys_fail(fptr->path);
|
||||
if (fptr->mode & FMODE_SYNC) {
|
||||
if (fflush(f) == EOF) rb_sys_fail(fptr->path);
|
||||
io_fflush(f, fptr->path);
|
||||
}
|
||||
|
||||
return ch;
|
||||
|
|
|
@ -5,8 +5,8 @@ class String
|
|||
printf STDERR, "feel free for some warnings:\n" if $VERBOSE
|
||||
|
||||
def _regex_quote(str)
|
||||
str.gsub(/\W/){|s|
|
||||
if s == "-" then s elsif s == "\\" then "\\\\" else "\\\\#{s}" end
|
||||
str.gsub(/[][.\\|*?+{}()]/n){|s|
|
||||
if s == "\\" then "\\\\" else "\\\\#{s}" end
|
||||
}
|
||||
end
|
||||
private :_regex_quote
|
||||
|
@ -93,7 +93,7 @@ class String
|
|||
|
||||
def _expand_ch str
|
||||
a = []
|
||||
str.scan(/(.|\n)-(.|\n)|(.|\n)/) do |r|
|
||||
str.scan(/(.)-(.)|(.)/m) do |r|
|
||||
if $3
|
||||
a.push $3
|
||||
elsif $1.length != $2.length
|
||||
|
|
|
@ -41,7 +41,7 @@ module Open3
|
|||
pi = [pw[1], pr[0], pe[0]]
|
||||
if defined? yield
|
||||
begin
|
||||
return yield *pi
|
||||
return yield(*pi)
|
||||
ensure
|
||||
pi.each{|p| p.close unless p.closed?}
|
||||
end
|
||||
|
|
5
time.c
5
time.c
|
@ -328,11 +328,6 @@ make_time_t(tptr, utc_or_local)
|
|||
tm = localtime(&guess);
|
||||
if (!tm) goto error;
|
||||
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
|
||||
struct tm gt, lt;
|
||||
long tzsec;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#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_RELEASE_CODE 20001104
|
||||
#define RUBY_RELEASE_CODE 20001108
|
||||
|
|
Loading…
Reference in a new issue