gir_ffi 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/History.txt +14 -0
  2. data/TODO.rdoc +10 -5
  3. data/lib/ffi-glib.rb +7 -73
  4. data/lib/ffi-glib/array.rb +29 -4
  5. data/lib/ffi-glib/byte_array.rb +15 -1
  6. data/lib/ffi-glib/hash_table.rb +31 -24
  7. data/lib/ffi-glib/list.rb +28 -0
  8. data/lib/ffi-glib/list_methods.rb +10 -2
  9. data/lib/ffi-glib/ptr_array.rb +39 -0
  10. data/lib/ffi-glib/s_list.rb +29 -0
  11. data/lib/ffi-gobject.rb +49 -22
  12. data/lib/ffi-gobject/closure.rb +4 -3
  13. data/lib/ffi-gobject/helper.rb +20 -43
  14. data/lib/ffi-gobject/initially_unowned.rb +2 -0
  15. data/lib/ffi-gobject/object.rb +54 -0
  16. data/lib/ffi-gobject/ruby_closure.rb +22 -16
  17. data/lib/ffi-gobject/value.rb +54 -19
  18. data/lib/ffi-gobject_introspection/i_constant_info.rb +17 -1
  19. data/lib/ffi-gobject_introspection/i_field_info.rb +8 -0
  20. data/lib/ffi-gobject_introspection/i_property_info.rb +3 -1
  21. data/lib/ffi-gobject_introspection/lib.rb +19 -2
  22. data/lib/gir_ffi/arg_helper.rb +7 -45
  23. data/lib/gir_ffi/builder.rb +1 -1
  24. data/lib/gir_ffi/builder/argument.rb +148 -107
  25. data/lib/gir_ffi/builder/argument/base.rb +5 -5
  26. data/lib/gir_ffi/builder/argument/in_base.rb +2 -2
  27. data/lib/gir_ffi/builder/argument/in_out_base.rb +2 -3
  28. data/lib/gir_ffi/builder/argument/out_base.rb +2 -3
  29. data/lib/gir_ffi/builder/function.rb +11 -17
  30. data/lib/gir_ffi/builder/module.rb +26 -0
  31. data/lib/gir_ffi/builder/type.rb +5 -0
  32. data/lib/gir_ffi/builder/type/base.rb +2 -0
  33. data/lib/gir_ffi/builder/type/callback.rb +18 -3
  34. data/lib/gir_ffi/builder/type/constant.rb +4 -12
  35. data/lib/gir_ffi/builder/type/enum.rb +15 -6
  36. data/lib/gir_ffi/builder/type/interface.rb +4 -0
  37. data/lib/gir_ffi/builder/type/object.rb +11 -0
  38. data/lib/gir_ffi/builder/type/struct_based.rb +14 -4
  39. data/lib/gir_ffi/builder/type/union.rb +13 -7
  40. data/lib/gir_ffi/builder/type/with_layout.rb +59 -8
  41. data/lib/gir_ffi/class_base.rb +8 -1
  42. data/lib/gir_ffi/in_out_pointer.rb +17 -18
  43. data/lib/gir_ffi/in_pointer.rb +8 -1
  44. data/lib/gir_ffi/type_map.rb +12 -0
  45. data/lib/gir_ffi/variable_name_generator.rb +12 -0
  46. data/lib/gir_ffi/version.rb +1 -1
  47. data/test/ffi-glib/array_test.rb +54 -0
  48. data/test/ffi-glib/byte_array_test.rb +21 -0
  49. data/test/ffi-glib/glib_overrides_test.rb +1 -46
  50. data/test/ffi-glib/hash_table_test.rb +24 -0
  51. data/test/ffi-glib/list_test.rb +46 -0
  52. data/test/ffi-glib/ptr_array_test.rb +51 -0
  53. data/test/ffi-glib/s_list_test.rb +46 -0
  54. data/test/ffi-gobject/g_object_overrides_test.rb +8 -8
  55. data/test/ffi-gobject/gobject_test.rb +26 -0
  56. data/test/ffi-gobject/object_test.rb +12 -0
  57. data/test/ffi-gobject_introspection/i_constant_info_test.rb +5 -1
  58. data/test/ffi-gobject_introspection/lib_test.rb +56 -0
  59. data/test/integration/generated_gimarshallingtests_test.rb +118 -76
  60. data/test/integration/generated_regress_test.rb +220 -62
  61. data/test/integration/pretty_print_test.rb +11 -0
  62. data/test/type_builder_test.rb +0 -48
  63. data/test/unintrospectable_type_builder_test.rb +8 -2
  64. data/test/unit/builder_test.rb +1 -1
  65. data/test/unit/callback_builder_test.rb +19 -0
  66. data/test/unit/constant_builder_test.rb +11 -0
  67. data/test/unit/enum_builder_test.rb +25 -0
  68. data/test/unit/function_builder_test.rb +17 -0
  69. data/test/unit/in_out_pointer_test.rb +11 -0
  70. data/test/unit/in_pointer_test.rb +6 -2
  71. data/test/unit/interface_builder_test.rb +17 -0
  72. data/test/unit/module_builder_test.rb +95 -0
  73. data/test/unit/object_type_builder_test.rb +24 -0
  74. data/test/unit/struct_builder_test.rb +106 -0
  75. data/test/unit/union_builder_test.rb +17 -0
  76. data/test/unit/variable_name_generator_test.rb +16 -0
  77. metadata +102 -75
  78. data/test/module_builder_test.rb +0 -53
