1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-08-24 06:21:43 +00:00
parent a85a9d31db
commit dea6ce41b4
13 changed files with 103 additions and 37 deletions

View file

@ -5,6 +5,21 @@ Sat Aug 19 01:34:02 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* ext/sdbm/_sdbm.c (makroom): fill hole with 0 on Win32 too. * ext/sdbm/_sdbm.c (makroom): fill hole with 0 on Win32 too.
Fri Aug 18 13:23:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_eval): should preserve and clear $! value before
compilation.
* eval.c (eval): ditto.
Fri Aug 18 11:06:19 2000 Shugo Maeda <shugo@ruby-lang.org>
* ext/socket/socket.c (s_accept): start GC on EMFILE/ENFILE.
Thu Aug 17 16:04:48 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (is_defined): should clear ruby_errinfo.
Thu Aug 17 04:26:31 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp> Thu Aug 17 04:26:31 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.27. * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.27.
@ -13,6 +28,10 @@ Thu Aug 17 04:26:31 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/smtp.rb: send_mail accepts many destinations. * lib/net/smtp.rb: send_mail accepts many destinations.
Wed Aug 16 00:43:47 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_s_times): use CLK_TCK for HZ if it's defined.
Tue Aug 15 17:30:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Aug 15 17:30:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (frame_dup): should set flag FRAME_MALLOC after * eval.c (frame_dup): should set flag FRAME_MALLOC after

1
ToDo
View file

@ -88,6 +88,7 @@ Standard Libraries
* optional stepsize argument for succ() * optional stepsize argument for succ()
* Ruby module -- Ruby::Version, Ruby::Interpreter * Ruby module -- Ruby::Version, Ruby::Interpreter
* introduce Boolean class; super of TrueClass, FalseClass * introduce Boolean class; super of TrueClass, FalseClass
* Process::waitall [ruby-talk:4557]
Extension Libraries Extension Libraries

14
array.c
View file

@ -893,8 +893,8 @@ rb_ary_reverse(ary)
VALUE *p1, *p2; VALUE *p1, *p2;
VALUE tmp; VALUE tmp;
if (RARRAY(ary)->len <= 1) return ary;
rb_ary_modify(ary); rb_ary_modify(ary);
if (RARRAY(ary)->len == 0) return ary;
p1 = RARRAY(ary)->ptr; p1 = RARRAY(ary)->ptr;
p2 = p1 + RARRAY(ary)->len - 1; /* points last item */ p2 = p1 + RARRAY(ary)->len - 1; /* points last item */
@ -909,6 +909,14 @@ rb_ary_reverse(ary)
return ary; return ary;
} }
static VALUE
rb_ary_reverse_bang(ary)
VALUE ary;
{
if (RARRAY(ary)->len <= 1) return Qnil;
return rb_ary_reverse(ary);
}
static VALUE static VALUE
rb_ary_reverse_m(ary) rb_ary_reverse_m(ary)
VALUE ary; VALUE ary;
@ -965,7 +973,7 @@ rb_ary_sort_bang(ary)
VALUE ary; VALUE ary;
{ {
rb_ary_modify(ary); rb_ary_modify(ary);
if (RARRAY(ary)->len <= 1) return ary; if (RARRAY(ary)->len <= 1) return Qnil;
FL_SET(ary, ARY_TMPLOCK); /* prohibit modification during sort */ FL_SET(ary, ARY_TMPLOCK); /* prohibit modification during sort */
rb_ensure(sort_internal, ary, sort_unlock, ary); rb_ensure(sort_internal, ary, sort_unlock, ary);
@ -1625,7 +1633,7 @@ Init_Array()
rb_define_method(rb_cArray, "clone", rb_ary_clone, 0); rb_define_method(rb_cArray, "clone", rb_ary_clone, 0);
rb_define_method(rb_cArray, "join", rb_ary_join_m, -1); rb_define_method(rb_cArray, "join", rb_ary_join_m, -1);
rb_define_method(rb_cArray, "reverse", rb_ary_reverse_m, 0); rb_define_method(rb_cArray, "reverse", rb_ary_reverse_m, 0);
rb_define_method(rb_cArray, "reverse!", rb_ary_reverse, 0); rb_define_method(rb_cArray, "reverse!", rb_ary_reverse_bang, 0);
rb_define_method(rb_cArray, "sort", rb_ary_sort, 0); rb_define_method(rb_cArray, "sort", rb_ary_sort, 0);
rb_define_method(rb_cArray, "sort!", rb_ary_sort_bang, 0); rb_define_method(rb_cArray, "sort!", rb_ary_sort_bang, 0);
rb_define_method(rb_cArray, "collect", rb_ary_collect, 0); rb_define_method(rb_cArray, "collect", rb_ary_collect, 0);

View file

@ -1087,8 +1087,8 @@ err_append(s)
else { else {
VALUE str = rb_str_to_str(ruby_errinfo); VALUE str = rb_str_to_str(ruby_errinfo);
rb_str_cat(str, "\n", 1); rb_str_cat2(str, "\n");
rb_str_cat(str, s, strlen(s)); rb_str_cat2(str, s);
ruby_errinfo = rb_exc_new3(rb_eSyntaxError, str); ruby_errinfo = rb_exc_new3(rb_eSyntaxError, str);
} }
} }

