1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
/* objects_simple_generics_chainup.c generated by valac, the Vala compiler
* generated from objects_simple_generics_chainup.vala, do not modify */
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#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;
}
|