class RLTK::CG::GlobalValue

This class represents global constants, variables, and functions.

Public Class Methods

new(ptr) click to toggle source

Global values can only be instantiated using a pointer, and as such should not be created directly by library users.

@param [FFI::Pointer] ptr

# File lib/rltk/cg/value.rb, line 1076
def initialize(ptr)
        @ptr = check_type(ptr, FFI::Pointer, 'ptr')
end

Public Instance Methods

alignment() click to toggle source

Get the byte alignment of this value.

@return [Integer]

# File lib/rltk/cg/value.rb, line 1083
def alignment
        Bindings.get_alignment(@ptr)
end
alignment=(bytes) click to toggle source

Set the byte alignment of this value.

@param [Integer] bytes

@return [void]

# File lib/rltk/cg/value.rb, line 1092
def alignment=(bytes)
        Bindings.set_alignment(@ptr, bytes)
end
declaration?() click to toggle source

Check if this value is a declaration.

@return [Boolean]

# File lib/rltk/cg/value.rb, line 1099
def declaration?
        Bindings.is_declaration(@ptr).to_bool
end
externally_initialized=(bool) click to toggle source

Sets the externally initialized property of a global value.

@param [Boolean] bool If the value is externally initialized

@return [void]

# File lib/rltk/cg/value.rb, line 1108
def externally_initialized=(bool)
        Bindings.set_externally_initialized(@ptr, bool.to_i)
end
externally_initialized?() click to toggle source

Check if this global is initialized externally.

@return [Boolean]

# File lib/rltk/cg/value.rb, line 1115
def externally_initialized?
        Bindings.externally_initialized(@ptr).to_bool
end
global_constant=(flag) click to toggle source

Set this value as a global constant or not.

@param [Boolean] flag

@return [void]

# File lib/rltk/cg/value.rb, line 1131
def global_constant=(flag)
        Bindings.set_global_constant(@ptr, flag.to_i)
end
global_constant?() click to toggle source

Check if this value is a global constant.

@return [Boolean]

# File lib/rltk/cg/value.rb, line 1122
def global_constant?
        Bindings.is_global_constant(@ptr).to_bool
end
initializer() click to toggle source

Get this value’s initializer.

@return [Value]

# File lib/rltk/cg/value.rb, line 1138
def initializer
        Value.new(Bindings.get_initializer(@ptr))
end
initializer=(val) click to toggle source

Set this value’s initializer.

@param [Value] val

@return [void]

# File lib/rltk/cg/value.rb, line 1147
def initializer=(val)
        Bindings.set_initializer(@ptr, check_type(val, Value, 'val'))
end
linkage() click to toggle source

Get this value’s linkage type.

@see Bindings.enum_linkage

@return [Symbol]

# File lib/rltk/cg/value.rb, line 1156
def linkage
        Bindings.get_linkage(@ptr)
end
linkage=(linkage) click to toggle source

Set this value’s linkage type.

@see Bindings.enum_linkage

@param [Symbol] linkage

@return [void]

# File lib/rltk/cg/value.rb, line 1167
def linkage=(linkage)
        Bindings.set_linkage(@ptr, linkage)
end
section() click to toggle source

Get this value’s section string.

@return [String]

# File lib/rltk/cg/value.rb, line 1174
def section
        Bindings.get_section(@ptr)
end
section=(section) click to toggle source

Set this value’s section string.

@param [String] section

@return [void]

# File lib/rltk/cg/value.rb, line 1183
def section=(section)
        Bindings.set_section(@ptr, section)
end
thread_local_mode() click to toggle source

Returns the thread local model used by a global value.

@return [Symbol from enum_thread_local_mode]

# File lib/rltk/cg/value.rb, line 1190
def thread_local_mode
        Bindings.get_thread_local_mode(@ptr)
end
thread_local_mode=(mode) click to toggle source

Set the global value’s thread local mode.

@param [Symbol from enum_thread_local_mode] mode

@return [void]

# File lib/rltk/cg/value.rb, line 1200
def thread_local_mode=(mode)
        Bindings.set_thread_local_mode(@ptr, mode)
end
visibility() click to toggle source

Get this value’s visibility.

@see Bindings.enum_visibility

@return [String]

# File lib/rltk/cg/value.rb, line 1209
def visibility
        Bindings.get_visibility(@ptr)
end
visibility=(vis) click to toggle source

Set this value’s visibility.

@see Bindings.enum_visibility

@param [Symbol] vis

@return [void]

# File lib/rltk/cg/value.rb, line 1220
def visibility=(vis)
        Bindings.set_visibility(@ptr, vis)
end