@@ -1,3 +1,17 @@
1
+ == 0.2.0 / 2011-11-19
2
+
3
+ * Add support for properties, with #get_property and #set_property.
4
+ * Add support for fields.
5
+ - Create field accessor methods.
6
+ - Get rid of #[] and #[]=.
7
+ * Explicitely load libgirepository with ABI version 1.
8
+ * Improve implementation of GLib container classes (GList etc.):
9
+ - Real constructors.
10
+ - #append and friends are instance methods now.
11
+ - Conversion methods to cast Ruby containers to GLib containers.
12
+ * Start implementing pretty printing.
13
+ * Various refactorings.
14
+
1
15
  == 0.1.0 / 2011-10-28
2
16
 
3
17
  * Put bindings for GObjectIntrospection in their own namespace.
data/TODO.rdoc CHANGED
@@ -1,6 +1,10 @@
1
1
  = TODO
2
2
 
3
- == Separate bindings to GIRepository from dynamic binding generation.
3
+ == Fix helper method names
4
+
5
+ GirFFI adds some methods to all generated modules. For some of these, it
6
+ avoids name clashes by prefixing an underscore. This is ugly and must be
7
+ changed.
4
8
 
5
9
  == Remove code for passing generic pointers
6
10
 
@@ -12,6 +16,9 @@ handling them can be removed.
12
16
  This is a big one. See commit 1e9822c7817062a9b853269b9418fd78782090b5 in
13
17
  gobject-introspection, and TestFundamentalObject in Regress.
14
18
 
19
+ The tests for TestFundamentalObject accidentally pass, but there may be
20
+ hidden issues.
21
+
15
22
  == Check binding of GObject:
16
23
 
17
24
  (11:37:03 PM) walters: the basic story is that GObject should be manually bound
@@ -21,10 +28,8 @@ gobject-introspection, and TestFundamentalObject in Regress.
21
28
 
22
29
  == Compatibility with all implementations.
23
30
 
24
- Currently, there are the following incompatibilities:
25
-
26
- * JRuby disables ObjectSpace by default, so using _id2ref for handling the
27
- passing of generic pointers is not ideal.
31
+ GirFFI is incompatible with Rubinius, but this is due to Rubinius' FFI
32
+ implementation lagging behind the others.
28
33
 
