mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merged from HEAD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9dcc08646f
commit
f5df3fcb1e
2 changed files with 8 additions and 11 deletions
|
@ -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",
|
||||
|
|
|
@ -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],
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue