Skip to content

Commit

Permalink
* eval.c (rb_thread_restore_context): save current value of
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
matz committed Sep 8, 2001
1 parent 1bcc5eb commit 67245ee
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 69 deletions.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
65 changes: 43 additions & 22 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ Sat Sep 8 07:13:42 2001 Wakou Aoyama <[email protected]>
* lib/net/telnet.rb: waitfor(): improvement. thanks to
[email protected]

Sat Sep 8 04:34:17 2001 Yukihiro Matsumoto <[email protected]>

* 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 <[email protected]>

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

Fri Sep 7 09:44:44 2001 Wakou Aoyama <[email protected]>

* lib/net/telnet.rb: waitfor(): bug fix.
Expand Down Expand Up @@ -31,28 +42,6 @@ Thu Sep 6 14:25:15 2001 Akinori MUSHA <[email protected]>
* ext/digest/digest.c (rb_digest_base_s_hexdigest): remove a debug
print.

Sun Aug 26 20:26:40 2001 Koji Arai <[email protected]>

* 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 <[email protected]>

* ext/digest/digest.c (rb_digest_base_s_digest,
Expand All @@ -72,6 +61,16 @@ Thu Sep 6 07:16:14 2001 Nobuyoshi Nakada <[email protected]>

* ext/socket/socket.c (Init_socket): remove duplicating constants.

Thu Sep 6 03:15:24 2001 Yukihiro Matsumoto <[email protected]>

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

Wed Sep 5 20:02:27 2001 Shin'ya Adzumi <[email protected]>

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

Wed Sep 5 17:41:11 2001 WATANABE Hirofumi <[email protected]>

* lib/jcode.rb (_regexp_quote): fix quote handling.
Expand Down Expand Up @@ -7205,6 +7204,28 @@ Fri Aug 28 17:32:55 1999 Yasuhiro Fukuma <[email protected]>
* 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 <[email protected]>

* 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 <[email protected]>

* gc.c (rb_gc): local variables may be placed beyond stack_end, so
Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.ja
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ COPYING.ja

* ����

�����ȡ��Х���ݡ��Ȥ���¾�� matz@zetabits.com �ޤǡ�
�����ȡ��Х���ݡ��Ȥ���¾�� matz@netlab.jp �ޤǡ�
-------------------------------------------------------
created at: Thu Aug 3 11:57:36 JST 1995
Local variables:
Expand Down
16 changes: 7 additions & 9 deletions class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
Expand Down
9 changes: 8 additions & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand All @@ -84,7 +91,7 @@ find_dirsep(s)
while (*s) {
if (isdirsep(*s))
return s;
s++;
s = CharNext(s);
}
return 0;
}
Expand Down
14 changes: 12 additions & 2 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -7267,6 +7267,7 @@ rb_thread_save_context(th)
{
VALUE *pos;
int len;
static VALUE tval;

len = stack_length(&pos);
th->stk_len = 0;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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);
}
Expand Down
23 changes: 23 additions & 0 deletions ext/digest/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion lib/resolv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Hosts
def initialize(filename = DefaultFileName)
@filename = filename
@mutex = Mutex.new
@initialized = nil
end

def lazy_initialize
Expand Down Expand Up @@ -106,6 +107,7 @@ class DNS
def initialize(config="/etc/resolv.conf")
@mutex = Mutex.new
@config = Config.new(config)
@initialized = nil
end

def lazy_initialize
Expand Down Expand Up @@ -157,7 +159,7 @@ def getresource(name, typeclass)
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)
Expand Down Expand Up @@ -385,6 +387,7 @@ class Config
def initialize(filename="/etc/resolv.conf")
@mutex = Mutex.new
@filename = filename
@initialized = nil
end

def lazy_initialize
Expand Down
14 changes: 9 additions & 5 deletions numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Loading

0 comments on commit 67245ee

Please sign in to comment.