oops
[platform/upstream/glib.git] / gobject / gvaluetransform.c
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * Copyright (C) 2001 Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General
15  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #include "config.h"
19
20 #include <string.h>
21
22 #include "gvalue.h"
23 #include "gtype-private.h"
24 #include "genums.h"
25
26
27 /* same type transforms
28  */
29 static void
30 value_transform_memcpy_data0 (const GValue *src_value,
31                               GValue       *dest_value)
32 {
33   memcpy (&dest_value->data[0], &src_value->data[0], sizeof (src_value->data[0]));
34 }
35 #define value_transform_int_int         value_transform_memcpy_data0
36 #define value_transform_uint_uint       value_transform_memcpy_data0
37 #define value_transform_long_long       value_transform_memcpy_data0
38 #define value_transform_ulong_ulong     value_transform_memcpy_data0
39 #define value_transform_int64_int64     value_transform_memcpy_data0
40 #define value_transform_uint64_uint64   value_transform_memcpy_data0
41 #define value_transform_float_float     value_transform_memcpy_data0
42 #define value_transform_double_double   value_transform_memcpy_data0
43
44
45 /* numeric casts
46  */
47 #define DEFINE_CAST(func_name, from_member, ctype, to_member)               \
48 static void                                                                 \
49 value_transform_##func_name (const GValue *src_value,                       \
50                              GValue       *dest_value)                      \
51 {                                                                           \
52   ctype c_value = src_value->data[0].from_member;                           \
53   dest_value->data[0].to_member = c_value;                                  \
54 } extern void glib_dummy_decl (void)
55 DEFINE_CAST (int_s8,            v_int,    gint8,   v_int);
56 DEFINE_CAST (int_u8,            v_int,    guint8,  v_uint);
57 DEFINE_CAST (int_uint,          v_int,    guint,   v_uint);
58 DEFINE_CAST (int_long,          v_int,    glong,   v_long);
59 DEFINE_CAST (int_ulong,         v_int,    gulong,  v_ulong);
60 DEFINE_CAST (int_int64,         v_int,    gint64,  v_int64);
61 DEFINE_CAST (int_uint64,        v_int,    guint64, v_uint64);
62 DEFINE_CAST (int_float,         v_int,    gfloat,  v_float);
63 DEFINE_CAST (int_double,        v_int,    gdouble, v_double);
64 DEFINE_CAST (uint_s8,           v_uint,   gint8,   v_int);
65 DEFINE_CAST (uint_u8,           v_uint,   guint8,  v_uint);
66 DEFINE_CAST (uint_int,          v_uint,   gint,    v_int);
67 DEFINE_CAST (uint_long,         v_uint,   glong,   v_long);
68 DEFINE_CAST (uint_ulong,        v_uint,   gulong,  v_ulong);
69 DEFINE_CAST (uint_int64,        v_uint,   gint64,  v_int64);
70 DEFINE_CAST (uint_uint64,       v_uint,   guint64, v_uint64);
71 DEFINE_CAST (uint_float,        v_uint,   gfloat,  v_float);
72 DEFINE_CAST (uint_double,       v_uint,   gdouble, v_double);
73 DEFINE_CAST (long_s8,           v_long,   gint8,   v_int);
74 DEFINE_CAST (long_u8,           v_long,   guint8,  v_uint);
75 DEFINE_CAST (long_int,          v_long,   gint,    v_int);
76 DEFINE_CAST (long_uint,         v_long,   guint,   v_uint);
77 DEFINE_CAST (long_ulong,        v_long,   gulong,  v_ulong);
78 DEFINE_CAST (long_int64,        v_long,   gint64,  v_int64);
79 DEFINE_CAST (long_uint64,       v_long,   guint64, v_uint64);
80 DEFINE_CAST (long_float,        v_long,   gfloat,  v_float);
81 DEFINE_CAST (long_double,       v_long,   gdouble, v_double);
82 DEFINE_CAST (ulong_s8,          v_ulong,  gint8,   v_int);
83 DEFINE_CAST (ulong_u8,          v_ulong,  guint8,  v_uint);
84 DEFINE_CAST (ulong_int,         v_ulong,  gint,    v_int);
85 DEFINE_CAST (ulong_uint,        v_ulong,  guint,   v_uint);
86 DEFINE_CAST (ulong_int64,       v_ulong,  gint64,  v_int64);
87 DEFINE_CAST (ulong_uint64,      v_ulong,  guint64, v_uint64);
88 DEFINE_CAST (ulong_long,        v_ulong,  glong,   v_long);
89 DEFINE_CAST (ulong_float,       v_ulong,  gfloat,  v_float);
90 DEFINE_CAST (ulong_double,      v_ulong,  gdouble, v_double);
91 DEFINE_CAST (int64_s8,          v_int64,  gint8,   v_int);
92 DEFINE_CAST (int64_u8,          v_int64,  guint8,  v_uint);
93 DEFINE_CAST (int64_int,         v_int64,  gint,    v_int);
94 DEFINE_CAST (int64_uint,        v_int64,  guint,   v_uint);
95 DEFINE_CAST (int64_long,        v_int64,  glong,   v_long);
96 DEFINE_CAST (int64_uint64,      v_int64,  guint64, v_uint64);
97 DEFINE_CAST (int64_ulong,       v_int64,  gulong,  v_ulong);
98 DEFINE_CAST (int64_float,       v_int64,  gfloat,  v_float);
99 DEFINE_CAST (int64_double,      v_int64,  gdouble, v_double);
100 DEFINE_CAST (uint64_s8,         v_uint64, gint8,   v_int);
101 DEFINE_CAST (uint64_u8,         v_uint64, guint8,  v_uint);
102 DEFINE_CAST (uint64_int,        v_uint64, gint,    v_int);
103 DEFINE_CAST (uint64_uint,       v_uint64, guint,   v_uint);
104 DEFINE_CAST (uint64_long,       v_uint64, glong,   v_long);
105 DEFINE_CAST (uint64_ulong,      v_uint64, gulong,  v_ulong);
106 DEFINE_CAST (uint64_int64,      v_uint64, gint64,  v_int64);
107 DEFINE_CAST (uint64_float,      v_uint64, gfloat,  v_float);
108 DEFINE_CAST (uint64_double,     v_uint64, gdouble, v_double);
109 DEFINE_CAST (float_s8,          v_float,  gint8,   v_int);
110 DEFINE_CAST (float_u8,          v_float,  guint8,  v_uint);
111 DEFINE_CAST (float_int,         v_float,  gint,    v_int);
112 DEFINE_CAST (float_uint,        v_float,  guint,   v_uint);
113 DEFINE_CAST (float_long,        v_float,  glong,   v_long);
114 DEFINE_CAST (float_ulong,       v_float,  gulong,  v_ulong);
115 DEFINE_CAST (float_int64,       v_float,  gint64,  v_int64);
116 DEFINE_CAST (float_uint64,      v_float,  guint64, v_uint64);
117 DEFINE_CAST (float_double,      v_float,  gdouble, v_double);
118 DEFINE_CAST (double_s8,         v_double, gint8,   v_int);
119 DEFINE_CAST (double_u8,         v_double, guint8,  v_uint);
120 DEFINE_CAST (double_int,        v_double, gint,    v_int);
121 DEFINE_CAST (double_uint,       v_double, guint,   v_uint);
122 DEFINE_CAST (double_long,       v_double, glong,   v_long);
123 DEFINE_CAST (double_ulong,      v_double, gulong,  v_ulong);
124 DEFINE_CAST (double_int64,      v_double, gint64,  v_int64);
125 DEFINE_CAST (double_uint64,     v_double, guint64, v_uint64);
126 DEFINE_CAST (double_float,      v_double, gfloat,  v_float);
127
128
129 /* boolean assignments
130  */
131 #define DEFINE_BOOL_CHECK(func_name, from_member)                           \
132 static void                                                                 \
133 value_transform_##func_name (const GValue *src_value,                       \
134                              GValue       *dest_value)                      \
135 {                                                                           \
136   dest_value->data[0].v_int = src_value->data[0].from_member != 0;  \
137 } extern void glib_dummy_decl (void)
138 DEFINE_BOOL_CHECK (int_bool,    v_int);
139 DEFINE_BOOL_CHECK (uint_bool,   v_uint);
140 DEFINE_BOOL_CHECK (long_bool,   v_long);
141 DEFINE_BOOL_CHECK (ulong_bool,  v_ulong);
142 DEFINE_BOOL_CHECK (int64_bool,  v_int64);
143 DEFINE_BOOL_CHECK (uint64_bool, v_uint64);
144
145
146 /* string printouts
147  */
148 #define DEFINE_SPRINTF(func_name, from_member, format)                      \
149 static void                                                                 \
150 value_transform_##func_name (const GValue *src_value,                       \
151                              GValue       *dest_value)                      \
152 {                                                                           \
153   dest_value->data[0].v_pointer = g_strdup_printf ((format),                \
154                                                    src_value->data[0].from_member);             \
155 } extern void glib_dummy_decl (void)
156 DEFINE_SPRINTF (int_string,     v_int,    "%d");
157 DEFINE_SPRINTF (uint_string,    v_uint,   "%u");
158 DEFINE_SPRINTF (long_string,    v_long,   "%ld");
159 DEFINE_SPRINTF (ulong_string,   v_ulong,  "%lu");
160 DEFINE_SPRINTF (int64_string,   v_int64,  "%" G_GINT64_FORMAT);
161 DEFINE_SPRINTF (uint64_string,  v_uint64, "%" G_GUINT64_FORMAT);
162 DEFINE_SPRINTF (float_string,   v_float,  "%f");
163 DEFINE_SPRINTF (double_string,  v_double, "%f");
164
165
166 /* special cases
167  */
168 static void
169 value_transform_bool_string (const GValue *src_value,
170                              GValue       *dest_value)
171 {
172   dest_value->data[0].v_pointer = g_strdup_printf ("%s",
173                                                    src_value->data[0].v_int ?
174                                                    "TRUE" : "FALSE");
175 }
176 static void
177 value_transform_string_string (const GValue *src_value,
178                                GValue       *dest_value)
179 {
180   dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
181 }
182 static void
183 value_transform_enum_string (const GValue *src_value,
184                              GValue       *dest_value)
185 {
186   GEnumClass *class = g_type_class_ref (G_VALUE_TYPE (src_value));
187   GEnumValue *enum_value = g_enum_get_value (class, src_value->data[0].v_long);
188   
189   if (enum_value)
190     dest_value->data[0].v_pointer = g_strdup (enum_value->value_name);
191   else
192     dest_value->data[0].v_pointer = g_strdup_printf ("%ld", src_value->data[0].v_long);
193   
194   g_type_class_unref (class);
195 }
196 static void
197 value_transform_flags_string (const GValue *src_value,
198                               GValue       *dest_value)
199 {
200   GFlagsClass *class = g_type_class_ref (G_VALUE_TYPE (src_value));
201   GFlagsValue *flags_value = g_flags_get_first_value (class, src_value->data[0].v_ulong);
202   
203   if (flags_value)
204     {
205       GString *gstring = g_string_new (NULL);
206       guint v_flags = src_value->data[0].v_ulong;
207       
208       do
209         {
210           v_flags &= ~flags_value->value;
211           
212           if (gstring->str[0])
213             g_string_append (gstring, " | ");
214           g_string_append (gstring, flags_value->value_name);
215           flags_value = g_flags_get_first_value (class, v_flags);
216         }
217       while (flags_value && v_flags);
218       
219       if (v_flags)
220         dest_value->data[0].v_pointer = g_strdup_printf ("%s | %u",
221                                                          gstring->str,
222                                                          v_flags);
223       else
224         dest_value->data[0].v_pointer = g_strdup (gstring->str);
225       g_string_free (gstring, TRUE);
226     }
227   else
228     dest_value->data[0].v_pointer = g_strdup_printf ("%lu", src_value->data[0].v_ulong);
229   
230   g_type_class_unref (class);
231 }
232
233
234 /* registration
235  */
236 void
237 _g_value_transforms_init (void)
238 {
239   /* some transformations are a bit questionable,
240    * we currently skip those
241    */
242 #define SKIP____register_transform_func(type1,type2,transform_func)     /* skip questionable transforms */ \
243   (void)0
244   
245   /* numeric types (plus to string) */
246   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_CHAR,            value_transform_int_int);
247   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_UCHAR,           value_transform_int_u8);
248   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_BOOLEAN,         value_transform_int_bool);
249   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_INT,             value_transform_int_int);
250   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_UINT,            value_transform_int_uint);
251   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_LONG,            value_transform_int_long);
252   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_ULONG,           value_transform_int_ulong);
253   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_INT64,           value_transform_int_int64);
254   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_UINT64,          value_transform_int_uint64);
255   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_ENUM,            value_transform_int_long);
256   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_FLAGS,           value_transform_int_ulong);
257   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_FLOAT,           value_transform_int_float);
258   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_DOUBLE,          value_transform_int_double);
259   g_value_register_transform_func (G_TYPE_CHAR,         G_TYPE_STRING,          value_transform_int_string);
260   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_CHAR,            value_transform_uint_s8);
261   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_UCHAR,           value_transform_uint_uint);
262   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_BOOLEAN,         value_transform_uint_bool);
263   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_INT,             value_transform_uint_int);
264   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_UINT,            value_transform_uint_uint);
265   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_LONG,            value_transform_uint_long);
266   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_ULONG,           value_transform_uint_ulong);
267   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_INT64,           value_transform_uint_int64);
268   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_UINT64,          value_transform_uint_uint64);
269   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_ENUM,            value_transform_uint_long);
270   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_FLAGS,           value_transform_uint_ulong);
271   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_FLOAT,           value_transform_uint_float);
272   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_DOUBLE,          value_transform_uint_double);
273   g_value_register_transform_func (G_TYPE_UCHAR,        G_TYPE_STRING,          value_transform_uint_string);
274   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_CHAR,            value_transform_int_s8);
275   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_UCHAR,           value_transform_int_u8);
276   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_BOOLEAN,         value_transform_int_int);
277   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_INT,             value_transform_int_int);
278   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_UINT,            value_transform_int_uint);
279   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_LONG,            value_transform_int_long);
280   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_ULONG,           value_transform_int_ulong);
281   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_INT64,           value_transform_int_int64);
282   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_UINT64,          value_transform_int_uint64);
283   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_ENUM,            value_transform_int_long);
284   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_FLAGS,           value_transform_int_ulong);
285   SKIP____register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_FLOAT,           value_transform_int_float);
286   SKIP____register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_DOUBLE,          value_transform_int_double);
287   g_value_register_transform_func (G_TYPE_BOOLEAN,      G_TYPE_STRING,          value_transform_bool_string);
288   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_CHAR,            value_transform_int_s8);
289   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_UCHAR,           value_transform_int_u8);
290   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_BOOLEAN,         value_transform_int_bool);
291   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_INT,             value_transform_int_int);
292   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_UINT,            value_transform_int_uint);
293   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_LONG,            value_transform_int_long);
294   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_ULONG,           value_transform_int_ulong);
295   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_INT64,           value_transform_int_int64);
296   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_UINT64,          value_transform_int_uint64);
297   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_ENUM,            value_transform_int_long);
298   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_FLAGS,           value_transform_int_ulong);
299   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_FLOAT,           value_transform_int_float);
300   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_DOUBLE,          value_transform_int_double);
301   g_value_register_transform_func (G_TYPE_INT,          G_TYPE_STRING,          value_transform_int_string);
302   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_CHAR,            value_transform_uint_s8);
303   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_UCHAR,           value_transform_uint_u8);
304   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_BOOLEAN,         value_transform_uint_bool);
305   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_INT,             value_transform_uint_int);
306   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_UINT,            value_transform_uint_uint);
307   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_LONG,            value_transform_uint_long);
308   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_ULONG,           value_transform_uint_ulong);
309   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_INT64,           value_transform_uint_int64);
310   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_UINT64,          value_transform_uint_uint64);
311   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_ENUM,            value_transform_uint_long);
312   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_FLAGS,           value_transform_uint_ulong);
313   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_FLOAT,           value_transform_uint_float);
314   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_DOUBLE,          value_transform_uint_double);
315   g_value_register_transform_func (G_TYPE_UINT,         G_TYPE_STRING,          value_transform_uint_string);
316   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_CHAR,            value_transform_long_s8);
317   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_UCHAR,           value_transform_long_u8);
318   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_BOOLEAN,         value_transform_long_bool);
319   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_INT,             value_transform_long_int);
320   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_UINT,            value_transform_long_uint);
321   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_LONG,            value_transform_long_long);
322   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_ULONG,           value_transform_long_ulong);
323   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_INT64,           value_transform_long_int64);
324   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_UINT64,          value_transform_long_uint64);
325   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_ENUM,            value_transform_long_long);
326   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_FLAGS,           value_transform_long_ulong);
327   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_FLOAT,           value_transform_long_float);
328   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_DOUBLE,          value_transform_long_double);
329   g_value_register_transform_func (G_TYPE_LONG,         G_TYPE_STRING,          value_transform_long_string);
330   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_CHAR,            value_transform_ulong_s8);
331   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_UCHAR,           value_transform_ulong_u8);
332   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_BOOLEAN,         value_transform_ulong_bool);
333   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_INT,             value_transform_ulong_int);
334   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_UINT,            value_transform_ulong_uint);
335   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_LONG,            value_transform_ulong_long);
336   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_ULONG,           value_transform_ulong_ulong);
337   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_INT64,           value_transform_ulong_int64);
338   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_UINT64,          value_transform_ulong_uint64);
339   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_ENUM,            value_transform_ulong_long);
340   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_FLAGS,           value_transform_ulong_ulong);
341   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_FLOAT,           value_transform_ulong_float);
342   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_DOUBLE,          value_transform_ulong_double);
343   g_value_register_transform_func (G_TYPE_ULONG,        G_TYPE_STRING,          value_transform_ulong_string);
344   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_CHAR,            value_transform_int64_s8);
345   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_UCHAR,           value_transform_int64_u8);
346   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_BOOLEAN,         value_transform_int64_bool);
347   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_INT,             value_transform_int64_int);
348   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_UINT,            value_transform_int64_uint);
349   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_LONG,            value_transform_int64_long);
350   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_ULONG,           value_transform_int64_ulong);
351   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_INT64,           value_transform_int64_int64);
352   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_UINT64,          value_transform_int64_uint64);
353   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_ENUM,            value_transform_int64_long);
354   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_FLAGS,           value_transform_int64_ulong);
355   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_FLOAT,           value_transform_int64_float);
356   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_DOUBLE,          value_transform_int64_double);
357   g_value_register_transform_func (G_TYPE_INT64,        G_TYPE_STRING,          value_transform_int64_string);
358   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_CHAR,            value_transform_uint64_s8);
359   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_UCHAR,           value_transform_uint64_u8);
360   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_BOOLEAN,         value_transform_uint64_bool);
361   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_INT,             value_transform_uint64_int);
362   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_UINT,            value_transform_uint64_uint);
363   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_LONG,            value_transform_uint64_long);
364   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_ULONG,           value_transform_uint64_ulong);
365   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_INT64,           value_transform_uint64_int64);
366   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_UINT64,          value_transform_uint64_uint64);
367   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_ENUM,            value_transform_uint64_long);
368   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_FLAGS,           value_transform_uint64_ulong);
369   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_FLOAT,           value_transform_uint64_float);
370   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_DOUBLE,          value_transform_uint64_double);
371   g_value_register_transform_func (G_TYPE_UINT64,       G_TYPE_STRING,          value_transform_uint64_string);
372   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_CHAR,            value_transform_long_s8);
373   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_UCHAR,           value_transform_long_u8);
374   SKIP____register_transform_func (G_TYPE_ENUM,         G_TYPE_BOOLEAN,         value_transform_long_bool);
375   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_INT,             value_transform_long_int);
376   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_UINT,            value_transform_long_uint);
377   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_LONG,            value_transform_long_long);
378   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_ULONG,           value_transform_long_ulong);
379   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_INT64,           value_transform_long_int64);
380   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_UINT64,          value_transform_long_uint64);
381   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_ENUM,            value_transform_long_long);
382   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_FLAGS,           value_transform_long_ulong);
383   SKIP____register_transform_func (G_TYPE_ENUM,         G_TYPE_FLOAT,           value_transform_long_float);
384   SKIP____register_transform_func (G_TYPE_ENUM,         G_TYPE_DOUBLE,          value_transform_long_double);
385   g_value_register_transform_func (G_TYPE_ENUM,         G_TYPE_STRING,          value_transform_enum_string);
386   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_CHAR,            value_transform_ulong_s8);
387   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_UCHAR,           value_transform_ulong_u8);
388   SKIP____register_transform_func (G_TYPE_FLAGS,        G_TYPE_BOOLEAN,         value_transform_ulong_bool);
389   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_INT,             value_transform_ulong_int);
390   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_UINT,            value_transform_ulong_uint);
391   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_LONG,            value_transform_ulong_long);
392   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_ULONG,           value_transform_ulong_ulong);
393   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_INT64,           value_transform_ulong_int64);
394   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_UINT64,          value_transform_ulong_uint64);
395   SKIP____register_transform_func (G_TYPE_FLAGS,        G_TYPE_ENUM,            value_transform_ulong_long);
396   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_FLAGS,           value_transform_ulong_ulong);
397   SKIP____register_transform_func (G_TYPE_FLAGS,        G_TYPE_FLOAT,           value_transform_ulong_float);
398   SKIP____register_transform_func (G_TYPE_FLAGS,        G_TYPE_DOUBLE,          value_transform_ulong_double);
399   g_value_register_transform_func (G_TYPE_FLAGS,        G_TYPE_STRING,          value_transform_flags_string);
400   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_CHAR,            value_transform_float_s8);
401   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_UCHAR,           value_transform_float_u8);
402   SKIP____register_transform_func (G_TYPE_FLOAT,        G_TYPE_BOOLEAN,         value_transform_float_bool);
403   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_INT,             value_transform_float_int);
404   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_UINT,            value_transform_float_uint);
405   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_LONG,            value_transform_float_long);
406   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_ULONG,           value_transform_float_ulong);
407   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_INT64,           value_transform_float_int64);
408   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_UINT64,          value_transform_float_uint64);
409   SKIP____register_transform_func (G_TYPE_FLOAT,        G_TYPE_ENUM,            value_transform_float_long);
410   SKIP____register_transform_func (G_TYPE_FLOAT,        G_TYPE_FLAGS,           value_transform_float_ulong);
411   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_FLOAT,           value_transform_float_float);
412   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_DOUBLE,          value_transform_float_double);
413   g_value_register_transform_func (G_TYPE_FLOAT,        G_TYPE_STRING,          value_transform_float_string);
414   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_CHAR,            value_transform_double_s8);
415   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_UCHAR,           value_transform_double_u8);
416   SKIP____register_transform_func (G_TYPE_DOUBLE,       G_TYPE_BOOLEAN,         value_transform_double_bool);
417   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_INT,             value_transform_double_int);
418   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_UINT,            value_transform_double_uint);
419   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_LONG,            value_transform_double_long);
420   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_ULONG,           value_transform_double_ulong);
421   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_INT64,           value_transform_double_int64);
422   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_UINT64,          value_transform_double_uint64);
423   SKIP____register_transform_func (G_TYPE_DOUBLE,       G_TYPE_ENUM,            value_transform_double_long);
424   SKIP____register_transform_func (G_TYPE_DOUBLE,       G_TYPE_FLAGS,           value_transform_double_ulong);
425   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_FLOAT,           value_transform_double_float);
426   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_DOUBLE,          value_transform_double_double);
427   g_value_register_transform_func (G_TYPE_DOUBLE,       G_TYPE_STRING,          value_transform_double_string);
428   /* string types */
429   g_value_register_transform_func (G_TYPE_STRING,       G_TYPE_STRING,          value_transform_string_string);
430 }