Class: RLTK::CG::IntPtr

Inherits:
SimpleIntType show all
Defined in:
lib/rltk/cg/type.rb

Overview

Integer the same size as a native pointer.

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Instance Method Summary collapse

Methods inherited from BasicIntType

#width

Methods inherited from NumberType

value_class, #value_class

Methods inherited from Type

#allignment, #context, #dump, from_ptr, #hash, #kind, #size, #to_s

Methods included from BindingClass

#==

Constructor Details

#initialize(target_data, addr_space = nil, context = nil) ⇒ IntPtr

Create an integer that is the same size as a pointer on the target machine. Additionally, an address space and a context may be provided.

Parameters:

  • target_data (TargetData)

    Data on compilation target

  • addr_space (Integer) (defaults to: nil)

    Target address space

  • context (Context) (defaults to: nil)

    Context in which to get the type



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/rltk/cg/type.rb', line 223

def initialize(target_data, addr_space = nil, context = nil)
	call = 'int_type'
	args = [target_data]

	if addr_space
		call += '_for_as'
		args << addr_space
	end

	if context
		call += '_in_context'
		args << context
	end

	Bindings.send(call.to_s, *args)
end