/usr/lib/ruby/vendor_ruby/gir_ffi/builder.rb is in ruby-gir-ffi 0.9.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | require 'gir_ffi/builders/type_builder'
require 'gir_ffi/builders/module_builder'
require 'gir_ffi/builder_helper'
require 'gir_ffi/unintrospectable_type_info'
require 'gir_ffi/unintrospectable_boxed_info'
module GirFFI
# Builds modules and classes based on information found in the
# introspection repository. Call its build_module and build_class methods
# to create the modules and classes used in your program.
module Builder
extend BuilderHelper
def self.build_class(info)
Builders::TypeBuilder.build(info)
end
def self.build_by_gtype(gtype)
info = GObjectIntrospection::IRepository.default.find_by_gtype gtype
info ||= case GObject.type_fundamental gtype
when GObject::TYPE_BOXED
UnintrospectableBoxedInfo.new gtype
when GObject::TYPE_OBJECT
UnintrospectableTypeInfo.new gtype
end
build_class info
end
def self.build_module(namespace, version = nil)
Builders::ModuleBuilder.new(namespace, version).generate
end
# TODO: Move elsewhere, perhaps to FunctionBuilder.
def self.attach_ffi_function(lib, info)
sym = info.symbol
return if lib.method_defined? sym
lib.attach_function sym, info.argument_ffi_types, info.return_ffi_type
end
end
end
|