2009-03-02 06:49:44 +01:00
'\" t
. \" Title: glib-genmarshal
. \" Author: [see the "Author" section]
2010-04-19 23:30:42 +02:00
. \" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
. \" Date: 04/19/2010
. \" Manual: User Commands
. \" Source: User Commands
2009-03-02 06:49:44 +01:00
. \" Language: English
. \"
2010-04-19 23:30:42 +02:00
.TH "GLIB\-GENMARSHAL" "1" "04/19/2010" "User Commands" "User Commands"
2009-03-02 06:49:44 +01:00
. \" -----------------------------------------------------------------
. \" * set default formatting
. \" -----------------------------------------------------------------
2005-08-23 06:35:33 +02:00
. \" disable hyphenation
.nh
. \" disable justification (adjust text to left margin only)
.ad l
2009-03-02 06:49:44 +01:00
. \" -----------------------------------------------------------------
. \" * MAIN CONTENT STARTS HERE *
. \" -----------------------------------------------------------------
2005-08-23 06:35:33 +02:00
.SH "NAME"
2009-03-02 06:49:44 +01:00
glib-genmarshal \- C code marshaller generation utility for GLib closures
2003-06-18 01:08:37 +02:00
.SH "SYNOPSIS"
2009-03-02 06:49:44 +01:00
.HP \w '\fBglib\-genmarshal\fR\ 'u
2005-08-23 06:35:33 +02:00
\fB glib\- genmarshal\fR [options...] [files...]
2003-06-18 01:08:37 +02:00
.SH "DESCRIPTION"
.PP
2005-08-23 06:35:33 +02:00
\fB glib\- genmarshal\fR
2009-03-02 06:49:44 +01:00
is a small utility that generates C code marshallers for callback functions of the GClosure mechanism in the GObject sublibrary of GLib\& . The marshaller functions have a standard signature, they get passed in 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 is then responsible to call the respective C code function of the closure with all the parameters on the stack and to collect its return value\& .
2005-08-10 12:49:46 +02:00
.SH "INVOCATION"
2003-06-18 01:08:37 +02:00
.PP
2005-08-23 06:35:33 +02:00
\fB glib\- genmarshal\fR
2009-03-02 06:49:44 +01:00
takes a list of marshallers to generate as input\& . The marshaller list is either read from standard input or from files passed as additional arguments on the command line\& .
2003-06-18 01:08:37 +02:00
.SS "Options"
2009-03-02 06:49:44 +01:00
.PP
2005-08-23 06:35:33 +02:00
\fB \- \- header\fR
2009-03-02 06:49:44 +01:00
.RS 4
Generate header file contents of the marshallers\& .
.RE
.PP
2005-08-23 06:35:33 +02:00
\fB \- \- body\fR
2009-03-02 06:49:44 +01:00
.RS 4
Generate C code file contents of the marshallers\& .
.RE
.PP
2005-08-23 06:35:33 +02:00
\fB \- \- prefix=string\fR , \fB \- \- prefix string\fR
2009-03-02 06:49:44 +01:00
.RS 4
Specify marshaller prefix\& . The default prefix is
`g_cclosure_marshal\' \& .
.RE
.PP
2005-08-23 06:35:33 +02:00
\fB \- \- skip\- source\fR
2009-03-02 06:49:44 +01:00
.RS 4
Skip source location remarks in generated comments\& .
.RE
.PP
2005-08-23 06:35:33 +02:00
\fB \- \- nostdinc\fR
2009-03-02 06:49:44 +01:00
.RS 4
2005-08-23 06:35:33 +02:00
Do not use the standard marshallers of the GObject library, and skip
2009-03-02 06:49:44 +01:00
gmarshal\& .h
include directive in generated header files\& .
.RE
.PP
2005-08-23 06:35:33 +02:00
\fB \- \- g\- fatal\- warnings\fR
2009-03-02 06:49:44 +01:00
.RS 4
Make warnings fatal, that is, exit immediately once a warning occurs\& .
.RE
.PP
2005-08-23 06:35:33 +02:00
\fB \- h\fR , \fB \- \- help\fR
2009-03-02 06:49:44 +01:00
.RS 4
Print brief help and exit\& .
.RE
.PP
2005-08-23 06:35:33 +02:00
\fB \- v\fR , \fB \- \- version\fR
2009-03-02 06:49:44 +01:00
.RS 4
Print version and exit\& .
.RE
2003-06-18 01:08:37 +02:00
.SS "Marshaller list format"
.PP
2005-08-23 06:35:33 +02:00
The marshaller lists are processed line by line, a line can contain a comment in the form of
.sp
2009-03-02 06:49:44 +01:00
.if n \{ \
.RS 4
. \}
2003-06-18 01:08:37 +02:00
.nf
# this is a comment
.fi
2009-03-02 06:49:44 +01:00
.if n \{ \
.RE
. \}
2005-08-23 06:35:33 +02:00
.sp
or a marshaller specification of the form
.sp
2009-03-02 06:49:44 +01:00
.if n \{ \
.RS 4
. \}
2003-06-18 01:08:37 +02:00
.nf
\fI RTYPE\fR :\fI PTYPE\fR
\fI RTYPE\fR :\fI PTYPE\fR ,\fI PTYPE\fR
\fI RTYPE\fR :\fI PTYPE\fR ,\fI PTYPE\fR ,\fI PTYPE\fR
.fi
2009-03-02 06:49:44 +01:00
.if n \{ \
.RE
. \}
2005-08-23 06:35:33 +02:00
.sp
(up to 16
2009-03-02 06:49:44 +01:00
\fI PTYPE\fR s may be present)\& .
2003-06-18 01:08:37 +02:00
.PP
2005-08-23 06:35:33 +02:00
The
\fI RTYPE\fR
2009-03-02 06:49:44 +01:00
part specifies the callback\' s return type and the
\fI PTYPE\fR s right to the colon specify the callback\' s parameter list, except for the first and the last arguments which are always pointers\& .
2003-06-18 01:08:37 +02:00
.SS "Parameter types"
.PP
2005-08-23 06:35:33 +02:00
Currently, the following types are supported:
2009-03-02 06:49:44 +01:00
.PP
2003-06-18 01:08:37 +02:00
\fI VOID\fR
2009-03-02 06:49:44 +01:00
.RS 4
indicates no return type, or no extra parameters\& . If
2005-08-23 06:35:33 +02:00
\fI VOID\fR
2009-03-02 06:49:44 +01:00
is used as the parameter list, no additional parameters may be present\& .
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI BOOLEAN\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for boolean types (gboolean)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI CHAR\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for signed char types (gchar)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI UCHAR\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for unsigned char types (guchar)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI INT\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for signed integer types (gint)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI UINT\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for unsigned integer types (guint)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI LONG\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for signed long integer types (glong)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI ULONG\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for unsigned long integer types (gulong)
2009-03-02 06:49:44 +01:00
.RE
.PP
2005-05-13 20:09:01 +02:00
\fI INT64\fR
2009-03-02 06:49:44 +01:00
.RS 4
2005-05-13 20:09:01 +02:00
for signed 64bit integer types (gint64)
2009-03-02 06:49:44 +01:00
.RE
.PP
2005-05-13 20:09:01 +02:00
\fI UINT64\fR
2009-03-02 06:49:44 +01:00
.RS 4
2005-05-13 20:09:01 +02:00
for unsigned 64bit integer types (guint64)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI ENUM\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for enumeration types (gint)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI FLAGS\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for flag enumeration types (guint)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI FLOAT\fR
2009-03-02 06:49:44 +01:00
.RS 4
2005-08-23 06:35:33 +02:00
for single\- precision float types (gfloat)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI DOUBLE\fR
2009-03-02 06:49:44 +01:00
.RS 4
2005-08-23 06:35:33 +02:00
for double\- precision float types (gdouble)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI STRING\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for string types (gchar*)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI BOXED\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for boxed (anonymous but reference counted) types (GBoxed*)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI PARAM\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for GParamSpec or derived types (GParamSpec*)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI POINTER\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for anonymous pointer types (gpointer)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI OBJECT\fR
2009-03-02 06:49:44 +01:00
.RS 4
2003-06-18 01:08:37 +02:00
for GObject or derived types (GObject*)
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI NONE\fR
2009-03-02 06:49:44 +01:00
.RS 4
2005-08-23 06:35:33 +02:00
deprecated alias for
\fI VOID\fR
2009-03-02 06:49:44 +01:00
.RE
.PP
2003-06-18 01:08:37 +02:00
\fI BOOL\fR
2009-03-02 06:49:44 +01:00
.RS 4
2005-08-23 06:35:33 +02:00
deprecated alias for
\fI BOOLEAN\fR
2009-03-02 06:49:44 +01:00
.RE
2003-06-18 01:08:37 +02:00
.SH "EXAMPLE"
.PP
To generate marshallers for the following callback functions:
2005-08-23 06:35:33 +02:00
.sp
2009-03-02 06:49:44 +01:00
.if n \{ \
.RS 4
. \}
2003-06-18 01:08:37 +02:00
.nf
void foo (gpointer data1,
gpointer data2);
void bar (gpointer data1,
gint param1,
gpointer data2);
gfloat baz (gpointer data1,
gboolean param1,
guchar param2,
gpointer data2);
.fi
2009-03-02 06:49:44 +01:00
.if n \{ \
.RE
. \}
2003-06-18 01:08:37 +02:00
.PP
The marshaller list has to look like this:
2005-08-23 06:35:33 +02:00
.sp
2009-03-02 06:49:44 +01:00
.if n \{ \
.RS 4
. \}
2003-06-18 01:08:37 +02:00
.nf
VOID:VOID
VOID:INT
FLOAT:BOOLEAN,UCHAR
.fi
2009-03-02 06:49:44 +01:00
.if n \{ \
.RE
. \}
2003-06-18 01:08:37 +02:00
.PP
2009-03-02 06:49:44 +01:00
The generated marshallers have the arguments encoded in their function name\& . For this particular list, they are
2005-08-23 06:35:33 +02:00
.sp
2009-03-02 06:49:44 +01:00
.if n \{ \
.RS 4
. \}
2003-06-18 01:08:37 +02:00
.nf
g_cclosure_marshal_VOID__VOID(),
g_cclosure_marshal_VOID__INT(),
2009-03-02 06:49:44 +01:00
g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR()\& .
2003-06-18 01:08:37 +02:00
.fi
2009-03-02 06:49:44 +01:00
.if n \{ \
.RE
. \}
2003-06-18 01:08:37 +02:00
.PP
They can be used directly for GClosures or be passed in as the GSignalCMarshaller c_marshaller; argument upon creation of signals:
2005-08-23 06:35:33 +02:00
.sp
2009-03-02 06:49:44 +01:00
.if n \{ \
.RS 4
. \}
2003-06-18 01:08:37 +02:00
.nf
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);
.fi
2009-03-02 06:49:44 +01:00
.if n \{ \
.RE
. \}
2003-06-18 01:08:37 +02:00
.SH "SEE ALSO"
.PP
2009-03-02 06:49:44 +01:00
2005-08-23 06:35:33 +02:00
\fB glib\- mkenums\fR (1)
2003-06-18 01:08:37 +02:00
.SH "BUGS"
.PP
2009-03-02 06:49:44 +01:00
None known yet\& .
2003-06-18 01:08:37 +02:00
.SH "AUTHOR"
.PP
2005-08-23 06:35:33 +02:00
\fB glib\- genmarshal\fR
has been written by Tim Janik
2009-03-02 06:49:44 +01:00
timj@gtk\& .org\& .
2003-06-18 01:08:37 +02:00
.PP
2005-08-23 06:35:33 +02:00
This manual page was provided by Tim Janik
2009-03-02 06:49:44 +01:00
timj@gtk\& .org\& .