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