class FFI::Struct

def array_layout(builder, spec)

def array_layout(builder, spec)
  mod = enclosing_module
  i = 0
  while i < spec.size
    name, type = spec[i, 2]
    i += 2
    # If the next param is a Integer, it specifies the offset
    if spec[i].kind_of?(Integer)
      offset = spec[i]
      i += 1
    else
      offset = nil
    end
    if type.kind_of?(Class) && type < Struct
      builder.add_struct(name, type, offset)
    elsif type.kind_of?(::Array)
      builder.add_array(name, find_type(type[0], mod), type[1], offset)
    else
      builder.add_field(name, find_type(type, mod), offset)
    end
  end
end