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
Родитель a85a9d31db
Коммит dea6ce41b4
13 изменённых файлов: 103 добавлений и 37 удалений

Просмотреть файл

@ -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.
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>
* 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.
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>
* eval.c (frame_dup): should set flag FRAME_MALLOC after

1
ToDo
Просмотреть файл

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

14
array.c
Просмотреть файл

@ -893,8 +893,8 @@ rb_ary_reverse(ary)
VALUE *p1, *p2;
VALUE tmp;
if (RARRAY(ary)->len <= 1) return ary;
rb_ary_modify(ary);
if (RARRAY(ary)->len == 0) return ary;
p1 = RARRAY(ary)->ptr;
p2 = p1 + RARRAY(ary)->len - 1; /* points last item */
@ -909,6 +909,14 @@ rb_ary_reverse(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
rb_ary_reverse_m(ary)
VALUE ary;
@ -965,7 +973,7 @@ rb_ary_sort_bang(ary)
VALUE 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 */
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, "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, 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_bang, 0);
rb_define_method(rb_cArray, "collect", rb_ary_collect, 0);

Просмотреть файл

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

35
eval.c
Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

5
file.c
Просмотреть файл

@ -1590,6 +1590,11 @@ rb_f_test(argc, argv)
int cmd;
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]);
if (cmd == 0) return Qfalse;
if (strchr("bcdefgGkloOprRsSuwWxXz", cmd)) {

Просмотреть файл

@ -313,18 +313,23 @@ def create_header()
end
end
def dir_config(target)
dir = with_config("%s-dir"%target)
def dir_config(target, idefault=nil, ldefault=nil)
if idefault && ldefault == nil
default = idefault
idefault = default + "/include"
ldefault = default + "/lib"
end
dir = with_config("%s-dir"%target, default)
if dir
idir = " -I"+dir+"/include"
ldir = " -L"+dir+"/lib"
end
unless idir
dir = with_config("%s-include"%target)
dir = with_config("%s-include"%target, idefault)
idir = " -I"+dir if dir
end
unless ldir
dir = with_config("%s-lib"%target)
dir = with_config("%s-lib"%target, ldefault)
ldir = " -L"+dir if dir
end
@ -386,7 +391,7 @@ hdrdir = #{$hdrdir}
CC = #{CONFIG["CC"]}
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)
DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
LDSHARED = #{CONFIG["LDSHARED"]} #{defflag}

Просмотреть файл

@ -98,12 +98,12 @@ range_eqq(range, obj)
end = rb_ivar_get(range, id_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 (NUM2LONG(obj) < NUM2LONG(end)) return Qtrue;
if (FIX2LONG(obj) < FIX2LONG(end)) return Qtrue;
}
else {
if (NUM2LONG(obj) <= NUM2LONG(end)) return Qtrue;
if (FIX2LONG(obj) <= FIX2LONG(end)) return Qtrue;
}
}
return Qfalse;

Просмотреть файл

@ -1991,7 +1991,7 @@ re_compile_pattern(pattern, size, bufp)
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) {
int mcnt;
int skip_stop_paren = 0;
@ -2069,7 +2069,7 @@ re_compile_pattern(pattern, size, bufp)
jump back only `upper_bound - 1' times. */
GET_BUFFER_SPACE(5);
store_jump_n(b, greedy?jump_n:finalize_push_n, laststart + 5,
upper_bound - 1);
upper_bound/* - 1*/);
b += 5;
/* 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
reinitialize the bounds. */
insert_op_2(set_number_at, laststart, b, b - laststart,
upper_bound - 1);
upper_bound/* - 1*/);
b += 5;
}
}
@ -3408,8 +3408,7 @@ re_search(bufp, string, size, startpos, range, regs)
do { unsigned this_reg; \
for (this_reg = 0; this_reg < num_regs; this_reg++) { \
if (IS_ACTIVE(reg_info[this_reg])) \
MATCHED_SOMETHING(reg_info[this_reg]) \
= 1; \
MATCHED_SOMETHING(reg_info[this_reg]) = 1; \
else \
MATCHED_SOMETHING(reg_info[this_reg]) = 0; \
} \

6
time.c
Просмотреть файл

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

Просмотреть файл

@ -1,4 +1,4 @@
#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_RELEASE_CODE 20000815
#define RUBY_RELEASE_CODE 20000816