29
34
  == See Also
30
35
 
@@ -5,83 +5,14 @@ require 'ffi-glib/list'
5
5
  require 'ffi-glib/hash_table'
6
6
  require 'ffi-glib/byte_array'
7
7
  require 'ffi-glib/array'
8
+ require 'ffi-glib/ptr_array'
8
9
 
9
10
  module GLib
10
- # FIXME: Turn into real constructor
11
- def self.slist_new elmttype
12
- ::GLib::List._real_new(FFI::Pointer.new(0)).tap {|it|
13
- it.element_type = elmttype}
14
- end
15
-
16
- # FIXME: Turn into instance method; Use element type.
17
- def self.slist_prepend slist, data
18
- ::GLib::SList.wrap(slist.element_type, ::GLib::Lib.g_slist_prepend(slist, data))
19
- end
20
-
21
- # FIXME: Turn into real constructor
22
- def self.list_new elmttype
23
- ::GLib::List._real_new(FFI::Pointer.new(0)).tap {|it|
24
- it.element_type = elmttype}
25
- end
26
-
27
- # FIXME: Turn into instance method; Use element type.
28
- def self.list_append list, data
29
- ::GLib::List.wrap(list.element_type, ::GLib::Lib.g_list_append(list, data))
30
- end
31
-
32
- # FIXME: Turn into real constructor
33
- def self.hash_table_new keytype, valtype
34
- hash_fn, eq_fn = case keytype
35
- when :utf8
36
- lib = ::GLib::Lib.ffi_libraries.first
37
- [ FFI::Function.new(:uint, [:pointer], lib.find_function("g_str_hash")),
38
- FFI::Function.new(:int, [:pointer, :pointer], lib.find_function("g_str_equal"))]
39
- else
40
- [nil, nil]
41
- end
42
-
43
- ::GLib::HashTable.wrap(keytype, valtype, ::GLib::Lib.g_hash_table_new(hash_fn, eq_fn))
44
- end
45
-
46
- # FIXME: Turn into real constructor
47
- def self.byte_array_new
48
- ::GLib::ByteArray.wrap(::GLib::Lib.g_byte_array_new)
49
- end
50
-
51
- # FIXME: Turn into instance method
52
- def self.byte_array_append arr, data
53
- bytes = GirFFI::InPointer.from :utf8, data
54
- len = data.bytesize
55
- ::GLib::ByteArray.wrap(::GLib::Lib.g_byte_array_append arr.to_ptr, bytes, len)
56
- end
57
-
58
- # FIXME: Turn into real constructor
59
- def self.array_new type
60
- ffi_type = type == :utf8 ? :pointer : type
61
- arr = ::GLib::Array.wrap(
62
- ::GLib::Lib.g_array_new(0, 0, FFI.type_size(ffi_type)))
63
- arr.element_type = type
64
- arr
65
- end
66
-
67
- # FIXME: Turn into instance method
68
- def self.array_append_vals arr, data
69
- bytes = GirFFI::InPointer.from_array arr.element_type, data
70
- len = data.length
71
- res = ::GLib::Array.wrap(
72
- ::GLib::Lib.g_array_append_vals(arr.to_ptr, bytes, len))
73
- res.element_type = arr.element_type
74
- res
75
- end
76
-
77
- # FIXME: Turn into real constructor?
78
- def self.main_loop_new context, is_running
79
- ::GLib::MainLoop.wrap(::GLib::Lib.g_main_loop_new context, is_running)
80
- end
81
-
82
11
  load_class :HFunc
83
12
  load_class :HashFunc
84
13
  load_class :EqualFunc
14
+ load_class :Func
15
+
85
16
  module Lib
86
17
  attach_function :g_slist_prepend, [:pointer, :pointer], :pointer
87
18
 
@@ -102,6 +33,9 @@ module GLib
102
33
  attach_function :g_array_append_vals,
