Module: FFI
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/io.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/enum.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/errno.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/types.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/union.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/library.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/pointer.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/version.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/platform.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/variadic.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/autopointer.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/managedstruct.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/data_converter.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/abstract_memory.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/tools/generator.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_by_reference.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout_builder.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/tools/const_generator.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/tools/types_generator.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/tools/struct_generator.rb
Overview
Copyright © 2008-2010 Wayne Meissner
This file is part of ruby-ffi.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of the Ruby FFI project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Defined Under Namespace
Modules: DataConverter, IO, Library, Platform Classes: AbstractMemory, AutoPointer, Bitmask, ConstGenerator, Enum, Enums, Generator, ManagedStruct, NotFoundError, PlatformError, Pointer, StrPtrConverter, Struct, StructByReference, StructGenerator, StructLayout, StructLayoutBuilder, TypesGenerator, Union, VariadicInvoker
Constant Summary collapse
- CURRENT_PROCESS =
USE_THIS_PROCESS_AS_LIBRARY = Object.new
- VERSION =
'1.15.5'
Class Method Summary collapse
-
.add_typedef(old, add) ⇒ Type
Add a definition type to type definitions.
- .errno ⇒ Object
- .errno=(error) ⇒ Object
-
.find_type(name, type_map = nil) ⇒ Type
Find a type in
type_map
(TypeDefs, by default) from a type objet, a type name (symbol). -
.map_library_name(lib) ⇒ String
Transform a generic library name to a platform library name.
-
.type_size(type) ⇒ Numeric
Get
type
size, in bytes. -
.typedef(old, add) ⇒ Type
Add a definition type to type definitions.
Class Method Details
.add_typedef(old, add) ⇒ Type
Add a definition type to type definitions.
45 46 47 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/types.rb', line 45 def self.add_typedef(old, add) typedef old, add end |
.errno ⇒ Object
34 35 36 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/errno.rb', line 34 def self.errno FFI::LastError.error end |
.errno=(error) ⇒ Object
40 41 42 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/errno.rb', line 40 def self.errno=(error) FFI::LastError.error = error end |
.find_type(name, type_map = nil) ⇒ Type
Find a type in type_map
(TypeDefs, by default) from a type objet, a type name (symbol). If name
is a DataConverter, a new Type::Mapped is created.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/types.rb', line 56 def self.find_type(name, type_map = nil) if name.is_a?(Type) name elsif type_map && type_map.has_key?(name) type_map[name] elsif TypeDefs.has_key?(name) TypeDefs[name] elsif name.is_a?(DataConverter) (type_map || TypeDefs)[name] = Type::Mapped.new(name) else raise TypeError, "unable to resolve type '#{name}'" end end |
.map_library_name(lib) ⇒ String
Transform a generic library name to a platform library name
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/library.rb', line 44 def self.map_library_name(lib) # Mangle the library name to reflect the native library naming conventions lib = Library::LIBC if lib == 'c' if lib && File.basename(lib) == lib lib = Platform::LIBPREFIX + lib unless lib =~ /^#{Platform::LIBPREFIX}/ r = Platform::IS_WINDOWS || Platform::IS_MAC ? "\\.#{Platform::LIBSUFFIX}$" : "\\.so($|\\.[1234567890]+)" lib += ".#{Platform::LIBSUFFIX}" unless lib =~ /#{r}/ end lib end |
.type_size(type) ⇒ Numeric
Get type
size, in bytes.
176 177 178 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/types.rb', line 176 def self.type_size(type) find_type(type).size end |
.typedef(old, add) ⇒ Type
Add a definition type to type definitions.
40 41 42 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/types.rb', line 40 def self.typedef(old, add) TypeDefs[add] = self.find_type(old) end |