From: WATANABE Tetsuya Date: 1999-08-18T17:51:48+09:00 Subject: [ruby-dev:7719] Re: [ruby-list:16198] Re: Ruby 1.4.0 渡辺哲也です。 In message "[ruby-dev:7718] Re: [ruby-list:16198] Re: Ruby 1.4.0" on 99/08/18, Yukihiro Matsumoto writes: |後、以下の情報があればしぼりこめるかも | | rb_cIO | *(struct RFile*)recv (rb_callで) | *(struct RClass*)((struct RBasic*)recv)->klass | *(struct RClass*)((struct RClass*)((struct RBasic*)recv)->klass)->super #9 0x80577b9 in rb_call (klass=1075012152, recv=1075012172, mid=6673, argc=0, argv=0x0, scope=0) at eval.c:3984 3984 else if ((body = rb_get_method_body(&klass, &id, &noex)) == 0) { (gdb) print *(struct RFile*)recv $1 = {basic = {flags = 0, klass = 1075012152}, fptr = 0x8103680} (gdb) print *(struct RClass*)((struct RBasic*)recv)->klass $2 = {basic = {flags = 0, klass = 1075012132}, iv_tbl = 0x0, m_tbl = 0x0, super = 0} (gdb) print *(struct RClass*)((struct RClass*)((struct RBasic*)recv)->klass)->super $3 = {basic = {flags = 83907072, klass = 1049088}, iv_tbl = 0x1f416d4, m_tbl = 0x244b, super = 1959} | ... 以下 klass と同じ値が出て来るまで ... え? って聞いちゃいます。この先は具体的には何をみれば いいですか? |それとこのオブジェクト(openの結果)が代入されている変数はなん |ですか? 通常ローカル変数? ブロック内ローカル変数? それと |もそれ以外のなにか? いわれてみて気がついたんですが、ブロック内ローカルを さらに使い回しています。あらら。こういうコード書くか ら引っかかるのかな? ------------------------------ def search_file(pattern, types, os, hw, cr, inc) topDir = '/home/httpd/html/hp-ux_patches' # os 10.X のとき s800 または s700 なら s700_800 も hws = [hw] hws.push('s700_800') if os == '10.X' and hw != 's700_800' patch_file = [] hws.each do |h| dir = topDir + '/' + h + '/' + os d = Dir.open(dir) d.each do |f| next if (types & [f[2,2]]).size == 0 file = dir + '/' + f if pattern == '' patch_file.push(file) if File.exist?(file) else f = File.open(file) $_ = f.read f.close next if ((! inc) and ~/This patch is replaced by PH/i) or (cr and (! ~/^\s+Crit:\s+Yes/i)) patch_file.push(file) if eval(pattern) end end d.close end patch_file.sort {|a, b| na = a.scan(/_(\d+)$/)[0][0].to_i nb = b.scan(/_(\d+)$/)[0][0].to_i nb <=> na } end ------------------------------ -- WATANABE Tetsuya e-mail: Tetsuya_WATANABE@hp.com tetsu@jpn.hp.com