1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>glib-genmarshal</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GObject Reference Manual">
8 <link rel="up" href="rn02.html" title="Tools Reference">
9 <link rel="prev" href="glib-mkenums.html" title="glib-mkenums">
10 <link rel="next" href="gobject-query.html" title="gobject-query">
11 <meta name="generator" content="GTK-Doc V1.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="preface" href="pr01.html" title="Introduction">
14 <link rel="part" href="pt01.html" title="Part I. Concepts">
15 <link rel="chapter" href="chapter-intro.html" title="Background">
16 <link rel="chapter" href="chapter-gtype.html" title="The GLib Dynamic Type System">
17 <link rel="chapter" href="chapter-gobject.html" title="The GObject base class">
18 <link rel="chapter" href="chapter-signal.html" title="The GObject messaging system">
19 <link rel="reference" href="rn01.html" title="API Reference">
20 <link rel="reference" href="rn02.html" title="Tools Reference">
21 <link rel="part" href="pt02.html" title="Part IV. Tutorial">
22 <link rel="chapter" href="howto-gobject.html" title="How to define and implement a new GObject">
23 <link rel="chapter" href="howto-interface.html" title="How to define and implement interfaces">
24 <link rel="chapter" href="howto-signals.html" title="How to create and use signals">
25 <link rel="part" href="pt03.html" title="Part V. Related Tools">
26 <link rel="chapter" href="tools-vala.html" title="Vala">
27 <link rel="chapter" href="tools-gob.html" title="GObject builder">
28 <link rel="chapter" href="tools-ginspector.html" title="Graphical inspection of GObjects">
29 <link rel="chapter" href="tools-refdb.html" title="Debugging reference count problems">
30 <link rel="chapter" href="tools-gtkdoc.html" title="Writing API docs">
31 <link rel="index" href="api-index-full.html" title="Index">
32 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
33 <link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
34 <link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
35 <link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
36 <link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
37 <link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
38 <link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
39 <link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
40 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
41 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
42 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
44 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
45 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
46 <td><a accesskey="p" href="glib-mkenums.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
47 <td><a accesskey="u" href="rn02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
48 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
49 <th width="100%" align="center">GObject Reference Manual</th>
50 <td><a accesskey="n" href="gobject-query.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
52 <div class="refentry" title="glib-genmarshal">
53 <a name="glib-genmarshal"></a><div class="titlepage"></div>
54 <div class="refnamediv"><table width="100%"><tr>
56 <h2><span class="refentrytitle">glib-genmarshal</span></h2>
57 <p>glib-genmarshal — C code marshaller generation utility for GLib closures</p>
59 <td valign="top" align="right"></td>
61 <div class="refsynopsisdiv" title="Synopsis">
63 <div class="cmdsynopsis"><p><code class="command">glib-genmarshal</code> [options...] [files...]</p></div>
65 <div class="refsect1" title="Description">
66 <a name="id618843"></a><h2>Description</h2>
67 <p><span class="command"><strong>glib-genmarshal</strong></span> is a small utility that generates C code
68 marshallers for callback functions of the GClosure mechanism in the GObject
69 sublibrary of GLib. The marshaller functions have a standard signature,
70 they get passed in the invoking closure, an array of value structures holding
71 the callback function parameters and a value structure for the return value
72 of the callback. The marshaller is then responsible to call the respective C
73 code function of the closure with all the parameters on the stack and to
74 collect its return value.
77 <div class="refsect1" title="Invocation">
78 <a name="id589843"></a><h2>Invocation</h2>
79 <p><span class="command"><strong>glib-genmarshal</strong></span> takes a list of marshallers to generate as
80 input. The marshaller list is either read from standard input or from files
81 passed as additional arguments on the command line.
83 <div class="refsect2" title="Options">
84 <a name="id584517"></a><h3>Options</h3>
85 <div class="variablelist"><table border="0">
86 <col align="left" valign="top">
89 <td><p><span class="term"><code class="option">--header</code></span></p></td>
91 Generate header file contents of the marshallers.
95 <td><p><span class="term"><code class="option">--body</code></span></p></td>
97 Generate C code file contents of the marshallers.
101 <td><p><span class="term"><code class="option">--prefix=string</code>, <code class="option">--prefix string</code></span></p></td>
103 Specify marshaller prefix. The default prefix is <code class="literal">`g_cclosure_marshal'</code>.
107 <td><p><span class="term"><code class="option">--skip-source</code></span></p></td>
109 Skip source location remarks in generated comments.
113 <td><p><span class="term"><code class="option">--nostdinc</code></span></p></td>
115 Do not use the standard marshallers of the GObject library, and skip
116 <code class="filename">gmarshal.h</code> include directive in generated header files.
120 <td><p><span class="term"><code class="option">--g-fatal-warnings</code></span></p></td>
122 Make warnings fatal, that is, exit immediately once a warning occurs.
126 <td><p><span class="term"><code class="option">-h</code>, <code class="option">--help</code></span></p></td>
128 Print brief help and exit.
132 <td><p><span class="term"><code class="option">-v</code>, <code class="option">--version</code></span></p></td>
134 Print version and exit.
141 <div class="refsect2" title="Marshaller list format">
142 <a name="id561940"></a><h3>Marshaller list format</h3>
144 The marshaller lists are processed line by line, a line can contain a
145 comment in the form of
147 <pre class="programlisting">
151 or a marshaller specification of the form
153 <pre class="programlisting">
154 <em class="replaceable"><code>RTYPE</code></em>:<em class="replaceable"><code>PTYPE</code></em>
155 <em class="replaceable"><code>RTYPE</code></em>:<em class="replaceable"><code>PTYPE</code></em>,<em class="replaceable"><code>PTYPE</code></em>
156 <em class="replaceable"><code>RTYPE</code></em>:<em class="replaceable"><code>PTYPE</code></em>,<em class="replaceable"><code>PTYPE</code></em>,<em class="replaceable"><code>PTYPE</code></em>
159 (up to 16 <em class="replaceable"><code>PTYPE</code></em>s may be present).
162 The <em class="replaceable"><code>RTYPE</code></em> part specifies the callback's return
163 type and the <em class="replaceable"><code>PTYPE</code></em>s right to the colon specify
164 the callback's parameter list, except for the first and the last arguments
165 which are always pointers.
169 <div class="refsect2" title="Parameter types">
170 <a name="id615939"></a><h3>Parameter types</h3>
172 Currently, the following types are supported:
174 <div class="variablelist"><table border="0">
175 <col align="left" valign="top">
178 <td><p><span class="term"><em class="replaceable"><code>VOID</code></em></span></p></td>
180 indicates no return type, or no extra parameters.
181 If <em class="replaceable"><code>VOID</code></em> is used as the parameter list, no
182 additional parameters may be present.
186 <td><p><span class="term"><em class="replaceable"><code>BOOLEAN</code></em></span></p></td>
188 for boolean types (gboolean)
192 <td><p><span class="term"><em class="replaceable"><code>CHAR</code></em></span></p></td>
194 for signed char types (gchar)
198 <td><p><span class="term"><em class="replaceable"><code>UCHAR</code></em></span></p></td>
200 for unsigned char types (guchar)
204 <td><p><span class="term"><em class="replaceable"><code>INT</code></em></span></p></td>
206 for signed integer types (gint)
210 <td><p><span class="term"><em class="replaceable"><code>UINT</code></em></span></p></td>
212 for unsigned integer types (guint)
216 <td><p><span class="term"><em class="replaceable"><code>LONG</code></em></span></p></td>
218 for signed long integer types (glong)
222 <td><p><span class="term"><em class="replaceable"><code>ULONG</code></em></span></p></td>
224 for unsigned long integer types (gulong)
228 <td><p><span class="term"><em class="replaceable"><code>INT64</code></em></span></p></td>
230 for signed 64bit integer types (gint64)
234 <td><p><span class="term"><em class="replaceable"><code>UINT64</code></em></span></p></td>
236 for unsigned 64bit integer types (guint64)
240 <td><p><span class="term"><em class="replaceable"><code>ENUM</code></em></span></p></td>
242 for enumeration types (gint)
246 <td><p><span class="term"><em class="replaceable"><code>FLAGS</code></em></span></p></td>
248 for flag enumeration types (guint)
252 <td><p><span class="term"><em class="replaceable"><code>FLOAT</code></em></span></p></td>
254 for single-precision float types (gfloat)
258 <td><p><span class="term"><em class="replaceable"><code>DOUBLE</code></em></span></p></td>
260 for double-precision float types (gdouble)
264 <td><p><span class="term"><em class="replaceable"><code>STRING</code></em></span></p></td>
266 for string types (gchar*)
270 <td><p><span class="term"><em class="replaceable"><code>BOXED</code></em></span></p></td>
272 for boxed (anonymous but reference counted) types (GBoxed*)
276 <td><p><span class="term"><em class="replaceable"><code>PARAM</code></em></span></p></td>
278 for GParamSpec or derived types (GParamSpec*)
282 <td><p><span class="term"><em class="replaceable"><code>POINTER</code></em></span></p></td>
284 for anonymous pointer types (gpointer)
288 <td><p><span class="term"><em class="replaceable"><code>OBJECT</code></em></span></p></td>
290 for GObject or derived types (GObject*)
294 <td><p><span class="term"><em class="replaceable"><code>NONE</code></em></span></p></td>
296 deprecated alias for <em class="replaceable"><code>VOID</code></em>
300 <td><p><span class="term"><em class="replaceable"><code>BOOL</code></em></span></p></td>
302 deprecated alias for <em class="replaceable"><code>BOOLEAN</code></em>
311 <div class="refsect1" title="Example">
312 <a name="id583131"></a><h2>Example</h2>
314 To generate marshallers for the following callback functions:
316 <pre class="programlisting">
317 void foo (gpointer data1,
319 void bar (gpointer data1,
322 gfloat baz (gpointer data1,
328 The marshaller list has to look like this:
330 <pre class="programlisting">
336 The generated marshallers have the arguments encoded in their function name.
337 For this particular list, they are
339 <pre class="programlisting">
340 g_cclosure_marshal_VOID__VOID(),
341 g_cclosure_marshal_VOID__INT(),
342 g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR().
345 They can be used directly for GClosures or be passed in as the
346 GSignalCMarshaller c_marshaller; argument upon creation of signals:
348 <pre class="programlisting">
349 GClosure *cc_foo, *cc_bar, *cc_baz;
351 cc_foo = g_cclosure_new (NULL, foo, NULL);
352 g_closure_set_marshal (cc_foo, g_cclosure_marshal_VOID__VOID);
353 cc_bar = g_cclosure_new (NULL, bar, NULL);
354 g_closure_set_marshal (cc_bar, g_cclosure_marshal_VOID__INT);
355 cc_baz = g_cclosure_new (NULL, baz, NULL);
356 g_closure_set_marshal (cc_baz, g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR);
359 <div class="refsect1" title="See also">
360 <a name="id570966"></a><h2>See also</h2>
362 <span class="command"><strong>glib-mkenums</strong></span>(1)
365 <div class="refsect1" title="Bugs">
366 <a name="id591176"></a><h2>Bugs</h2>
371 <div class="refsect1" title="Author">
372 <a name="id597530"></a><h2>Author</h2>
373 <p><span class="command"><strong>glib-genmarshal</strong></span> has been written by Tim Janik
374 <code class="email"><<a class="email" href="mailto:timj@gtk.org">timj@gtk.org</a>></code>.
377 This manual page was provided by Tim Janik <code class="email"><<a class="email" href="mailto:timj@gtk.org">timj@gtk.org</a>></code>.
383 Generated by GTK-Doc V1.13</div>