103
34
  [:pointer, :pointer, :uint], :pointer
104
35
 
105
- attach_function :g_main_loop_new, [:pointer, :bool], :pointer
36
+ attach_function :g_ptr_array_new, [], :pointer
37
+ attach_function :g_ptr_array_add, [:pointer, :pointer], :void
38
+ attach_function :g_ptr_array_foreach, [:pointer, Func, :pointer],
39
+ :pointer
106
40
  end
107
41
  end
@@ -1,14 +1,39 @@
1
1
  module GLib
2
2
  load_class :Array
3
3
 
4
+ # Overrides for GArray, GLib's automatically growing array. It should not
5
+ # be necessary to create objects of this class from Ruby directly.
4
6
  class Array
7
+ include Enumerable
8
+
5
9
  attr_accessor :element_type
6
10
 
7
- def to_a
11
+ class << self
12
+ undef :new
13
+ def new type
14
+ ffi_type = GirFFI::TypeMap.map_basic_type_or_string(type)
15
+ wrap(Lib.g_array_new(0, 0, FFI.type_size(ffi_type))).tap {|it|
16
+ it.element_type = type}
17
+ end
18
+ end
19
+
20
+ def append_vals data
21
+ bytes = GirFFI::InPointer.from_array element_type, data
22
+ len = data.length
23
+ Lib.g_array_append_vals(self, bytes, len)
24
+ self
25
+ end
26
+
27
+ # FIXME: Make GirFII::InPointer support #each and use that.
28
+ def each &block
29
+ to_typed_array.each(&block)
30
+ end
31
+
32
+ private
33
+
34
+ def to_typed_array
8
35
  GirFFI::ArgHelper.ptr_to_typed_array(self.element_type,
9
- self[:data], self[:len])
36
+ @struct[:data], @struct[:len])
10
37
  end
11
38
  end
12
39
  end
13
-
14
-
@@ -1,9 +1,23 @@
1
1
  module GLib
2
2
  load_class :ByteArray
3
3
 
4
+ # Overrides for GByteArray, GLib's automatically growing array of bytes.
4
5
  class ByteArray
5
6
  def to_string
6
- GirFFI::ArgHelper.ptr_to_utf8_length self[:data], self[:len]
7
+ GirFFI::ArgHelper.ptr_to_utf8_length @struct[:data], @struct[:len]
8
+ end
9
+
10
+ def append data
11
+ bytes = GirFFI::InPointer.from :utf8, data
12
+ len = data.bytesize
13
+ self.class.wrap(Lib.g_byte_array_append self.to_ptr, bytes, len)
14
+ end
15
+
16
+ class << self
17
+ undef :new
18
+ def new
19
+ wrap(Lib.g_byte_array_new)
20
+ end
7
21
  end
8
22
  end
9
23
  end
@@ -1,6 +1,7 @@
1
1
  module GLib
2
2
  load_class :HashTable
3
3
 
4
+ # Overrides for GHashTable, GLib's hash table implementation.
4
5
  class HashTable
5
6
  include Enumerable
6
7
  attr_accessor :key_type
@@ -8,8 +9,8 @@ module GLib
8
9
 
9
10
  def each
10
11
  prc = Proc.new {|keyptr, valptr, userdata|
11
- key = cast_from_pointer key_type, keyptr
12
- val = cast_from_pointer value_type, valptr
12
+ key = GirFFI::ArgHelper.cast_from_pointer key_type, keyptr
13
+ val = GirFFI::ArgHelper.cast_from_pointer value_type, valptr
13
14
  yield key, val
14
15
  }
15
16
  ::GLib::Lib.g_hash_table_foreach self.to_ptr, prc, nil
@@ -20,35 +21,41 @@ module GLib
20
21
  end
21
22
 
22
23
  def insert key, value
