1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2002-02-01 06:03:03 +00:00
parent 3d51761abd
commit 9f0d9bd711
6 changed files with 23 additions and 10 deletions

View file

@ -1,3 +1,7 @@
Fri Feb 1 00:03:30 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* file.c (rb_stat_inspect): print dev, rdev in hexadecimal.
Thu Jan 31 20:45:33 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* lib/mkmf.rb (dir_config): prior --with flag.
@ -15,6 +19,10 @@ Wed Jan 30 15:58:04 2002 K.Kosako <kosako@sofnec.co.jp>
* regex.c (mbc_startpos): ditto.
Wed Jan 30 13:37:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* re.c (rb_reg_search): should set regs.allocated.
Wed Jan 30 02:25:38 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* regex.c (re_adjust_startpos): search start of multibyte

6
file.c
View file

@ -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));
}

View file

@ -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

View file

@ -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)))))

View file

@ -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("==");

1
re.c
View file

@ -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, &regs);