35
eval.c
View file

@ -1141,18 +1141,17 @@ compile_error(at)
const char *at; const char *at;
{ {
VALUE str; VALUE str;
char *mesg;
int len;
mesg = rb_str2cstr(ruby_errinfo, &len);
ruby_nerrs = 0; ruby_nerrs = 0;
str = rb_str_new2("compile error"); str = rb_str_new2("compile error");
if (at) { if (at) {
rb_str_cat(str, " in ", 4); rb_str_cat2(str, " in ");
rb_str_cat(str, at, strlen(at)); rb_str_cat2(str, at);
} }
rb_str_cat(str, "\n", 1); rb_str_cat(str, "\n", 1);
rb_str_cat(str, mesg, len); if (!NIL_P(ruby_errinfo)) {
rb_str_concat(str, ruby_errinfo);
}
rb_exc_raise(rb_exc_new3(rb_eSyntaxError, str)); rb_exc_raise(rb_exc_new3(rb_eSyntaxError, str));
} }
@ -1678,7 +1677,10 @@ is_defined(self, node, buf)
val = CLASS_OF(val); val = CLASS_OF(val);
} }
POP_TAG(); POP_TAG();
if (state) return 0; if (state) {
ruby_errinfo = Qnil;
return 0;
}
check_bound: check_bound:
if (rb_method_boundp(val, node->nd_mid, nd_type(node)== NODE_CALL)) { if (rb_method_boundp(val, node->nd_mid, nd_type(node)== NODE_CALL)) {
return arg_defined(self, node->nd_args, buf, "method"); return arg_defined(self, node->nd_args, buf, "method");
@ -1748,7 +1750,10 @@ is_defined(self, node, buf)
val = rb_eval(self, node->nd_head); val = rb_eval(self, node->nd_head);
} }
POP_TAG(); POP_TAG();
if (state) return 0; if (state) {
ruby_errinfo = Qnil;
return 0;
}
else { else {
switch (TYPE(val)) { switch (TYPE(val)) {
case T_CLASS: case T_CLASS:
@ -1786,6 +1791,7 @@ is_defined(self, node, buf)
if (!state) { if (!state) {
return "expression"; return "expression";
} }
ruby_errinfo = Qnil;
break; break;
} }
return 0; return 0;
@ -2722,6 +2728,8 @@ rb_eval(self, n)
str2 = list->nd_head->nd_lit; str2 = list->nd_head->nd_lit;
break; break;
case NODE_EVSTR: case NODE_EVSTR:
result = ruby_errinfo;
ruby_errinfo = Qnil;
ruby_sourceline = nd_line(node); ruby_sourceline = nd_line(node);
ruby_in_eval++; ruby_in_eval++;
list->nd_head = compile(list->nd_head->nd_lit, list->nd_head = compile(list->nd_head->nd_lit,
@ -2732,10 +2740,10 @@ rb_eval(self, n)
if (ruby_nerrs > 0) { if (ruby_nerrs > 0) {
compile_error("string expansion"); compile_error("string expansion");
} }
if (!NIL_P(result)) ruby_errinfo = result;
/* fall through */ /* fall through */
default: default:
str2 = rb_eval(self, list->nd_head); str2 = rb_obj_as_string(rb_eval(self, list->nd_head));
str2 = rb_obj_as_string(str2);
break; break;
} }
rb_str_append(str, str2); rb_str_append(str, str2);
@ -4569,10 +4577,15 @@ eval(self, src, scope, file, line)
} }
PUSH_TAG(PROT_NONE); PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
NODE *node = compile(src, file, line); NODE *node;
result = ruby_errinfo;
ruby_errinfo = Qnil;
node = compile(src, file, line);
if (ruby_nerrs > 0) { if (ruby_nerrs > 0) {
compile_error(0); compile_error(0);
} }
if (!NIL_P(result)) ruby_errinfo = result;
result = eval_node(self, node); result = eval_node(self, node);
} }
POP_TAG(); POP_TAG();