23
- keyptr = cast_to_pointer key_type, key
24
- valptr = cast_to_pointer value_type, value
24
+ keyptr = GirFFI::InPointer.from key_type, key
25
+ valptr = GirFFI::InPointer.from value_type, value
25
26
  ::GLib::Lib.g_hash_table_insert self.to_ptr, keyptr, valptr
26
27
  end
27
28
 
28
- def cast_to_pointer type, it
29
- if type == :utf8
30
- GirFFI::InPointer.from :utf8, it
31
- else
32
- FFI::Pointer.new(it)
29
+ class << self
30
+ undef :new
31
+ def new keytype, valtype
32
+ hash_fn, eq_fn = case keytype
33
+ when :utf8
34
+ lib = ::GLib::Lib.ffi_libraries.first
35
+ [ FFI::Function.new(:uint, [:pointer], lib.find_function("g_str_hash")),
36
+ FFI::Function.new(:int, [:pointer, :pointer], lib.find_function("g_str_equal"))]
37
+ else
38
+ [nil, nil]
39
+ end
40
+ wrap(keytype, valtype, Lib.g_hash_table_new(hash_fn, eq_fn))
33
41
  end
34
- end
35
42
 
36
- def cast_from_pointer type, it
37
- case type
38
- when :utf8
39
- GirFFI::ArgHelper.ptr_to_utf8 it
40
- when :gint32
41
- GirFFI::ArgHelper.cast_pointer_to_int32 it
42
- else
43
- it.address
43
+ def wrap keytype, valtype, ptr
44
+ super(ptr).tap do |it|
45
+ break if it.nil?
46
+ it.key_type = keytype
47
+ it.value_type = valtype
48
+ end
44
49
  end
45
- end
46
50
 
47
- def self.wrap keytype, valtype, ptr
48
- super(ptr).tap do |it|
49
- break if it.nil?
50
- it.key_type = keytype
51
- it.value_type = valtype
51
+ def from_hash keytype, valtype, hash
52
+ return nil if hash.nil?
53
+ return hash if hash.is_a? self
54
+ ghash = self.new keytype, valtype
55
+ hash.each do |key, val|
56
+ ghash.insert key, val
57
+ end
58
+ ghash
52
59
  end
53
60
  end
54
61
  end
@@ -3,7 +3,35 @@ require 'ffi-glib/list_methods'
3
3
  module GLib
4
4
  load_class :List
5
5
 
6
+ # Overrides for GList, GLib's doubly linked list implementation.
6
7
  class List
7
8
  include ListMethods
9
+
10
+ # Override default field accessors.
11
+ undef :next
12
+ undef :data
13
+
14
+ alias :next :tail
15
+ alias :data :head
16
+
17
+ class << self
18
+ undef :new
19
+ def new type
20
+ _real_new(FFI::Pointer.new(0)).tap {|it|
21
+ it.element_type = type}
22
+ end
23
+
24
+ def from_array type, arr
25
+ return nil if arr.nil?
26
+ return arr if arr.is_a? self
27
+ arr.inject(self.new type) { |lst, val|
28
+ lst.append val }
29
+ end
30
+ end
31
+
32
+ def append data
33
+ data_ptr = GirFFI::InPointer.from(element_type, data)
34
+ self.class.wrap(element_type, Lib.g_list_append(self, data_ptr))
35
+ end
8
36
  end
9
37
  end
@@ -11,12 +11,20 @@ module GLib
11
11
  list = self
12
12
  rval = nil
13
13
  until list.nil?
14
- rval = yield GirFFI::ArgHelper.cast_from_pointer(element_type, list[:data])
15
- list = self.class.wrap(element_type, list[:next])
14
+ rval = yield list.head
15
+ list = list.tail
16
16
  end
17
17
  rval
18
18
  end
19
19
 
20
+ def tail
21
+ self.class.wrap(element_type, @struct[:next])
22
+ end
23
+
24
+ def head
25
+ GirFFI::ArgHelper.cast_from_pointer(element_type, @struct[:data])
26
+ end
27
+
20
28
  module ClassMethods
