class RLTK::CG::GlobalValue
This class represents global constants, variables, and functions.
Public Class Methods
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
Get the byte alignment of this value.
@return [Integer]
# File lib/rltk/cg/value.rb, line 1083 def alignment Bindings.get_alignment(@ptr) end
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
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
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
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
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
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
Get this value’s initializer.
@return [Value]
# File lib/rltk/cg/value.rb, line 1138 def initializer Value.new(Bindings.get_initializer(@ptr)) end
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
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
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
Get this value’s section string.
@return [String]
# File lib/rltk/cg/value.rb, line 1174 def section Bindings.get_section(@ptr) end
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
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
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
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
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