diff --git a/ChangeLog b/ChangeLog index 8e94150fec..853e9fe84f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Jun 1 00:59:15 2000 Yukihiro Matsumoto + + * eval.c (rb_yield_0): convert Qundef to []. + +Wed May 31 12:37:04 2000 Yukihiro Matsumoto + + * eval.c (rb_exec_end_proc): print error message from END procs. + Wed May 31 04:06:41 2000 Wakou Aoyama * lib/cgi.rb: change: CGI#out() if "HEAD" == REQUEST_METHOD then @@ -53,16 +61,12 @@ Thu May 25 22:01:32 2000 Katsuyuki Komatsu * regex.h: mswin32: export re_mbctab properly. - * win32/win32.def: add ruby_ignorecase and regex.c's exports. + * win32/ruby.def: add ruby_ignorecase and regex.c's exports. Thu May 25 21:28:44 JST 2000 Minero Aoki * re.c (rb_reg_expr_str): escape un-printable character. -Wed May 24 23:17:50 2000 Katsuyuki Komatsu - - * win32/Makefile: remove unnecessary mv and rm command call. - Thu May 25 01:35:15 2000 Yukihiro Matsumoto * parse.y (tokadd_escape): forgot to add `\x' to hexadecimal @@ -200,7 +204,7 @@ Thu May 18 13:34:57 2000 Yukihiro Matsumoto * ext/socket/socket.c (ruby_connect): should not have replaced thread_write_select() by rb_thread_fd_writable(). -Wed May 18 09:01:25 2000 Katsuyuki Komatsu +Thu May 18 09:01:25 2000 Katsuyuki Komatsu * configure.in, ext/extmk.rb.in, lib/mkmf.rb: remove BeOS R3 support. Make a shared library (libruby.so) only if the --enable-shared @@ -252,7 +256,7 @@ Tue May 16 17:00:05 2000 Masaki Fukushima Tue May 16 11:51:31 2000 Yukihiro Matsumoto - * io.c (pipe_open): syncronize subprocess stdout/stderr. + * io.c (pipe_open): synchronize subprocess stdout/stderr. Mon May 15 15:38:09 2000 Yukihiro Matsumoto @@ -288,7 +292,7 @@ Sun May 14 18:05:59 2000 WATANABE Hirofumi Sun May 14 02:02:48 2000 WATANABE Hirofumi - * lib/irb/ruby-lex.rb: '/' should be escaped in charcter class. + * lib/irb/ruby-lex.rb: '/' should be escaped in character class. Sun May 14 00:54:43 2000 WATANABE Hirofumi @@ -2811,7 +2815,7 @@ Fri May 7 08:17:19 1999 Yukihiro Matsumoto Fri May 7 01:42:20 1999 Yukihiro Matsumoto - * ext/socket/socket.c (tcp_s_gethostbyname): aboid using struct + * ext/socket/socket.c (tcp_s_gethostbyname): avoid using struct sockaddr_storage. Thu May 6 13:21:41 1999 Yukihiro Matsumoto @@ -2940,7 +2944,7 @@ Tue Apr 20 02:32:42 1999 Yukihiro Matsumoto * re.c (rb_reg_desc): did not print options properly. - * io.c (rb_file_s_open): intialize was called twice. + * io.c (rb_file_s_open): initialize was called twice. Mon Apr 19 18:56:21 1999 Yukihiro Matsumoto @@ -3067,7 +3071,7 @@ Wed Mar 24 13:06:43 1999 Yukihiro Matsumoto * io.c (next_argv): need to check type for ARGV.shift. - * eval.c (blk_copy_prev): need to preverse outer scope as well as + * eval.c (blk_copy_prev): need to preserve outer scope as well as outer frames. * parse.y (rb_compile_string): return can appear within eval(). @@ -5932,7 +5936,7 @@ Tue Feb 10 17:29:08 1998 Yukihiro Matsumoto * string.c (str_oct): does recognize `0x'. - * sprintf.c (f_sprintf): use baes 10 for conversion from string to + * sprintf.c (f_sprintf): use base 10 for conversion from string to integer. Mon Feb 9 14:51:56 1998 Yukihiro Matsumoto diff --git a/eval.c b/eval.c index 0a92e4615e..429915705c 100644 --- a/eval.c +++ b/eval.c @@ -1043,38 +1043,10 @@ static void rb_thread_wait_other_threads _((void)); static int exit_status; -void -ruby_run() +static int +error_handle(ex) + int ex; { - int state; - static int ex; - volatile NODE *tmp; - - if (ruby_nerrs > 0) exit(ruby_nerrs); - - Init_stack(&tmp); - PUSH_TAG(PROT_NONE); - PUSH_ITER(ITER_NOT); - if ((state = EXEC_TAG()) == 0) { - eval_node(ruby_top_self); - } - POP_ITER(); - POP_TAG(); - - if (state && !ex) ex = state; - PUSH_TAG(PROT_NONE); - PUSH_ITER(ITER_NOT); - if ((state = EXEC_TAG()) == 0) { - rb_trap_exit(); - rb_thread_cleanup(); - rb_thread_wait_other_threads(); - } - else { - ex = state; - } - POP_ITER(); - POP_TAG(); - switch (ex & 0xf) { case 0: ex = 0; @@ -1119,6 +1091,42 @@ ruby_run() rb_bug("Unknown longjmp status %d", ex); break; } + return ex; +} + +void +ruby_run() +{ + int state; + static int ex; + volatile NODE *tmp; + + if (ruby_nerrs > 0) exit(ruby_nerrs); + + Init_stack(&tmp); + PUSH_TAG(PROT_NONE); + PUSH_ITER(ITER_NOT); + if ((state = EXEC_TAG()) == 0) { + eval_node(ruby_top_self); + } + POP_ITER(); + POP_TAG(); + + if (state && !ex) ex = state; + PUSH_TAG(PROT_NONE); + PUSH_ITER(ITER_NOT); + if ((state = EXEC_TAG()) == 0) { + rb_trap_exit(); + rb_thread_cleanup(); + rb_thread_wait_other_threads(); + } + else { + ex = state; + } + POP_ITER(); + POP_TAG(); + + ex = error_handle(ex); rb_exec_end_proc(); rb_gc_call_finalizer_at_exit(); exit(ex); @@ -3353,6 +3361,7 @@ rb_yield_0(val, self, klass, acheck) ruby_class = klass?klass:block->klass; if (!self) self = block->self; node = block->body; + if (block->var) { PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { @@ -3364,6 +3373,7 @@ rb_yield_0(val, self, klass, acheck) POP_TAG(); if (state) goto pop_state; } + PUSH_ITER(block->iter); PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { @@ -3372,6 +3382,7 @@ rb_yield_0(val, self, klass, acheck) result = Qnil; } else if (nd_type(node) == NODE_CFUNC) { + if (val == Qundef) val = rb_ary_new2(0); result = (*node->nd_cfnc)(val, node->nd_tval, self); } else { @@ -3450,19 +3461,14 @@ massign(self, node, val, check) NODE *list; int i = 0, len; - list = node->nd_head; - - if (TYPE(val) != T_ARRAY) { -#if 0 - if (!check && NIL_P(val)) - val = rb_ary_new2(0); - else - val = rb_ary_new3(1, val); -#else + if (val == Qundef) { + val = rb_ary_new2(0); + } + else if (TYPE(val) != T_ARRAY) { val = rb_ary_new3(1, val); -#endif } len = RARRAY(val)->len; + list = node->nd_head; for (i=0; list && ind_head, RARRAY(val)->ptr[i], check); list = list->nd_next; @@ -3470,7 +3476,9 @@ massign(self, node, val, check) if (check && list) goto arg_error; if (node->nd_args) { if (node->nd_args == (NODE*)-1) { - /* ignore rest args */ + if (check) { + goto arg_error; + } } else if (!list && ind_args, rb_ary_new4(len-i, RARRAY(val)->ptr+i), check); @@ -3502,6 +3510,7 @@ assign(self, lhs, val, check) VALUE val; int check; { + if (val == Qundef) val = Qnil; switch (nd_type(lhs)) { case NODE_GASGN: rb_gvar_set(lhs->nd_entry, val); @@ -5403,7 +5412,7 @@ static void call_end_proc(data) VALUE data; { - proc_call(data, Qnil); + proc_call(data, Qundef); } static void @@ -5435,6 +5444,9 @@ rb_exec_end_proc() link = end_procs; while (link) { rb_protect((VALUE(*)())link->func, link->data, &status); + if (status) { + error_handle(status); + } link = link->next; } while (ephemeral_end_procs) { @@ -5843,7 +5855,7 @@ callargs(args) { switch (RARRAY(args)->len) { case 0: - return Qnil; + return Qundef; break; case 1: return RARRAY(args)->ptr[0]; diff --git a/version.h b/version.h index 400516474c..ae16b6ba67 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.5.4" -#define RUBY_RELEASE_DATE "2000-05-31" +#define RUBY_RELEASE_DATE "2000-06-01" #define RUBY_VERSION_CODE 154 -#define RUBY_RELEASE_CODE 20000531 +#define RUBY_RELEASE_CODE 20000601