21
29
  def wrap elmttype, ptr
22
30
  super(ptr).tap do |it|
@@ -0,0 +1,39 @@
1
+ module GLib
2
+ load_class :PtrArray
3
+
4
+ # Overrides for GPtrArray, GLib's automatically growing array of
5
+ # pointers.
6
+ class PtrArray
7
+ include Enumerable
8
+
9
+ attr_accessor :element_type
10
+
11
+ class << self
12
+ undef :new
13
+ def new type
14
+ wrap(Lib.g_ptr_array_new).tap {|it|
15
+ it.element_type = type}
16
+ end
17
+
18
+ # Remove stub generated by builder.
19
+ undef :add
20
+
21
+ def add array, data
22
+ array.add data
23
+ end
24
+ end
25
+
26
+ def add data
27
+ ptr = GirFFI::InPointer.from element_type, data
28
+ Lib.g_ptr_array_add self, ptr
29
+ end
30
+
31
+ def each
32
+ prc = Proc.new {|valptr, userdata|
33
+ val = GirFFI::ArgHelper.cast_from_pointer element_type, valptr
34
+ yield val
35
+ }
36
+ Lib.g_ptr_array_foreach self.to_ptr, prc, nil
37
+ end
38
+ end
39
+ end
@@ -3,7 +3,36 @@ require 'ffi-glib/list_methods'
3
3
  module GLib
4
4
  load_class :SList
5
5
 
6
+ # Overrides for GSList, GLib's singly linked list implementation.
6
7
  class SList
7
8
  include ListMethods
9
+
10
+ # Override default field accessors.
11
+ undef :next
12
+ undef :data
13
+
14
+ alias :next :tail
15
+ alias :data :head
16
+
17
+ class << self
18
+ undef :new
19
+ def new type
20
+ _real_new(FFI::Pointer.new(0)).tap {|it|
21
+ it.element_type = type}
22
+ end
23
+
24
+ def from_array type, arr
25
+ return nil if arr.nil?
26
+ return arr if arr.is_a? self
27
+ arr.reverse.inject(self.new type) { |lst, val|
28
+ lst.prepend val }
29
+ end
30
+ end
31
+
32
+ def prepend data
33
+ data_ptr = GirFFI::InPointer.from(element_type, data)
34
+ self.class.wrap(element_type, Lib.g_slist_prepend(self, data_ptr))
35
+ end
36
+
8
37
  end
9
38
  end
@@ -3,6 +3,7 @@ GirFFI.setup :GObject
3
3
  require 'ffi-gobject/value'
4
4
  require 'ffi-gobject/initially_unowned'
5
5
  require 'ffi-gobject/closure'
6
+ require 'ffi-gobject/object'
6
7
  require 'ffi-gobject/ruby_closure'
7
8
  require 'ffi-gobject/helper'
8
9
 
@@ -28,6 +29,7 @@ module GObject
28
29
  end
29
30
 
30
31
  def self.type_from_instance_pointer inst_ptr
32
+ return nil if inst_ptr.null?
31
33
  klsptr = inst_ptr.get_pointer 0
32
34
  klsptr.send "get_#{GirFFI::TypeMap::TAG_TYPE_MAP[:gtype]}", 0
33
35
  end
@@ -38,38 +40,27 @@ module GObject
38
40
 
39
41
  _setup_method :signal_emitv
40
42
 
41
- def self.signal_emit object, signal, *args
42
- type = type_from_instance object
43
- id = signal_lookup signal, type
43
+ def self.signal_lookup_from_instance signal, object
44
+ signal_lookup signal, type_from_instance(object)
45
+ end
44
46
 
47
+ def self.signal_emit object, signal, *args
48
+ id = signal_lookup_from_instance signal, object
45
49
  arr = Helper.signal_arguments_to_gvalue_array signal, object, *args
