summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-27 15:29:28 +0000
committerttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-09-27 15:29:28 +0000
commitce714853444a00aaf47af5f1f4faa1f4489daaba (patch)
treeb5471beb94deb4c304f6e2e4be4c4b0908123a45
parent44347299944fee9d278e21f2e1742df370a59b02 (diff)
downloadruby-ce714853444a00aaf47af5f1f4faa1f4489daaba.tar.gz
ruby-ce714853444a00aaf47af5f1f4faa1f4489daaba.tar.xz
ruby-ce714853444a00aaf47af5f1f4faa1f4489daaba.zip
merged from HEAD.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/dl/lib/dl/import.rb10
-rw-r--r--ext/dl/lib/dl/types.rb9
2 files changed, 8 insertions, 11 deletions
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb
index c0dfb5f70..1ab5145de 100644
--- a/ext/dl/lib/dl/import.rb
+++ b/ext/dl/lib/dl/import.rb
@@ -9,15 +9,11 @@ module DL
module Internal
def init_types()
- if( !@types )
- @types = ::DL::Types.new
- end
+ @types ||= ::DL::Types.new
end
def init_sym()
- if( !@SYM )
- @SYM = {}
- end
+ @SYM ||= {}
end
def [](name)
@@ -85,7 +81,7 @@ module DL
" args = enc.call(args) if enc",
" r,rs = #{func}(*args)",
" r = renc.call(r) if rdec",
- " rs = dec.call(rs) if dec",
+ " rs = dec.call(rs) if (dec && rs)",
" @retval = r",
" @args = rs",
" @retval",
diff --git a/ext/dl/lib/dl/types.rb b/ext/dl/lib/dl/types.rb
index b9a235f3b..139426473 100644
--- a/ext/dl/lib/dl/types.rb
+++ b/ext/dl/lib/dl/types.rb
@@ -53,7 +53,7 @@ module DL
proc{|v| (v != 0) ? true : false},
proc{|v,len| v ? 1 : 0},
proc{|v,len| (v != 0) ? true : false}],
- ["unsigned char", "I",
+ ["unsigned char", "C",
proc{|v| [v].pack("C").unpack("c")[0]},
proc{|v| [v].pack("c").unpack("C")[0]},
proc{|v| [v].pack("C").unpack("c")[0]},
@@ -73,7 +73,7 @@ module DL
proc{|v| [v].pack("l").unpack("L")[0]},
proc{|v| [v].pack("L").unpack("l")[0]},
proc{|v| [v].pack("l").unpack("L")[0]}],
- ["unsigned char ref", "i",
+ ["unsigned char ref", "c",
proc{|v| [v].pack("C").unpack("c")[0]},
proc{|v| [v].pack("c").unpack("C")[0]},
nil, nil],
@@ -97,8 +97,9 @@ module DL
["long", "L", nil, nil, nil, nil],
["float", "F", nil, nil, nil, nil],
["double", "D", nil, nil, nil, nil],
- [/^char\s*\*$/,"S",nil, nil, nil, nil],
- [/^.+\*$/, "P", nil, nil, nil, nil],
+ [/^char\s*\*$/,"s",nil, nil, nil, nil],
+ [/^const char\s*\*$/,"S",nil, nil, nil, nil],
+ [/^.+\*$/, "p", nil, nil, nil, nil],
[/^.+\[\]$/, "a", nil, nil, nil, nil],
["void", "0", nil, nil, nil, nil],
]