Module: VinaryTree::Libdictenstein::Native

Extended by:
Fiddle::Importer
Defined in:
lib/vinary_tree/libdictenstein/native.rb

Constant Summary collapse

Resource =
struct ["void* context", "void* vtable"]
TextEntry =
struct [
  "void* data", "size_t len", "uint64_t value", "uint8_t has_value",
  "uint8_t reserved[7]"
]
DictionaryEntry =
struct [
  "size_t unit_offset", "size_t unit_len", "size_t value_offset",
  "size_t value_len", "uint64_t reserved"
]
EntryBatchLimits =
struct [
  "size_t max_entries", "size_t max_units", "size_t max_values",
  "uint64_t reserved"
]
EntryBatch =
struct [
  "void* entries", "size_t entry_count", "void* units",
  "size_t unit_count", "void* values", "size_t value_count",
  "uint64_t generation", "uint64_t reserved"
]
EntriesInfo =
struct [
  "uint32_t unit_domain", "uint32_t value_domain", "uint32_t order",
  "uint32_t reserved0", "uint64_t flags", "size_t exact_len",
  "uint64_t identity_producer", "uint64_t identity_revision",
  "uint64_t reserved[2]"
]

Class Method Summary collapse

Class Method Details

.byte_outputObject



99
# File 'lib/vinary_tree/libdictenstein/native.rb', line 99

def byte_output = Fiddle::Pointer.malloc(1, Fiddle::RUBY_FREE)

.candidatesObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vinary_tree/libdictenstein/native.rb', line 9

def self.candidates
  explicit = ENV["LIBDICTENSTEIN_LIBRARY"]
  os, filename = case RbConfig::CONFIG["host_os"]
                 when /darwin/ then ["darwin", "liblibdictenstein.dylib"]
                 when /mswin|mingw/ then ["windows", "libdictenstein.dll"]
                 else ["linux", "liblibdictenstein.so"]
                 end
  cpu = case RbConfig::CONFIG["host_cpu"]
        when /x86_64|amd64/ then "x64"
        when /aarch64|arm64/ then "arm64"
        else RbConfig::CONFIG["host_cpu"]
        end
  platform = "#{os}-#{cpu}"
  [explicit, File.expand_path("native/#{platform}/#{filename}", __dir__), filename].compact
end

.pointer_outputObject



93
# File 'lib/vinary_tree/libdictenstein/native.rb', line 93

def pointer_output = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP, Fiddle::RUBY_FREE)

.read_pointer(output) ⇒ Object



94
# File 'lib/vinary_tree/libdictenstein/native.rb', line 94

def read_pointer(output) = output[0, Fiddle::SIZEOF_VOIDP].unpack1("J")

.read_size(output) ⇒ Object



96
# File 'lib/vinary_tree/libdictenstein/native.rb', line 96

def read_size(output) = output[0, Fiddle::SIZEOF_SIZE_T].unpack1("J")

.read_u64(output) ⇒ Object



98
# File 'lib/vinary_tree/libdictenstein/native.rb', line 98

def read_u64(output) = output[0, 8].unpack1("Q")

.size_outputObject



95
# File 'lib/vinary_tree/libdictenstein/native.rb', line 95

def size_output = Fiddle::Pointer.malloc(Fiddle::SIZEOF_SIZE_T, Fiddle::RUBY_FREE)

.u64_outputObject



97
# File 'lib/vinary_tree/libdictenstein/native.rb', line 97

def u64_output = Fiddle::Pointer.malloc(8, Fiddle::RUBY_FREE)