46
50
  rval = Helper.gvalue_for_signal_return_value signal, object
47
51
 
48
- ::GObject::Lib.g_signal_emitv arr[:values], id, 0, rval
52
+ Lib.g_signal_emitv arr.values, id, 0, rval
49
53
 
50
- rval
54
+ return rval
51
55
  end
52
56
 
53
57
  def self.signal_connect object, signal, data=nil, &block
54
- sig = object.class._find_signal signal
55
- if sig.nil?
56
- raise "Signal #{signal} is invalid for #{object}"
57
- end
58
- if block.nil?
59
- raise ArgumentError, "Block needed"
60
- end
61
-
62
- rettype = GirFFI::Builder.itypeinfo_to_ffitype sig.return_type
63
-
64
- argtypes = GirFFI::Builder.ffi_argument_types_for_signal sig
65
-
66
- callback = FFI::Function.new rettype, argtypes,
67
- &(Helper.signal_callback_args(sig, object.class, &block))
68
- ::GObject::Lib::CALLBACKS << callback
69
-
58
+ callback = Helper.signal_callback object.class, signal, &block
70
59
  data_ptr = GirFFI::ArgHelper.object_to_inptr data
71
60
 
72
- ::GObject::Lib.g_signal_connect_data object, signal, callback, data_ptr, nil, 0
61
+ Lib::CALLBACKS << callback
62
+
63
+ Lib.g_signal_connect_data object, signal, callback, data_ptr, nil, 0
73
64
  end
74
65
 
75
66
  load_class :Callback
@@ -91,4 +82,40 @@ module GObject
91
82
  attach_function :g_closure_set_marshal,
92
83
  [:pointer, ClosureMarshal], :void
93
84
  end
85
+
86
+ TYPE_INVALID = type_from_name("invalid")
87
+ TYPE_NONE = type_from_name("void")
88
+ TYPE_INTERFACE = type_from_name("GInterface")
89
+ TYPE_CHAR = type_from_name("gchar")
90
+ TYPE_UCHAR = type_from_name("guchar")
91
+ TYPE_BOOLEAN = type_from_name("gboolean")
92
+ TYPE_INT = type_from_name("gint")
93
+ TYPE_UINT = type_from_name("guint")
94
+ TYPE_LONG = type_from_name("glong")
95
+ TYPE_ULONG = type_from_name("gulong")
96
+ TYPE_INT64 = type_from_name("gint64")
97
+ TYPE_UINT64 = type_from_name("guint64")
98
+ TYPE_ENUM = type_from_name("GEnum")
99
+ TYPE_FLAGS = type_from_name("GFlags")
100
+ TYPE_FLOAT = type_from_name("gfloat")
101
+ TYPE_DOUBLE = type_from_name("gdouble")
102
+ TYPE_STRING = type_from_name("gchararray")
103
+ TYPE_POINTER = type_from_name("gpointer")
104
+ TYPE_BOXED = type_from_name("GBoxed")
105
+ TYPE_PARAM = type_from_name("GParam")
106
+ TYPE_OBJECT = type_from_name("GObject")
107
+ TYPE_GTYPE = type_from_name("GType")
108
+ TYPE_VARIANT = type_from_name("GVariant")
109
+ TYPE_HASH_TABLE = type_from_name("GHashTable")
110
+
111
+ TYPE_TAG_TO_GTYPE = {
112
+ :void => TYPE_NONE,
113
+ :gboolean => TYPE_BOOLEAN,
114
+ :gint32 => TYPE_INT,
115
+ :gfloat => TYPE_FLOAT,
116
+ :gdouble => TYPE_DOUBLE,
117
+ :utf8 => TYPE_STRING,
118
+ :ghash => TYPE_HASH_TABLE,
119
+ :glist => TYPE_POINTER
120
+ }
94
121
  end