-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgobject-sys.tmpl
84 lines (70 loc) · 2.14 KB
/
gobject-sys.tmpl
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<%!
from grust.namematch import MatchList
suppress_c_names = MatchList(
# Structures containing bit fields, custom-defined below
"GClosure",
"GParamSpecString",
# Unions or structures containing them, custom-defined below
"GTypeCValue",
"GWeakRef",
"GValue",
# Callbacks with va_list in the signature and nodes depending on them
"GVaClosureMarshal",
"GSignalCVaMarshaller",
"g_signal_set_va_marshaller",
)
ignore_names = ["_Value__data__union"]
%>
<%inherit file="/sys/crate.tmpl"/>
<%block name="custom_crate_attributes">\
#![allow(overflowing_literals)] // for GParamFlags::Deprecated
</%block>
<%block name="custom_types">
#[repr(C)]
pub struct GClosure {
// A group of bit fields in the original definition here
flags: u32,
marshal: Option<extern "C" fn (closure: *mut GClosure,
return_value: *mut GValue,
n_param_values: guint,
param_values: *const GValue,
invocation_hint: gpointer,
marshal_data: gpointer)>,
pub data: gpointer,
notifiers: *mut GClosureNotifyData
}
#[repr(C)]
pub struct GParamSpecString {
pub parent_instance: GParamSpec,
pub default_value: *mut gchar,
pub cset_first: *mut gchar,
pub cset_nth: *mut gchar,
pub substitutor: gchar,
// Two single-bit fields in the C definition here
flags: u8
}
#[repr(C)]
pub struct GTypeCValue(i64);
#[repr(C)]
pub struct GWeakRef(gpointer);
#[repr(C)]
pub struct GValue {
pub g_type: GType,
data: [u64; 2]
}
</%block>
<%block name="custom_extern">
<%
# libgobject provides GType functions for types defined in GLib.
# Piggyback on the extern crate list to get at the included
# GLib namespace.
glib_namespace = None
for crate in mapper.extern_crates():
if crate.namespace.name == 'GLib':
glib_namespace = crate.namespace
assert glib_namespace
%>\
// GType functions for GLib
${self.gtype_functions(glib_namespace.type_names.values(),
glib_namespace.symbols.values())}\
</%block>