/* parser_var_type_dynamic.c generated by valac, the Vala compiler * generated from parser_var_type_dynamic.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 #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_BAR_PROPERTY, FOO_NUM_PROPERTIES }; static GParamSpec* foo_properties[FOO_NUM_PROPERTIES]; #define _g_free0(var) (var = (g_free (var), NULL)) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_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 _Foo { GObject parent_instance; FooPrivate * priv; }; struct _FooClass { GObjectClass parent_class; }; struct _FooPrivate { gchar* _bar; }; static gint Foo_private_offset; static gpointer foo_parent_class = NULL; VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref) VALA_EXTERN Foo* foo_new (void); VALA_EXTERN Foo* foo_construct (GType object_type); VALA_EXTERN gchar* foo_get_bar (Foo* self); VALA_EXTERN void foo_set_bar (Foo* self, const gchar* value); static void foo_finalize (GObject * obj); 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); static void _vala_main (void); static void _g_object_unref0_ (gpointer var); static inline void _g_list_free__g_object_unref0_ (GList* self); static inline gpointer foo_get_instance_private (Foo* self) { return G_STRUCT_MEMBER_P (self, Foo_private_offset); } Foo* foo_construct (GType object_type) { Foo * self = NULL; self = (Foo*) g_object_new (object_type, NULL); return self; } Foo* foo_new (void) { return foo_construct (TYPE_FOO); } gchar* foo_get_bar (Foo* self) { gchar* result; const gchar* _tmp0_; gchar* _tmp1_; g_return_val_if_fail (IS_FOO (self), NULL); _tmp0_ = self->priv->_bar; _tmp1_ = g_strdup (_tmp0_); result = _tmp1_; return result; } void foo_set_bar (Foo* self, const gchar* value) { gchar* old_value; g_return_if_fail (IS_FOO (self)); old_value = foo_get_bar (self); if (g_strcmp0 (value, old_value) != 0) { gchar* _tmp0_; _tmp0_ = g_strdup (value); _g_free0 (self->priv->_bar); self->priv->_bar = _tmp0_; g_object_notify_by_pspec ((GObject *) self, foo_properties[FOO_BAR_PROPERTY]); } _g_free0 (old_value); } 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); G_OBJECT_CLASS (klass)->get_property = _vala_foo_get_property; G_OBJECT_CLASS (klass)->set_property = _vala_foo_set_property; G_OBJECT_CLASS (klass)->finalize = foo_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), FOO_BAR_PROPERTY, foo_properties[FOO_BAR_PROPERTY] = g_param_spec_string ("manam", "bar", "bar", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE)); } static void foo_instance_init (Foo * self, gpointer klass) { gchar* _tmp0_; self->priv = foo_get_instance_private (self); _tmp0_ = g_strdup ("foo"); self->priv->_bar = _tmp0_; } static void foo_finalize (GObject * obj) { Foo * self; self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo); _g_free0 (self->priv->_bar); G_OBJECT_CLASS (foo_parent_class)->finalize (obj); } 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, 0); 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_BAR_PROPERTY: g_value_take_string (value, foo_get_bar (self)); 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_BAR_PROPERTY: foo_set_bar (self, g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static gpointer _g_object_ref0 (gpointer self) { return self ? g_object_ref (self) : NULL; } static void _g_object_unref0_ (gpointer var) { (var == NULL) ? NULL : (var = (g_object_unref (var), NULL)); } static inline void _g_list_free__g_object_unref0_ (GList* self) { g_list_free_full (self, (GDestroyNotify) _g_object_unref0_); } static void _vala_main (void) { Foo* foo = NULL; Foo* _tmp0_; GList* foo_list = NULL; Foo* _tmp1_; Foo* _tmp2_; _tmp0_ = foo_new (); foo = _tmp0_; foo_list = NULL; _tmp1_ = foo; _tmp2_ = _g_object_ref0 (_tmp1_); foo_list = g_list_prepend (foo_list, _tmp2_); { Foo* bar = NULL; Foo* _tmp3_; Foo* _tmp4_; gchar* s = NULL; Foo* _tmp5_; gchar* _tmp6_; gchar* _tmp7_; const gchar* _tmp8_; _tmp3_ = foo; _tmp4_ = _g_object_ref0 (_tmp3_); bar = _tmp4_; _tmp5_ = bar; g_object_get (_tmp5_, "manam", &_tmp6_, NULL); _tmp7_ = _tmp6_; s = _tmp7_; _tmp8_ = s; _vala_assert (g_strcmp0 (_tmp8_, "foo") == 0, "s == \"foo\""); _g_free0 (s); _g_object_unref0 (bar); } { Foo* bar = NULL; Foo* _tmp9_; gchar* s = NULL; Foo* _tmp10_; gchar* _tmp11_; gchar* _tmp12_; const gchar* _tmp13_; _tmp9_ = foo; bar = _tmp9_; _tmp10_ = bar; g_object_get (_tmp10_, "manam", &_tmp11_, NULL); _tmp12_ = _tmp11_; s = _tmp12_; _tmp13_ = s; _vala_assert (g_strcmp0 (_tmp13_, "foo") == 0, "s == \"foo\""); _g_free0 (s); } { Foo* bar = NULL; Foo* _tmp14_; Foo* _tmp15_; gchar* s = NULL; Foo* _tmp16_; gchar* _tmp17_; gchar* _tmp18_; const gchar* _tmp19_; _tmp14_ = foo; _tmp15_ = _g_object_ref0 (_tmp14_); bar = _tmp15_; _tmp16_ = bar; g_object_get (_tmp16_, "manam", &_tmp17_, NULL); _tmp18_ = _tmp17_; s = _tmp18_; _tmp19_ = s; _vala_assert (g_strcmp0 (_tmp19_, "foo") == 0, "s == \"foo\""); _g_free0 (s); _g_object_unref0 (bar); } { Foo* bar = NULL; Foo* _tmp20_; gchar* s = NULL; Foo* _tmp21_; gchar* _tmp22_; gchar* _tmp23_; const gchar* _tmp24_; _tmp20_ = foo; bar = _tmp20_; _tmp21_ = bar; g_object_get (_tmp21_, "manam", &_tmp22_, NULL); _tmp23_ = _tmp22_; s = _tmp23_; _tmp24_ = s; _vala_assert (g_strcmp0 (_tmp24_, "foo") == 0, "s == \"foo\""); _g_free0 (s); } { GList* _tmp25_; _tmp25_ = foo_list; { GList* bar_collection = NULL; GList* bar_it = NULL; bar_collection = _tmp25_; for (bar_it = bar_collection; bar_it != NULL; bar_it = bar_it->next) { Foo* _tmp26_; Foo* bar = NULL; _tmp26_ = _g_object_ref0 ((Foo*) bar_it->data); bar = _tmp26_; { gchar* s = NULL; Foo* _tmp27_; gchar* _tmp28_; gchar* _tmp29_; const gchar* _tmp30_; _tmp27_ = bar; g_object_get (_tmp27_, "manam", &_tmp28_, NULL); _tmp29_ = _tmp28_; s = _tmp29_; _tmp30_ = s; _vala_assert (g_strcmp0 (_tmp30_, "foo") == 0, "s == \"foo\""); _g_free0 (s); _g_object_unref0 (bar); } } } } { GList* _tmp31_; _tmp31_ = foo_list; { GList* bar_collection = NULL; GList* bar_it = NULL; bar_collection = _tmp31_; for (bar_it = bar_collection; bar_it != NULL; bar_it = bar_it->next) { Foo* bar = NULL; bar = (Foo*) bar_it->data; { gchar* s = NULL; Foo* _tmp32_; gchar* _tmp33_; gchar* _tmp34_; const gchar* _tmp35_; _tmp32_ = bar; g_object_get (_tmp32_, "manam", &_tmp33_, NULL); _tmp34_ = _tmp33_; s = _tmp34_; _tmp35_ = s; _vala_assert (g_strcmp0 (_tmp35_, "foo") == 0, "s == \"foo\""); _g_free0 (s); } } } } { GList* _tmp36_; _tmp36_ = foo_list; { GList* bar_collection = NULL; GList* bar_it = NULL; bar_collection = _tmp36_; for (bar_it = bar_collection; bar_it != NULL; bar_it = bar_it->next) { Foo* _tmp37_; Foo* bar = NULL; _tmp37_ = _g_object_ref0 ((Foo*) bar_it->data); bar = _tmp37_; { gchar* s = NULL; Foo* _tmp38_; gchar* _tmp39_; gchar* _tmp40_; const gchar* _tmp41_; _tmp38_ = bar; g_object_get (_tmp38_, "manam", &_tmp39_, NULL); _tmp40_ = _tmp39_; s = _tmp40_; _tmp41_ = s; _vala_assert (g_strcmp0 (_tmp41_, "foo") == 0, "s == \"foo\""); _g_free0 (s); _g_object_unref0 (bar); } } } } { GList* _tmp42_; _tmp42_ = foo_list; { GList* bar_collection = NULL; GList* bar_it = NULL; bar_collection = _tmp42_; for (bar_it = bar_collection; bar_it != NULL; bar_it = bar_it->next) { Foo* bar = NULL; bar = (Foo*) bar_it->data; { gchar* s = NULL; Foo* _tmp43_; gchar* _tmp44_; gchar* _tmp45_; const gchar* _tmp46_; _tmp43_ = bar; g_object_get (_tmp43_, "manam", &_tmp44_, NULL); _tmp45_ = _tmp44_; s = _tmp45_; _tmp46_ = s; _vala_assert (g_strcmp0 (_tmp46_, "foo") == 0, "s == \"foo\""); _g_free0 (s); } } } } { { Foo* bar = NULL; Foo* _tmp47_; Foo* _tmp48_; gchar* s = NULL; gchar* _tmp49_; gchar* _tmp50_; _tmp47_ = foo; _tmp48_ = _g_object_ref0 (_tmp47_); bar = _tmp48_; g_object_get (bar, "manam", &_tmp49_, NULL); _tmp50_ = _tmp49_; s = _tmp50_; _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\""); _g_free0 (s); _g_object_unref0 (bar); } } { { Foo* bar = NULL; Foo* _tmp51_; gchar* s = NULL; gchar* _tmp52_; gchar* _tmp53_; _tmp51_ = foo; bar = _tmp51_; g_object_get (bar, "manam", &_tmp52_, NULL); _tmp53_ = _tmp52_; s = _tmp53_; _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\""); _g_free0 (s); } } { { Foo* bar = NULL; Foo* _tmp54_; Foo* _tmp55_; gchar* s = NULL; gchar* _tmp56_; gchar* _tmp57_; _tmp54_ = foo; _tmp55_ = _g_object_ref0 (_tmp54_); bar = _tmp55_; g_object_get (bar, "manam", &_tmp56_, NULL); _tmp57_ = _tmp56_; s = _tmp57_; _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\""); _g_free0 (s); _g_object_unref0 (bar); } } { { Foo* bar = NULL; Foo* _tmp58_; gchar* s = NULL; gchar* _tmp59_; gchar* _tmp60_; _tmp58_ = foo; bar = _tmp58_; g_object_get (bar, "manam", &_tmp59_, NULL); _tmp60_ = _tmp59_; s = _tmp60_; _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\""); _g_free0 (s); } } (foo_list == NULL) ? NULL : (foo_list = (_g_list_free__g_object_unref0_ (foo_list), NULL)); _g_object_unref0 (foo); } int main (int argc, char ** argv) { _vala_main (); return 0; }