2000-06-13

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-06-13 09:42:40 +00:00
parent 97f8593cf8
commit 9ee0cafbfe
6 changed files with 69 additions and 18 deletions

View File

@ -1,3 +1,15 @@
Tue Jun 13 11:46:17 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* process.c (proc_setsid): try implement it using setpgrp() and
ioctl(fd, TIOCNOTTY, NULL).
* re.c (rb_reg_prepare_re): magic variable $= should affect regex
pattern match.
* time.c (make_time_t): use tm.tm_gmtoff if possible.
* time.c (time_zone): use tm.tm_zone if available.
Mon Jun 12 23:41:54 2000 WATANABE Hirofumi <eban@os.rim.or.jp> Mon Jun 12 23:41:54 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* configure.in (daylight): avoid GCC optimization. * configure.in (daylight): avoid GCC optimization.

3
ToDo
View File

@ -44,7 +44,8 @@ Hacking Interpreter
* scrambled script, or script filter * scrambled script, or script filter
* setuid ruby * setuid ruby
* performance tune for in-block (dynamic) local variables. * performance tune for in-block (dynamic) local variables.
* generational GC ?? (is it possible?) * generational GC ?
* give warnings to assign magic variables.
Standard Libraries Standard Libraries

28
io.c
View File

@ -498,6 +498,10 @@ io_fread(ptr, len, f)
c = getc(f); c = getc(f);
TRAP_END; TRAP_END;
if (c == EOF) { if (c == EOF) {
if (ferror(f)) {
if (errno == EINTR) continue;
rb_sys_fail(0);
}
*ptr = '\0'; *ptr = '\0';
break; break;
} }
@ -624,7 +628,10 @@ rb_io_gets_internal(argc, argv, io)
c = getc(f); c = getc(f);
TRAP_END; TRAP_END;
if (c == EOF) { if (c == EOF) {
if (ferror(f) && errno == EINTR) continue; if (ferror(f)) {
if (errno == EINTR) continue;
rb_sys_fail(fptr->path);
}
break; break;
} }
if ((*bp++ = c) == newline) break; if ((*bp++ = c) == newline) break;
@ -711,7 +718,10 @@ rb_io_gets(io)
c = getc(f); c = getc(f);
TRAP_END; TRAP_END;
if (c == EOF) { if (c == EOF) {
if (ferror(f) && errno == EINTR) continue; if (ferror(f)) {
if (errno == EINTR) continue;
rb_sys_fail(fptr->path);
}
break; break;
} }
if ((*bp++ = c) == '\n') break; if ((*bp++ = c) == '\n') break;
@ -865,7 +875,13 @@ rb_io_each_byte(io)
TRAP_BEG; TRAP_BEG;
c = getc(f); c = getc(f);
TRAP_END; TRAP_END;
if (c == EOF) break; if (c == EOF) {
if (ferror(f)) {
if (errno == EINTR) continue;
rb_sys_fail(fptr->path);
}
break;
}
rb_yield(INT2FIX(c & 0xff)); rb_yield(INT2FIX(c & 0xff));
} }
if (ferror(f)) rb_sys_fail(fptr->path); if (ferror(f)) rb_sys_fail(fptr->path);
@ -884,13 +900,17 @@ rb_io_getc(io)
rb_io_check_readable(fptr); rb_io_check_readable(fptr);
f = fptr->f; f = fptr->f;
retry:
READ_CHECK(f); READ_CHECK(f);
TRAP_BEG; TRAP_BEG;
c = getc(f); c = getc(f);
TRAP_END; TRAP_END;
if (c == EOF) { if (c == EOF) {
if (ferror(f)) rb_sys_fail(fptr->path); if (ferror(f)) {
if (errno == EINTR) goto retry;
rb_sys_fail(fptr->path);
}
return Qnil; return Qnil;
} }
return INT2FIX(c & 0xff); return INT2FIX(c & 0xff);

View File

@ -826,13 +826,29 @@ proc_setpgid(obj, pid, pgrp)
static VALUE static VALUE
proc_setsid() proc_setsid()
{ {
#ifdef HAVE_SETSID #if defined(HAVE_SETSID)
int pid; int pid;
rb_secure(2); rb_secure(2);
pid = setsid(); pid = setsid();
if (pid < 0) rb_sys_fail(0); if (pid < 0) rb_sys_fail(0);
return INT2FIX(pid); return INT2FIX(pid);
#elif defined(HAVE_SETPGRP) && defined(TIOCNOTTY)
pid_t sid;
#if defined(SETPGRP_VOID)
sid = setpgrp();
#else
sid = setpgrp(0, getpid());
#endif
if (sid == -1) return -1;
if ((fd = open("/dev/tty", O_RDWR)) >= 0) {
ioctl(fd, TIOCNOTTY, NULL);
close(fd);
}
return sid;
}
#else #else
rb_notimplement(); rb_notimplement();
#endif #endif
@ -1025,9 +1041,7 @@ Init_process()
#endif #endif
#endif #endif
#if !defined(NT)
rb_define_singleton_method(rb_mProcess, "fork", rb_f_fork, 0); rb_define_singleton_method(rb_mProcess, "fork", rb_f_fork, 0);
#endif
rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, -1); rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, -1);
rb_define_module_function(rb_mProcess, "kill", rb_f_kill, -1); rb_define_module_function(rb_mProcess, "kill", rb_f_kill, -1);
#ifndef NT #ifndef NT

20
re.c
View File

@ -520,16 +520,20 @@ rb_reg_prepare_re(re)
VALUE re; VALUE re;
{ {
int need_recompile = 0; int need_recompile = 0;
int state;
rb_reg_check(re); rb_reg_check(re);
/* case-flag not set for the object */ state = FL_TEST(re, REG_CASESTATE);
if (!(RREGEXP(re)->ptr->options & RE_OPTION_IGNORECASE)) { /* ignorecase status */
int state = FL_TEST(re, REG_CASESTATE); if (ruby_ignorecase && !state) {
FL_SET(re, REG_CASESTATE);
if ((ruby_ignorecase || state) && !(ruby_ignorecase && state)) { RREGEXP(re)->ptr->options |= RE_OPTION_IGNORECASE;
RBASIC(re)->flags ^= REG_CASESTATE; need_recompile = 1;
need_recompile = 1; }
} if (!ruby_ignorecase && state) {
FL_UNSET(re, REG_CASESTATE);
RREGEXP(re)->ptr->options &= ~RE_OPTION_IGNORECASE;
need_recompile = 1;
} }
if (!FL_TEST(re, KCODE_FIXED) && if (!FL_TEST(re, KCODE_FIXED) &&

View File

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.4" #define RUBY_VERSION "1.5.4"
#define RUBY_RELEASE_DATE "2000-06-12" #define RUBY_RELEASE_DATE "2000-06-13"
#define RUBY_VERSION_CODE 154 #define RUBY_VERSION_CODE 154
#define RUBY_RELEASE_CODE 20000612 #define RUBY_RELEASE_CODE 20000613