Module: FFI::Generator
- Defined in:
- lib/ffi-generator.rb,
lib/ffi-swig-generator.rb,
lib/generator/generator.rb,
lib/generator/application.rb,
lib/generator/generatortask.rb
Defined Under Namespace
Classes: Application, Callback, Constant, Enum, Function, Node, Parser, Structure, Task, Type, Typedef, Union
Constant Summary collapse
- VERSION =
:stopdoc:
'0.2.0'- LIBPATH =
::File.(::File.dirname(__FILE__)) + ::File::SEPARATOR
- PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
- TYPES =
{ 'char' => ':char', 'double' => ':double', 'float' => ':float', 'unsigned long' => ':ulong', 'unsigned char' => ':uchar', 'signed char' => ':char', 'unsigned char' => ':uchar', 'short' => ':short', 'signed short' => ':short', 'signed short int' => ':short', 'unsigned short' => ':ushort', 'unsigned short int' => ':ushort', 'int' => ':int', 'signed int' => ':int', 'unsigned int' => ':uint', 'long' => ':long', 'long int' => ':long', 'signed long' => ':long', 'signed long int' => ':long', 'unsigned long' => ':ulong', 'unsigned long int' => ':ulong', 'long unsigned int' => ':ulong', 'long long' => ':long_long', 'long long int' => ':long_long', 'signed long long' => ':long_long', 'signed long long int' => ':long_long', 'unsigned long long' => ':ulong_long', 'unsigned long long int' => ':ulong_long', 'void' => ':void' }
Class Attribute Summary collapse
-
.typedefs ⇒ Object
readonly
Returns the value of attribute typedefs.
Class Method Summary collapse
- .add_type(ctype, rtype) ⇒ Object
-
.libpath(*args) ⇒ Object
Returns the library path for the module.
-
.path(*args) ⇒ Object
Returns the lpath for the module.
-
.require_all_libs_relative_to(fname, dir = nil) ⇒ Object
Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in.
-
.version ⇒ Object
Returns the version string for the library.
Class Attribute Details
.typedefs ⇒ Object (readonly)
Returns the value of attribute typedefs.
39 40 41 |
# File 'lib/generator/generator.rb', line 39 def typedefs @typedefs end |
Class Method Details
.add_type(ctype, rtype) ⇒ Object
40 41 42 |
# File 'lib/generator/generator.rb', line 40 def add_type(ctype, rtype) @typedefs[ctype] = rtype end |
.libpath(*args) ⇒ Object
Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.
19 20 21 |
# File 'lib/ffi-generator.rb', line 19 def self.libpath( *args ) args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten) end |
.path(*args) ⇒ Object
Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.
27 28 29 |
# File 'lib/ffi-generator.rb', line 27 def self.path( *args ) args.empty? ? PATH : ::File.join(PATH, args.flatten) end |
.require_all_libs_relative_to(fname, dir = nil) ⇒ Object
Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.
36 37 38 39 40 41 42 |
# File 'lib/ffi-generator.rb', line 36 def self.require_all_libs_relative_to( fname, dir = nil ) dir ||= ::File.basename(fname, '.*') search_me = ::File.( ::File.join(::File.dirname(fname), dir, '**', '*.rb')) Dir.glob(search_me).sort.each {|rb| require rb} end |
.version ⇒ Object
Returns the version string for the library.
11 12 13 |
# File 'lib/ffi-generator.rb', line 11 def self.version VERSION end |