/* parser_tuple.c generated by valac, the Vala compiler * generated from parser_tuple.vala, do not modify */ #include #include #include #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); static void _vala_main (void); static gchar** _vala_array_dup1 (gchar** self, gssize length); static gint* _vala_array_dup2 (gint* self, gssize length); static void _vala_array_destroy (gpointer array, gssize array_length, GDestroyNotify destroy_func); static void _vala_array_free (gpointer array, gssize array_length, GDestroyNotify destroy_func); static inline gpointer _vala_memdup2 (gconstpointer mem, gsize byte_size); static gchar** _vala_array_dup1 (gchar** self, gssize length) { if (length >= 0) { gchar** result; gssize i; result = g_new0 (gchar*, length + 1); for (i = 0; i < length; i++) { gchar* _tmp0_; _tmp0_ = g_strdup (self[i]); result[i] = _tmp0_; } return result; } return NULL; } static gint* _vala_array_dup2 (gint* self, gssize length) { if (length > 0) { return _vala_memdup2 (self, length * sizeof (gint)); } return NULL; } static void _vala_main (void) { gchar** FOO = NULL; gchar* _tmp0_; gchar** _tmp1_; gint FOO_length1; gint _FOO_size_; gint* BAR = NULL; gint* _tmp2_; gint BAR_length1; gint _BAR_size_; const gchar* s = NULL; const gchar* n = NULL; gchar** _tmp3_ = NULL; gchar** _tmp4_; gint _tmp4__length1; gint _tmp3__length1; gint __tmp3__size_; const gchar* _tmp5_; const gchar* _tmp6_; gint i = 0; gint j = 0; gint* _tmp7_ = NULL; gint* _tmp8_; gint _tmp8__length1; gint _tmp7__length1; gint __tmp7__size_; gint _tmp9_; gint _tmp10_; gint* _tmp11_ = NULL; gint* _tmp12_; gint _tmp11__length1; gint __tmp11__size_; gint test = 0; gint _tmp13_; gint test2 = 0; gint _tmp14_; _tmp0_ = g_strdup ("foo"); _tmp1_ = g_new0 (gchar*, 2 + 1); _tmp1_[0] = _tmp0_; _tmp1_[1] = NULL; FOO = _tmp1_; FOO_length1 = 2; _FOO_size_ = FOO_length1; _tmp2_ = g_new0 (gint, 2); _tmp2_[0] = 42; _tmp2_[1] = 4711; BAR = _tmp2_; BAR_length1 = 2; _BAR_size_ = BAR_length1; _tmp4_ = (FOO != NULL) ? _vala_array_dup1 (FOO, FOO_length1) : FOO; _tmp4__length1 = FOO_length1; _tmp3_ = _tmp4_; _tmp3__length1 = _tmp4__length1; __tmp3__size_ = _tmp3__length1; _tmp5_ = _tmp3_[0]; s = _tmp5_; _tmp6_ = _tmp3_[1]; n = _tmp6_; _vala_assert (g_strcmp0 (s, "foo") == 0, "s == \"foo\""); _vala_assert (n == NULL, "n == null"); _tmp8_ = (BAR != NULL) ? _vala_array_dup2 (BAR, BAR_length1) : BAR; _tmp8__length1 = BAR_length1; _tmp7_ = _tmp8_; _tmp7__length1 = _tmp8__length1; __tmp7__size_ = _tmp7__length1; _tmp9_ = _tmp7_[0]; i = _tmp9_; _tmp10_ = _tmp7_[1]; j = _tmp10_; _vala_assert (i == 42, "i == 42"); _vala_assert (j == 4711, "j == 4711"); _tmp12_ = g_new0 (gint, 2); _tmp12_[0] = 23; _tmp12_[1] = 51; _tmp11_ = _tmp12_; _tmp11__length1 = 2; __tmp11__size_ = _tmp11__length1; _tmp13_ = _tmp11_[0]; test = _tmp13_; _tmp14_ = _tmp11_[1]; test2 = _tmp14_; _vala_assert (test == 23, "test == 23"); _vala_assert (test2 == 51, "test2 == 51"); _tmp11_ = (g_free (_tmp11_), NULL); _tmp7_ = (g_free (_tmp7_), NULL); _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL); BAR = (g_free (BAR), NULL); FOO = (_vala_array_free (FOO, FOO_length1, (GDestroyNotify) g_free), NULL); } int main (int argc, char ** argv) { _vala_main (); return 0; } static void _vala_array_destroy (gpointer array, gssize array_length, GDestroyNotify destroy_func) { if ((array != NULL) && (destroy_func != NULL)) { gssize i; for (i = 0; i < array_length; i = i + 1) { if (((gpointer*) array)[i] != NULL) { destroy_func (((gpointer*) array)[i]); } } } } static void _vala_array_free (gpointer array, gssize array_length, GDestroyNotify destroy_func) { _vala_array_destroy (array, array_length, destroy_func); g_free (array); } 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; }