/* methods_array_length_type.c generated by valac, the Vala compiler * generated from methods_array_length_type.vala, do not modify */ #include #include #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 typedef gint* (*FooFunc) (gint* p, guint8 p_length1, guint8* result_length1, gpointer user_data); #define TYPE_IFOO (ifoo_get_type ()) #define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo)) #define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO)) #define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface)) typedef struct _IFoo IFoo; typedef struct _IFooIface IFooIface; #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; typedef struct _ParamSpecFoo ParamSpecFoo; #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; #define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL))) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); struct _IFooIface { GTypeInterface parent_iface; gint* (*get_foo) (IFoo* self, guint8* result_length1); void (*set_foo) (IFoo* self, gint** p, guint8* p_length1); gint* (*get_manam) (IFoo* self, guint8* result_length1); void (*set_manam) (IFoo* self, gint* value, guint8 value_length1); }; struct _Foo { GTypeInstance parent_instance; volatile int ref_count; FooPrivate * priv; }; struct _FooClass { GTypeClass parent_class; void (*finalize) (Foo *self); gint* (*get_bar) (Foo* self, guint8* result_length1); void (*set_bar) (Foo* self, gint** p, guint8* p_length1); gint* (*get_manar) (Foo* self, guint8* result_length1); void (*set_manar) (Foo* self, gint* value, guint8 value_length1); }; struct _FooPrivate { gint* _manam; gint _manam_length1; gint __manam_size_; gint* _manar; gint _manar_length1; gint __manar_size_; }; struct _ParamSpecFoo { GParamSpec parent_instance; }; struct _Bar { Foo parent_instance; BarPrivate * priv; }; struct _BarClass { FooClass parent_class; }; struct _BarPrivate { gint* _manar; gint _manar_length1; gint __manar_size_; }; static gint Foo_private_offset; static gpointer foo_parent_class = NULL; static IFooIface * foo_ifoo_parent_iface = NULL; static gint Bar_private_offset; static gpointer bar_parent_class = NULL; VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ; VALA_EXTERN gint* ifoo_get_foo (IFoo* self, guint8* result_length1); VALA_EXTERN void ifoo_set_foo (IFoo* self, gint** p, guint8* p_length1); VALA_EXTERN gint* ifoo_get_manam (IFoo* self, guint8* result_length1); VALA_EXTERN void ifoo_set_manam (IFoo* self, gint* value, guint8 value_length1); static GType ifoo_get_type_once (void); VALA_EXTERN gpointer foo_ref (gpointer instance); VALA_EXTERN void foo_unref (gpointer instance); VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); VALA_EXTERN void value_set_foo (GValue* value, gpointer v_object); VALA_EXTERN void value_take_foo (GValue* value, gpointer v_object); VALA_EXTERN gpointer value_get_foo (const GValue* value); VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref) VALA_EXTERN gint* foo_get_bar (Foo* self, guint8* result_length1); VALA_EXTERN void foo_set_bar (Foo* self, gint** p, guint8* p_length1); VALA_EXTERN gint* foo_get_manar (Foo* self, guint8* result_length1); VALA_EXTERN void foo_set_manar (Foo* self, gint* value, guint8 value_length1); static gint* foo_real_get_foo (IFoo* base, guint8* result_length1); static void foo_real_set_foo (IFoo* base, gint** p, guint8* p_length1); static gint* foo_real_get_bar (Foo* self, guint8* result_length1); static void foo_real_set_bar (Foo* self, gint** p, guint8* p_length1); VALA_EXTERN Foo* foo_new (void); VALA_EXTERN Foo* foo_construct (GType object_type); static gint* _vala_array_dup1 (gint* self, gssize length); static gint* _vala_array_dup2 (gint* self, gssize length); static void foo_finalize (Foo * obj); static GType foo_get_type_once (void); VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, foo_unref) static gint* bar_real_get_bar (Foo* base, guint8* result_length1); static void bar_real_set_bar (Foo* base, gint** p, guint8* p_length1); VALA_EXTERN Bar* bar_new (void); VALA_EXTERN Bar* bar_construct (GType object_type); static gint* _vala_array_dup3 (gint* self, gssize length); static void bar_finalize (Foo * obj); static GType bar_get_type_once (void); VALA_EXTERN gint* get_foo (guint8* result_length1); VALA_EXTERN void set_foo (gint** p, guint8* p_length1); VALA_EXTERN gint* foo_func (gint* p, guint8 p_length1, guint8* result_length1); static gint* _vala_array_dup4 (gint* self, gssize length); static void _vala_main (void); static gint* ___lambda4_ (gint* a, guint8 a_length1, guint8* result_length1); static gint* _vala_array_dup5 (gint* self, gssize length); static gint* ____lambda4__foo_func (gint* p, guint8 p_length1, guint8* result_length1, gpointer self); static inline gpointer _vala_memdup2 (gconstpointer mem, gsize byte_size); gint* ifoo_get_foo (IFoo* self, guint8* result_length1) { IFooIface* _iface_; g_return_val_if_fail (IS_IFOO (self), NULL); _iface_ = IFOO_GET_INTERFACE (self); if (_iface_->get_foo) { return _iface_->get_foo (self, result_length1); } return NULL; } void ifoo_set_foo (IFoo* self, gint** p, guint8* p_length1) { IFooIface* _iface_; g_return_if_fail (IS_IFOO (self)); _iface_ = IFOO_GET_INTERFACE (self); if (_iface_->set_foo) { _iface_->set_foo (self, p, p_length1); } } gint* ifoo_get_manam (IFoo* self, guint8* result_length1) { IFooIface* _iface_; g_return_val_if_fail (IS_IFOO (self), NULL); _iface_ = IFOO_GET_INTERFACE (self); if (_iface_->get_manam) { return _iface_->get_manam (self, result_length1); } return NULL; } void ifoo_set_manam (IFoo* self, gint* value, guint8 value_length1) { IFooIface* _iface_; g_return_if_fail (IS_IFOO (self)); _iface_ = IFOO_GET_INTERFACE (self); if (_iface_->set_manam) { _iface_->set_manam (self, value, value_length1); } } static void ifoo_default_init (IFooIface * iface, gpointer iface_data) { } static GType ifoo_get_type_once (void) { static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; GType ifoo_type_id; ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0); return ifoo_type_id; } GType ifoo_get_type (void) { static volatile gsize ifoo_type_id__once = 0; if (g_once_init_enter (&ifoo_type_id__once)) { GType ifoo_type_id; ifoo_type_id = ifoo_get_type_once (); g_once_init_leave (&ifoo_type_id__once, ifoo_type_id); } return ifoo_type_id__once; } static inline gpointer foo_get_instance_private (Foo* self) { return G_STRUCT_MEMBER_P (self, Foo_private_offset); } static gint* foo_real_get_foo (IFoo* base, guint8* result_length1) { Foo * self; gint* res = NULL; gint* _tmp0_; gint res_length1; gint _res_size_; gint* _tmp1_; gint _tmp1__length1; gint* result; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo); _tmp0_ = g_new0 (gint, 255); res = _tmp0_; res_length1 = 255; _res_size_ = res_length1; res[254] = 4711; _tmp1_ = res; _tmp1__length1 = res_length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; return result; } static void foo_real_set_foo (IFoo* base, gint** p, guint8* p_length1) { Foo * self; gint* _vala_p = NULL; guint8 _vala_p_length1 = 0; gint* _tmp0_; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo); _tmp0_ = g_new0 (gint, 255); _vala_p = (g_free (_vala_p), NULL); _vala_p = _tmp0_; _vala_p_length1 = 255; _vala_p[254] = 4711; if (p) { *p = _vala_p; } else { _vala_p = (g_free (_vala_p), NULL); } if (p_length1) { *p_length1 = _vala_p_length1; } } static gint* foo_real_get_bar (Foo* self, guint8* result_length1) { gint* res = NULL; gint* _tmp0_; gint res_length1; gint _res_size_; gint* _tmp1_; gint _tmp1__length1; gint* result; _tmp0_ = g_new0 (gint, 255); res = _tmp0_; res_length1 = 255; _res_size_ = res_length1; res[254] = 4711; _tmp1_ = res; _tmp1__length1 = res_length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; return result; } gint* foo_get_bar (Foo* self, guint8* result_length1) { FooClass* _klass_; g_return_val_if_fail (IS_FOO (self), NULL); _klass_ = FOO_GET_CLASS (self); if (_klass_->get_bar) { return _klass_->get_bar (self, result_length1); } return NULL; } static void foo_real_set_bar (Foo* self, gint** p, guint8* p_length1) { gint* _vala_p = NULL; guint8 _vala_p_length1 = 0; gint* _tmp0_; _tmp0_ = g_new0 (gint, 255); _vala_p = (g_free (_vala_p), NULL); _vala_p = _tmp0_; _vala_p_length1 = 255; _vala_p[254] = 4711; if (p) { *p = _vala_p; } else { _vala_p = (g_free (_vala_p), NULL); } if (p_length1) { *p_length1 = _vala_p_length1; } } void foo_set_bar (Foo* self, gint** p, guint8* p_length1) { FooClass* _klass_; g_return_if_fail (IS_FOO (self)); _klass_ = FOO_GET_CLASS (self); if (_klass_->set_bar) { _klass_->set_bar (self, p, p_length1); } } Foo* foo_construct (GType object_type) { Foo* self = NULL; self = (Foo*) g_type_create_instance (object_type); { gint* a = NULL; guint8 _tmp0_ = 0; gint* _tmp1_; gint a_length1; gint _a_size_; gint _tmp2_; _tmp1_ = ifoo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), &_tmp0_); a = _tmp1_; a_length1 = _tmp0_; _a_size_ = a_length1; _vala_assert (a_length1 == 255, "a.length == 255"); _tmp2_ = a[254]; _vala_assert (_tmp2_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); } { gint* a = NULL; gint a_length1; gint _a_size_; gint* _tmp3_ = NULL; guint8 _tmp4_ = 0; gint* _tmp5_; gint _tmp5__length1; gint* _tmp6_; gint _tmp6__length1; gint _tmp7_; a = NULL; a_length1 = 0; _a_size_ = a_length1; ifoo_set_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), &_tmp3_, &_tmp4_); a = (g_free (a), NULL); a = _tmp3_; a_length1 = _tmp4_; _a_size_ = a_length1; _tmp5_ = a; _tmp5__length1 = a_length1; _vala_assert (_tmp5__length1 == 255, "a.length == 255"); _tmp6_ = a; _tmp6__length1 = a_length1; _tmp7_ = _tmp6_[254]; _vala_assert (_tmp7_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); } return self; } Foo* foo_new (void) { return foo_construct (TYPE_FOO); } static gint* foo_real_get_manam (IFoo* base, guint8* result_length1) { gint* result; Foo* self; gint* _tmp0_; gint _tmp0__length1; gint* _tmp1_; gint _tmp1__length1; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo); _tmp0_ = self->priv->_manam; _tmp0__length1 = self->priv->_manam_length1; _tmp1_ = _tmp0_; _tmp1__length1 = _tmp0__length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; return result; } static gint* _vala_array_dup1 (gint* self, gssize length) { if (length > 0) { return _vala_memdup2 (self, length * sizeof (gint)); } return NULL; } static void foo_real_set_manam (IFoo* base, gint* value, guint8 value_length1) { Foo* self; gint* _tmp0_; gint _tmp0__length1; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_FOO, Foo); _tmp0_ = (value != NULL) ? _vala_array_dup1 (value, value_length1) : value; _tmp0__length1 = value_length1; self->priv->_manam = (g_free (self->priv->_manam), NULL); self->priv->_manam = _tmp0_; self->priv->_manam_length1 = _tmp0__length1; self->priv->__manam_size_ = self->priv->_manam_length1; } gint* foo_get_manar (Foo* self, guint8* result_length1) { FooClass* _klass_; g_return_val_if_fail (IS_FOO (self), NULL); _klass_ = FOO_GET_CLASS (self); if (_klass_->get_manar) { return _klass_->get_manar (self, result_length1); } return NULL; } static gint* foo_real_get_manar (Foo* base, guint8* result_length1) { gint* result; Foo* self; gint* _tmp0_; gint _tmp0__length1; gint* _tmp1_; gint _tmp1__length1; self = base; _tmp0_ = self->priv->_manar; _tmp0__length1 = self->priv->_manar_length1; _tmp1_ = _tmp0_; _tmp1__length1 = _tmp0__length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; return result; } void foo_set_manar (Foo* self, gint* value, guint8 value_length1) { FooClass* _klass_; g_return_if_fail (IS_FOO (self)); _klass_ = FOO_GET_CLASS (self); if (_klass_->set_manar) { _klass_->set_manar (self, value, value_length1); } } static gint* _vala_array_dup2 (gint* self, gssize length) { if (length > 0) { return _vala_memdup2 (self, length * sizeof (gint)); } return NULL; } static void foo_real_set_manar (Foo* base, gint* value, guint8 value_length1) { Foo* self; gint* _tmp0_; gint _tmp0__length1; self = base; _tmp0_ = (value != NULL) ? _vala_array_dup2 (value, value_length1) : value; _tmp0__length1 = value_length1; self->priv->_manar = (g_free (self->priv->_manar), NULL); self->priv->_manar = _tmp0_; self->priv->_manar_length1 = _tmp0__length1; self->priv->__manar_size_ = self->priv->_manar_length1; } static void value_foo_init (GValue* value) { value->data[0].v_pointer = NULL; } static void value_foo_free_value (GValue* value) { if (value->data[0].v_pointer) { foo_unref (value->data[0].v_pointer); } } static void value_foo_copy_value (const GValue* src_value, GValue* dest_value) { if (src_value->data[0].v_pointer) { dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer); } else { dest_value->data[0].v_pointer = NULL; } } static gpointer value_foo_peek_pointer (const GValue* value) { return value->data[0].v_pointer; } static gchar* value_foo_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { if (collect_values[0].v_pointer) { Foo * object; object = collect_values[0].v_pointer; if (object->parent_instance.g_class == NULL) { return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); } value->data[0].v_pointer = foo_ref (object); } else { value->data[0].v_pointer = NULL; } return NULL; } static gchar* value_foo_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { Foo ** object_p; object_p = collect_values[0].v_pointer; if (!object_p) { return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); } if (!value->data[0].v_pointer) { *object_p = NULL; } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) { *object_p = value->data[0].v_pointer; } else { *object_p = foo_ref (value->data[0].v_pointer); } return NULL; } GParamSpec* param_spec_foo (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { ParamSpecFoo* spec; g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL); spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); G_PARAM_SPEC (spec)->value_type = object_type; return G_PARAM_SPEC (spec); } gpointer value_get_foo (const GValue* value) { g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL); return value->data[0].v_pointer; } void value_set_foo (GValue* value, gpointer v_object) { Foo * old; g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO)); old = value->data[0].v_pointer; if (v_object) { g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO)); g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); value->data[0].v_pointer = v_object; foo_ref (value->data[0].v_pointer); } else { value->data[0].v_pointer = NULL; } if (old) { foo_unref (old); } } void value_take_foo (GValue* value, gpointer v_object) { Foo * old; g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO)); old = value->data[0].v_pointer; if (v_object) { g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO)); g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); value->data[0].v_pointer = v_object; } else { value->data[0].v_pointer = NULL; } if (old) { foo_unref (old); } } static void foo_class_init (FooClass * klass, gpointer klass_data) { foo_parent_class = g_type_class_peek_parent (klass); ((FooClass *) klass)->finalize = foo_finalize; g_type_class_adjust_private_offset (klass, &Foo_private_offset); ((FooClass *) klass)->get_bar = (gint* (*) (Foo*, guint8*)) foo_real_get_bar; ((FooClass *) klass)->set_bar = (void (*) (Foo*, gint**, guint8*)) foo_real_set_bar; FOO_CLASS (klass)->get_manar = (gint* (*) (Foo*, guint8*)) foo_real_get_manar; FOO_CLASS (klass)->set_manar = (void (*) (Foo*, gint*, guint8)) foo_real_set_manar; } static void foo_ifoo_interface_init (IFooIface * iface, gpointer iface_data) { foo_ifoo_parent_iface = g_type_interface_peek_parent (iface); iface->get_foo = (gint* (*) (IFoo*, guint8*)) foo_real_get_foo; iface->set_foo = (void (*) (IFoo*, gint**, guint8*)) foo_real_set_foo; iface->get_manam = foo_real_get_manam; iface->set_manam = foo_real_set_manam; } static void foo_instance_init (Foo * self, gpointer klass) { self->priv = foo_get_instance_private (self); self->ref_count = 1; } static void foo_finalize (Foo * obj) { Foo * self; self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo); g_signal_handlers_destroy (self); self->priv->_manam = (g_free (self->priv->_manam), NULL); self->priv->_manar = (g_free (self->priv->_manar), NULL); } static GType foo_get_type_once (void) { static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value }; 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, &g_define_type_value_table }; static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; static const GInterfaceInfo ifoo_info = { (GInterfaceInitFunc) foo_ifoo_interface_init, (GInterfaceFinalizeFunc) NULL, NULL}; GType foo_type_id; foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, &g_define_type_fundamental_info, 0); g_type_add_interface_static (foo_type_id, TYPE_IFOO, &ifoo_info); 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; } gpointer foo_ref (gpointer instance) { Foo * self; self = instance; g_atomic_int_inc (&self->ref_count); return instance; } void foo_unref (gpointer instance) { Foo * self; self = instance; if (g_atomic_int_dec_and_test (&self->ref_count)) { FOO_GET_CLASS (self)->finalize (self); g_type_free_instance ((GTypeInstance *) self); } } static inline gpointer bar_get_instance_private (Bar* self) { return G_STRUCT_MEMBER_P (self, Bar_private_offset); } static gint* bar_real_get_bar (Foo* base, guint8* result_length1) { Bar * self; gint* res = NULL; gint* _tmp0_; gint res_length1; gint _res_size_; gint* _tmp1_; gint _tmp1__length1; gint* result; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar); _tmp0_ = g_new0 (gint, 255); res = _tmp0_; res_length1 = 255; _res_size_ = res_length1; res[254] = 4711; _tmp1_ = res; _tmp1__length1 = res_length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; return result; } static void bar_real_set_bar (Foo* base, gint** p, guint8* p_length1) { Bar * self; gint* _vala_p = NULL; guint8 _vala_p_length1 = 0; gint* _tmp0_; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar); _tmp0_ = g_new0 (gint, 255); _vala_p = (g_free (_vala_p), NULL); _vala_p = _tmp0_; _vala_p_length1 = 255; _vala_p[254] = 4711; if (p) { *p = _vala_p; } else { _vala_p = (g_free (_vala_p), NULL); } if (p_length1) { *p_length1 = _vala_p_length1; } } Bar* bar_construct (GType object_type) { Bar* self = NULL; self = (Bar*) foo_construct (object_type); { gint* a = NULL; guint8 _tmp0_ = 0; gint* _tmp1_; gint a_length1; gint _a_size_; gint _tmp2_; _tmp1_ = ifoo_get_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), &_tmp0_); a = _tmp1_; a_length1 = _tmp0_; _a_size_ = a_length1; _vala_assert (a_length1 == 255, "a.length == 255"); _tmp2_ = a[254]; _vala_assert (_tmp2_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); } { gint* a = NULL; gint a_length1; gint _a_size_; gint* _tmp3_ = NULL; guint8 _tmp4_ = 0; gint* _tmp5_; gint _tmp5__length1; gint* _tmp6_; gint _tmp6__length1; gint _tmp7_; a = NULL; a_length1 = 0; _a_size_ = a_length1; ifoo_set_foo (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_IFOO, IFoo), &_tmp3_, &_tmp4_); a = (g_free (a), NULL); a = _tmp3_; a_length1 = _tmp4_; _a_size_ = a_length1; _tmp5_ = a; _tmp5__length1 = a_length1; _vala_assert (_tmp5__length1 == 255, "a.length == 255"); _tmp6_ = a; _tmp6__length1 = a_length1; _tmp7_ = _tmp6_[254]; _vala_assert (_tmp7_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); } { gint* a = NULL; guint8 _tmp8_ = 0; gint* _tmp9_; gint a_length1; gint _a_size_; gint _tmp10_; _tmp9_ = foo_get_bar (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), &_tmp8_); a = _tmp9_; a_length1 = _tmp8_; _a_size_ = a_length1; _vala_assert (a_length1 == 255, "a.length == 255"); _tmp10_ = a[254]; _vala_assert (_tmp10_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); } { gint* a = NULL; gint a_length1; gint _a_size_; gint* _tmp11_ = NULL; guint8 _tmp12_ = 0; gint* _tmp13_; gint _tmp13__length1; gint* _tmp14_; gint _tmp14__length1; gint _tmp15_; a = NULL; a_length1 = 0; _a_size_ = a_length1; foo_set_bar (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo), &_tmp11_, &_tmp12_); a = (g_free (a), NULL); a = _tmp11_; a_length1 = _tmp12_; _a_size_ = a_length1; _tmp13_ = a; _tmp13__length1 = a_length1; _vala_assert (_tmp13__length1 == 255, "a.length == 255"); _tmp14_ = a; _tmp14__length1 = a_length1; _tmp15_ = _tmp14_[254]; _vala_assert (_tmp15_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); } return self; } Bar* bar_new (void) { return bar_construct (TYPE_BAR); } static gint* bar_real_get_manar (Foo* base, guint8* result_length1) { gint* result; Bar* self; gint* _tmp0_; gint _tmp0__length1; gint* _tmp1_; gint _tmp1__length1; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar); _tmp0_ = self->priv->_manar; _tmp0__length1 = self->priv->_manar_length1; _tmp1_ = _tmp0_; _tmp1__length1 = _tmp0__length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; return result; } static gint* _vala_array_dup3 (gint* self, gssize length) { if (length > 0) { return _vala_memdup2 (self, length * sizeof (gint)); } return NULL; } static void bar_real_set_manar (Foo* base, gint* value, guint8 value_length1) { Bar* self; gint* _tmp0_; gint _tmp0__length1; self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_BAR, Bar); _tmp0_ = (value != NULL) ? _vala_array_dup3 (value, value_length1) : value; _tmp0__length1 = value_length1; self->priv->_manar = (g_free (self->priv->_manar), NULL); self->priv->_manar = _tmp0_; self->priv->_manar_length1 = _tmp0__length1; self->priv->__manar_size_ = self->priv->_manar_length1; } static void bar_class_init (BarClass * klass, gpointer klass_data) { bar_parent_class = g_type_class_peek_parent (klass); ((FooClass *) klass)->finalize = bar_finalize; g_type_class_adjust_private_offset (klass, &Bar_private_offset); ((FooClass *) klass)->get_bar = (gint* (*) (Foo*, guint8*)) bar_real_get_bar; ((FooClass *) klass)->set_bar = (void (*) (Foo*, gint**, guint8*)) bar_real_set_bar; FOO_CLASS (klass)->get_manar = (gint* (*) (Foo*, guint8*)) bar_real_get_manar; FOO_CLASS (klass)->set_manar = (void (*) (Foo*, gint*, guint8)) bar_real_set_manar; } static void bar_instance_init (Bar * self, gpointer klass) { self->priv = bar_get_instance_private (self); } static void bar_finalize (Foo * obj) { Bar * self; self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar); self->priv->_manar = (g_free (self->priv->_manar), NULL); FOO_CLASS (bar_parent_class)->finalize (obj); } 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); Bar_private_offset = g_type_add_instance_private (bar_type_id, sizeof (BarPrivate)); 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; } gint* get_foo (guint8* result_length1) { gint* res = NULL; gint* _tmp0_; gint res_length1; gint _res_size_; gint* _tmp1_; gint _tmp1__length1; gint* result; _tmp0_ = g_new0 (gint, 255); res = _tmp0_; res_length1 = 255; _res_size_ = res_length1; res[254] = 4711; _tmp1_ = res; _tmp1__length1 = res_length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; return result; } void set_foo (gint** p, guint8* p_length1) { gint* _vala_p = NULL; guint8 _vala_p_length1 = 0; gint* _tmp0_; _tmp0_ = g_new0 (gint, 255); _vala_p = (g_free (_vala_p), NULL); _vala_p = _tmp0_; _vala_p_length1 = 255; _vala_p[254] = 4711; if (p) { *p = _vala_p; } else { _vala_p = (g_free (_vala_p), NULL); } if (p_length1) { *p_length1 = _vala_p_length1; } } static gint* _vala_array_dup4 (gint* self, gssize length) { if (length > 0) { return _vala_memdup2 (self, length * sizeof (gint)); } return NULL; } gint* foo_func (gint* p, guint8 p_length1, guint8* result_length1) { gint* _tmp0_; gint _tmp0__length1; gint* _tmp1_; gint _tmp1__length1; gint* result; _tmp0_ = (p != NULL) ? _vala_array_dup4 (p, p_length1) : p; _tmp0__length1 = p_length1; _tmp1_ = _tmp0_; _tmp1__length1 = _tmp0__length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; p = (g_free (p), NULL); return result; } static gint* _vala_array_dup5 (gint* self, gssize length) { if (length > 0) { return _vala_memdup2 (self, length * sizeof (gint)); } return NULL; } static gint* ___lambda4_ (gint* a, guint8 a_length1, guint8* result_length1) { gint* _tmp0_; gint _tmp0__length1; gint* _tmp1_; gint _tmp1__length1; gint* result; _tmp0_ = (a != NULL) ? _vala_array_dup5 (a, a_length1) : a; _tmp0__length1 = a_length1; _tmp1_ = _tmp0_; _tmp1__length1 = _tmp0__length1; if (result_length1) { *result_length1 = _tmp1__length1; } result = _tmp1_; a = (g_free (a), NULL); return result; } static gint* ____lambda4__foo_func (gint* p, guint8 p_length1, guint8* result_length1, gpointer self) { gint* result; result = ___lambda4_ (p, p_length1, result_length1); return result; } static void _vala_main (void) { { FooFunc f = NULL; gpointer f_target; GDestroyNotify f_target_destroy_notify; gint* a = NULL; gint* _tmp0_; gint a_length1; gint _a_size_; gint* _tmp1_; gint _tmp1__length1; gint* _tmp2_; gint _tmp2__length1; guint8 _tmp3_ = 0; gint* _tmp4_; gint* _tmp5_; gint _tmp5__length1; gint* _tmp6_; gint _tmp6__length1; gint _tmp7_; f = ____lambda4__foo_func; f_target = NULL; f_target_destroy_notify = NULL; _tmp0_ = g_new0 (gint, 255); a = _tmp0_; a_length1 = 255; _a_size_ = a_length1; _tmp1_ = a; _tmp1__length1 = a_length1; _tmp1_[254] = 4711; _tmp2_ = a; _tmp2__length1 = a_length1; a = NULL; a_length1 = 0; _tmp4_ = f (_tmp2_, (guint8) _tmp2__length1, &_tmp3_, f_target); a = (g_free (a), NULL); a = _tmp4_; a_length1 = _tmp3_; _a_size_ = a_length1; _tmp5_ = a; _tmp5__length1 = a_length1; _vala_assert (_tmp5__length1 == 255, "a.length == 255"); _tmp6_ = a; _tmp6__length1 = a_length1; _tmp7_ = _tmp6_[254]; _vala_assert (_tmp7_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL); f = NULL; f_target = NULL; f_target_destroy_notify = NULL; } { FooFunc f = NULL; gpointer f_target; GDestroyNotify f_target_destroy_notify; gint* a = NULL; gint* _tmp8_; gint a_length1; gint _a_size_; gint* _tmp9_; gint _tmp9__length1; gint* _tmp10_; gint _tmp10__length1; guint8 _tmp11_ = 0; gint* _tmp12_; gint* _tmp13_; gint _tmp13__length1; gint* _tmp14_; gint _tmp14__length1; gint _tmp15_; f = (FooFunc) foo_func; f_target = NULL; f_target_destroy_notify = NULL; _tmp8_ = g_new0 (gint, 255); a = _tmp8_; a_length1 = 255; _a_size_ = a_length1; _tmp9_ = a; _tmp9__length1 = a_length1; _tmp9_[254] = 4711; _tmp10_ = a; _tmp10__length1 = a_length1; a = NULL; a_length1 = 0; _tmp12_ = f (_tmp10_, (guint8) _tmp10__length1, &_tmp11_, f_target); a = (g_free (a), NULL); a = _tmp12_; a_length1 = _tmp11_; _a_size_ = a_length1; _tmp13_ = a; _tmp13__length1 = a_length1; _vala_assert (_tmp13__length1 == 255, "a.length == 255"); _tmp14_ = a; _tmp14__length1 = a_length1; _tmp15_ = _tmp14_[254]; _vala_assert (_tmp15_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); (f_target_destroy_notify == NULL) ? NULL : (f_target_destroy_notify (f_target), NULL); f = NULL; f_target = NULL; f_target_destroy_notify = NULL; } { gint* a = NULL; guint8 _tmp16_ = 0; gint* _tmp17_; gint a_length1; gint _a_size_; gint _tmp18_; _tmp17_ = get_foo (&_tmp16_); a = _tmp17_; a_length1 = _tmp16_; _a_size_ = a_length1; _vala_assert (a_length1 == 255, "a.length == 255"); _tmp18_ = a[254]; _vala_assert (_tmp18_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); } { gint* a = NULL; gint a_length1; gint _a_size_; gint* _tmp19_ = NULL; guint8 _tmp20_ = 0; gint* _tmp21_; gint _tmp21__length1; gint* _tmp22_; gint _tmp22__length1; gint _tmp23_; a = NULL; a_length1 = 0; _a_size_ = a_length1; set_foo (&_tmp19_, &_tmp20_); a = (g_free (a), NULL); a = _tmp19_; a_length1 = _tmp20_; _a_size_ = a_length1; _tmp21_ = a; _tmp21__length1 = a_length1; _vala_assert (_tmp21__length1 == 255, "a.length == 255"); _tmp22_ = a; _tmp22__length1 = a_length1; _tmp23_ = _tmp22_[254]; _vala_assert (_tmp23_ == 4711, "a[254] == 4711"); a = (g_free (a), NULL); } { Foo* foo = NULL; Foo* _tmp24_; gint* _tmp25_; gint* _tmp26_; gint _tmp26__length1; gint* _tmp27_; gint _tmp27__length1; guint8 _tmp28_ = 0; gint* _tmp29_; gint _tmp29__length1; gint* _tmp30_; gint _tmp30__length1; guint8 _tmp31_ = 0; gint* _tmp32_; gint _tmp32__length1; gint* _tmp33_; gint _tmp33__length1; guint8 _tmp34_ = 0; gint* _tmp35_; gint _tmp35__length1; gint _tmp36_; _tmp24_ = foo_new (); foo = _tmp24_; _tmp25_ = g_new0 (gint, 255); _tmp26_ = _tmp25_; _tmp26__length1 = 255; ifoo_set_manam (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), _tmp26_, 255); _tmp26_ = (g_free (_tmp26_), NULL); _tmp27_ = ifoo_get_manam (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), &_tmp28_); _tmp27__length1 = _tmp28_; _tmp29_ = _tmp27_; _tmp29__length1 = _tmp27__length1; _tmp29_[254] = 4711; _tmp30_ = ifoo_get_manam (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), &_tmp31_); _tmp30__length1 = _tmp31_; _tmp32_ = _tmp30_; _tmp32__length1 = _tmp30__length1; _vala_assert (_tmp32__length1 == 255, "foo.manam.length == 255"); _tmp33_ = ifoo_get_manam (G_TYPE_CHECK_INSTANCE_CAST (foo, TYPE_IFOO, IFoo), &_tmp34_); _tmp33__length1 = _tmp34_; _tmp35_ = _tmp33_; _tmp35__length1 = _tmp33__length1; _tmp36_ = _tmp35_[254]; _vala_assert (_tmp36_ == 4711, "foo.manam[254] == 4711"); _foo_unref0 (foo); } { Bar* bar = NULL; Bar* _tmp37_; gint* _tmp38_; gint* _tmp39_; gint _tmp39__length1; gint* _tmp40_; gint _tmp40__length1; guint8 _tmp41_ = 0; gint* _tmp42_; gint _tmp42__length1; gint* _tmp43_; gint _tmp43__length1; guint8 _tmp44_ = 0; gint* _tmp45_; gint _tmp45__length1; gint* _tmp46_; gint _tmp46__length1; guint8 _tmp47_ = 0; gint* _tmp48_; gint _tmp48__length1; gint _tmp49_; _tmp37_ = bar_new (); bar = _tmp37_; _tmp38_ = g_new0 (gint, 255); _tmp39_ = _tmp38_; _tmp39__length1 = 255; foo_set_manar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), _tmp39_, 255); _tmp39_ = (g_free (_tmp39_), NULL); _tmp40_ = foo_get_manar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp41_); _tmp40__length1 = _tmp41_; _tmp42_ = _tmp40_; _tmp42__length1 = _tmp40__length1; _tmp42_[254] = 4711; _tmp43_ = foo_get_manar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp44_); _tmp43__length1 = _tmp44_; _tmp45_ = _tmp43_; _tmp45__length1 = _tmp43__length1; _vala_assert (_tmp45__length1 == 255, "bar.manar.length == 255"); _tmp46_ = foo_get_manar (G_TYPE_CHECK_INSTANCE_CAST (bar, TYPE_FOO, Foo), &_tmp47_); _tmp46__length1 = _tmp47_; _tmp48_ = _tmp46_; _tmp48__length1 = _tmp46__length1; _tmp49_ = _tmp48_[254]; _vala_assert (_tmp49_ == 4711, "bar.manar[254] == 4711"); _foo_unref0 (bar); } } int main (int argc, char ** argv) { _vala_main (); return 0; } static inline gpointer _vala_memdup2 (gconstpointer mem, gsize byte_size) { gpointer new_mem; if (mem && byte_size != 0) { new_mem = g_malloc (byte_size); memcpy (new_mem, mem, byte_size); } else { new_mem = NULL; } return new_mem; }