Module: FFI
- Defined in:
- lib/ffi-compiler/task.rb,
lib/ffi-compiler/loader.rb,
lib/ffi-compiler/export_task.rb,
lib/ffi-compiler/compile_task.rb,
lib/ffi-compiler/fake_ffi/ffi.rb,
lib/ffi-compiler/fake_ffi/ffi-compiler/loader.rb
Defined Under Namespace
Modules: Compiler, Library
Classes: Exporter, Struct, StructByReference, StructByValue, Type
Constant Summary
collapse
- PrimitiveTypes =
{
:char => 'char',
:uchar => 'unsigned char',
:short => 'short',
:ushort => 'unsigned short',
:int => 'int',
:uint => 'unsigned int',
:long => 'long',
:ulong => 'unsigned long',
:float => 'float',
:double => 'double',
:pointer => 'void *',
:string => 'const char *',
}
- TypeMap =
{}
Class Method Summary
collapse
Class Method Details
.exporter ⇒ Object
7
8
9
|
# File 'lib/ffi-compiler/fake_ffi/ffi.rb', line 7
def self.exporter
@@exporter
end
|
.exporter=(exporter) ⇒ Object
3
4
5
|
# File 'lib/ffi-compiler/fake_ffi/ffi.rb', line 3
def self.exporter=(exporter)
@@exporter = exporter
end
|
.find_type(type) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/ffi-compiler/fake_ffi/ffi.rb', line 46
def self.find_type(type)
return type if type.is_a?(Type)
t = TypeMap[type]
return t unless t.nil?
if PrimitiveTypes.has_key?(type)
return TypeMap[type] = Type.new(PrimitiveTypes[type])
end
raise TypeError.new("cannot resolve type #{type}")
end
|