Bug #1451
closeddl in ruby-1.9 can't parse signatures correctly.
Description
=begin
1.9 の dl の cparser.rb が空白があるシグネチャを正しくパースできません。
$ cat d7.rb
require 'dl/import'
module M
extend DL::Importer
dlload 'libc.so.6'
extern 'void * memmove(void *, void *, unsigned long )'
end
$ ruby-1.9 -v d7.rb
ruby 1.9.2dev (2009-05-02 trunk 23326) [i686-linux]
/usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/cparser.rb:104:in parse_ctype': unknown type: unsigned long (DL::DLError) from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/cparser.rb:53:in
block in parse_signature'
from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/cparser.rb:53:in collect' from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/cparser.rb:53:in
parse_signature'
from /usr/local/pkg/ruby-1.9/lib/ruby/1.9.1/dl/import.rb:116:in extern' from d7.rb:6:in
module:M'
from d7.rb:3:in `'
パッチです。
$ svn diff lib/dl/cparser.rb
Index: lib/dl/cparser.rb
--- lib/dl/cparser.rb (リビジョン 23328)
+++ lib/dl/cparser.rb (作業コピー)
@@ -41,7 +41,7 @@ module DL
case signature
when /^([\d\w@*\s]+)(([\d\w*\s,[]]*))$/
ret = $1
-
args = $2
-
args = $2.sub(/\A\s*/, '').sub(/\s*\z/, '') ret = ret.split(/\s+/) args = args.split(/\s*,\s*/) func = ret.pop
=end