1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c (rb_thread_restore_context): save current value of

lastline and lastmatch in the thread struct for later restore.

* eval.c (rb_thread_save_context): restore lastline and lastmatch.

* numeric.c (flo_to_s): should handle negative float value.

* class.c (rb_include_module): should check whole ancestors to
  avoid duplicate module inclusion.

* string.c (trnext): should check backslash before updating "now"
  position.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-09-08 14:17:53 +00:00
parent 1bcc5eb922
commit 67245eec71
16 changed files with 143 additions and 69 deletions

View file

@ -1,4 +1,4 @@
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@zetabits.com>.
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
You can redistribute it and/or modify it under either the terms of the GPL
(see the file GPL), or the conditions below:

View file

@ -3,6 +3,17 @@ Sat Sep 8 07:13:42 2001 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/net/telnet.rb: waitfor(): improvement. thanks to
nobu.nakada@nifty.ne.jp
Sat Sep 8 04:34:17 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_thread_restore_context): save current value of
lastline and lastmatch in the thread struct for later restore.
* eval.c (rb_thread_save_context): restore lastline and lastmatch.
Fri Sep 7 11:27:56 2001 akira yamada <akira@ruby-lang.org>
* numeric.c (flo_to_s): should handle negative float value.
Fri Sep 7 09:44:44 2001 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/net/telnet.rb: waitfor(): bug fix.
@ -31,28 +42,6 @@ Thu Sep 6 14:25:15 2001 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (rb_digest_base_s_hexdigest): remove a debug
print.
Sun Aug 26 20:26:40 2001 Koji Arai <JCA02266@nifty.ne.jp>
* ext/readline/readline.c: restore terminal mode
even if readline() interrupted.
* ext/readline/readline.c: returned string need to
be tainted.
* ext/readline/readline.c: fixed memory leak.
* ext/readline/readline.c: allow negative index.
* ext/readline/readline.c: added Readline::HISTORY.size
same as Readline::HISTORY.length
* ext/readline/readline.c: allow conditional parsing
of the ~/.inputrc file by `$if Ruby'.
* ext/readline/extconf.rb: check whether the
libreadline has the variable `rl_completion_append_character'
(this feature was implemented from GNU readline 2.1).
Thu Sep 6 13:56:14 2001 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (rb_digest_base_s_digest,
@ -72,6 +61,16 @@ Thu Sep 6 07:16:14 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* ext/socket/socket.c (Init_socket): remove duplicating constants.
Thu Sep 6 03:15:24 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* class.c (rb_include_module): should check whole ancestors to
avoid duplicate module inclusion.
Wed Sep 5 20:02:27 2001 Shin'ya Adzumi <adzumi@denpa.org>
* string.c (trnext): should check backslash before updating "now"
position.
Wed Sep 5 17:41:11 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* lib/jcode.rb (_regexp_quote): fix quote handling.
@ -7205,6 +7204,28 @@ Fri Aug 28 17:32:55 1999 Yasuhiro Fukuma <yasuf@big.or.jp>
* eval.c (rb_eval): should set return value (nil) explicitly if a
value is omitted for return statement.
Sun Aug 26 20:26:40 2001 Koji Arai <JCA02266@nifty.ne.jp>
* ext/readline/readline.c: restore terminal mode
even if readline() interrupted.
* ext/readline/readline.c: returned string need to
be tainted.
* ext/readline/readline.c: fixed memory leak.
* ext/readline/readline.c: allow negative index.
* ext/readline/readline.c: added Readline::HISTORY.size
same as Readline::HISTORY.length
* ext/readline/readline.c: allow conditional parsing
of the ~/.inputrc file by `$if Ruby'.
* ext/readline/extconf.rb: check whether the
libreadline has the variable `rl_completion_append_character'
(this feature was implemented from GNU readline 2.1).
Thu Aug 26 15:06:11 1999 Masaki Fukushima <fukusima@goto.info.waseda.ac.jp>
* gc.c (rb_gc): local variables may be placed beyond stack_end, so

View file

@ -122,7 +122,7 @@ realclean: distclean
@rm -f parse.c
@rm -f lex.c
test: miniruby$(EXEEXT)
test: miniruby$(EXEEXT) rbconfig.rb
@./miniruby$(EXEEXT) $(srcdir)/rubytest.rb
rbconfig.rb: miniruby$(EXEEXT) $(srcdir)/mkconfig.rb config.status

2
README
View file

@ -97,7 +97,7 @@ See the file COPYING.
Feel free to send comments and bug reports to the author. Here is the
author's latest mail address:
matz@zetabits.com
matz@netlab.jp
-------------------------------------------------------
created at: Thu Aug 3 11:57:36 JST 1995

View file

@ -145,7 +145,7 @@ COPYING.ja
* Ãø¼Ô
コメント,バグレポートその他は matz@zetabits.com まで.
コメント,バグレポートその他は matz@netlab.jp まで.
-------------------------------------------------------
created at: Thu Aug 3 11:57:36 JST 1995
Local variables:

16
class.c
View file

@ -291,7 +291,7 @@ void
rb_include_module(klass, module)
VALUE klass, module;
{
VALUE p;
VALUE p, c;
int changed = 0;
rb_frozen_class_p(klass);
@ -312,22 +312,20 @@ rb_include_module(klass, module)
}
OBJ_INFECT(klass, module);
c = klass;
while (module) {
/* ignore if the module included already in superclasses */
for (p = RCLASS(klass)->super; p; p = RCLASS(p)->super) {
if (BUILTIN_TYPE(p) == T_ICLASS &&
RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) {
if (RCLASS(module)->super) {
rb_include_module(p, RCLASS(module)->super);
}
if (changed) rb_clear_cache();
return;
goto skip;
}
}
RCLASS(klass)->super = include_class_new(module, RCLASS(klass)->super);
klass = RCLASS(klass)->super;
module = RCLASS(module)->super;
RCLASS(c)->super = include_class_new(module, RCLASS(c)->super);
c = RCLASS(c)->super;
changed = 1;
skip:
module = RCLASS(module)->super;
}
if (changed) rb_clear_cache();
}

