* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2008-12-28 12:13:24 +00:00
Родитель 00cb692395
Коммит 28001c849d
3 изменённых файлов: 23 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Sun Dec 28 21:03:07 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* 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@ruby-lang.org> Sun Dec 28 19:11:03 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/Makefile.sub (config.h): do not use snprintf/vsnprintf in * win32/Makefile.sub (config.h): do not use snprintf/vsnprintf in

Просмотреть файл

@ -119,7 +119,13 @@ module DL
name = symname.gsub(/@.+/,'') name = symname.gsub(/@.+/,'')
@func_map[name] = f @func_map[name] = f
# define_method(name){|*args,&block| f.call(*args,&block)} # 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) def #{name}(*args, &block)
@func_map['#{name}'].call(*args,&block) @func_map['#{name}'].call(*args,&block)
end end
@ -143,7 +149,13 @@ module DL
end end
@func_map[name] = f @func_map[name] = f
#define_method(name){|*args,&block| f.call(*args,&block)} #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) def #{name}(*args,&block)
@func_map['#{name}'].call(*args,&block) @func_map['#{name}'].call(*args,&block)
end end

Просмотреть файл

@ -29,7 +29,7 @@ module DL
} }
} }
size = klass.entity_class.size(types) size = klass.entity_class.size(types)
new_class.module_eval(<<-EOS) new_class.module_eval(<<-EOS, __FILE__, __LINE__+1)
def new_class.size() def new_class.size()
#{size} #{size}
end end