1GLIB-GENMARSHAL(1) User Commands 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
32 Generate C code file contents of the marshallers.
33
34 --prefix=string, --prefix string
35 Specify marshaller prefix. The default prefix is
36 `g_cclosure_marshal´.
37
38 --skip-source
39 Skip source location remarks in generated comments.
40
41 --nostdinc
42 Do not use the standard marshallers of the GObject library, and
43 skip gmarshal.h include directive in generated header files.
44
45 --g-fatal-warnings
46 Make warnings fatal, that is, exit immediately once a warning
47 occurs.
48
49 -h, --help
50 Print brief help and exit.
51
52 -v, --version
53 Print version and exit.
54
55 Marshaller list format
56 The marshaller lists are processed line by line, a line can contain a
57 comment in the form of
58
59 # this is a comment
60
61 or a marshaller specification of the form
62
63 RTYPE:PTYPE
64 RTYPE:PTYPE,PTYPE
65 RTYPE:PTYPE,PTYPE,PTYPE
66
67 (up to 16 PTYPEs may be present).
68
69 The RTYPE part specifies the callback´s return type and the PTYPEs
70 right to the colon specify the callback´s parameter list, except for
71 the first and the last arguments which are always pointers.
72
73 Parameter types
74 Currently, the following types are supported:
75
76 VOID
77 indicates no return type, or no extra parameters. If VOID is used
78 as the parameter list, no additional parameters may be present.
79
80 BOOLEAN
81 for boolean types (gboolean)
82
83 CHAR
84 for signed char types (gchar)
85
86 UCHAR
87 for unsigned char types (guchar)
88
89 INT
90 for signed integer types (gint)
91
92 UINT
93 for unsigned integer types (guint)
94
95 LONG
96 for signed long integer types (glong)
97
98 ULONG
99 for unsigned long integer types (gulong)
100
101 INT64
102 for signed 64bit integer types (gint64)
103
104 UINT64
105 for unsigned 64bit integer types (guint64)
106
107 ENUM
108 for enumeration types (gint)
109
110 FLAGS
111 for flag enumeration types (guint)
112
113 FLOAT
114 for single-precision float types (gfloat)
115
116 DOUBLE
117 for double-precision float types (gdouble)
118
119 STRING
120 for string types (gchar*)
121
122 BOXED
123 for boxed (anonymous but reference counted) types (GBoxed*)
124
125 PARAM
126 for GParamSpec or derived types (GParamSpec*)
127
128 POINTER
129 for anonymous pointer types (gpointer)
130
131 OBJECT
132 for GObject or derived types (GObject*)
133
134 VARIANT
135 for GVariant types (GVariant*)
136
137 NONE
138 deprecated alias for VOID
139
140 BOOL
141 deprecated alias for BOOLEAN
142
144 To generate marshallers for the following callback functions:
145
146 void foo (gpointer data1,
147 gpointer data2);
148 void bar (gpointer data1,
149 gint param1,
150 gpointer data2);
151 gfloat baz (gpointer data1,
152 gboolean param1,
153 guchar param2,
154 gpointer data2);
155
156 The marshaller list has to look like this:
157
158 VOID:VOID
159 VOID:INT
160 FLOAT:BOOLEAN,UCHAR
161
162 The generated marshallers have the arguments encoded in their function
163 name. For this particular list, they are
164
165 g_cclosure_marshal_VOID__VOID(),
166 g_cclosure_marshal_VOID__INT(),
167 g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR().
168
169 They can be used directly for GClosures or be passed in as the
170 GSignalCMarshaller c_marshaller; argument upon creation of signals:
171
172 GClosure *cc_foo, *cc_bar, *cc_baz;
173
174 cc_foo = g_cclosure_new (NULL, foo, NULL);
175 g_closure_set_marshal (cc_foo, g_cclosure_marshal_VOID__VOID);
176 cc_bar = g_cclosure_new (NULL, bar, NULL);
177 g_closure_set_marshal (cc_bar, g_cclosure_marshal_VOID__INT);
178 cc_baz = g_cclosure_new (NULL, baz, NULL);
179 g_closure_set_marshal (cc_baz, g_cclosure_marshal_FLOAT__BOOLEAN_UCHAR);
180
182 glib-mkenums(1)
183
185 None known yet.
186
188 glib-genmarshal has been written by Tim Janik timj@gtk.org.
189
190 This manual page was provided by Tim Janik timj@gtk.org.
191
192
193
194User Commands 09/27/2010 GLIB-GENMARSHAL(1)