gir_ffi 0.15.4 → 0.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog.md +4 -0
- data/lib/ffi-glib/container_class_methods.rb +1 -3
- data/lib/ffi-gobject.rb +1 -1
- data/lib/ffi-gobject/object.rb +19 -19
- data/lib/ffi-gobject_introspection/i_base_info.rb +4 -4
- data/lib/gir_ffi/builder.rb +2 -3
- data/lib/gir_ffi/builders/function_builder.rb +1 -1
- data/lib/gir_ffi/builders/interface_builder.rb +2 -2
- data/lib/gir_ffi/builders/module_builder.rb +1 -1
- data/lib/gir_ffi/builders/object_builder.rb +8 -6
- data/lib/gir_ffi/builders/struct_builder.rb +31 -6
- data/lib/gir_ffi/version.rb +1 -1
- metadata +4 -5
- data/lib/gir_ffi/builders/class_struct_builder.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1bab3fa290a2ef0cb49ee4bb2b24f29f6ef5ae0bf4bbdd83ed92bc28b9aa8e0
|
4
|
+
data.tar.gz: c87ddb7f7f41a033319dafd849db129a72afb2cd6fba5e2ffc64715e1cc1e446
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ff032878aa00fea1c6096f8b09509e6cbee0c492f864c1c258e4c1b1932f0052e2efda13517e2e381f367f91713ed0e56f42bcc302abe2de04103607beac8dd
|
7
|
+
data.tar.gz: 4f90c766aee3e8953a8f017e94284db5be4cc0cf93991795ee2e77aa66c700995ec9f3feeb336169f02b618468675a2744f5159a790819c5248422a85baa789f
|
data/Changelog.md
CHANGED
data/lib/ffi-gobject.rb
CHANGED
@@ -86,7 +86,7 @@ module GObject
|
|
86
86
|
load_class :ParamFlags
|
87
87
|
|
88
88
|
# NOTE: This Lib module is set up in `gir_ffi-base/gobject/lib.rb`.
|
89
|
-
|
89
|
+
Lib.class_eval do
|
90
90
|
attach_function :g_object_ref_sink, [:pointer], :pointer
|
91
91
|
attach_function :g_object_ref, [:pointer], :pointer
|
92
92
|
attach_function :g_object_unref, [:pointer], :pointer
|
data/lib/ffi-gobject/object.rb
CHANGED
@@ -7,7 +7,25 @@ GObject.load_class :Object
|
|
7
7
|
module GObject
|
8
8
|
# Overrides for GObject, GObject's generic base class.
|
9
9
|
class Object
|
10
|
-
if
|
10
|
+
if GLib.check_version(2, 54, 0)
|
11
|
+
setup_method! "new"
|
12
|
+
|
13
|
+
# Before GLib 2.54.0, use g_object_newv, which takes an array of GParameter.
|
14
|
+
def initialize_with_automatic_gtype(properties = {})
|
15
|
+
gparameters = properties.map do |name, value|
|
16
|
+
name = name.to_s
|
17
|
+
property_param_spec(name)
|
18
|
+
GObject::Parameter.new.tap do |gparam|
|
19
|
+
gparam.name = name
|
20
|
+
gparam.value = value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
initialize_without_automatic_gtype(self.class.gtype, gparameters)
|
24
|
+
end
|
25
|
+
|
26
|
+
alias initialize_without_automatic_gtype initialize
|
27
|
+
alias initialize initialize_with_automatic_gtype
|
28
|
+
else
|
11
29
|
GObject::Lib.attach_function(:g_object_new_with_properties,
|
12
30
|
[:size_t, :uint32, :pointer, :pointer],
|
13
31
|
:pointer)
|
@@ -43,24 +61,6 @@ module GObject
|
|
43
61
|
obj.__send__ :initialize, *args, &block
|
44
62
|
obj
|
45
63
|
end
|
46
|
-
else
|
47
|
-
setup_method! "new"
|
48
|
-
|
49
|
-
# Before GLib 2.54.0, use g_object_newv, which takes an array of GParameter.
|
50
|
-
def initialize_with_automatic_gtype(properties = {})
|
51
|
-
gparameters = properties.map do |name, value|
|
52
|
-
name = name.to_s
|
53
|
-
property_param_spec(name)
|
54
|
-
GObject::Parameter.new.tap do |gparam|
|
55
|
-
gparam.name = name
|
56
|
-
gparam.value = value
|
57
|
-
end
|
58
|
-
end
|
59
|
-
initialize_without_automatic_gtype(self.class.gtype, gparameters)
|
60
|
-
end
|
61
|
-
|
62
|
-
alias initialize_without_automatic_gtype initialize
|
63
|
-
alias initialize initialize_with_automatic_gtype
|
64
64
|
end
|
65
65
|
|
66
66
|
alias base_initialize initialize
|
@@ -110,10 +110,10 @@ module GObjectIntrospection
|
|
110
110
|
def container
|
111
111
|
@container ||= begin
|
112
112
|
ptr = Lib.g_base_info_get_container self
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
unless ptr.null?
|
114
|
+
Lib.g_base_info_ref ptr
|
115
|
+
IRepository.wrap_ibaseinfo_pointer ptr
|
116
|
+
end
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
data/lib/gir_ffi/builder.rb
CHANGED
@@ -23,9 +23,8 @@ module GirFFI
|
|
23
23
|
fund = GObject.type_fundamental gtype
|
24
24
|
if fund == GObject::TYPE_BOXED
|
25
25
|
UnintrospectableBoxedInfo.new gtype
|
26
|
-
elsif fund == GObject::TYPE_OBJECT
|
27
|
-
|
28
|
-
elsif fund >= GObject::TYPE_RESERVED_USER_FIRST
|
26
|
+
elsif fund == GObject::TYPE_OBJECT ||
|
27
|
+
fund >= GObject::TYPE_RESERVED_USER_FIRST
|
29
28
|
UnintrospectableTypeInfo.new gtype
|
30
29
|
else
|
31
30
|
raise "Unable to handle type #{GObject.type_name gtype}"
|
@@ -39,7 +39,7 @@ module GirFFI
|
|
39
39
|
def receiver_call_argument
|
40
40
|
container_type_info = ReceiverTypeInfo.new(container_info)
|
41
41
|
if @info.instance_ownership_transfer == :everything &&
|
42
|
-
|
42
|
+
container_type_info.flattened_tag == :object
|
43
43
|
"self.ref"
|
44
44
|
else
|
45
45
|
"self"
|
@@ -9,8 +9,8 @@ module GirFFI
|
|
9
9
|
class InterfaceBuilder < RegisteredTypeBuilder
|
10
10
|
def interface_struct
|
11
11
|
@interface_struct ||=
|
12
|
-
|
13
|
-
|
12
|
+
StructBuilder.new(iface_struct_info,
|
13
|
+
superclass: GObject::TypeInterface).build_class
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
@@ -43,7 +43,7 @@ module GirFFI
|
|
43
43
|
def find_namespaced_class_info(classname)
|
44
44
|
name = classname.to_s
|
45
45
|
info = gir.find_by_name(@namespace, name) ||
|
46
|
-
|
46
|
+
gir.find_by_name(@namespace, name.sub(/^./, &:downcase))
|
47
47
|
unless info
|
48
48
|
raise NameError,
|
49
49
|
"Class #{classname} not found in namespace #{@namespace}"
|
@@ -3,7 +3,6 @@
|
|
3
3
|
require "gir_ffi/builders/registered_type_builder"
|
4
4
|
require "gir_ffi/builders/with_layout"
|
5
5
|
require "gir_ffi/builders/property_builder"
|
6
|
-
require "gir_ffi/builders/class_struct_builder"
|
7
6
|
require "gir_ffi/object_base"
|
8
7
|
require "gir_ffi/struct"
|
9
8
|
|
@@ -38,11 +37,14 @@ module GirFFI
|
|
38
37
|
|
39
38
|
def object_class_struct
|
40
39
|
@object_class_struct ||=
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
begin
|
41
|
+
parent_struct = parent_builder.object_class_struct
|
42
|
+
if object_class_struct_info
|
43
|
+
StructBuilder.new(object_class_struct_info,
|
44
|
+
superclass: parent_struct).build_class
|
45
|
+
else
|
46
|
+
parent_struct
|
47
|
+
end
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
@@ -10,23 +10,48 @@ module GirFFI
|
|
10
10
|
class StructBuilder < RegisteredTypeBuilder
|
11
11
|
include StructLike
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def initialize(info, superclass: nil)
|
14
|
+
@superclass = superclass
|
15
|
+
super info
|
15
16
|
end
|
16
17
|
|
17
18
|
def superclass
|
18
|
-
|
19
|
-
|
19
|
+
@superclass ||= if info.gtype_struct?
|
20
|
+
gtype_struct_parent
|
21
|
+
elsif GObject.type_fundamental(info.gtype) == GObject::TYPE_BOXED
|
22
|
+
BoxedBase
|
23
|
+
else
|
24
|
+
StructBase
|
25
|
+
end
|
26
|
+
end
|
20
27
|
|
21
|
-
|
28
|
+
private
|
29
|
+
|
30
|
+
def layout_superclass
|
31
|
+
GirFFI::Struct
|
22
32
|
end
|
23
33
|
|
24
34
|
def klass
|
25
35
|
@klass ||= get_or_define_class(namespace_module, @classname) { superclass }
|
26
36
|
end
|
27
37
|
|
38
|
+
def parent_info
|
39
|
+
@parent_info ||= parent_field_type&.interface
|
40
|
+
end
|
41
|
+
|
28
42
|
def parent_field_type
|
29
|
-
fields.first
|
43
|
+
fields.first&.field_type
|
44
|
+
end
|
45
|
+
|
46
|
+
def gtype_struct_parent
|
47
|
+
full_name = info.full_type_name
|
48
|
+
if full_name == "GObject::InitiallyUnownedClass"
|
49
|
+
GObject::ObjectClass
|
50
|
+
else
|
51
|
+
raise "Unable to calculate parent class for #{full_name}" unless parent_info
|
52
|
+
|
53
|
+
Builder.build_class parent_info
|
54
|
+
end
|
30
55
|
end
|
31
56
|
end
|
32
57
|
end
|
data/lib/gir_ffi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gir_ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matijs van Zuijlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: 1.3.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: 1.3.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rubocop-minitest
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -286,7 +286,6 @@ files:
|
|
286
286
|
- lib/gir_ffi/builders/callback_argument_builder.rb
|
287
287
|
- lib/gir_ffi/builders/callback_builder.rb
|
288
288
|
- lib/gir_ffi/builders/callback_return_value_builder.rb
|
289
|
-
- lib/gir_ffi/builders/class_struct_builder.rb
|
290
289
|
- lib/gir_ffi/builders/closure_argument_builder.rb
|
291
290
|
- lib/gir_ffi/builders/closure_convertor.rb
|
292
291
|
- lib/gir_ffi/builders/closure_return_value_builder.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "gir_ffi/builders/struct_builder"
|
4
|
-
|
5
|
-
module GirFFI
|
6
|
-
module Builders
|
7
|
-
# Implements the creation of a class representing a Struct.
|
8
|
-
class ClassStructBuilder < RegisteredTypeBuilder
|
9
|
-
include StructLike
|
10
|
-
|
11
|
-
attr_reader :superclass
|
12
|
-
|
13
|
-
def initialize(info, super_class_struct)
|
14
|
-
@superclass = super_class_struct
|
15
|
-
super info
|
16
|
-
raise "Info does not represent gtype_struct" unless info.gtype_struct?
|
17
|
-
end
|
18
|
-
|
19
|
-
def layout_superclass
|
20
|
-
GirFFI::Struct
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|