diff --git a/ChangeLog b/ChangeLog index 816a14176f..afff9606dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,21 @@ Mon Sep 23 19:57:52 2002 WATANABE Hirofumi * lib/mkmf.rb: refactoring. +Mon Sep 23 08:27:11 2002 Tanaka Akira + + * io.c (appendline): forget to terminate with nul. + +Mon Sep 23 02:46:29 2002 Yukihiro Matsumoto + + * eval.c (ruby_run): should set toplevel visibility again here. + + * eval.c (rb_eval): should not rely on ruby_class == rb_cObject + check. Besides allow implicit publicity for attribute set + methods. + + * parse.y (primary): need not to check class_nest, just set + whether method is an attrset or not. + Sun Sep 22 21:49:42 2002 Nobuyoshi Nakada * eval.c (call_trace_func): should not call trace function while @@ -32,6 +47,21 @@ Sun Sep 22 21:49:42 2002 Nobuyoshi Nakada * ruby.c (require_libraries): preserve source file/line for each require. +Sun Sep 22 17:08:11 2002 Tanaka Akira + + * string.c (rb_str_each_line): p might be at the top of the + string. + +Sat Sep 21 23:28:28 2002 Yukihiro Matsumoto + + * class.c (rb_make_metaclass): class of metaclass should be + metaclass of superclass, unless class itself is a metaclass; + class of metaclass of metaclass should point back to self. + eh, confusing, isn't it. + + * class.c (rb_singleton_class): check if its class is singleton + AND attached to self. + Sat Sep 21 22:23:41 2002 Nobuyoshi Nakada * eval.c (rb_thread_raise): no need to save dead thread context. @@ -46,6 +76,15 @@ Fri Sep 20 19:43:40 2002 Akinori MUSHA * lib/set.rb: Merge rough/lib/set.rb rev.1.5-1.15. +Wed Sep 18 12:41:16 2002 Yukihiro Matsumoto + + * eval.c (rb_eval): should define class/module under ruby_cbase. + + * eval.c (rb_eval): should set class/module path based on + ruby_cbase, not ruby_class. + + * eval.c (module_setup): use ruby_cbase instead of ruby_class. + Tue Sep 17 21:06:04 2002 Nobuyoshi Nakada * eval.c (rb_thread_die): put thread dead state. diff --git a/class.c b/class.c index 9d9d3660ca..d55c37e991 100644 --- a/class.c +++ b/class.c @@ -147,11 +147,12 @@ rb_make_metaclass(obj, super) FL_SET(klass, FL_SINGLETON); RBASIC(obj)->klass = klass; rb_singleton_class_attached(klass, obj); - if (BUILTIN_TYPE(obj) == T_CLASS) { + if (BUILTIN_TYPE(obj) == T_CLASS && FL_TEST(obj, FL_SINGLETON)) { RBASIC(klass)->klass = klass; - if (FL_TEST(obj, FL_SINGLETON)) { - RCLASS(klass)->super = RBASIC(rb_class_real(RCLASS(obj)->super))->klass; - } + RCLASS(klass)->super = RBASIC(rb_class_real(RCLASS(obj)->super))->klass; + } + else { + RBASIC(klass)->klass = RBASIC(rb_class_real(super))->klass; } return klass; @@ -699,8 +700,7 @@ rb_singleton_class(obj) DEFER_INTS; if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) && - (BUILTIN_TYPE(obj) == T_CLASS || /* metaclass (or metaclass of metaclass) */ - rb_iv_get(RBASIC(obj)->klass, "__attached__") == obj)) { + rb_iv_get(RBASIC(obj)->klass, "__attached__") == obj) { klass = RBASIC(obj)->klass; } else { diff --git a/configure.in b/configure.in index 0f8272bb67..c781213b37 100644 --- a/configure.in +++ b/configure.in @@ -915,6 +915,9 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no *djgpp*) setup=Setup.dj ;; + atheos*) + setup=Setup.atheos + ;; *) setup=Setup ;; diff --git a/eval.c b/eval.c index fad145124b..958346deed 100644 --- a/eval.c +++ b/eval.c @@ -1255,6 +1255,8 @@ ruby_run() Init_stack((void*)&tmp); PUSH_TAG(PROT_NONE); PUSH_ITER(ITER_NOT); + /* default visibility is private at toplevel */ + SCOPE_SET(SCOPE_PRIVATE); if ((state = EXEC_TAG()) == 0) { eval_node(ruby_top_self, ruby_eval_tree); } @@ -2923,7 +2925,7 @@ rb_eval(self, n) break; case NODE_CDECL: - if (NIL_P(ruby_class)) { + if (NIL_P(ruby_cbase)) { rb_raise(rb_eTypeError, "no class/module to define constant"); } result = rb_eval(self, node->nd_value); @@ -3166,15 +3168,15 @@ rb_eval(self, n) } } - if (SCOPE_TEST(SCOPE_PRIVATE) || node->nd_mid == init) { + if (node->nd_noex == NOEX_PUBLIC) { + noex = NOEX_PUBLIC; /* means is is an attrset */ + } + else if (SCOPE_TEST(SCOPE_PRIVATE) || node->nd_mid == init) { noex = NOEX_PRIVATE; } else if (SCOPE_TEST(SCOPE_PROTECTED)) { noex = NOEX_PROTECTED; } - else if (ruby_class == rb_cObject) { - noex = node->nd_noex; - } else { noex = NOEX_PUBLIC; } @@ -3260,7 +3262,7 @@ rb_eval(self, n) { VALUE super, klass, tmp; - if (NIL_P(ruby_class)) { + if (NIL_P(ruby_cbase)) { rb_raise(rb_eTypeError, "no outer class/module"); } if (node->nd_super) { @@ -3270,11 +3272,11 @@ rb_eval(self, n) super = 0; } - if ((ruby_class == rb_cObject) && rb_autoload_defined(node->nd_cname)) { + if ((ruby_cbase == rb_cObject) && rb_autoload_defined(node->nd_cname)) { rb_autoload_load(node->nd_cname); } - if (rb_const_defined_at(ruby_class, node->nd_cname)) { - klass = rb_const_get(ruby_class, node->nd_cname); + if (rb_const_defined_at(ruby_cbase, node->nd_cname)) { + klass = rb_const_get(ruby_cbase, node->nd_cname); if (TYPE(klass) != T_CLASS) { rb_raise(rb_eTypeError, "%s is not a class", rb_id2name(node->nd_cname)); @@ -3293,7 +3295,7 @@ rb_eval(self, n) override_class: if (!super) super = rb_cObject; klass = rb_define_class_id(node->nd_cname, super); - rb_set_class_path(klass,ruby_class,rb_id2name(node->nd_cname)); + rb_set_class_path(klass,ruby_cbase,rb_id2name(node->nd_cname)); rb_class_inherited(super, klass); rb_const_set(ruby_cbase, node->nd_cname, klass); } @@ -3310,14 +3312,14 @@ rb_eval(self, n) { VALUE module; - if (NIL_P(ruby_class)) { + if (NIL_P(ruby_cbase)) { rb_raise(rb_eTypeError, "no outer class/module"); } - if ((ruby_class == rb_cObject) && rb_autoload_defined(node->nd_cname)) { + if ((ruby_cbase == rb_cObject) && rb_autoload_defined(node->nd_cname)) { rb_autoload_load(node->nd_cname); } - if (rb_const_defined_at(ruby_class, node->nd_cname)) { - module = rb_const_get(ruby_class, node->nd_cname); + if (rb_const_defined_at(ruby_cbase, node->nd_cname)) { + module = rb_const_get(ruby_cbase, node->nd_cname); if (TYPE(module) != T_MODULE) { rb_raise(rb_eTypeError, "%s is not a module", rb_id2name(node->nd_cname)); @@ -3328,8 +3330,8 @@ rb_eval(self, n) } else { module = rb_define_module_id(node->nd_cname); + rb_set_class_path(module,ruby_cbase,rb_id2name(node->nd_cname)); rb_const_set(ruby_cbase, node->nd_cname, module); - rb_set_class_path(module,ruby_class,rb_id2name(node->nd_cname)); } if (ruby_wrapper) { rb_extend_object(module, ruby_wrapper); @@ -3429,11 +3431,11 @@ module_setup(module, n) PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { if (trace_func) { - call_trace_func("class", ruby_current_node, ruby_class, + call_trace_func("class", ruby_current_node, ruby_cbase, ruby_frame->last_func, ruby_frame->last_class); } - result = rb_eval(ruby_class, node->nd_next); + result = rb_eval(ruby_cbase, node->nd_next); } POP_TAG(); POP_CREF(); @@ -7279,7 +7281,7 @@ struct thread { VALUE result; - int stk_len; + int stk_len; int stk_max; VALUE*stk_ptr; VALUE*stk_pos; diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index cdb3b92e81..c90a807ae7 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -693,8 +693,9 @@ ip_invoke_real(argc, argv, obj) else #endif { - ptr->return_value = (*info.proc)(info.clientData, - ptr->ip, argc, av); + TRAP_BEG; + ptr->return_value = (*info.proc)(info.clientData, ptr->ip, argc, av); + TRAP_END; } if (ptr->return_value == TCL_ERROR) { diff --git a/io.c b/io.c index 8671edeac2..80c12bc5b5 100644 --- a/io.c +++ b/io.c @@ -792,6 +792,7 @@ appendline(fptr, delim, strp) else { *strp = str = rb_str_buf_new(len); RSTRING(str)->len = len; + RSTRING(str)->ptr[len] = '\0'; } if (c != EOF) { RSTRING(str)->ptr[last++] = c; diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index bf6b954903..b1c18f4364 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -46,20 +46,22 @@ module URI # hname = *urlc # hvalue = *urlc # header = hname "=" hvalue - HEADER_REGEXP = "(?:[^?=&]*=[^?=&]*)".freeze + header_pattern = "(?:[^?=&]*=[^?=&]*)" + HEADER_REGEXP = /#{header_pattern}/ # headers = "?" header *( "&" header ) # to = #mailbox # mailtoURL = "mailto:" [ to ] [ headers ] - MAILBOX_REGEXP = "(?:[^(),%?=&]|#{PATTERN::ESCAPED})".freeze + mailbox_pattern = "(?:[^(),%?=&]|#{PATTERN::ESCAPED})" + MAILBOX_REGEXP = /#{mailbox_pattern}/ MAILTO_REGEXP = Regexp.new(" \\A - (#{MAILBOX_REGEXP}*?) (?# 1: to) + (#{mailbox_pattern}*?) (?# 1: to) (?: \\? - (#{HEADER_REGEXP}(?:\\&#{HEADER_REGEXP})*) (?# 2: headers) + (#{header_pattern}(?:\\&#{header_pattern})*) (?# 2: headers) )? \\z - ", Regexp::EXTENDED, 'N').freeze + ", Regexp::EXTENDED, 'N') =begin diff --git a/parse.y b/parse.y index 4c2655492c..5bf5750333 100644 --- a/parse.y +++ b/parse.y @@ -1488,8 +1488,7 @@ primary : literal bodystmt kEND { - /* NOEX_PRIVATE for toplevel */ - $$ = NEW_DEFN($2, $4, $5, class_nest?NOEX_PUBLIC:NOEX_PRIVATE); + $$ = NEW_DEFN($2, $4, $5, NOEX_PRIVATE); if (is_attrset_id($2)) $$->nd_noex = NOEX_PUBLIC; fixpos($$, $4); local_pop(); diff --git a/string.c b/string.c index 161c8a9894..5b60e9268b 100644 --- a/string.c +++ b/string.c @@ -2631,7 +2631,7 @@ rb_str_each_line(argc, argv, str) if (*++p != '\n') continue; while (*p == '\n') p++; } - if (p[-1] == newline && + if (RSTRING(str)->ptr < p && p[-1] == newline && (rslen <= 1 || rb_memcmp(RSTRING(rs)->ptr, p-rslen, rslen) == 0)) { line = rb_str_new5(str, s, p - s); diff --git a/version.h b/version.h index af636a5fbc..9abf9c43eb 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.3" -#define RUBY_RELEASE_DATE "2002-09-23" +#define RUBY_RELEASE_DATE "2002-09-25" #define RUBY_VERSION_CODE 173 -#define RUBY_RELEASE_CODE 20020923 +#define RUBY_RELEASE_CODE 20020925