Skip to content

Commit

Permalink
* io.c (appendline): forget to terminate with nul.
Browse files Browse the repository at this point in the history
* 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.

* string.c (rb_str_each_line): p might be at the top of the
  string.

* 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.

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Sep 25, 2002
1 parent 8a1e574 commit 4b9a7ea
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 36 deletions.
39 changes: 39 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ Mon Sep 23 19:57:52 2002 WATANABE Hirofumi <[email protected]>

* lib/mkmf.rb: refactoring.

Mon Sep 23 08:27:11 2002 Tanaka Akira <[email protected]>

* io.c (appendline): forget to terminate with nul.

Mon Sep 23 02:46:29 2002 Yukihiro Matsumoto <[email protected]>

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

* eval.c (call_trace_func): should not call trace function while
Expand All @@ -32,6 +47,21 @@ Sun Sep 22 21:49:42 2002 Nobuyoshi Nakada <[email protected]>
* ruby.c (require_libraries): preserve source file/line for each
require.

Sun Sep 22 17:08:11 2002 Tanaka Akira <[email protected]>

* string.c (rb_str_each_line): p might be at the top of the
string.

Sat Sep 21 23:28:28 2002 Yukihiro Matsumoto <[email protected]>

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

* eval.c (rb_thread_raise): no need to save dead thread context.
Expand All @@ -46,6 +76,15 @@ Fri Sep 20 19:43:40 2002 Akinori MUSHA <[email protected]>

* lib/set.rb: Merge rough/lib/set.rb rev.1.5-1.15.

Wed Sep 18 12:41:16 2002 Yukihiro Matsumoto <[email protected]>

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

* eval.c (rb_thread_die): put thread dead state.
Expand Down
12 changes: 6 additions & 6 deletions class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down
38 changes: 20 additions & 18 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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));
Expand All @@ -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);
}
Expand All @@ -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));
Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -7279,7 +7281,7 @@ struct thread {

VALUE result;

int stk_len;
int stk_len;
int stk_max;
VALUE*stk_ptr;
VALUE*stk_pos;
Expand Down
5 changes: 3 additions & 2 deletions ext/tcltklib/tcltklib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 7 additions & 5 deletions lib/uri/mailto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,22 @@ class MailTo < Generic
# 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
Expand Down
3 changes: 1 addition & 2 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions version.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4b9a7ea

Please sign in to comment.