/* objects_simple_generics_chainup.c generated by valac, the Vala compiler * generated from objects_simple_generics_chainup.vala, do not modify */ #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 GSequence IntSequence; typedef GSequence StringSequence; typedef GHashTable StringIntMap; #define _g_sequence_free0(var) ((var == NULL) ? NULL : (var = (g_sequence_free (var), NULL))) #define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_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); G_DEFINE_AUTOPTR_CLEANUP_FUNC (IntSequence, g_sequence_free) static void int_sequence_instance_init (IntSequence * self); VALA_EXTERN IntSequence* int_sequence_new (void); G_DEFINE_AUTOPTR_CLEANUP_FUNC (StringSequence, g_sequence_free) static void string_sequence_instance_init (StringSequence * self); VALA_EXTERN StringSequence* string_sequence_new (void); static void _g_free0_ (gpointer var); static void string_int_map_instance_init (StringIntMap * self); VALA_EXTERN StringIntMap* string_int_map_new (void); static void _vala_main (void); IntSequence* int_sequence_new (void) { IntSequence* self; self = (IntSequence*) g_sequence_new (NULL); int_sequence_instance_init (self); return self; } static void int_sequence_instance_init (IntSequence * self) { } static void _g_free0_ (gpointer var) { var = (g_free (var), NULL); } StringSequence* string_sequence_new (void) { StringSequence* self; self = (StringSequence*) g_sequence_new (_g_free0_); string_sequence_instance_init (self); return self; } static void string_sequence_instance_init (StringSequence * self) { } StringIntMap* string_int_map_new (void) { StringIntMap* self; GHashFunc _tmp0_; GEqualFunc _tmp1_; _tmp0_ = g_str_hash; _tmp1_ = g_str_equal; self = (StringIntMap*) g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, NULL); string_int_map_instance_init (self); return self; } static void string_int_map_instance_init (StringIntMap * self) { } static void _vala_main (void) { { IntSequence* seq = NULL; IntSequence* _tmp0_; GSequenceIter* _tmp1_; GSequenceIter* _tmp2_; gconstpointer _tmp3_; _tmp0_ = int_sequence_new (); seq = _tmp0_; _tmp1_ = g_sequence_append ((GSequence*) seq, (gpointer) ((gintptr) 23)); _tmp2_ = g_sequence_get_begin_iter ((GSequence*) seq); _tmp3_ = g_sequence_get (_tmp2_); _vala_assert (((gint) ((gintptr) _tmp3_)) == 23, "seq.get_begin_iter ().get () == 23"); _g_sequence_free0 (seq); } { StringSequence* seq = NULL; StringSequence* _tmp4_; gchar* _tmp5_; GSequenceIter* _tmp6_; GSequenceIter* _tmp7_; gconstpointer _tmp8_; _tmp4_ = string_sequence_new (); seq = _tmp4_; _tmp5_ = g_strdup ("foo"); _tmp6_ = g_sequence_append ((GSequence*) seq, _tmp5_); _tmp7_ = g_sequence_get_begin_iter ((GSequence*) seq); _tmp8_ = g_sequence_get (_tmp7_); _vala_assert (g_strcmp0 ((const gchar*) _tmp8_, "foo") == 0, "seq.get_begin_iter ().get () == \"foo\""); _g_sequence_free0 (seq); } { StringIntMap* map = NULL; StringIntMap* _tmp9_; gchar* _tmp10_; gconstpointer _tmp11_; _tmp9_ = string_int_map_new (); map = _tmp9_; _tmp10_ = g_strdup ("foo"); g_hash_table_insert ((GHashTable*) map, _tmp10_, (gpointer) ((gintptr) 42)); _tmp11_ = g_hash_table_lookup ((GHashTable*) map, "foo"); _vala_assert (((gint) ((gintptr) _tmp11_)) == 42, "map[\"foo\"] == 42"); _g_hash_table_unref0 (map); } } int main (int argc, char ** argv) { _vala_main (); return 0; }