1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

define alias "struct" and "union" in the module Importable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ttate 2002-04-11 03:06:33 +00:00
parent bd074c1f03
commit 1ee89595bc

View file

@ -10,11 +10,13 @@ module DL
init_types()
Struct.new(@types, contents)
end
alias struct define_struct
def define_union(contents)
init_types()
Union.new(@types, contents)
end
alias union define_union
class Memory
def initialize(ptr, names, ty, len, enc, dec)
@ -56,8 +58,11 @@ module DL
parse(contents)
end
def new
ptr = DL::malloc(@size)
def new(size = nil)
if( !size )
size = @size
end
ptr = DL::malloc(size)
ptr.struct!(@tys, *@names)
mem = Memory.new(ptr, @names, @ty, @len, @enc, @dec)
return mem