9
dir.c
View file

@ -75,6 +75,13 @@ char *strchr _((char*,char));
#define downcase(c) (nocase && ISUPPER(c) ? tolower(c) : (c))
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
# if defined(DJGPP)
# define CharNext(p) ((p) + mblen(p, MB_CUR_MAX))
# else
# define CharNext(p) ((p) + 1)
# endif
#endif
#if defined DOSISH
#define isdirsep(c) ((c) == '/' || (c) == '\\')
static char *
@ -84,7 +91,7 @@ find_dirsep(s)
while (*s) {
if (isdirsep(*s))
return s;
s++;
s = CharNext(s);
}
return 0;
}

14
eval.c
View file

@ -7267,6 +7267,7 @@ rb_thread_save_context(th)
{
VALUE *pos;
int len;
static VALUE tval;
len = stack_length(&pos);
th->stk_len = 0;
@ -7294,8 +7295,12 @@ rb_thread_save_context(th)
th->tracing = tracing;
th->errinfo = ruby_errinfo;
th->last_status = rb_last_status;
th->last_line = rb_lastline_get();
th->last_match = rb_backref_get();
tval = rb_lastline_get();
rb_lastline_set(th->last_line);
th->last_line = tval;
tval = rb_backref_get();
rb_backref_set(th->last_match);
th->last_match = tval;
th->safe = ruby_safe_level;
th->file = ruby_sourcefile;
@ -7359,6 +7364,7 @@ rb_thread_restore_context(th, exit)
VALUE v;
static rb_thread_t tmp;
static int ex;
static VALUE tval;
if (!th->stk_ptr) rb_bug("unsaved context");
@ -7395,8 +7401,12 @@ rb_thread_restore_context(th, exit)
FLUSH_REGISTER_WINDOWS;
MEMCPY(tmp->stk_pos, tmp->stk_ptr, VALUE, tmp->stk_len);
tval = rb_lastline_get();
rb_lastline_set(tmp->last_line);
tmp->last_line = tval;
tval = rb_backref_get();
rb_backref_set(tmp->last_match);
tmp->last_match = tval;
longjmp(tmp->context, ex);
}

View file

@ -7,5 +7,28 @@ digest.txt.ja
extconf.rb
lib/md5.rb
lib/sha1.rb
md5/MANIFEST
md5/extconf.rb
md5/md5.c
md5/md5.h
md5/md5init.c
rmd160/MANIFEST
rmd160/extconf.rb
rmd160/rmd160.c
rmd160/rmd160.h
rmd160/rmd160hl.c
rmd160/rmd160init.c
sha1/MANIFEST
sha1/extconf.rb
sha1/sha1.c
sha1/sha1.h
sha1/sha1hl.c
sha1/sha1init.c
sha2/MANIFEST
sha2/extconf.rb
sha2/sha2.c
sha2/sha2.h
sha2/sha2hl.c
sha2/sha2init.c
test.rb
test.sh

2
file.c
View file

