ChangeLog lib/pp.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
96aa0c2a8f
commit
1ebb904958
@ -1,3 +1,8 @@
|
||||
Mon Nov 28 20:24:22 2005 Tanaka Akira <akr@m17n.org>
|
||||
|
||||
* lib/pp.rb (PP::PPMethods#object_address_group): mask an address with
|
||||
word size.
|
||||
|
||||
Tue Nov 29 23:57:05 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (struct parser_params): heap must be placed at same offset
|
||||
|
10
lib/pp.rb
10
lib/pp.rb
@ -150,6 +150,14 @@ class PP < PrettyPrint
|
||||
group(1, '#<' + obj.class.name, '>', &block)
|
||||
end
|
||||
|
||||
if 0x100000000.class == Bignum
|
||||
# 32bit
|
||||
PointerMask = 0xffffffff
|
||||
else
|
||||
# 64bit
|
||||
PointerMask = 0xffffffffffffffff
|
||||
end
|
||||
|
||||
case Object.new.inspect
|
||||
when /\A\#<Object:0x([0-9a-f]+)>\z/
|
||||
PointerFormat = "%0#{$1.length}x"
|
||||
@ -158,7 +166,7 @@ class PP < PrettyPrint
|
||||
end
|
||||
|
||||
def object_address_group(obj, &block)
|
||||
id = PointerFormat % (obj.__id__ * 2)
|
||||
id = PointerFormat % (obj.__id__ * 2 & PointerMask)
|
||||
id.sub!(/\Af(?=[[:xdigit:]]{2}+\z)/, '') if id.sub!(/\A\.\./, '')
|
||||
group(1, "\#<#{obj.class}:0x#{id}", '>', &block)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user