Class: RLTK::CG::Triple

Inherits:
Object
  • Object
show all
Includes:
BindingClass
Defined in:
lib/rltk/cg/triple.rb

Overview

Class binding for the LLVM Triple class.

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BindingClass

#==

Constructor Details

#initialize(overloaded) ⇒ Triple

Create a new triple describing the host architecture, vendor, OS, and (optionally) environment.

Parameters:

  • overloaded (FFI::Pointer, String)


45
46
47
48
49
50
51
# File 'lib/rltk/cg/triple.rb', line 45

def initialize(overloaded)
	@ptr, @str = 
	case overloaded
	when FFI::Pointer then [overloaded, nil]
	when String       then [Bindings.triple_create(overloaded), overloaded]
	end
end

Class Method Details

.hostTriple

Returns Object representing the host architecture, vendor, OS, and environment.

Returns:

  • (Triple)

    Object representing the host architecture, vendor, OS, and environment.



28
29
30
# File 'lib/rltk/cg/triple.rb', line 28

def self.host
	@host ||= Triple.new(host_string)
end

.host_stringString

Returns String representation of the host architecture, vendor, OS, and environment.

Returns:

  • (String)

    String representation of the host architecture, vendor, OS, and environment.



33
34
35
# File 'lib/rltk/cg/triple.rb', line 33

def self.host_string
	@host_string ||= Bindings.get_default_target_triple
end

Instance Method Details

#to_sString

Returns String representation of this triple.

Returns:

  • (String)

    String representation of this triple.



54
55
56
# File 'lib/rltk/cg/triple.rb', line 54

def to_s
	@str ||= Bindings.get_triple_string(@ptr)
end