ruby-changes:9597
From: yugui <ko1@a...>
Date: Sun, 28 Dec 2008 21:13:47 +0900 (JST)
Subject: [ruby-changes:9597] Ruby:r21137 (trunk): * ext/dl/lib/dl/import.rb (DL::Importer#extern): adds filename and
yugui 2008-12-28 21:13:24 +0900 (Sun, 28 Dec 2008) New Revision: 21137 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21137 Log: * ext/dl/lib/dl/import.rb (DL::Importer#extern): adds filename and line number to module_eval'ing for readability of backtrace. (DL::Importer#bind): ditto. * ext/dl/lib/dl/struct.rb (DL::CStructBuilder#create): ditto. Modified files: trunk/ChangeLog trunk/ext/dl/lib/dl/import.rb trunk/ext/dl/lib/dl/struct.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 21136) +++ ChangeLog (revision 21137) @@ -1,3 +1,11 @@ +Sun Dec 28 21:03:07 2008 Yuki Sonoda (Yugui) <yugui@y...> + + * ext/dl/lib/dl/import.rb (DL::Importer#extern): adds filename and + line number to module_eval'ing for readability of backtrace. + (DL::Importer#bind): ditto. + + * ext/dl/lib/dl/struct.rb (DL::CStructBuilder#create): ditto. + Sun Dec 28 19:11:03 2008 Nobuyoshi Nakada <nobu@r...> * win32/Makefile.sub (config.h): do not use snprintf/vsnprintf in Index: ext/dl/lib/dl/struct.rb =================================================================== --- ext/dl/lib/dl/struct.rb (revision 21136) +++ ext/dl/lib/dl/struct.rb (revision 21137) @@ -29,7 +29,7 @@ } } size = klass.entity_class.size(types) - new_class.module_eval(<<-EOS) + new_class.module_eval(<<-EOS, __FILE__, __LINE__+1) def new_class.size() #{size} end Index: ext/dl/lib/dl/import.rb =================================================================== --- ext/dl/lib/dl/import.rb (revision 21136) +++ ext/dl/lib/dl/import.rb (revision 21137) @@ -119,7 +119,13 @@ name = symname.gsub(/@.+/,'') @func_map[name] = f # define_method(name){|*args,&block| f.call(*args,&block)} - module_eval(<<-EOS) + begin + /^(.+?):(\d+)/ =~ caller.first + file, line = $1, $2.to_i + rescue + file, line = __FILE__, __LINE__+3 + end + module_eval(<<-EOS, file, line) def #{name}(*args, &block) @func_map['#{name}'].call(*args,&block) end @@ -143,7 +149,13 @@ end @func_map[name] = f #define_method(name){|*args,&block| f.call(*args,&block)} - module_eval(<<-EOS) + begin + /^(.+?):(\d+)/ =~ caller.first + file, line = $1, $2.to_i + rescue + file, line = __FILE__, __LINE__+3 + end + module_eval(<<-EOS, file, line) def #{name}(*args,&block) @func_map['#{name}'].call(*args,&block) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/