1GLIB-GENMARSHAL(1) GLIB-GENMARSHAL(1)
2
3
4
6 glib-genmarshal - C code marshaller generation utility for GLib
7 closures
8
10 glib-genmarshal [options...] [files...]
11
13 glib-genmarshal is a small utility that generates C code marshallers
14 for callback functions of the GClosure mechanism in the GObject
15 sublibrary of GLib. The marshaller functions have a standard signature,
16 they get passed in the invoking closure, an array of value structures
17 holding the callback function parameters and a value structure for the
18 return value of the callback. The marshaller is then responsible to
19 call the respective C code function of the closure with all the
20 parameters on the stack and to collect its return value.
21
23 glib-genmarshal takes a list of marshallers to generate as input. The
24 marshaller list is either read from standard input or from files passed
25 as additional arguments on the command line.
26
27 Options
28 --header
29 Generate header file contents of the marshallers.
30
31 --body Generate C code file contents of the marshallers.
32
33 --prefix=string, --prefix string
34 Specify marshaller prefix. The default prefix is
35 `g_cclosure_marshal'.
36
37 --skip-source
38 Skip source location remarks in generated comments.
39
40 --nostdinc
41 Do not use the standard marshallers of the GObject library, and
42 skip gmarshal.h include directive in generated header files.
43
44 --g-fatal-warnings
45 Make warnings fatal, that is, exit immediately once a warning
46 occurs.
47
48 -h, --help
49 Print brief help and exit.
50
51 -v, --version
52 Print version and exit.
53
54 Marshaller list format
55 The marshaller lists are processed line by line, a line can contain a
56 comment in the form of
57
58 # this is a comment
59
60 or a marshaller specification of the form
61
62 RTYPE:PTYPE
63 RTYPE:PTYPE,PTYPE
64 RTYPE:PTYPE,PTYPE,PTYPE
65
66 (up to 16 PTYPEs may be present).
67
68 The RTYPE part specifies the callback's return type and the PTYPEs
69 right to the colon specify the callback's parameter list, except for
70 the first and the last arguments which are always pointers.
71
72 Parameter types
73 Currently, the following types are supported:
74
75 VOID indicates no return type, or no extra parameters. If VOID is
76 used as the parameter list, no additional parameters may be
77 present.
78
79 BOOLEAN
80 for boolean types (gboolean)
81
82 CHAR for signed char types (gchar)
83
84 UCHAR for unsigned char types (guchar)
85
86 INT for signed integer types (gint)
87
88 UINT for unsigned integer types (guint)
89
90 LONG for signed long integer types (glong)
91
92 ULONG for unsigned long integer types (gulong)
93
94 INT64 for signed 64bit integer types (gint64)
95
96 UINT64 for unsigned 64bit integer types (guint64)
97
98 ENUM for enumeration types (gint)
99
100 FLAGS for flag enumeration types (guint)
101
102 FLOAT for single-precision float types (gfloat)
103
104 DOUBLE for double-precision float types (gdouble)
105
106 STRING for string types (gchar*)
107
108 BOXED for boxed (anonymous but reference counted) types (GBoxed*)
109
110 PARAM for GParamSpec or derived types (GParamSpec*)
111
112 POINTER
113 for anonymous pointer types (gpointer)
114
115 OBJECT for GObject or derived types (GObject*)
116
117 NONE deprecated alias for VOID
118
119 BOOL deprecated alias for BOOLEAN
120
122 To generate marshallers for the following callback functions:
123
124 void foo (gpointer data1,
125 gpointer data2);
126 void bar (gpointer data1,
127 gint param1,
128 gpointer data2);
129 gfloat baz (gpointer data1,
130 gboolean param1,
131 guchar param2,
132 gpointer data2);
133
134 The marshaller list has to look like this:
135
136 VOID:VOID
137 VOID:INT
138 FLOAT:BOOLEAN,UCHAR
139
140 The generated marshallers have the arguments encoded in their function
141 name. For this particular list, they are
142
143 g_cclosure_marshal_VOID__VOID(),
144 g_cclosure_marshal_VOID__INT(),
145 g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR().
146
147 They can be used directly for GClosures or be passed in as the
148 GSignalCMarshaller c_marshaller; argument upon creation of signals:
149
150 GClosure *cc_foo, *cc_bar, *cc_baz;
151
152 cc_foo = g_cclosure_new (NULL, foo, NULL);
153 g_closure_set_marshal (cc_foo, g_cclosure_marshal_VOID__VOID);
154 cc_bar = g_cclosure_new (NULL, bar, NULL);
155 g_closure_set_marshal (cc_bar, g_cclosure_marshal_VOID__INT);
156 cc_baz = g_cclosure_new (NULL, baz, NULL);
157 g_closure_set_marshal (cc_baz, g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR);
158
160 glib-mkenums(1)
161
163 None known yet.
164
166 glib-genmarshal has been written by Tim Janik <timj@gtk.org>.
167
168 This manual page was provided by Tim Janik <timj@gtk.org>.
169
170
171
172 08/22/2005 GLIB-GENMARSHAL(1)