From 9f0d9bd7111ecfbc087cc4dfe6b4d46e8b98800f Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 1 Feb 2002 06:03:03 +0000 Subject: [PATCH] * file.c (rb_stat_inspect): print dev, rdev in hexadecimal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ file.c | 6 ++++++ lib/singleton.rb | 7 +++---- misc/ruby-mode.el | 2 ++ object.c | 9 +++------ re.c | 1 + 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6ba9b0426..e98072b31b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Feb 1 00:03:30 2002 Yukihiro Matsumoto + + * file.c (rb_stat_inspect): print dev, rdev in hexadecimal. + Thu Jan 31 20:45:33 2002 Nobuyoshi Nakada * lib/mkmf.rb (dir_config): prior --with flag. @@ -15,6 +19,10 @@ Wed Jan 30 15:58:04 2002 K.Kosako * regex.c (mbc_startpos): ditto. +Wed Jan 30 13:37:05 2002 Yukihiro Matsumoto + + * re.c (rb_reg_search): should set regs.allocated. + Wed Jan 30 02:25:38 2002 Nobuyoshi Nakada * regex.c (re_adjust_startpos): search start of multibyte diff --git a/file.c b/file.c index 13cca0fa47..ddd282c6c9 100644 --- a/file.c +++ b/file.c @@ -332,6 +332,12 @@ rb_stat_inspect(self) sprintf(buf, "0%o", NUM2INT(v)); rb_str_buf_cat2(str, buf); } + else if (i == 0 || i == 6) { /* dev/rdev */ + char buf[32]; + + sprintf(buf, "0x%x", NUM2ULONG(v)); + rb_str_buf_cat2(str, buf); + } else { rb_str_append(str, rb_inspect(v)); } diff --git a/lib/singleton.rb b/lib/singleton.rb index 2b5a3a3cb5..6ff6d190f2 100644 --- a/lib/singleton.rb +++ b/lib/singleton.rb @@ -66,18 +66,17 @@ module Singleton # singletons types (sounds like an oxymoron) and # helps out people counting on transitive mixins unless mod.instance_of? (Class) - raise TypeError.new "Inclusion of the OO-Singleton module in module #{mod}" + raise TypeError, "Inclusion of the OO-Singleton module in module #{mod}" end unless (class << mod; self end) <= (class << Object; self end) - raise TypeError.new "Inclusion of the OO-Singleton module in singleton type" + raise TypeError, "Inclusion of the OO-Singleton module in singleton type" end super end def included (klass) # remove build in copying methods klass.class_eval do - undef_method(:clone) rescue nil - undef_method(:dup) rescue nil + define_method(:clone) {raise TypeError, "can't clone singleton #{self.type}"} end # initialize the ``klass instance variable'' @__instance__ to nil diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index bbbb2706e5..38d2ee2487 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -773,6 +773,8 @@ An end of a defun is found by moving forward from the beginning of one." (add-hook 'ruby-mode-hook '(lambda () (make-local-variable 'font-lock-defaults) + (make-local-variable 'font-lock-keywords) + (make-local-variable 'font-lock-syntactic-keywords) (setq font-lock-defaults '((ruby-font-lock-keywords) nil nil)) (setq font-lock-keywords ruby-font-lock-keywords) (setq font-lock-syntactic-keywords ruby-font-lock-syntactic-keywords))))) diff --git a/object.c b/object.c index e2ecbd30a7..f4558139e8 100644 --- a/object.c +++ b/object.c @@ -115,6 +115,9 @@ rb_obj_dup(obj) { VALUE dup; + if (rb_special_const_p(obj)) { + rb_raise(rb_eTypeError, "can't dup %s", rb_class2name(CLASS_OF(obj))); + } dup = rb_funcall(obj, clone, 0, 0); if (TYPE(dup) != TYPE(obj)) { rb_raise(rb_eTypeError, "dupulicated object must be same type"); @@ -1239,8 +1242,6 @@ Init_Object() rb_define_method(rb_cNilClass, "&", false_and, 1); rb_define_method(rb_cNilClass, "|", false_or, 1); rb_define_method(rb_cNilClass, "^", false_xor, 1); - rb_undef_method(rb_cNilClass, "clone"); - rb_undef_method(rb_cNilClass, "dup"); rb_define_method(rb_cNilClass, "nil?", rb_true, 0); rb_undef_method(CLASS_OF(rb_cNilClass), "allocate"); @@ -1316,8 +1317,6 @@ Init_Object() rb_define_method(rb_cTrueClass, "^", true_xor, 1); rb_undef_method(CLASS_OF(rb_cTrueClass), "allocate"); rb_undef_method(CLASS_OF(rb_cTrueClass), "new"); - rb_undef_method(rb_cTrueClass, "clone"); - rb_undef_method(rb_cTrueClass, "dup"); rb_define_global_const("TRUE", Qtrue); rb_cFalseClass = rb_define_class("FalseClass", rb_cObject); @@ -1327,8 +1326,6 @@ Init_Object() rb_define_method(rb_cFalseClass, "^", false_xor, 1); rb_undef_method(CLASS_OF(rb_cFalseClass), "allocate"); rb_undef_method(CLASS_OF(rb_cFalseClass), "new"); - rb_undef_method(rb_cFalseClass, "clone"); - rb_undef_method(rb_cFalseClass, "dup"); rb_define_global_const("FALSE", Qfalse); eq = rb_intern("=="); diff --git a/re.c b/re.c index 5e73ddbd8b..d587cdbb5c 100644 --- a/re.c +++ b/re.c @@ -629,6 +629,7 @@ rb_reg_search(re, str, pos, reverse) else { range = RSTRING(str)->len - pos; } + regs.allocated = 0; result = re_search(RREGEXP(re)->ptr,RSTRING(str)->ptr,RSTRING(str)->len, pos, range, ®s);