Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

  • dl/lib/dl/struct.rb

Included Modules

DL::CUnionEntity

Public Class Methods

malloc(types, func=nil) click to toggle source
 
               # File dl/lib/dl/struct.rb, line 175
def CUnionEntity.malloc(types, func=nil)
  addr = DL.malloc(CUnionEntity.size(types))
  CUnionEntity.new(addr, types, func)
end
            
size(types) click to toggle source
 
               # File dl/lib/dl/struct.rb, line 180
def CUnionEntity.size(types)
  size   = 0
  types.each_with_index{|t,i|
    if( t.is_a?(Array) )
      tsize = PackInfo::SIZE_MAP[t[0]] * t[1]
    else
      tsize = PackInfo::SIZE_MAP[t]
    end
    if( tsize > size )
      size = tsize
    end
  }
end
            

Public Instance Methods

set_ctypes(types) click to toggle source
 
               # File dl/lib/dl/struct.rb, line 194
def set_ctypes(types)
  @ctypes = types
  @offset = []
  @size   = 0
  types.each_with_index{|t,i|
    @offset[i] = 0
    if( t.is_a?(Array) )
      size = SIZE_MAP[t[0]] * t[1]
    else
      size = SIZE_MAP[t]
    end
    if( size > @size )
      @size = size
    end
  }
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.