mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
bugfix for [ruby-talk:121309].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bf6f327fb2
commit
c0b17e006c
3 changed files with 21 additions and 13 deletions
|
@ -71,6 +71,9 @@ module DL
|
||||||
init_sym()
|
init_sym()
|
||||||
|
|
||||||
rty,renc,rdec,_,_,_ = @types.encode_type(ret)
|
rty,renc,rdec,_,_,_ = @types.encode_type(ret)
|
||||||
|
if( !rty )
|
||||||
|
raise(TypeError, "unsupported type: #{ret}")
|
||||||
|
end
|
||||||
ty,enc,dec = encode_types(args)
|
ty,enc,dec = encode_types(args)
|
||||||
symty = rty + ty
|
symty = rty + ty
|
||||||
|
|
||||||
|
@ -132,6 +135,9 @@ module DL
|
||||||
init_sym()
|
init_sym()
|
||||||
|
|
||||||
rty,_,rdec,_,_,_ = @types.encode_type(rettype)
|
rty,_,rdec,_,_,_ = @types.encode_type(rettype)
|
||||||
|
if( !rty )
|
||||||
|
raise(TypeError, "unsupported type: #{rettype}")
|
||||||
|
end
|
||||||
ty,enc,dec = encode_types(argtypes)
|
ty,enc,dec = encode_types(argtypes)
|
||||||
symty = rty + ty
|
symty = rty + ty
|
||||||
|
|
||||||
|
@ -185,6 +191,9 @@ module DL
|
||||||
dec = nil
|
dec = nil
|
||||||
tys.each_with_index{|ty,idx|
|
tys.each_with_index{|ty,idx|
|
||||||
ty,c1,c2,_,_,_ = @types.encode_type(ty)
|
ty,c1,c2,_,_,_ = @types.encode_type(ty)
|
||||||
|
if( !ty )
|
||||||
|
raise(TypeError, "unsupported type: #{ty}")
|
||||||
|
end
|
||||||
encty.push(ty)
|
encty.push(ty)
|
||||||
if( enc )
|
if( enc )
|
||||||
if( c1 )
|
if( c1 )
|
||||||
|
|
|
@ -129,6 +129,9 @@ module DL
|
||||||
raise(RuntimeError, "invalid element: #{elem}")
|
raise(RuntimeError, "invalid element: #{elem}")
|
||||||
end
|
end
|
||||||
_,_,_,ty,enc,dec = @types.encode_type(ty)
|
_,_,_,ty,enc,dec = @types.encode_type(ty)
|
||||||
|
if( !ty )
|
||||||
|
raise(TypeError, "unsupported type: #{ty}")
|
||||||
|
end
|
||||||
return [name,ty,num,enc,dec]
|
return [name,ty,num,enc,dec]
|
||||||
end
|
end
|
||||||
end # class Struct
|
end # class Struct
|
||||||
|
|
|
@ -179,17 +179,12 @@ module DL
|
||||||
dec = nil
|
dec = nil
|
||||||
senc = nil
|
senc = nil
|
||||||
sdec = nil
|
sdec = nil
|
||||||
ty1 = nil
|
ty1 = ty
|
||||||
ty2 = nil
|
ty2 = ty
|
||||||
@TYDEFS.each{|t1,t2,c1,c2,t3,c3,c4|
|
@TYDEFS.each{|t1,t2,c1,c2,t3,c3,c4|
|
||||||
# if( t1.is_a?(String) )
|
if( (t1.is_a?(Regexp) && (t1 =~ ty1)) || (t1 == ty1) )
|
||||||
# t1 = Regexp.new("^" + t1 + "$")
|
ty1 = ty1.gsub(t1,t2) if t2
|
||||||
# end
|
|
||||||
if( (t1.is_a?(Regexp) && (t1 =~ ty)) || (t1 == ty) )
|
|
||||||
ty1 = ty.gsub(t1,t2) if t2
|
|
||||||
ty2 = ty.gsub(t1,t3) if t3
|
|
||||||
ty1.strip! if ty1
|
ty1.strip! if ty1
|
||||||
ty2.strip! if ty2
|
|
||||||
if( enc )
|
if( enc )
|
||||||
if( c1 )
|
if( c1 )
|
||||||
conv1 = enc
|
conv1 = enc
|
||||||
|
@ -210,6 +205,10 @@ module DL
|
||||||
dec = c2
|
dec = c2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
if( (t1.is_a?(Regexp) && (t1 =~ ty2)) || (t1 == ty2) )
|
||||||
|
ty2 = ty2.gsub(t1,t3) if t3
|
||||||
|
ty2.strip! if ty2
|
||||||
if( senc )
|
if( senc )
|
||||||
if( c3 )
|
if( c3 )
|
||||||
conv3 = senc
|
conv3 = senc
|
||||||
|
@ -230,11 +229,8 @@ module DL
|
||||||
sdec = c4
|
sdec = c4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
if( ty1.length != 1 && ty2.length != 1 )
|
|
||||||
raise(TypeError, "unknown type: #{orig_ty}.")
|
|
||||||
end
|
|
||||||
return [ty1,enc,dec,ty2,senc,sdec]
|
return [ty1,enc,dec,ty2,senc,sdec]
|
||||||
end
|
end
|
||||||
end # end of Types
|
end # end of Types
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue