glib-genmarshal.1 revision 11904
<!DOCTYPE REFENTRY PUBLIC "-//Sun Microsystems//DTD DocBook V3.0-Based SolBook Subset V2.0//EN" [
<!--ArborText, Inc., 1988-1999, v.4002-->
<!ENTITY cmd "glib-genmarshal">
<!ENTITY % commonents SYSTEM "smancommon.ent">
%commonents;
<!ENTITY % booktitles SYSTEM "booktitles.ent">
%booktitles;
<!ENTITY suncopy "Copyright (c) 2003,2006 Sun Microsystems, Inc. All Rights Reserved.">
]>
<?Pub UDT _bookmark _target>
<?Pub Inc>
<refentry id="glib-genmarshal-1">
<!-- %Z%%M% %I% %E% SMI; -->
<refmeta><refentrytitle>glib-genmarshal</refentrytitle><manvolnum>1</manvolnum>
<refmiscinfo class="date">7 Apr 2003</refmiscinfo>
<refmiscinfo class="sectdesc">&man1;</refmiscinfo>
<refmiscinfo class="software">&release;</refmiscinfo>
<refmiscinfo class="arch">generic</refmiscinfo>
<refmiscinfo class="copyright">&suncopy;</refmiscinfo>
</refmeta>
<indexterm><primary>glib-genmarshal</primary></indexterm><indexterm><primary>
generates C code marshallers for GLib closures</primary></indexterm><refnamediv
id="glib-genmarshal-1-name"><refname>glib-genmarshal</refname><refpurpose>generates
C code marshallers for GLib closures</refpurpose></refnamediv>
<refsynopsisdiv id="glib-genmarshal-1-synp"><title>&synp-tt;</title>
<cmdsynopsis><command>&cmd;</command>
<arg choice="opt"><option>-body</option></arg>
<arg choice="opt"><option>-g-fatal-warnings</option></arg>
<arg choice="opt"><option>-header</option></arg>
<arg choice="opt"><option>-help</option></arg>
<arg choice="opt"><option>-internal</option></arg>
<arg choice="opt"><option>-nostdinc</option> | <option>-stdinc</option></arg>
<arg choice="opt"><option>-prefix=<replaceable>dir</replaceable></option></arg>
<arg choice="opt"><option>-skip-source</option></arg>
<arg choice="opt"><option>-version</option></arg>
<arg choice="opt" rep="repeat"><option role="nodash"><replaceable>file</replaceable></option></arg>
</cmdsynopsis></refsynopsisdiv>
<refsect1 id="glib-genmarshal-1-desc"><title>&desc-tt;</title>
<para><command>&cmd;</command> generates C code marshallers for callback functions
of the GClosure mechanism in the GObject sublibrary of GLib. The marshaller
functions have a standard signature. The following are passed to the marshaller
functions: the invoking closure, an array of value structures holding the
callback function parameters, and a value structure for the return value of
the callback. The marshaller then calls the C code function of the closure
with all of the parameters on the stack, and collects the return value.</para>
<para><command>&cmd;</command> generates the specified list of marshallers.
The marshaller list is either read from standard input or from files passed
as additional arguments on the command line.</para>
</refsect1>
<refsect1 id="glib-genmarshal-1-exde"><title>&exde-tt;</title>
<para>The marshaller lists are processed line by line. A line can contain
a comment in the following format:</para>
<para><screen># this is a comment</screen></para>
<para>A marshaller list can contain a marshaller specification in the following
format:</para>
<para><screen><replaceable>RTYPE</replaceable>:<replaceable>PTYPE</replaceable>
<replaceable>RTYPE</replaceable>:<replaceable>PTYPE</replaceable>,<replaceable>
PTYPE</replaceable>
<replaceable>RTYPE</replaceable>:<replaceable>PTYPE</replaceable>,<replaceable>
PTYPE</replaceable>,<replaceable>PTYPE</replaceable>
# up to 16 <replaceable>PTYPE</replaceable>s may be present</screen></para>
<para>RTYPE specifies the callback return type. PTYPE specifies the callback
parameter list, except for the first and the last arguments which are always
pointers.</para>
<refsect2 id="glib-genmarshal-1-exde-ptyp"><title>Parameter Types</title>
<para>Currently, the following parameter types are supported:</para>
<variablelist><varlistentry><term><literal>BOOL</literal></term><listitem>
<para>Deprecated alias for <literal>BOOLEAN</literal>.</para>
</listitem></varlistentry>
<varlistentry><term><literal>BOOLEAN</literal></term><listitem><para>Boolean
type (<literal>gboolean</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>BOXED</literal></term><listitem><para>Boxed,
anonymous but reference counted, type (<literal>GBoxed*</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>CHAR</literal></term><listitem><para>Signed char
type (<literal>gchar</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>DOUBLE</literal></term><listitem><para>Double-precision
float type (<literal>gdouble</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>ENUM</literal></term><listitem><para>Enumeration
type (<literal>gint</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>FLAGS</literal></term><listitem><para>Flag enumeration
type (<literal>guint</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>FLOAT</literal></term><listitem><para>Single-precision
float type (<literal>gfloat</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>INT</literal></term><listitem><para>Signed integer
type (<literal>gint</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>INT64</literal></term><listitem><para>Signed 64bit integer type (<literal>gint64</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>LONG</literal></term><listitem><para>Signed long
integer type (<literal>glong</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>NONE</literal></term><listitem><para>Deprecated
alias for <literal>VOID</literal>.</para>
</listitem></varlistentry>
<varlistentry><term><literal>OBJECT</literal></term><listitem><para>GObject
or derived type (<literal>GObject*</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>PARAM</literal></term><listitem><para>GParamSpec
or derived type (<literal>GParamSpec*</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>POINTER</literal></term><listitem><para>Anonymous
pointer type (<literal>gpointer</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>STRING</literal></term><listitem><para>String
type (<literal>gchar*</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>UCHAR</literal></term><listitem><para>Unsigned
char type (<literal>guchar</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>UINT</literal></term><listitem><para>Unsigned
integer type (<literal>guint</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>UINT64</literal></term><listitem><para>Unsigned
64bit integer type (<literal>guint64</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>ULONG</literal></term><listitem><para>Unsigned
long integer type (<literal>gulong</literal>).</para>
</listitem></varlistentry>
<varlistentry><term><literal>VOID</literal></term><listitem><para>No return
type, or no extra parameters. If <literal>VOID</literal> is used as the parameter
list, no additional parameters may be present.</para>
</listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
<refsect1 id="glib-genmarshal-1-opts"><title>&opts-tt;</title>
<para>The following options are supported:</para>
<variablelist termlength="medium"><varlistentry><term><option>-body</option></term>
<listitem><para>Generate the C code file contents of the marshallers.</para>
</listitem></varlistentry>
<varlistentry><term><option>-g-fatal-warnings</option></term>
<listitem><para>Make warnings fatal, that is, exit immediately once a warning
occurs.</para>
</listitem></varlistentry>
<varlistentry><term><option>-internal</option></term><listitem><para>Mark
generated functions as internal.</para>
</listitem></varlistentry>
<varlistentry><term><option>-header</option></term><listitem><para>Generate
the header file contents of the marshallers.</para>
</listitem></varlistentry>
<varlistentry><term><option role="nodash">-h</option>, <option>-help</option></term><listitem><para>Show usage
and basic help information.</para>
</listitem></varlistentry>
<varlistentry><term><option>-nostdinc</option></term><listitem><para>Do not
use the standard marshallers of the GObject library, and skip the <filename>
gmarshal.h</filename> include directive in generated header files.</para>
</listitem></varlistentry>
<varlistentry><term><option>-stdinc</option></term><listitem><para>Use
the standard marshallers of the GObject library, and use the <filename>
gmarshal.h</filename> include directive in generated header files.</para>
</listitem></varlistentry>
<varlistentry><term><option>-prefix=<replaceable>dir</replaceable></option></term>
<listitem><para>Specify the marshaller prefix. The default prefix is <literal>
g_cclosure_marshal</literal>.</para>
</listitem></varlistentry>
<varlistentry><term><option>-skip-source</option></term><listitem><para>Skip
source location remarks in generated comments.</para>
</listitem></varlistentry>
<varlistentry><term><option role="nodash">-v</option>, <option>-version</option></term><listitem><para>Show version
information.</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1 id="glib-genmarshal-1-oper"><title>&oper-tt;</title>
<para>The following operands are supported:</para>
<variablelist termlength="medium"><varlistentry><term><option role="nodash"><replaceable>
file</replaceable></option></term><listitem><para>Specifies the marshaller
to be generated.</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1 id="glib-genmarshal-1-exam"><title>&exam-tt;</title>
<example role="example"><title>Generating Marshallers</title>
<para>This example shows how to generate marshallers for the following callback
functions:</para>
<para><screen>void foo (gpointer data1,
gpointer data2);
void bar (gpointer data1,
gint param1,
gpointer data2);
gfloat baz (gpointer data1,
gboolean param1,
guchar param2,
gpointer data2);</screen></para>
<para>The marshaller list is as follows:</para>
<screen>VOID:VOID
VOID:INT
FLOAT:BOOLEAN,UCHAR</screen>
<para>The generated marshallers have the arguments encoded in their function
name. For this particular list, they are as follows:</para>
<screen>g_cclosure_marshal_VOID__VOID()
g_cclosure_marshal_VOID__INT()
g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR()</screen>
<para>The generated marshallers can be used directly for GClosures or can
be passed in as the GSignalCMarshaller c_marshaller; argument upon creation
of signals:</para>
<screen>GClosure *cc_foo, *cc_bar, *cc_baz;
cc_foo = g_cclosure_new (NULL, foo, NULL);
g_closure_set_marshal (cc_foo, g_cclosure_marshal_VOID__VOID);
cc_bar = g_cclosure_new (NULL, bar, NULL);
g_closure_set_marshal (cc_bar, g_cclosure_marshal_VOID__INT);
cc_baz = g_cclosure_new (NULL, baz, NULL);
g_closure_set_marshal (cc_baz, g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR);</screen>
</example>
</refsect1>
<refsect1 id="glib-genmarshal-1-exit"><title>&exit-tt;</title>
<para>The following exit values are returned:</para>
<variablelist termlength="xtranarrow"><varlistentry><term><returnvalue>0</returnvalue></term>
<listitem><para>Application exited successfully</para>
</listitem></varlistentry>
<varlistentry><term><returnvalue>>0</returnvalue></term><listitem><para>Application
exited with failure</para>
</listitem></varlistentry>
</variablelist></refsect1>
<refsect1 id="glib-genmarshal-1-file"><title>&file-tt;</title>
<para>The following files are used by this application:</para>
<variablelist termlength="wide"><varlistentry><term><filename>/usr/bin/&cmd;</filename>
</term><listitem><para>The command-line executable for the application.</para>
</listitem></varlistentry>
<varlistentry><term><filename>/usr/share/gtk-doc/html/glib</filename></term><listitem>
<para>Location of developer documentation</para></listitem>
</varlistentry>
</variablelist></refsect1>
<refsect1 id="glib-genmarshal-1-attr"><title>&attr-tt;</title>
<para>See <olink targetdocent="REFMAN5" localinfo="attributes-5"><citerefentry>
<refentrytitle>attributes</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink>
for descriptions of the following attributes:</para>
<informaltable frame="all">
<tgroup cols="2" colsep="1" rowsep="1"><colspec colname="COLSPEC0" colwidth="1*">
<colspec colname="COLSPEC1" colwidth="1*">
<thead>
<row><entry align="center" valign="middle">ATTRIBUTE TYPE</entry><entry align="center"
valign="middle">ATTRIBUTE VALUE</entry></row>
</thead>
<tbody>
<row><entry><para>Availability</para></entry><entry><para>SUNWgnome-base-libs-devel
</para></entry></row>
<row><entry colname="COLSPEC0"><para>Interface stability</para></entry><entry
colname="COLSPEC1"><para>Committed</para></entry></row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="glib-genmarshal-1-also"><title>&also-tt;</title>
<!--Reference to another man page-->
<!--Reference to a Help manual-->
<!--Reference to a book.-->
<para>
<citerefentry><refentrytitle>gdk-pixbuf-csource</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gdk-pixbuf-query-loaders</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>glib-gettextize</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>glib-mkenums</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gobject-query</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gtk-query-immodules-2.0</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gtk-update-icon-cache</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>libglib-2.0</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>attributes</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>gnome-interfaces</refentrytitle><manvolnum>5</manvolnum></citerefentry>
</para>
</refsect1>
<refsect1 id="glib-genmarshal-1-note"><title>&note-tt;</title>
<para>Updated by Brian Cameron, Sun Microsystems Inc., 2003, 2006. Written by Tim
Janik.</para>
</refsect1>
</refentry>