@ -2286,7 +2286,7 @@ extern VALUE rb_load_path;
int
rb_find_file_ext(filep, ext)
VALUE *filep;
const char *const *ext;
const char * const *ext;
{
char *path, *e, *found;
char *f = RSTRING(*filep)->ptr;

View file

@ -48,6 +48,7 @@ class Resolv
def initialize(filename = DefaultFileName)
@filename = filename
@mutex = Mutex.new
@initialized = nil
end
def lazy_initialize
@ -106,6 +107,7 @@ class Resolv
def initialize(config="/etc/resolv.conf")
@mutex = Mutex.new
@config = Config.new(config)
@initialized = nil
end
def lazy_initialize
@ -157,7 +159,7 @@ class Resolv
end
sender.send
reply = reply_name = nil
timeout (tout) { reply, reply_name = q.pop }
timeout(tout) { reply, reply_name = q.pop }
case reply.rcode
when RCode::NoError
return extract_resource(reply, reply_name, typeclass)
@ -385,6 +387,7 @@ class Resolv
def initialize(filename="/etc/resolv.conf")
@mutex = Mutex.new
@filename = filename
@initialized = nil
end
def lazy_initialize

View file

@ -216,21 +216,25 @@ flo_to_s(flt)
char buf[24];
char *fmt = "%.10g";
double value = RFLOAT(flt)->value;
double d1, d2;
double avalue, d1, d2;
if (isinf(value))
return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
else if(isnan(value))
return rb_str_new2("NaN");
if (value < 1.0e-3) {
d1 = value;
avalue = fabs(value);
if (avalue == 0.0) {
fmt = "%.1f";
}
else if (avalue < 1.0e-3) {
d1 = avalue;
while (d1 < 1.0) d1 *= 10.0;
d1 = modf(d1, &d2);
if (d1 == 0) fmt = "%.1e";
}
else if (value >= 1.0e10) {
d1 = value;
else if (avalue >= 1.0e10) {
d1 = avalue;
while (d1 > 10.0) d1 /= 10.0;
d1 = modf(d1, &d2);
if (d1 == 0) fmt = "%.1e";

View file

@ -1112,17 +1112,19 @@ proc_setuid(obj, id)
uid = NUM2INT(id);
#if defined(HAVE_SETRESUID) && !defined(__CHECKER__)
setresuid(uid, -1, -1);
if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID
setreuid(uid, -1);
if (setreuid(uid, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETRUID
setruid(uid);
if (setruid(uid) < 0) rb_sys_fail(0);
#else
{
if (geteuid() == uid)
setuid(uid);
else
if (geteuid() == uid) {
if (setuid(uid) < 0) rb_sys_fail(0);
}
else {
rb_notimplement();
}
}
#endif
return INT2FIX(uid);
@ -1144,17 +1146,19 @@ proc_setgid(obj, id)
gid = NUM2INT(id);
#if defined(HAVE_SETRESGID) && !defined(__CHECKER__)
setresgid(gid, -1, -1);
if (setresgid(gid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID
setregid(gid, -1);
if (setregid(gid, -1) < 0) rb_sys_fail(0);
#elif defined HAS_SETRGID
setrgid((GIDTYPE)gid);
if (setrgid((GIDTYPE)gid) < 0) rb_sys_fail(0);
#else
{
if (getegid() == gid)
setgid(gid);
else
if (getegid() == gid) {
if (setgid(gid) < 0) rb_sys_fail(0);
}
else {
rb_notimplement();
}
}
#endif
return INT2FIX(gid);
@ -1180,10 +1184,12 @@ proc_seteuid(obj, euid)
if (seteuid(NUM2INT(euid)) < 0) rb_sys_fail(0);
#else
euid = NUM2INT(euid);
if (euid == getuid())
setuid(euid);
else
if (euid == getuid()) {
if (setuid(euid) < 0) rb_sys_fail(0);
}
else {
rb_notimplement();
}
#endif
return euid;
}
@ -1209,10 +1215,12 @@ proc_setegid(obj, egid)
if (setegid(NUM2INT(egid)) < 0) rb_sys_fail(0);
#else
egid = NUM2INT(egid);
if (egid == getgid())
setgid(egid);
else
if (egid == getgid()) {
if (setgid(egid) < 0) rb_sys_fail(0);
}
else {
rb_notimplement();
}
#endif
return egid;
}

4
ruby.1
View file

@ -1,4 +1,4 @@
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@zetabits.com>.
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
.na
.TH RUBY 1 "ruby 1.6" "2000-09-11" "Ruby Programmers Reference Guide"
.SH NAME
@ -288,4 +288,4 @@ state messages during compiling scripts. You don't have to specify
this switch, unless you are going to debug the Ruby interpreter.
.PP
.SH AUTHOR
Ruby is designed and implemented by Yukihiro Matsumoto <matz@zetabits.com>.
Ruby is designed and implemented by Yukihiro Matsumoto <matz@netlab.jp>.

View file

@ -1967,11 +1967,11 @@ trnext(t)
for (;;) {
if (!t->gen) {
if (t->p == t->pend) return -1;
t->now = *(USTR)t->p++;
if (t->p < t->pend - 1 && *t->p == '\\') {
t->p++;
}
else if (t->p < t->pend - 1 && *t->p == '-') {
t->now = *(USTR)t->p++;
if (t->p < t->pend - 1 && *t->p == '-') {
t->p++;
if (t->p < t->pend) {
if (t->now > *(USTR)t->p) {

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.1"
#define RUBY_RELEASE_DATE "2001-09-05"
#define RUBY_RELEASE_DATE "2001-09-08"
#define RUBY_VERSION_CODE 171
#define RUBY_RELEASE_CODE 20010905
#define RUBY_RELEASE_CODE 20010908