View file

@ -311,22 +311,27 @@ def create_header()
end end
end end
def dir_config(target) def dir_config(target, idefault=nil, ldefault=nil)
dir = with_config("%s-dir"%target) if idefault && ldefault == nil
default = idefault
idefault = default + "/include"
ldefault = default + "/lib"
end
dir = with_config("%s-dir"%target, default)
if dir if dir
idir = " -I"+dir+"/include" idir = " -I"+dir+"/include"
ldir = " -L"+dir+"/lib" ldir = " -L"+dir+"/lib"
end end
unless idir unless idir
dir = with_config("%s-include"%target) dir = with_config("%s-include"%target, idefault)
idir = " -I"+dir if dir idir = " -I"+dir if dir
end end
unless ldir unless ldir
dir = with_config("%s-lib"%target) dir = with_config("%s-lib"%target, ldefault)
ldir = " -L"+dir if dir ldir = " -L"+dir if dir
end end
$CPPFLAGS += idir if idir $CFLAGS += idir if idir
$LDFLAGS += ldir if ldir $LDFLAGS += ldir if ldir
end end

View file

@ -1044,6 +1044,7 @@ s_accept(class, fd, sockaddr, len)
socklen_t *len; socklen_t *len;
{ {
int fd2; int fd2;
int retry = 0;
rb_secure(3); rb_secure(3);
retry: retry:
@ -1053,6 +1054,12 @@ s_accept(class, fd, sockaddr, len)
TRAP_END; TRAP_END;
if (fd2 < 0) { if (fd2 < 0) {
switch (errno) { switch (errno) {
case EMFILE:
case ENFILE:
if (retry) break;
rb_gc();
retry = 1;
goto retry;
case EINTR: case EINTR:
rb_thread_schedule(); rb_thread_schedule();
goto retry; goto retry;

5
file.c
View file

@ -1590,6 +1590,11 @@ rb_f_test(argc, argv)
int cmd; int cmd;
if (argc == 0) rb_raise(rb_eArgError, "wrong # of arguments"); if (argc == 0) rb_raise(rb_eArgError, "wrong # of arguments");
#if 0 /* 1.7 behavior? */
if (argc == 1) {
return RTEST(argv[0]) ? Qtrue : Qfalse;
}
#endif
cmd = NUM2CHR(argv[0]); cmd = NUM2CHR(argv[0]);
if (cmd == 0) return Qfalse; if (cmd == 0) return Qfalse;
if (strchr("bcdefgGkloOprRsSuwWxXz", cmd)) { if (strchr("bcdefgGkloOprRsSuwWxXz", cmd)) {

View file

@ -313,18 +313,23 @@ def create_header()
end end
end end
def dir_config(target) def dir_config(target, idefault=nil, ldefault=nil)
dir = with_config("%s-dir"%target) if idefault && ldefault == nil
default = idefault
idefault = default + "/include"
ldefault = default + "/lib"
end
dir = with_config("%s-dir"%target, default)
if dir if dir
idir = " -I"+dir+"/include" idir = " -I"+dir+"/include"
ldir = " -L"+dir+"/lib" ldir = " -L"+dir+"/lib"
end end
unless idir unless idir
dir = with_config("%s-include"%target) dir = with_config("%s-include"%target, idefault)
idir = " -I"+dir if dir idir = " -I"+dir if dir
end end
unless ldir unless ldir
dir = with_config("%s-lib"%target) dir = with_config("%s-lib"%target, ldefault)
ldir = " -L"+dir if dir ldir = " -L"+dir if dir
end end
@ -386,7 +391,7 @@ hdrdir = #{$hdrdir}
CC = #{CONFIG["CC"]} CC = #{CONFIG["CC"]}
CFLAGS = #{CONFIG["CCDLFLAGS"]} #{CFLAGS} #{$CFLAGS} CFLAGS = #{CONFIG["CCDLFLAGS"]} #{CFLAGS} #{$CFLAGS}
CPPFLAGS = -I$(hdrdir) -I#{CONFIG["includedir"]} #{$defs.join(" ")} #{CONFIG["CPPFLAGS"]} CPPFLAGS = -I$(hdrdir) -I#{CONFIG["includedir"]} #{$defs.join(" ")} #{CONFIG["CPPFLAGS"]}
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS} DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
LDSHARED = #{CONFIG["LDSHARED"]} #{defflag} LDSHARED = #{CONFIG["LDSHARED"]} #{defflag}

View file

@ -98,12 +98,12 @@ range_eqq(range, obj)
end = rb_ivar_get(range, id_end); end = rb_ivar_get(range, id_end);
if (FIXNUM_P(beg) && FIXNUM_P(obj) && FIXNUM_P(end)) { if (FIXNUM_P(beg) && FIXNUM_P(obj) && FIXNUM_P(end)) {
if (NUM2LONG(beg) <= NUM2LONG(obj)) { if (FIX2LONG(beg) <= FIX2LONG(obj)) {
if (EXCL(range)) { if (EXCL(range)) {
if (NUM2LONG(obj) < NUM2LONG(end)) return Qtrue; if (FIX2LONG(obj) < FIX2LONG(end)) return Qtrue;
} }
else { else {
if (NUM2LONG(obj) <= NUM2LONG(end)) return Qtrue; if (FIX2LONG(obj) <= FIX2LONG(end)) return Qtrue;
} }
} }
return Qfalse; return Qfalse;

View file

@ -1991,7 +1991,7 @@ re_compile_pattern(pattern, size, bufp)
break; break;
} }
/* If lower_bound == upper_bound, repeat cound can be removed */ /* If lower_bound == upper_bound, repeat count can be removed */
if (lower_bound == upper_bound) { if (lower_bound == upper_bound) {
int mcnt; int mcnt;
int skip_stop_paren = 0; int skip_stop_paren = 0;
@ -2069,7 +2069,7 @@ re_compile_pattern(pattern, size, bufp)
jump back only `upper_bound - 1' times. */ jump back only `upper_bound - 1' times. */
GET_BUFFER_SPACE(5); GET_BUFFER_SPACE(5);
store_jump_n(b, greedy?jump_n:finalize_push_n, laststart + 5, store_jump_n(b, greedy?jump_n:finalize_push_n, laststart + 5,
upper_bound - 1); upper_bound/* - 1*/);
b += 5; b += 5;
/* The location we want to set is the second /* The location we want to set is the second
@ -2087,7 +2087,7 @@ re_compile_pattern(pattern, size, bufp)
so that if we fail during matching, we'll so that if we fail during matching, we'll
reinitialize the bounds. */ reinitialize the bounds. */
insert_op_2(set_number_at, laststart, b, b - laststart, insert_op_2(set_number_at, laststart, b, b - laststart,
upper_bound - 1); upper_bound/* - 1*/);
b += 5; b += 5;
} }
} }
@ -3408,8 +3408,7 @@ re_search(bufp, string, size, startpos, range, regs)
do { unsigned this_reg; \ do { unsigned this_reg; \
for (this_reg = 0; this_reg < num_regs; this_reg++) { \ for (this_reg = 0; this_reg < num_regs; this_reg++) { \
if (IS_ACTIVE(reg_info[this_reg])) \ if (IS_ACTIVE(reg_info[this_reg])) \
MATCHED_SOMETHING(reg_info[this_reg]) \ MATCHED_SOMETHING(reg_info[this_reg]) = 1; \
= 1; \
else \ else \
MATCHED_SOMETHING(reg_info[this_reg]) = 0; \ MATCHED_SOMETHING(reg_info[this_reg]) = 0; \
} \ } \

6
time.c
View file

@ -946,7 +946,11 @@ time_s_times(obj)
{ {
#ifdef HAVE_TIMES #ifdef HAVE_TIMES
#ifndef HZ #ifndef HZ
#define HZ 60 /* Universal constant :-) */ # ifdef CLK_TCK
# define HZ CLK_TCK
# else
# define HZ 60
# endif
#endif /* HZ */ #endif /* HZ */
struct tms buf; struct tms buf;

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.5" #define RUBY_VERSION "1.5.5"
#define RUBY_RELEASE_DATE "2000-08-15" #define RUBY_RELEASE_DATE "2000-08-16"
#define RUBY_VERSION_CODE 155 #define RUBY_VERSION_CODE 155
#define RUBY_RELEASE_CODE 20000815 #define RUBY_RELEASE_CODE 20000816