/* objects_bug644938.c generated by valac, the Vala compiler * generated from objects_bug644938.vala, do not modify */ #include #include #if !defined(VALA_EXTERN) #if defined(_WIN32) || defined(__CYGWIN__) #define VALA_EXTERN __declspec(dllexport) extern #elif __GNUC__ >= 4 #define VALA_EXTERN __attribute__((visibility("default"))) extern #else #define VALA_EXTERN extern #endif #endif #define TYPE_FOO (foo_get_type ()) #define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo)) #define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass)) #define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO)) #define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO)) #define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass)) typedef struct _Foo Foo; typedef struct _FooClass FooClass; typedef struct _FooPrivate FooPrivate; enum { FOO_0_PROPERTY, FOO_TYPE_PARAM_TYPE, FOO_TYPE_PARAM_DUP_FUNC, FOO_TYPE_PARAM_DESTROY_FUNC, FOO_NUM_PROPERTIES }; static GParamSpec* foo_properties[FOO_NUM_PROPERTIES]; #define TYPE_BAR (bar_get_type ()) #define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar)) #define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass)) #define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR)) #define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR)) #define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass)) typedef struct _Bar Bar; typedef struct _BarClass BarClass; typedef struct _BarPrivate BarPrivate; enum { BAR_0_PROPERTY, BAR_NUM_PROPERTIES }; static GParamSpec* bar_properties[BAR_NUM_PROPERTIES]; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) struct _Foo { GObject parent_instance; FooPrivate * priv; }; struct _FooClass { GObjectClass parent_class; void (*method) (Foo* self, gconstpointer o); }; struct _FooPrivate { GType type_param_type; GBoxedCopyFunc type_param_dup_func; GDestroyNotify type_param_destroy_func; }; struct _Bar { Foo parent_instance; BarPrivate * priv; }; struct _BarClass { FooClass parent_class; }; static gint Foo_private_offset; static gpointer foo_parent_class = NULL; static gpointer bar_parent_class = NULL; VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref) VALA_EXTERN void foo_method (Foo* self, gconstpointer o); static void foo_real_method (Foo* self, gconstpointer o); VALA_EXTERN Foo* foo_construct (GType object_type, GType type_param_type, GBoxedCopyFunc type_param_dup_func, GDestroyNotify type_param_destroy_func); static GType foo_get_type_once (void); static void _vala_foo_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void _vala_foo_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref) static void bar_real_method (Foo* base, gint i); VALA_EXTERN Bar* bar_new (void); VALA_EXTERN Bar* bar_construct (GType object_type); static GType bar_get_type_once (void); static void _vala_main (void); static inline gpointer foo_get_instance_private (Foo* self) { return G_STRUCT_MEMBER_P (self, Foo_private_offset); } static void foo_real_method (Foo* self, gconstpointer o) { g_critical ("Type `%s' does not implement abstract method `foo_method'", g_type_name (G_TYPE_FROM_INSTANCE (self))); return; } void foo_method (Foo* self, gconstpointer o) { FooClass* _klass_; g_return_if_fail (IS_FOO (self)); _klass_ = FOO_GET_CLASS (self); if (_klass_->method) { _klass_->method (self, o); } } Foo* foo_construct (GType object_type, GType type_param_type, GBoxedCopyFunc type_param_dup_func, GDestroyNotify type_param_destroy_func) { Foo * self = NULL; self = (Foo*) g_object_new (object_type, "type-param-type", type_param_type, "type-param-dup-func", type_param_dup_func, "type-param-destroy-func", type_param_destroy_func, NULL); self->priv->type_param_type = type_param_type; self->priv->type_param_dup_func = type_param_dup_func; self->priv->type_param_destroy_func = type_param_destroy_func; return self; } static void foo_class_init (FooClass * klass, gpointer klass_data) { foo_parent_class = g_type_class_peek_parent (klass); g_type_class_adjust_private_offset (klass, &Foo_private_offset); ((FooClass *) klass)->method = (void (*) (Foo*, gconstpointer)) foo_real_method; G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property; G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property; g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_TYPE_PARAM_TYPE, g_param_spec_gtype ("type-param-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_TYPE_PARAM_DUP_FUNC, g_param_spec_pointer ("type-param-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_TYPE_PARAM_DESTROY_FUNC, g_param_spec_pointer ("type-param-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } static void foo_instance_init (Foo * self, gpointer klass) { self->priv = foo_get_instance_private (self); } static GType foo_get_type_once (void) { static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, (GInstanceInitFunc) foo_instance_init, NULL }; GType foo_type_id; foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, G_TYPE_FLAG_ABSTRACT); Foo_private_offset = g_type_add_instance_private (foo_type_id, sizeof (FooPrivate)); return foo_type_id; } GType foo_get_type (void) { static volatile gsize foo_type_id__once = 0; if (g_once_init_enter (&foo_type_id__once)) { GType foo_type_id; foo_type_id = foo_get_type_once (); g_once_init_leave (&foo_type_id__once, foo_type_id); } return foo_type_id__once; } static void _vala_foo_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { Foo * self; self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo); switch (property_id) { case FOO_TYPE_PARAM_TYPE: g_value_set_gtype (value, self->priv->type_param_type); break; case FOO_TYPE_PARAM_DUP_FUNC: g_value_set_pointer (value, self->priv->type_param_dup_func); break; case FOO_TYPE_PARAM_DESTROY_FUNC: g_value_set_pointer (value, self->priv->type_param_destroy_func); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void _vala_foo_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { Foo * self; self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_FOO, Foo); switch (property_id) { case FOO_TYPE_PARAM_TYPE: self->priv->type_param_type = g_value_get_gtype (value); break; case FOO_TYPE_PARAM_DUP_FUNC: self->priv->type_param_dup_func = g_value_get_pointer (value); break; case FOO_TYPE_PARAM_DESTROY_FUNC: self->priv->type_param_destroy_func = g_value_get_pointer (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void bar_real_method (Foo* base, gint i) { Bar * self; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar); } Bar* bar_construct (GType object_type) { Bar * self = NULL; self = (Bar*) foo_construct (object_type, G_TYPE_INT, NULL, NULL); return self; } Bar* bar_new (void) { return bar_construct (TYPE_BAR); } static void bar_class_init (BarClass * klass, gpointer klass_data) { bar_parent_class = g_type_class_peek_parent (klass); ((FooClass *) klass)->method = (void (*) (Foo*, gconstpointer)) bar_real_method; } static void bar_instance_init (Bar * self, gpointer klass) { } static GType bar_get_type_once (void) { static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, (GInstanceInitFunc) bar_instance_init, NULL }; GType bar_type_id; bar_type_id = g_type_register_static (TYPE_FOO, "Bar", &g_define_type_info, 0); return bar_type_id; } GType bar_get_type (void) { static volatile gsize bar_type_id__once = 0; if (g_once_init_enter (&bar_type_id__once)) { GType bar_type_id; bar_type_id = bar_get_type_once (); g_once_init_leave (&bar_type_id__once, bar_type_id); } return bar_type_id__once; } static void _vala_main (void) { Bar* bar = NULL; Bar* _tmp0_; _tmp0_ = bar_new (); bar = _tmp0_; _g_object_unref0 (bar); } int main (int argc, char ** argv) { _vala_main (); return 0; }