/* swigwriter.c generated by valac 0.56.19, the Vala compiler
 * generated from swigwriter.vala, do not modify */

/* Copyright 2009-2017 -- pancake, eddyb, ritesh */

#include <vala.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <valagee.h>
#include <valacodegen.h>
#include <stdio.h>
#include <glib/gstdio.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

#define TYPE_VALABIND_WRITER (valabind_writer_get_type ())
#define VALABIND_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_VALABIND_WRITER, ValabindWriter))
#define VALABIND_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_VALABIND_WRITER, ValabindWriterClass))
#define IS_VALABIND_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_VALABIND_WRITER))
#define IS_VALABIND_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_VALABIND_WRITER))
#define VALABIND_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_VALABIND_WRITER, ValabindWriterClass))

typedef struct _ValabindWriter ValabindWriter;
typedef struct _ValabindWriterClass ValabindWriterClass;
typedef struct _ValabindWriterPrivate ValabindWriterPrivate;

#define TYPE_SWIG_WRITER (swig_writer_get_type ())
#define SWIG_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SWIG_WRITER, SwigWriter))
#define SWIG_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SWIG_WRITER, SwigWriterClass))
#define IS_SWIG_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SWIG_WRITER))
#define IS_SWIG_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SWIG_WRITER))
#define SWIG_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SWIG_WRITER, SwigWriterClass))

typedef struct _SwigWriter SwigWriter;
typedef struct _SwigWriterClass SwigWriterClass;
typedef struct _SwigWriterPrivate SwigWriterPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
#define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL)))

struct _ValabindWriter {
	ValaCodeVisitor parent_instance;
	ValabindWriterPrivate * priv;
	gchar* modulename;
	gchar* library;
	gboolean pkgmode;
	gboolean camelgetters;
	gchar* pkgname;
	gchar** include_dirs;
	gchar** namespaces;
	ValaCodeContext* context;
	gchar* vapidir;
	GList* source_files;
	GList* packages;
	GList* defines;
	gboolean glibmode;
	GList* includefiles;
};

struct _ValabindWriterClass {
	ValaCodeVisitorClass parent_class;
	void (*write) (ValabindWriter* self, const gchar* file);
	gchar* (*get_filename) (ValabindWriter* self, const gchar* base_name);
};

struct _SwigWriter {
	ValabindWriter parent_instance;
	SwigWriterPrivate * priv;
};

struct _SwigWriterClass {
	ValabindWriterClass parent_class;
};

struct _SwigWriterPrivate {
	gboolean cxx_mode;
	gchar* statics;
	gchar* structs;
	gchar* extends;
	gchar* enums;
	gchar* vectors;
	gchar* ns_pfx;
};

static gint SwigWriter_private_offset;
static gpointer swig_writer_parent_class = NULL;

VALA_EXTERN GType valabind_writer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ValabindWriter, vala_code_visitor_unref)
VALA_EXTERN GType swig_writer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SwigWriter, vala_code_visitor_unref)
VALA_EXTERN gchar* valabind_writer_get_filename (ValabindWriter* self,
                                     const gchar* base_name);
VALA_EXTERN void valabind_writer_write (ValabindWriter* self,
                            const gchar* file);
VALA_EXTERN SwigWriter* swig_writer_new (gboolean cxx_mode);
VALA_EXTERN SwigWriter* swig_writer_construct (GType object_type,
                                   gboolean cxx_mode);
VALA_EXTERN ValabindWriter* valabind_writer_new (void);
VALA_EXTERN ValabindWriter* valabind_writer_construct (GType object_type);
static gchar* swig_writer_real_get_filename (ValabindWriter* base,
                                      const gchar* base_name);
static gchar* swig_writer_get_alias (SwigWriter* self,
                              const gchar* oname);
VALA_EXTERN void warning (const gchar* msg);
static gchar* swig_writer_type_name (SwigWriter* self,
                              ValaDataType* type,
                              gboolean retType,
                              gboolean ignoreRef);
VALA_EXTERN gint array_length (ValaArrayType* array);
VALA_EXTERN gchar* valabind_writer_sep (ValabindWriter* self,
                            const gchar* str,
                            const gchar* separator);
static void swig_writer_real_visit_constant (ValaCodeVisitor* base,
                                      ValaConstant* c);
static void swig_writer_real_visit_enum (ValaCodeVisitor* base,
                                  ValaEnum* e);
VALA_EXTERN void valabind_writer_add_includes (ValabindWriter* self,
                                   ValaSymbol* s);
static void swig_writer_real_visit_struct (ValaCodeVisitor* base,
                                    ValaStruct* s);
static void swig_writer_real_visit_class (ValaCodeVisitor* base,
                                   ValaClass* c);
static void swig_writer_real_visit_field (ValaCodeVisitor* base,
                                   ValaField* f);
static void swig_writer_real_visit_method (ValaCodeVisitor* base,
                                    ValaMethod* m);
VALA_EXTERN void error (const gchar* msg);
static void swig_writer_real_visit_namespace (ValaCodeVisitor* base,
                                       ValaNamespace* ns);
VALA_EXTERN gboolean valabind_writer_use_namespace (ValabindWriter* self,
                                        ValaNamespace* ns);
static void swig_writer_real_write (ValabindWriter* base,
                             const gchar* file);
static void swig_writer_finalize (ValaCodeVisitor * obj);
static GType swig_writer_get_type_once (void);
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 gssize _vala_array_length (gpointer array);

static inline gpointer
swig_writer_get_instance_private (SwigWriter* self)
{
	return G_STRUCT_MEMBER_P (self, SwigWriter_private_offset);
}

SwigWriter*
swig_writer_construct (GType object_type,
                       gboolean cxx_mode)
{
	SwigWriter* self = NULL;
	self = (SwigWriter*) valabind_writer_construct (object_type);
	self->priv->cxx_mode = cxx_mode;
	return self;
}

SwigWriter*
swig_writer_new (gboolean cxx_mode)
{
	return swig_writer_construct (TYPE_SWIG_WRITER, cxx_mode);
}

static gchar*
swig_writer_real_get_filename (ValabindWriter* base,
                               const gchar* base_name)
{
	SwigWriter * self;
	gchar* _tmp0_;
	gchar* result;
	self = (SwigWriter*) base;
	g_return_val_if_fail (base_name != NULL, NULL);
	_tmp0_ = g_strconcat (base_name, ".i", NULL);
	result = _tmp0_;
	return result;
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

static gchar*
swig_writer_get_alias (SwigWriter* self,
                       const gchar* oname)
{
	gchar* name = NULL;
	gchar* _tmp0_;
	const gchar* _tmp17_;
	GQuark _tmp19_ = 0U;
	static GQuark _tmp18_label0 = 0;
	static GQuark _tmp18_label1 = 0;
	static GQuark _tmp18_label2 = 0;
	static GQuark _tmp18_label3 = 0;
	static GQuark _tmp18_label4 = 0;
	static GQuark _tmp18_label5 = 0;
	static GQuark _tmp18_label6 = 0;
	const gchar* _tmp22_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (oname != NULL, NULL);
	_tmp0_ = g_strdup (oname);
	name = _tmp0_;
	if (((ValabindWriter*) self)->camelgetters) {
		if (g_str_has_prefix (oname, "set_")) {
			gchar* capital = NULL;
			gchar* _tmp1_;
			const gchar* _tmp2_;
			gchar* _tmp3_;
			gchar* _tmp4_;
			gchar* _tmp5_;
			gchar* _tmp6_;
			gchar* _tmp7_;
			gchar* _tmp8_;
			_tmp1_ = g_strdup_printf ("%c", (gint) g_ascii_toupper (string_get (oname, (glong) 4)));
			capital = _tmp1_;
			_tmp2_ = capital;
			_tmp3_ = g_strconcat ("set", _tmp2_, NULL);
			_tmp4_ = _tmp3_;
			_tmp5_ = string_substring (oname, (glong) 5, (glong) -1);
			_tmp6_ = _tmp5_;
			_tmp7_ = g_strconcat (_tmp4_, _tmp6_, NULL);
			_tmp8_ = _tmp7_;
			_g_free0 (_tmp6_);
			_g_free0 (_tmp4_);
			result = _tmp8_;
			_g_free0 (capital);
			_g_free0 (name);
			return result;
		} else {
			if (g_str_has_prefix (oname, "get_")) {
				gchar* capital = NULL;
				gchar* _tmp9_;
				const gchar* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				gchar* _tmp15_;
				gchar* _tmp16_;
				_tmp9_ = g_strdup_printf ("%c", (gint) g_ascii_toupper (string_get (oname, (glong) 4)));
				capital = _tmp9_;
				_tmp10_ = capital;
				_tmp11_ = g_strconcat ("get", _tmp10_, NULL);
				_tmp12_ = _tmp11_;
				_tmp13_ = string_substring (oname, (glong) 5, (glong) -1);
				_tmp14_ = _tmp13_;
				_tmp15_ = g_strconcat (_tmp12_, _tmp14_, NULL);
				_tmp16_ = _tmp15_;
				_g_free0 (_tmp14_);
				_g_free0 (_tmp12_);
				result = _tmp16_;
				_g_free0 (capital);
				_g_free0 (name);
				return result;
			}
		}
	}
	_tmp17_ = oname;
	_tmp19_ = (NULL == _tmp17_) ? 0 : g_quark_from_string (_tmp17_);
	if ((((((_tmp19_ == ((0 != _tmp18_label0) ? _tmp18_label0 : (_tmp18_label0 = g_quark_from_static_string ("call")))) || (_tmp19_ == ((0 != _tmp18_label1) ? _tmp18_label1 : (_tmp18_label1 = g_quark_from_static_string ("lock"))))) || (_tmp19_ == ((0 != _tmp18_label2) ? _tmp18_label2 : (_tmp18_label2 = g_quark_from_static_string ("base"))))) || (_tmp19_ == ((0 != _tmp18_label3) ? _tmp18_label3 : (_tmp18_label3 = g_quark_from_static_string ("clone"))))) || (_tmp19_ == ((0 != _tmp18_label4) ? _tmp18_label4 : (_tmp18_label4 = g_quark_from_static_string ("break"))))) || (_tmp19_ == ((0 != _tmp18_label5) ? _tmp18_label5 : (_tmp18_label5 = g_quark_from_static_string ("delete"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp20_;
				_tmp20_ = g_strconcat ("_", oname, NULL);
				_g_free0 (name);
				name = _tmp20_;
				break;
			}
		}
	} else if (_tmp19_ == ((0 != _tmp18_label6) ? _tmp18_label6 : (_tmp18_label6 = g_quark_from_static_string ("continue")))) {
		switch (0) {
			default:
			{
				gchar* _tmp21_;
				_tmp21_ = g_strdup ("cont");
				_g_free0 (name);
				name = _tmp21_;
				break;
			}
		}
	}
	_tmp22_ = name;
	if (g_strcmp0 (_tmp22_, oname) != 0) {
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		_tmp23_ = name;
		_tmp24_ = g_strdup_printf ("Method %s renamed to %s (don't ask where)", oname, _tmp23_);
		_tmp25_ = _tmp24_;
		warning (_tmp25_);
		_g_free0 (_tmp25_);
	}
	result = name;
	return result;
}

static gpointer
_vala_code_node_ref0 (gpointer self)
{
	return self ? vala_code_node_ref (self) : NULL;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gchar*
swig_writer_type_name (SwigWriter* self,
                       ValaDataType* type,
                       gboolean retType,
                       gboolean ignoreRef)
{
	gboolean _tmp24_ = FALSE;
	gchar* generic = NULL;
	gchar* _tmp31_;
	gchar* _type = NULL;
	gchar* _tmp47_;
	const gchar* _tmp48_;
	gchar** _tmp49_;
	gchar** _tmp50_;
	gchar** _tmp51_;
	gint _tmp51__length1;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	const gchar* _tmp54_;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	gchar* _tmp58_;
	const gchar* _tmp59_;
	gchar* _tmp60_;
	const gchar* _tmp61_;
	gchar* _tmp62_;
	const gchar* _tmp63_;
	const gchar* _tmp64_;
	GQuark _tmp66_ = 0U;
	static GQuark _tmp65_label0 = 0;
	static GQuark _tmp65_label1 = 0;
	static GQuark _tmp65_label2 = 0;
	static GQuark _tmp65_label3 = 0;
	static GQuark _tmp65_label4 = 0;
	static GQuark _tmp65_label5 = 0;
	static GQuark _tmp65_label6 = 0;
	static GQuark _tmp65_label7 = 0;
	static GQuark _tmp65_label8 = 0;
	static GQuark _tmp65_label9 = 0;
	static GQuark _tmp65_label10 = 0;
	static GQuark _tmp65_label11 = 0;
	static GQuark _tmp65_label12 = 0;
	static GQuark _tmp65_label13 = 0;
	static GQuark _tmp65_label14 = 0;
	static GQuark _tmp65_label15 = 0;
	static GQuark _tmp65_label16 = 0;
	static GQuark _tmp65_label17 = 0;
	static GQuark _tmp65_label18 = 0;
	static GQuark _tmp65_label19 = 0;
	static GQuark _tmp65_label20 = 0;
	static GQuark _tmp65_label21 = 0;
	static GQuark _tmp65_label22 = 0;
	static GQuark _tmp65_label23 = 0;
	static GQuark _tmp65_label24 = 0;
	static GQuark _tmp65_label25 = 0;
	static GQuark _tmp65_label26 = 0;
	static GQuark _tmp65_label27 = 0;
	static GQuark _tmp65_label28 = 0;
	static GQuark _tmp65_label29 = 0;
	static GQuark _tmp65_label30 = 0;
	static GQuark _tmp65_label31 = 0;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (type != NULL, NULL);
	if (type == NULL) {
		gchar* _tmp0_;
		warning ("Cannot resolve type");
		_tmp0_ = g_strdup ("__UNRESOLVED_TYPE_OH_PLEASE_KILL_ME_NOW__");
		result = _tmp0_;
		return result;
	}
	if (G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_ENUM_VALUE_TYPE)) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("long int");
		result = _tmp1_;
		return result;
	}
	if (G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_GENERIC_TYPE)) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("void*");
		result = _tmp2_;
		return result;
	}
	if (G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_POINTER_TYPE)) {
		ValaPointerType* pointer = NULL;
		ValaPointerType* _tmp3_;
		ValaPointerType* _tmp4_;
		ValaDataType* _tmp5_;
		ValaDataType* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (type, VALA_TYPE_POINTER_TYPE, ValaPointerType));
		pointer = _tmp3_;
		_tmp4_ = pointer;
		_tmp5_ = vala_pointer_type_get_base_type (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = swig_writer_type_name (self, _tmp6_, retType, TRUE);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strconcat (_tmp8_, "*", NULL);
		_tmp10_ = _tmp9_;
		_g_free0 (_tmp8_);
		result = _tmp10_;
		_vala_code_node_unref0 (pointer);
		return result;
	}
	if (G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_ARRAY_TYPE)) {
		ValaArrayType* array = NULL;
		ValaArrayType* _tmp11_;
		gchar* element = NULL;
		ValaArrayType* _tmp12_;
		ValaDataType* _tmp13_;
		ValaDataType* _tmp14_;
		gchar* _tmp15_;
		gint len = 0;
		ValaArrayType* _tmp16_;
		const gchar* _tmp19_;
		gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		_tmp11_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) type) : NULL);
		array = _tmp11_;
		_tmp12_ = array;
		_tmp13_ = vala_array_type_get_element_type (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = swig_writer_type_name (self, _tmp14_, retType, FALSE);
		element = _tmp15_;
		_tmp16_ = array;
		len = array_length (_tmp16_);
		if (len < 0) {
			const gchar* _tmp17_;
			gchar* _tmp18_;
			_tmp17_ = element;
			_tmp18_ = g_strconcat (_tmp17_, "*", NULL);
			result = _tmp18_;
			_g_free0 (element);
			_vala_code_node_unref0 (array);
			return result;
		}
		_tmp19_ = element;
		_tmp20_ = g_strdup_printf ("[%d]", len);
		_tmp21_ = _tmp20_;
		_tmp22_ = g_strconcat (_tmp19_, _tmp21_, NULL);
		_tmp23_ = _tmp22_;
		_g_free0 (_tmp21_);
		result = _tmp23_;
		_g_free0 (element);
		_vala_code_node_unref0 (array);
		return result;
	}
	if (!ignoreRef) {
		_tmp24_ = G_TYPE_CHECK_INSTANCE_TYPE (type, VALA_TYPE_REFERENCE_TYPE);
	} else {
		_tmp24_ = FALSE;
	}
	if (_tmp24_) {
		gchar* unref_type = NULL;
		gchar* _tmp25_;
		gboolean _tmp26_ = FALSE;
		const gchar* _tmp27_;
		const gchar* _tmp29_;
		gchar* _tmp30_;
		_tmp25_ = swig_writer_type_name (self, type, retType, TRUE);
		unref_type = _tmp25_;
		_tmp27_ = unref_type;
		if (g_strcmp0 (_tmp27_, "char*") == 0) {
			_tmp26_ = TRUE;
		} else {
			const gchar* _tmp28_;
			_tmp28_ = unref_type;
			_tmp26_ = g_strcmp0 (_tmp28_, "const char*") == 0;
		}
		if (_tmp26_) {
			result = unref_type;
			return result;
		}
		_tmp29_ = unref_type;
		_tmp30_ = g_strconcat (_tmp29_, "*", NULL);
		result = _tmp30_;
		_g_free0 (unref_type);
		return result;
	}
	_tmp31_ = g_strdup ("");
	generic = _tmp31_;
	{
		ValaList* _t_list = NULL;
		ValaList* _tmp32_;
		gint _t_size = 0;
		ValaList* _tmp33_;
		gint _tmp34_;
		gint _tmp35_;
		gint _t_index = 0;
		_tmp32_ = vala_data_type_get_type_arguments (type);
		_t_list = _tmp32_;
		_tmp33_ = _t_list;
		_tmp34_ = vala_collection_get_size ((ValaCollection*) _tmp33_);
		_tmp35_ = _tmp34_;
		_t_size = _tmp35_;
		_t_index = -1;
		while (TRUE) {
			gint _tmp36_;
			gint _tmp37_;
			ValaDataType* t = NULL;
			ValaList* _tmp38_;
			gpointer _tmp39_;
			const gchar* _tmp40_;
			gchar* _tmp41_;
			gchar* _tmp42_;
			ValaDataType* _tmp43_;
			gchar* _tmp44_;
			gchar* _tmp45_;
			gchar* _tmp46_;
			_t_index = _t_index + 1;
			_tmp36_ = _t_index;
			_tmp37_ = _t_size;
			if (!(_tmp36_ < _tmp37_)) {
				break;
			}
			_tmp38_ = _t_list;
			_tmp39_ = vala_list_get (_tmp38_, _t_index);
			t = (ValaDataType*) _tmp39_;
			_tmp40_ = generic;
			_tmp41_ = valabind_writer_sep ((ValabindWriter*) self, _tmp40_, ", ");
			_tmp42_ = _tmp41_;
			_tmp43_ = t;
			_tmp44_ = swig_writer_type_name (self, _tmp43_, FALSE, FALSE);
			_tmp45_ = _tmp44_;
			_tmp46_ = g_strconcat (_tmp42_, _tmp45_, NULL);
			_g_free0 (generic);
			generic = _tmp46_;
			_g_free0 (_tmp45_);
			_g_free0 (_tmp42_);
			_vala_code_node_unref0 (t);
		}
	}
	_tmp47_ = vala_code_node_to_string ((ValaCodeNode*) type);
	_type = _tmp47_;
	_tmp48_ = _type;
	_tmp50_ = _tmp49_ = g_strsplit (_tmp48_, "<", 2);
	_tmp51_ = _tmp50_;
	_tmp51__length1 = _vala_array_length (_tmp49_);
	_tmp52_ = _tmp51_[0];
	_tmp53_ = g_strdup (_tmp52_);
	_g_free0 (_type);
	_type = _tmp53_;
	_tmp51_ = (_vala_array_free (_tmp51_, _tmp51__length1, (GDestroyNotify) g_free), NULL);
	_tmp54_ = _type;
	_tmp55_ = self->priv->ns_pfx;
	_tmp56_ = string_replace (_tmp54_, _tmp55_, "");
	_tmp57_ = _tmp56_;
	_tmp58_ = string_replace (_tmp57_, ".", "");
	_g_free0 (_type);
	_type = _tmp58_;
	_g_free0 (_tmp57_);
	_tmp59_ = _type;
	_tmp60_ = string_replace (_tmp59_, "?", "");
	_g_free0 (_type);
	_type = _tmp60_;
	_tmp61_ = _type;
	_tmp62_ = string_replace (_tmp61_, "unsigned ", "u");
	_g_free0 (_type);
	_type = _tmp62_;
	_tmp63_ = _type;
	_tmp64_ = _tmp63_;
	_tmp66_ = (NULL == _tmp64_) ? 0 : g_quark_from_string (_tmp64_);
	if ((_tmp66_ == ((0 != _tmp65_label0) ? _tmp65_label0 : (_tmp65_label0 = g_quark_from_static_string ("bool")))) || (_tmp66_ == ((0 != _tmp65_label1) ? _tmp65_label1 : (_tmp65_label1 = g_quark_from_static_string ("gboolean"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp67_;
				_tmp67_ = g_strdup ("bool");
				result = _tmp67_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label2) ? _tmp65_label2 : (_tmp65_label2 = g_quark_from_static_string ("gconstpointer")))) || (_tmp66_ == ((0 != _tmp65_label3) ? _tmp65_label3 : (_tmp65_label3 = g_quark_from_static_string ("gpointer"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp68_;
				_tmp68_ = g_strdup ("void*");
				result = _tmp68_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label4) ? _tmp65_label4 : (_tmp65_label4 = g_quark_from_static_string ("gchar")))) {
		switch (0) {
			default:
			{
				gchar* _tmp69_;
				_tmp69_ = g_strdup ("char");
				result = _tmp69_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label5) ? _tmp65_label5 : (_tmp65_label5 = g_quark_from_static_string ("SDBSdb")))) {
		switch (0) {
			default:
			{
				gchar* _tmp70_;
				_tmp70_ = g_strdup ("Sdb");
				result = _tmp70_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if ((((_tmp66_ == ((0 != _tmp65_label6) ? _tmp65_label6 : (_tmp65_label6 = g_quark_from_static_string ("gint")))) || (_tmp66_ == ((0 != _tmp65_label7) ? _tmp65_label7 : (_tmp65_label7 = g_quark_from_static_string ("st32"))))) || (_tmp66_ == ((0 != _tmp65_label8) ? _tmp65_label8 : (_tmp65_label8 = g_quark_from_static_string ("int32"))))) || (_tmp66_ == ((0 != _tmp65_label9) ? _tmp65_label9 : (_tmp65_label9 = g_quark_from_static_string ("gint32"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp71_;
				_tmp71_ = g_strdup ("int");
				result = _tmp71_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (((((_tmp66_ == ((0 != _tmp65_label10) ? _tmp65_label10 : (_tmp65_label10 = g_quark_from_static_string ("uint")))) || (_tmp66_ == ((0 != _tmp65_label11) ? _tmp65_label11 : (_tmp65_label11 = g_quark_from_static_string ("guint"))))) || (_tmp66_ == ((0 != _tmp65_label12) ? _tmp65_label12 : (_tmp65_label12 = g_quark_from_static_string ("ut32"))))) || (_tmp66_ == ((0 != _tmp65_label13) ? _tmp65_label13 : (_tmp65_label13 = g_quark_from_static_string ("uint32"))))) || (_tmp66_ == ((0 != _tmp65_label14) ? _tmp65_label14 : (_tmp65_label14 = g_quark_from_static_string ("guint32"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp72_;
				_tmp72_ = g_strdup ("unsigned int");
				result = _tmp72_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label15) ? _tmp65_label15 : (_tmp65_label15 = g_quark_from_static_string ("glong")))) {
		switch (0) {
			default:
			{
				gchar* _tmp73_;
				_tmp73_ = g_strdup ("long");
				result = _tmp73_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (((_tmp66_ == ((0 != _tmp65_label16) ? _tmp65_label16 : (_tmp65_label16 = g_quark_from_static_string ("ut8")))) || (_tmp66_ == ((0 != _tmp65_label17) ? _tmp65_label17 : (_tmp65_label17 = g_quark_from_static_string ("uint8"))))) || (_tmp66_ == ((0 != _tmp65_label18) ? _tmp65_label18 : (_tmp65_label18 = g_quark_from_static_string ("guint8"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp74_;
				_tmp74_ = g_strdup ("unsigned char");
				result = _tmp74_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if ((_tmp66_ == ((0 != _tmp65_label19) ? _tmp65_label19 : (_tmp65_label19 = g_quark_from_static_string ("guint16")))) || (_tmp66_ == ((0 != _tmp65_label20) ? _tmp65_label20 : (_tmp65_label20 = g_quark_from_static_string ("uint16"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp75_;
				_tmp75_ = g_strdup ("unsigned short");
				result = _tmp75_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (((_tmp66_ == ((0 != _tmp65_label21) ? _tmp65_label21 : (_tmp65_label21 = g_quark_from_static_string ("st64")))) || (_tmp66_ == ((0 != _tmp65_label22) ? _tmp65_label22 : (_tmp65_label22 = g_quark_from_static_string ("int64"))))) || (_tmp66_ == ((0 != _tmp65_label23) ? _tmp65_label23 : (_tmp65_label23 = g_quark_from_static_string ("gint64"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp76_;
				_tmp76_ = g_strdup ("long long");
				result = _tmp76_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (((_tmp66_ == ((0 != _tmp65_label24) ? _tmp65_label24 : (_tmp65_label24 = g_quark_from_static_string ("ut64")))) || (_tmp66_ == ((0 != _tmp65_label25) ? _tmp65_label25 : (_tmp65_label25 = g_quark_from_static_string ("uint64"))))) || (_tmp66_ == ((0 != _tmp65_label26) ? _tmp65_label26 : (_tmp65_label26 = g_quark_from_static_string ("guint64"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp77_;
				_tmp77_ = g_strdup ("unsigned long long");
				result = _tmp77_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label27) ? _tmp65_label27 : (_tmp65_label27 = g_quark_from_static_string ("gdouble")))) {
		switch (0) {
			default:
			{
				gchar* _tmp78_;
				_tmp78_ = g_strdup ("double");
				result = _tmp78_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label28) ? _tmp65_label28 : (_tmp65_label28 = g_quark_from_static_string ("gfloat")))) {
		switch (0) {
			default:
			{
				gchar* _tmp79_;
				_tmp79_ = g_strdup ("float");
				result = _tmp79_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label29) ? _tmp65_label29 : (_tmp65_label29 = g_quark_from_static_string ("string")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp80_ = NULL;
				gchar* _tmp81_;
				if (retType) {
					_tmp80_ = "const char*";
				} else {
					_tmp80_ = "char*";
				}
				_tmp81_ = g_strdup (_tmp80_);
				result = _tmp81_;
				_g_free0 (_type);
				_g_free0 (generic);
				return result;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label30) ? _tmp65_label30 : (_tmp65_label30 = g_quark_from_static_string ("RList")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp82_;
				_tmp82_ = generic;
				if (g_strcmp0 (_tmp82_, "") != 0) {
					const gchar* _tmp83_;
					gchar* _tmp84_;
					gchar* _tmp85_;
					gchar* _tmp86_;
					gchar* _tmp87_;
					_tmp83_ = generic;
					_tmp84_ = g_strconcat ("std::vector<", _tmp83_, NULL);
					_tmp85_ = _tmp84_;
					_tmp86_ = g_strconcat (_tmp85_, ">", NULL);
					_tmp87_ = _tmp86_;
					_g_free0 (_tmp85_);
					result = _tmp87_;
					_g_free0 (_type);
					_g_free0 (generic);
					return result;
				}
				break;
			}
		}
	} else if (_tmp66_ == ((0 != _tmp65_label31) ? _tmp65_label31 : (_tmp65_label31 = g_quark_from_static_string ("SdbList")))) {
		switch (0) {
			default:
			{
				const gchar* _tmp88_;
				_tmp88_ = generic;
				if (g_strcmp0 (_tmp88_, "") != 0) {
					const gchar* _tmp89_;
					gchar* _tmp90_;
					gchar* _tmp91_;
					gchar* _tmp92_;
					gchar* _tmp93_;
					_tmp89_ = generic;
					_tmp90_ = g_strconcat ("std::vector<", _tmp89_, NULL);
					_tmp91_ = _tmp90_;
					_tmp92_ = g_strconcat (_tmp91_, ">", NULL);
					_tmp93_ = _tmp92_;
					_g_free0 (_tmp91_);
					result = _tmp93_;
					_g_free0 (_type);
					_g_free0 (generic);
					return result;
				}
				break;
			}
		}
	}
	result = _type;
	_g_free0 (generic);
	return result;
}

static void
swig_writer_real_visit_constant (ValaCodeVisitor* base,
                                 ValaConstant* c)
{
	SwigWriter * self;
	gchar* cname = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	self = (SwigWriter*) base;
	g_return_if_fail (c != NULL);
	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) c);
	cname = _tmp0_;
	_tmp1_ = self->priv->extends;
	_tmp2_ = vala_symbol_get_name ((ValaSymbol*) c);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat ("%immutable ", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strconcat (_tmp5_, ";\n", NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strconcat (_tmp1_, _tmp7_, NULL);
	_g_free0 (self->priv->extends);
	self->priv->extends = _tmp8_;
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_tmp9_ = self->priv->extends;
	_tmp10_ = vala_symbol_get_name ((ValaSymbol*) c);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strconcat ("static const char *", _tmp11_, NULL);
	_tmp13_ = _tmp12_;
	_tmp14_ = g_strconcat (_tmp13_, " = ", NULL);
	_tmp15_ = _tmp14_;
	_tmp16_ = g_strconcat (_tmp15_, cname, NULL);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_strconcat (_tmp17_, ";\n", NULL);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strconcat (_tmp9_, _tmp19_, NULL);
	_g_free0 (self->priv->extends);
	self->priv->extends = _tmp20_;
	_g_free0 (_tmp19_);
	_g_free0 (_tmp17_);
	_g_free0 (_tmp15_);
	_g_free0 (_tmp13_);
	_g_free0 (cname);
}

static void
swig_writer_real_visit_enum (ValaCodeVisitor* base,
                             ValaEnum* e)
{
	SwigWriter * self;
	self = (SwigWriter*) base;
	g_return_if_fail (e != NULL);
	valabind_writer_add_includes ((ValabindWriter*) self, (ValaSymbol*) e);
}

static gpointer
_vala_iterable_ref0 (gpointer self)
{
	return self ? vala_iterable_ref (self) : NULL;
}

static void
swig_writer_real_visit_struct (ValaCodeVisitor* base,
                               ValaStruct* s)
{
	SwigWriter * self;
	gchar* name = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* cname = NULL;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	ValaList* methods = NULL;
	ValaList* _tmp27_;
	ValaList* _tmp28_;
	ValaList* _tmp29_;
	gint _tmp30_;
	gint _tmp31_;
	self = (SwigWriter*) base;
	g_return_if_fail (s != NULL);
	valabind_writer_add_includes ((ValabindWriter*) self, (ValaSymbol*) s);
	_tmp0_ = vala_symbol_get_full_name ((ValaSymbol*) s);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->ns_pfx;
	_tmp3_ = string_replace (_tmp1_, _tmp2_, "");
	_tmp4_ = _tmp3_;
	_tmp5_ = string_replace (_tmp4_, ".", "");
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	_g_free0 (_tmp1_);
	name = _tmp6_;
	_tmp7_ = vala_get_ccode_name ((ValaCodeNode*) s);
	cname = _tmp7_;
	_tmp8_ = self->priv->structs;
	_tmp9_ = cname;
	_tmp10_ = g_strdup_printf ("typedef struct %s {\n", _tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strconcat (_tmp8_, _tmp11_, NULL);
	_g_free0 (self->priv->structs);
	self->priv->structs = _tmp12_;
	_g_free0 (_tmp11_);
	{
		ValaList* _f_list = NULL;
		ValaList* _tmp13_;
		gint _f_size = 0;
		ValaList* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		gint _f_index = 0;
		_tmp13_ = vala_struct_get_fields (s);
		_f_list = _tmp13_;
		_tmp14_ = _f_list;
		_tmp15_ = vala_collection_get_size ((ValaCollection*) _tmp14_);
		_tmp16_ = _tmp15_;
		_f_size = _tmp16_;
		_f_index = -1;
		while (TRUE) {
			gint _tmp17_;
			gint _tmp18_;
			ValaField* f = NULL;
			ValaList* _tmp19_;
			gpointer _tmp20_;
			ValaField* _tmp21_;
			_f_index = _f_index + 1;
			_tmp17_ = _f_index;
			_tmp18_ = _f_size;
			if (!(_tmp17_ < _tmp18_)) {
				break;
			}
			_tmp19_ = _f_list;
			_tmp20_ = vala_list_get (_tmp19_, _f_index);
			f = (ValaField*) _tmp20_;
			_tmp21_ = f;
			vala_code_node_accept ((ValaCodeNode*) _tmp21_, (ValaCodeVisitor*) self);
			_vala_code_node_unref0 (f);
		}
	}
	_tmp22_ = self->priv->structs;
	_tmp23_ = name;
	_tmp24_ = g_strdup_printf ("} %s;\n", _tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_strconcat (_tmp22_, _tmp25_, NULL);
	_g_free0 (self->priv->structs);
	self->priv->structs = _tmp26_;
	_g_free0 (_tmp25_);
	_tmp27_ = vala_struct_get_methods (s);
	_tmp28_ = _vala_iterable_ref0 (_tmp27_);
	methods = _tmp28_;
	_tmp29_ = methods;
	_tmp30_ = vala_collection_get_size ((ValaCollection*) _tmp29_);
	_tmp31_ = _tmp30_;
	if (_tmp31_ > 0) {
		const gchar* _tmp32_;
		const gchar* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		const gchar* _tmp46_;
		gchar* _tmp47_;
		_tmp32_ = self->priv->extends;
		_tmp33_ = name;
		_tmp34_ = g_strdup_printf ("%%extend %s {\n", _tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = g_strconcat (_tmp32_, _tmp35_, NULL);
		_g_free0 (self->priv->extends);
		self->priv->extends = _tmp36_;
		_g_free0 (_tmp35_);
		{
			ValaList* _m_list = NULL;
			ValaList* _tmp37_;
			gint _m_size = 0;
			ValaList* _tmp38_;
			gint _tmp39_;
			gint _tmp40_;
			gint _m_index = 0;
			_tmp37_ = methods;
			_m_list = _tmp37_;
			_tmp38_ = _m_list;
			_tmp39_ = vala_collection_get_size ((ValaCollection*) _tmp38_);
			_tmp40_ = _tmp39_;
			_m_size = _tmp40_;
			_m_index = -1;
			while (TRUE) {
				gint _tmp41_;
				gint _tmp42_;
				ValaMethod* m = NULL;
				ValaList* _tmp43_;
				gpointer _tmp44_;
				ValaMethod* _tmp45_;
				_m_index = _m_index + 1;
				_tmp41_ = _m_index;
				_tmp42_ = _m_size;
				if (!(_tmp41_ < _tmp42_)) {
					break;
				}
				_tmp43_ = _m_list;
				_tmp44_ = vala_list_get (_tmp43_, _m_index);
				m = (ValaMethod*) _tmp44_;
				_tmp45_ = m;
				vala_code_visitor_visit_method ((ValaCodeVisitor*) self, _tmp45_);
				_vala_code_node_unref0 (m);
			}
		}
		_tmp46_ = self->priv->extends;
		_tmp47_ = g_strconcat (_tmp46_, "};\n", NULL);
		_g_free0 (self->priv->extends);
		self->priv->extends = _tmp47_;
	}
	_vala_iterable_unref0 (methods);
	_g_free0 (cname);
	_g_free0 (name);
}

static void
swig_writer_real_visit_class (ValaCodeVisitor* base,
                              ValaClass* c)
{
	SwigWriter * self;
	gchar* name = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* cname = NULL;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* freefun = NULL;
	const gchar* _tmp38_;
	ValaList* methods = NULL;
	ValaList* _tmp39_;
	ValaList* _tmp40_;
	gboolean _tmp41_ = FALSE;
	const gchar* _tmp42_;
	self = (SwigWriter*) base;
	g_return_if_fail (c != NULL);
	valabind_writer_add_includes ((ValabindWriter*) self, (ValaSymbol*) c);
	_tmp0_ = vala_symbol_get_full_name ((ValaSymbol*) c);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->ns_pfx;
	_tmp3_ = string_replace (_tmp1_, _tmp2_, "");
	_tmp4_ = _tmp3_;
	_tmp5_ = string_replace (_tmp4_, ".", "");
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	_g_free0 (_tmp1_);
	name = _tmp6_;
	_tmp7_ = vala_get_ccode_name ((ValaCodeNode*) c);
	cname = _tmp7_;
	_tmp8_ = self->priv->structs;
	_tmp9_ = cname;
	_tmp10_ = g_strdup_printf ("typedef struct %s {\n", _tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = g_strconcat (_tmp8_, _tmp11_, NULL);
	_g_free0 (self->priv->structs);
	self->priv->structs = _tmp12_;
	_g_free0 (_tmp11_);
	{
		ValaList* _f_list = NULL;
		ValaList* _tmp13_;
		gint _f_size = 0;
		ValaList* _tmp14_;
		gint _tmp15_;
		gint _tmp16_;
		gint _f_index = 0;
		_tmp13_ = vala_object_type_symbol_get_fields ((ValaObjectTypeSymbol*) c);
		_f_list = _tmp13_;
		_tmp14_ = _f_list;
		_tmp15_ = vala_collection_get_size ((ValaCollection*) _tmp14_);
		_tmp16_ = _tmp15_;
		_f_size = _tmp16_;
		_f_index = -1;
		while (TRUE) {
			gint _tmp17_;
			gint _tmp18_;
			ValaField* f = NULL;
			ValaList* _tmp19_;
			gpointer _tmp20_;
			ValaField* _tmp21_;
			_f_index = _f_index + 1;
			_tmp17_ = _f_index;
			_tmp18_ = _f_size;
			if (!(_tmp17_ < _tmp18_)) {
				break;
			}
			_tmp19_ = _f_list;
			_tmp20_ = vala_list_get (_tmp19_, _f_index);
			f = (ValaField*) _tmp20_;
			_tmp21_ = f;
			vala_code_node_accept ((ValaCodeNode*) _tmp21_, (ValaCodeVisitor*) self);
			_vala_code_node_unref0 (f);
		}
	}
	_tmp22_ = self->priv->structs;
	_tmp23_ = name;
	_tmp24_ = g_strdup_printf ("} %s;\n", _tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_strconcat (_tmp22_, _tmp25_, NULL);
	_g_free0 (self->priv->structs);
	self->priv->structs = _tmp26_;
	_g_free0 (_tmp25_);
	{
		ValaList* _e_list = NULL;
		ValaList* _tmp27_;
		gint _e_size = 0;
		ValaList* _tmp28_;
		gint _tmp29_;
		gint _tmp30_;
		gint _e_index = 0;
		_tmp27_ = vala_object_type_symbol_get_enums ((ValaObjectTypeSymbol*) c);
		_e_list = _tmp27_;
		_tmp28_ = _e_list;
		_tmp29_ = vala_collection_get_size ((ValaCollection*) _tmp28_);
		_tmp30_ = _tmp29_;
		_e_size = _tmp30_;
		_e_index = -1;
		while (TRUE) {
			gint _tmp31_;
			gint _tmp32_;
			ValaEnum* e = NULL;
			ValaList* _tmp33_;
			gpointer _tmp34_;
			ValaEnum* _tmp35_;
			_e_index = _e_index + 1;
			_tmp31_ = _e_index;
			_tmp32_ = _e_size;
			if (!(_tmp31_ < _tmp32_)) {
				break;
			}
			_tmp33_ = _e_list;
			_tmp34_ = vala_list_get (_tmp33_, _e_index);
			e = (ValaEnum*) _tmp34_;
			_tmp35_ = e;
			vala_code_node_accept ((ValaCodeNode*) _tmp35_, (ValaCodeVisitor*) self);
			_vala_code_node_unref0 (e);
		}
	}
	freefun = NULL;
	if (vala_is_reference_counting ((ValaTypeSymbol*) c)) {
		gchar* _tmp36_;
		_tmp36_ = vala_get_ccode_unref_function ((ValaObjectTypeSymbol*) c);
		_g_free0 (freefun);
		freefun = _tmp36_;
	} else {
		gchar* _tmp37_;
		_tmp37_ = vala_get_ccode_free_function ((ValaTypeSymbol*) c);
		_g_free0 (freefun);
		freefun = _tmp37_;
	}
	_tmp38_ = freefun;
	if (g_strcmp0 (_tmp38_, "") == 0) {
		_g_free0 (freefun);
		freefun = NULL;
	}
	_tmp39_ = vala_object_type_symbol_get_methods ((ValaObjectTypeSymbol*) c);
	_tmp40_ = _vala_iterable_ref0 (_tmp39_);
	methods = _tmp40_;
	_tmp42_ = freefun;
	if (_tmp42_ != NULL) {
		_tmp41_ = TRUE;
	} else {
		ValaList* _tmp43_;
		gint _tmp44_;
		gint _tmp45_;
		_tmp43_ = methods;
		_tmp44_ = vala_collection_get_size ((ValaCollection*) _tmp43_);
		_tmp45_ = _tmp44_;
		_tmp41_ = _tmp45_ > 0;
	}
	if (_tmp41_) {
		const gchar* _tmp46_;
		const gchar* _tmp47_;
		gchar* _tmp48_;
		gchar* _tmp49_;
		gchar* _tmp50_;
		gboolean _tmp51_ = FALSE;
		const gchar* _tmp52_;
		const gchar* _tmp69_;
		gchar* _tmp70_;
		_tmp46_ = self->priv->extends;
		_tmp47_ = name;
		_tmp48_ = g_strdup_printf ("%%extend %s {\n", _tmp47_);
		_tmp49_ = _tmp48_;
		_tmp50_ = g_strconcat (_tmp46_, _tmp49_, NULL);
		_g_free0 (self->priv->extends);
		self->priv->extends = _tmp50_;
		_g_free0 (_tmp49_);
		_tmp52_ = freefun;
		if (_tmp52_ != NULL) {
			const gchar* _tmp53_;
			_tmp53_ = freefun;
			_tmp51_ = g_strcmp0 (_tmp53_, "") != 0;
		} else {
			_tmp51_ = FALSE;
		}
		if (_tmp51_) {
			const gchar* _tmp54_;
			const gchar* _tmp55_;
			const gchar* _tmp56_;
			gchar* _tmp57_;
			gchar* _tmp58_;
			gchar* _tmp59_;
			_tmp54_ = self->priv->extends;
			_tmp55_ = name;
			_tmp56_ = freefun;
			_tmp57_ = g_strdup_printf ("\t~%s() {\n\t\t%s(self);\n\t}\n", _tmp55_, _tmp56_);
			_tmp58_ = _tmp57_;
			_tmp59_ = g_strconcat (_tmp54_, _tmp58_, NULL);
			_g_free0 (self->priv->extends);
			self->priv->extends = _tmp59_;
			_g_free0 (_tmp58_);
		}
		{
			ValaList* _m_list = NULL;
			ValaList* _tmp60_;
			gint _m_size = 0;
			ValaList* _tmp61_;
			gint _tmp62_;
			gint _tmp63_;
			gint _m_index = 0;
			_tmp60_ = methods;
			_m_list = _tmp60_;
			_tmp61_ = _m_list;
			_tmp62_ = vala_collection_get_size ((ValaCollection*) _tmp61_);
			_tmp63_ = _tmp62_;
			_m_size = _tmp63_;
			_m_index = -1;
			while (TRUE) {
				gint _tmp64_;
				gint _tmp65_;
				ValaMethod* m = NULL;
				ValaList* _tmp66_;
				gpointer _tmp67_;
				ValaMethod* _tmp68_;
				_m_index = _m_index + 1;
				_tmp64_ = _m_index;
				_tmp65_ = _m_size;
				if (!(_tmp64_ < _tmp65_)) {
					break;
				}
				_tmp66_ = _m_list;
				_tmp67_ = vala_list_get (_tmp66_, _m_index);
				m = (ValaMethod*) _tmp67_;
				_tmp68_ = m;
				vala_code_visitor_visit_method ((ValaCodeVisitor*) self, _tmp68_);
				_vala_code_node_unref0 (m);
			}
		}
		_tmp69_ = self->priv->extends;
		_tmp70_ = g_strconcat (_tmp69_, "};\n", NULL);
		_g_free0 (self->priv->extends);
		self->priv->extends = _tmp70_;
	}
	{
		ValaList* _s_list = NULL;
		ValaList* _tmp71_;
		gint _s_size = 0;
		ValaList* _tmp72_;
		gint _tmp73_;
		gint _tmp74_;
		gint _s_index = 0;
		_tmp71_ = vala_object_type_symbol_get_structs ((ValaObjectTypeSymbol*) c);
		_s_list = _tmp71_;
		_tmp72_ = _s_list;
		_tmp73_ = vala_collection_get_size ((ValaCollection*) _tmp72_);
		_tmp74_ = _tmp73_;
		_s_size = _tmp74_;
		_s_index = -1;
		while (TRUE) {
			gint _tmp75_;
			gint _tmp76_;
			ValaStruct* s = NULL;
			ValaList* _tmp77_;
			gpointer _tmp78_;
			ValaStruct* _tmp79_;
			_s_index = _s_index + 1;
			_tmp75_ = _s_index;
			_tmp76_ = _s_size;
			if (!(_tmp75_ < _tmp76_)) {
				break;
			}
			_tmp77_ = _s_list;
			_tmp78_ = vala_list_get (_tmp77_, _s_index);
			s = (ValaStruct*) _tmp78_;
			_tmp79_ = s;
			vala_code_node_accept ((ValaCodeNode*) _tmp79_, (ValaCodeVisitor*) self);
			_vala_code_node_unref0 (s);
		}
	}
	{
		ValaList* _k_list = NULL;
		ValaList* _tmp80_;
		gint _k_size = 0;
		ValaList* _tmp81_;
		gint _tmp82_;
		gint _tmp83_;
		gint _k_index = 0;
		_tmp80_ = vala_object_type_symbol_get_classes ((ValaObjectTypeSymbol*) c);
		_k_list = _tmp80_;
		_tmp81_ = _k_list;
		_tmp82_ = vala_collection_get_size ((ValaCollection*) _tmp81_);
		_tmp83_ = _tmp82_;
		_k_size = _tmp83_;
		_k_index = -1;
		while (TRUE) {
			gint _tmp84_;
			gint _tmp85_;
			ValaClass* k = NULL;
			ValaList* _tmp86_;
			gpointer _tmp87_;
			ValaClass* _tmp88_;
			_k_index = _k_index + 1;
			_tmp84_ = _k_index;
			_tmp85_ = _k_size;
			if (!(_tmp84_ < _tmp85_)) {
				break;
			}
			_tmp86_ = _k_list;
			_tmp87_ = vala_list_get (_tmp86_, _k_index);
			k = (ValaClass*) _tmp87_;
			_tmp88_ = k;
			vala_code_node_accept ((ValaCodeNode*) _tmp88_, (ValaCodeVisitor*) self);
			_vala_code_node_unref0 (k);
		}
	}
	_vala_iterable_unref0 (methods);
	_g_free0 (freefun);
	_g_free0 (cname);
	_g_free0 (name);
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static void
swig_writer_real_visit_field (ValaCodeVisitor* base,
                              ValaField* f)
{
	SwigWriter * self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* field = NULL;
	gchar* _tmp2_;
	ValaDataType* type = NULL;
	ValaDataType* _tmp3_;
	ValaDataType* _tmp4_;
	ValaDataType* _tmp5_;
	ValaDataType* _tmp6_;
	const gchar* _tmp56_;
	const gchar* _tmp57_;
	gchar* _tmp58_;
	gchar* _tmp59_;
	gchar* _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	self = (SwigWriter*) base;
	g_return_if_fail (f != NULL);
	if (vala_symbol_is_private_symbol ((ValaSymbol*) f)) {
		return;
	}
	_tmp0_ = vala_symbol_get_name ((ValaSymbol*) f);
	_tmp1_ = _tmp0_;
	if (g_strcmp0 (_tmp1_, "class") == 0) {
		return;
	}
	_tmp2_ = g_strdup ("");
	field = _tmp2_;
	_tmp3_ = vala_variable_get_variable_type ((ValaVariable*) f);
	_tmp4_ = _tmp3_;
	_tmp5_ = _vala_code_node_ref0 (_tmp4_);
	type = _tmp5_;
	_tmp6_ = type;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, VALA_TYPE_ARRAY_TYPE)) {
		ValaArrayType* array = NULL;
		ValaDataType* _tmp7_;
		ValaArrayType* _tmp8_;
		gchar* element = NULL;
		ValaArrayType* _tmp9_;
		ValaDataType* _tmp10_;
		ValaDataType* _tmp11_;
		gchar* _tmp12_;
		gint len = 0;
		ValaArrayType* _tmp13_;
		const gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		gchar* _tmp27_;
		gchar* _tmp28_;
		gchar* _tmp29_;
		_tmp7_ = type;
		_tmp8_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) _tmp7_) : NULL);
		array = _tmp8_;
		_tmp9_ = array;
		_tmp10_ = vala_array_type_get_element_type (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = swig_writer_type_name (self, _tmp11_, FALSE, FALSE);
		element = _tmp12_;
		_tmp13_ = array;
		len = array_length (_tmp13_);
		if (len < 0) {
			const gchar* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
			const gchar* _tmp17_;
			const gchar* _tmp18_;
			gchar* _tmp19_;
			_tmp14_ = element;
			_tmp15_ = g_strconcat (_tmp14_, "* ", NULL);
			_tmp16_ = _tmp15_;
			_tmp17_ = vala_symbol_get_name ((ValaSymbol*) f);
			_tmp18_ = _tmp17_;
			_tmp19_ = g_strconcat (_tmp16_, _tmp18_, NULL);
			_g_free0 (field);
			field = _tmp19_;
			_g_free0 (_tmp16_);
		}
		_tmp20_ = element;
		_tmp21_ = g_strconcat (_tmp20_, " ", NULL);
		_tmp22_ = _tmp21_;
		_tmp23_ = vala_symbol_get_name ((ValaSymbol*) f);
		_tmp24_ = _tmp23_;
		_tmp25_ = g_strconcat (_tmp22_, _tmp24_, NULL);
		_tmp26_ = _tmp25_;
		_tmp27_ = g_strdup_printf ("[%d]", len);
		_tmp28_ = _tmp27_;
		_tmp29_ = g_strconcat (_tmp26_, _tmp28_, NULL);
		_g_free0 (field);
		field = _tmp29_;
		_g_free0 (_tmp28_);
		_g_free0 (_tmp26_);
		_g_free0 (_tmp22_);
		_g_free0 (element);
		_vala_code_node_unref0 (array);
	} else {
		gchar* _type = NULL;
		ValaDataType* _tmp30_;
		gchar* _tmp31_;
		const gchar* _tmp32_;
		_tmp30_ = type;
		_tmp31_ = vala_code_node_to_string ((ValaCodeNode*) _tmp30_);
		_type = _tmp31_;
		_tmp32_ = _type;
		if (string_index_of (_tmp32_, "RListIter", 0) != -1) {
			const gchar* _tmp33_;
			const gchar* _tmp34_;
			gchar* _tmp35_;
			_tmp33_ = vala_symbol_get_name ((ValaSymbol*) f);
			_tmp34_ = _tmp33_;
			_tmp35_ = g_strconcat ("RListIter* ", _tmp34_, NULL);
			_g_free0 (field);
			field = _tmp35_;
		} else {
			const gchar* _tmp36_;
			_tmp36_ = _type;
			if (string_index_of (_tmp36_, "RList", 0) != -1) {
				const gchar* _tmp37_;
				const gchar* _tmp38_;
				gchar* _tmp39_;
				_tmp37_ = vala_symbol_get_name ((ValaSymbol*) f);
				_tmp38_ = _tmp37_;
				_tmp39_ = g_strconcat ("RList* ", _tmp38_, NULL);
				_g_free0 (field);
				field = _tmp39_;
			} else {
				const gchar* _tmp40_;
				_tmp40_ = _type;
				if (string_index_of (_tmp40_, "SdbListIter", 0) != -1) {
					const gchar* _tmp41_;
					const gchar* _tmp42_;
					gchar* _tmp43_;
					_tmp41_ = vala_symbol_get_name ((ValaSymbol*) f);
					_tmp42_ = _tmp41_;
					_tmp43_ = g_strconcat ("SdbListIter* ", _tmp42_, NULL);
					_g_free0 (field);
					field = _tmp43_;
				} else {
					const gchar* _tmp44_;
					_tmp44_ = _type;
					if (string_index_of (_tmp44_, "SdbList", 0) != -1) {
						const gchar* _tmp45_;
						const gchar* _tmp46_;
						gchar* _tmp47_;
						_tmp45_ = vala_symbol_get_name ((ValaSymbol*) f);
						_tmp46_ = _tmp45_;
						_tmp47_ = g_strconcat ("SdbList* ", _tmp46_, NULL);
						_g_free0 (field);
						field = _tmp47_;
					} else {
						ValaDataType* _tmp48_;
						gchar* _tmp49_;
						gchar* _tmp50_;
						gchar* _tmp51_;
						gchar* _tmp52_;
						const gchar* _tmp53_;
						const gchar* _tmp54_;
						gchar* _tmp55_;
						_tmp48_ = type;
						_tmp49_ = swig_writer_type_name (self, _tmp48_, FALSE, FALSE);
						_tmp50_ = _tmp49_;
						_tmp51_ = g_strconcat (_tmp50_, " ", NULL);
						_tmp52_ = _tmp51_;
						_tmp53_ = vala_symbol_get_name ((ValaSymbol*) f);
						_tmp54_ = _tmp53_;
						_tmp55_ = g_strconcat (_tmp52_, _tmp54_, NULL);
						_g_free0 (field);
						field = _tmp55_;
						_g_free0 (_tmp52_);
						_g_free0 (_tmp50_);
					}
				}
			}
		}
		_g_free0 (_type);
	}
	_tmp56_ = self->priv->structs;
	_tmp57_ = field;
	_tmp58_ = g_strconcat ("\t", _tmp57_, NULL);
	_tmp59_ = _tmp58_;
	_tmp60_ = g_strconcat (_tmp59_, ";\n", NULL);
	_tmp61_ = _tmp60_;
	_tmp62_ = g_strconcat (_tmp56_, _tmp61_, NULL);
	_g_free0 (self->priv->structs);
	self->priv->structs = _tmp62_;
	_g_free0 (_tmp61_);
	_g_free0 (_tmp59_);
	_vala_code_node_unref0 (type);
	_g_free0 (field);
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static void
swig_writer_real_visit_method (ValaCodeVisitor* base,
                               ValaMethod* m)
{
	SwigWriter * self;
	gchar* cname = NULL;
	gchar* _tmp0_;
	gchar* alias = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	ValaSymbol* parent = NULL;
	ValaSymbol* _tmp4_;
	ValaSymbol* _tmp5_;
	ValaSymbol* _tmp6_;
	gboolean is_static = FALSE;
	ValaMemberBinding _tmp7_;
	ValaMemberBinding _tmp8_;
	gboolean is_constructor = FALSE;
	gboolean _tmp9_ = FALSE;
	ValaSymbol* _tmp10_;
	gboolean parent_is_class = FALSE;
	gchar* ret = NULL;
	ValaDataType* _tmp12_;
	ValaDataType* _tmp13_;
	gchar* _tmp14_;
	gchar* def_args = NULL;
	gchar* _tmp15_;
	gchar* call_args = NULL;
	gchar* _tmp16_;
	gchar* applys = NULL;
	gchar* _tmp17_;
	gchar* clears = NULL;
	gchar* _tmp18_;
	self = (SwigWriter*) base;
	g_return_if_fail (m != NULL);
	if (vala_symbol_is_private_symbol ((ValaSymbol*) m)) {
		return;
	}
	valabind_writer_add_includes ((ValabindWriter*) self, (ValaSymbol*) m);
	_tmp0_ = vala_get_ccode_name ((ValaCodeNode*) m);
	cname = _tmp0_;
	_tmp1_ = vala_symbol_get_name ((ValaSymbol*) m);
	_tmp2_ = _tmp1_;
	_tmp3_ = swig_writer_get_alias (self, _tmp2_);
	alias = _tmp3_;
	_tmp4_ = vala_symbol_get_parent_symbol ((ValaSymbol*) m);
	_tmp5_ = _tmp4_;
	_tmp6_ = _vala_code_node_ref0 (_tmp5_);
	parent = _tmp6_;
	_tmp7_ = vala_method_get_binding (m);
	_tmp8_ = _tmp7_;
	is_static = (_tmp8_ & VALA_MEMBER_BINDING_STATIC) != 0;
	is_constructor = G_TYPE_CHECK_INSTANCE_TYPE (m, VALA_TYPE_CREATION_METHOD);
	_tmp10_ = parent;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, VALA_TYPE_CLASS)) {
		_tmp9_ = TRUE;
	} else {
		ValaSymbol* _tmp11_;
		_tmp11_ = parent;
		_tmp9_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, VALA_TYPE_STRUCT);
	}
	parent_is_class = _tmp9_;
	_tmp12_ = vala_callable_get_return_type ((ValaCallable*) m);
	_tmp13_ = _tmp12_;
	_tmp14_ = swig_writer_type_name (self, _tmp13_, TRUE, FALSE);
	ret = _tmp14_;
	_tmp15_ = g_strdup ("");
	def_args = _tmp15_;
	_tmp16_ = g_strdup ("");
	call_args = _tmp16_;
	_tmp17_ = g_strdup ("");
	applys = _tmp17_;
	_tmp18_ = g_strdup ("");
	clears = _tmp18_;
	{
		ValaList* _foo_list = NULL;
		ValaList* _tmp19_;
		gint _foo_size = 0;
		ValaList* _tmp20_;
		gint _tmp21_;
		gint _tmp22_;
		gint _foo_index = 0;
		_tmp19_ = vala_callable_get_parameters ((ValaCallable*) m);
		_foo_list = _tmp19_;
		_tmp20_ = _foo_list;
		_tmp21_ = vala_collection_get_size ((ValaCollection*) _tmp20_);
		_tmp22_ = _tmp21_;
		_foo_size = _tmp22_;
		_foo_index = -1;
		while (TRUE) {
			gint _tmp23_;
			gint _tmp24_;
			ValaParameter* foo = NULL;
			ValaList* _tmp25_;
			gpointer _tmp26_;
			ValaDataType* bar = NULL;
			ValaParameter* _tmp27_;
			ValaDataType* _tmp28_;
			ValaDataType* _tmp29_;
			ValaDataType* _tmp30_;
			ValaDataType* _tmp31_;
			gchar* arg_name = NULL;
			ValaParameter* _tmp32_;
			const gchar* _tmp33_;
			const gchar* _tmp34_;
			gchar* _tmp35_;
			gchar* arg_type = NULL;
			ValaDataType* _tmp36_;
			gchar* _tmp37_;
			ValaParameter* _tmp38_;
			ValaParameterDirection _tmp39_;
			ValaParameterDirection _tmp40_;
			const gchar* _tmp67_;
			gchar* _tmp68_;
			gchar* _tmp69_;
			const gchar* _tmp70_;
			gchar* _tmp71_;
			const gchar* _tmp72_;
			gchar* _tmp73_;
			gchar* _tmp74_;
			const gchar* _tmp75_;
			gchar* _tmp76_;
			gchar* _tmp77_;
			gchar* _tmp78_;
			gchar* _tmp79_;
			const gchar* _tmp80_;
			gchar* _tmp81_;
			_foo_index = _foo_index + 1;
			_tmp23_ = _foo_index;
			_tmp24_ = _foo_size;
			if (!(_tmp23_ < _tmp24_)) {
				break;
			}
			_tmp25_ = _foo_list;
			_tmp26_ = vala_list_get (_tmp25_, _foo_index);
			foo = (ValaParameter*) _tmp26_;
			_tmp27_ = foo;
			_tmp28_ = vala_variable_get_variable_type ((ValaVariable*) _tmp27_);
			_tmp29_ = _tmp28_;
			_tmp30_ = _vala_code_node_ref0 (_tmp29_);
			bar = _tmp30_;
			_tmp31_ = bar;
			if (_tmp31_ == NULL) {
				_vala_code_node_unref0 (bar);
				_vala_code_node_unref0 (foo);
				continue;
			}
			_tmp32_ = foo;
			_tmp33_ = vala_symbol_get_name ((ValaSymbol*) _tmp32_);
			_tmp34_ = _tmp33_;
			_tmp35_ = swig_writer_get_alias (self, _tmp34_);
			arg_name = _tmp35_;
			_tmp36_ = bar;
			_tmp37_ = swig_writer_type_name (self, _tmp36_, FALSE, FALSE);
			arg_type = _tmp37_;
			_tmp38_ = foo;
			_tmp39_ = vala_parameter_get_direction (_tmp38_);
			_tmp40_ = _tmp39_;
			if (_tmp40_ != VALA_PARAMETER_DIRECTION_IN) {
				gchar* var_name = NULL;
				gchar* _tmp41_;
				ValaParameter* _tmp42_;
				ValaParameterDirection _tmp43_;
				ValaParameterDirection _tmp44_;
				const gchar* _tmp50_;
				const gchar* _tmp53_;
				const gchar* _tmp54_;
				const gchar* _tmp55_;
				const gchar* _tmp56_;
				const gchar* _tmp57_;
				gchar* _tmp58_;
				gchar* _tmp59_;
				gchar* _tmp60_;
				const gchar* _tmp61_;
				const gchar* _tmp62_;
				const gchar* _tmp63_;
				gchar* _tmp64_;
				gchar* _tmp65_;
				gchar* _tmp66_;
				_tmp41_ = g_strdup ("");
				var_name = _tmp41_;
				_tmp42_ = foo;
				_tmp43_ = vala_parameter_get_direction (_tmp42_);
				_tmp44_ = _tmp43_;
				if (_tmp44_ == VALA_PARAMETER_DIRECTION_OUT) {
					gchar* _tmp45_;
					_tmp45_ = g_strdup ("OUTPUT");
					_g_free0 (var_name);
					var_name = _tmp45_;
				} else {
					ValaParameter* _tmp46_;
					ValaParameterDirection _tmp47_;
					ValaParameterDirection _tmp48_;
					_tmp46_ = foo;
					_tmp47_ = vala_parameter_get_direction (_tmp46_);
					_tmp48_ = _tmp47_;
					if (_tmp48_ == VALA_PARAMETER_DIRECTION_REF) {
						gchar* _tmp49_;
						_tmp49_ = g_strdup ("INOUT");
						_g_free0 (var_name);
						var_name = _tmp49_;
					}
				}
				_tmp50_ = arg_type;
				if (string_index_of (_tmp50_, "*", 0) == -1) {
					const gchar* _tmp51_;
					gchar* _tmp52_;
					_tmp51_ = arg_type;
					_tmp52_ = g_strconcat (_tmp51_, "*", NULL);
					_g_free0 (arg_type);
					arg_type = _tmp52_;
				}
				_tmp53_ = applys;
				_tmp54_ = arg_type;
				_tmp55_ = var_name;
				_tmp56_ = arg_type;
				_tmp57_ = arg_name;
				_tmp58_ = g_strdup_printf ("\t%%apply %s %s { %s %s };\n", _tmp54_, _tmp55_, _tmp56_, _tmp57_);
				_tmp59_ = _tmp58_;
				_tmp60_ = g_strconcat (_tmp53_, _tmp59_, NULL);
				_g_free0 (applys);
				applys = _tmp60_;
				_g_free0 (_tmp59_);
				_tmp61_ = clears;
				_tmp62_ = arg_type;
				_tmp63_ = arg_name;
				_tmp64_ = g_strdup_printf ("\t%%clear %s %s;\n", _tmp62_, _tmp63_);
				_tmp65_ = _tmp64_;
				_tmp66_ = g_strconcat (_tmp61_, _tmp65_, NULL);
				_g_free0 (clears);
				clears = _tmp66_;
				_g_free0 (_tmp65_);
				_g_free0 (var_name);
			}
			_tmp67_ = call_args;
			_tmp68_ = valabind_writer_sep ((ValabindWriter*) self, _tmp67_, ", ");
			_tmp69_ = _tmp68_;
			_tmp70_ = arg_name;
			_tmp71_ = g_strconcat (_tmp69_, _tmp70_, NULL);
			_g_free0 (call_args);
			call_args = _tmp71_;
			_g_free0 (_tmp69_);
			_tmp72_ = def_args;
			_tmp73_ = valabind_writer_sep ((ValabindWriter*) self, _tmp72_, ", ");
			_tmp74_ = _tmp73_;
			_tmp75_ = arg_type;
			_tmp76_ = g_strconcat (_tmp74_, _tmp75_, NULL);
			_tmp77_ = _tmp76_;
			_tmp78_ = g_strconcat (_tmp77_, " ", NULL);
			_tmp79_ = _tmp78_;
			_tmp80_ = arg_name;
			_tmp81_ = g_strconcat (_tmp79_, _tmp80_, NULL);
			_g_free0 (def_args);
			def_args = _tmp81_;
			_g_free0 (_tmp79_);
			_g_free0 (_tmp77_);
			_g_free0 (_tmp74_);
			_g_free0 (arg_type);
			_g_free0 (arg_name);
			_vala_code_node_unref0 (bar);
			_vala_code_node_unref0 (foo);
		}
	}
	if (is_constructor) {
		gchar* classname = NULL;
		ValaSymbol* _tmp82_;
		gchar* _tmp83_;
		gchar* _tmp84_;
		const gchar* _tmp85_;
		gchar* _tmp86_;
		gchar* _tmp87_;
		gchar* _tmp88_;
		gchar* _tmp89_;
		const gchar* _tmp90_;
		const gchar* _tmp91_;
		gchar* _tmp92_;
		const gchar* _tmp93_;
		const gchar* _tmp94_;
		const gchar* _tmp95_;
		gchar* _tmp96_;
		gchar* _tmp97_;
		gchar* _tmp98_;
		ValaCodeContext* _tmp99_;
		const gchar* _tmp102_;
		const gchar* _tmp103_;
		const gchar* _tmp104_;
		gchar* _tmp105_;
		gchar* _tmp106_;
		gchar* _tmp107_;
		const gchar* _tmp108_;
		const gchar* _tmp109_;
		gchar* _tmp110_;
		_tmp82_ = parent;
		_tmp83_ = vala_symbol_get_full_name (_tmp82_);
		_tmp84_ = _tmp83_;
		_tmp85_ = self->priv->ns_pfx;
		_tmp86_ = string_replace (_tmp84_, _tmp85_, "");
		_tmp87_ = _tmp86_;
		_tmp88_ = string_replace (_tmp87_, ".", "");
		_tmp89_ = _tmp88_;
		_g_free0 (_tmp87_);
		_g_free0 (_tmp84_);
		classname = _tmp89_;
		_tmp90_ = self->priv->extends;
		_tmp91_ = applys;
		_tmp92_ = g_strconcat (_tmp90_, _tmp91_, NULL);
		_g_free0 (self->priv->extends);
		self->priv->extends = _tmp92_;
		_tmp93_ = self->priv->extends;
		_tmp94_ = classname;
		_tmp95_ = def_args;
		_tmp96_ = g_strdup_printf ("\t%s (%s) {\n", _tmp94_, _tmp95_);
		_tmp97_ = _tmp96_;
		_tmp98_ = g_strconcat (_tmp93_, _tmp97_, NULL);
		_g_free0 (self->priv->extends);
		self->priv->extends = _tmp98_;
		_g_free0 (_tmp97_);
		_tmp99_ = ((ValabindWriter*) self)->context;
		if (vala_code_context_is_defined (_tmp99_, "GOBJECT")) {
			const gchar* _tmp100_;
			gchar* _tmp101_;
			_tmp100_ = self->priv->extends;
			_tmp101_ = g_strconcat (_tmp100_, "\t\tg_type_init ();\n", NULL);
			_g_free0 (self->priv->extends);
			self->priv->extends = _tmp101_;
		}
		_tmp102_ = self->priv->extends;
		_tmp103_ = cname;
		_tmp104_ = call_args;
		_tmp105_ = g_strdup_printf ("\t\treturn %s (%s);\n\t}\n", _tmp103_, _tmp104_);
		_tmp106_ = _tmp105_;
		_tmp107_ = g_strconcat (_tmp102_, _tmp106_, NULL);
		_g_free0 (self->priv->extends);
		self->priv->extends = _tmp107_;
		_g_free0 (_tmp106_);
		_tmp108_ = self->priv->extends;
		_tmp109_ = clears;
		_tmp110_ = g_strconcat (_tmp108_, _tmp109_, NULL);
		_g_free0 (self->priv->extends);
		self->priv->extends = _tmp110_;
		_g_free0 (classname);
	} else {
		gchar* func = NULL;
		gchar* _tmp111_;
		gchar* fbdy = NULL;
		gchar* _tmp112_;
		const gchar* _tmp117_;
		const gchar* _tmp118_;
		gchar* _tmp119_;
		gboolean _tmp120_ = FALSE;
		const gchar* _tmp247_;
		const gchar* _tmp248_;
		gchar* _tmp249_;
		const gchar* _tmp250_;
		const gchar* _tmp251_;
		gchar* _tmp252_;
		_tmp111_ = g_strdup ("");
		func = _tmp111_;
		_tmp112_ = g_strdup ("");
		fbdy = _tmp112_;
		if (!is_static) {
			const gchar* _tmp113_;
			_tmp113_ = call_args;
			if (g_strcmp0 (_tmp113_, "") == 0) {
				gchar* _tmp114_;
				_tmp114_ = g_strdup ("self");
				_g_free0 (call_args);
				call_args = _tmp114_;
			} else {
				const gchar* _tmp115_;
				gchar* _tmp116_;
				_tmp115_ = call_args;
				_tmp116_ = g_strconcat ("self, ", _tmp115_, NULL);
				_g_free0 (call_args);
				call_args = _tmp116_;
			}
		}
		_tmp117_ = func;
		_tmp118_ = applys;
		_tmp119_ = g_strconcat (_tmp117_, _tmp118_, NULL);
		_g_free0 (func);
		func = _tmp119_;
		if (self->priv->cxx_mode) {
			const gchar* _tmp121_;
			_tmp121_ = ret;
			_tmp120_ = string_index_of (_tmp121_, "std::vector", 0) != -1;
		} else {
			_tmp120_ = FALSE;
		}
		if (_tmp120_) {
			const gchar* _tmp122_;
			gchar* _tmp123_;
			gchar* _tmp124_;
			gchar* _tmp125_;
			gint ptr = 0;
			const gchar* _tmp126_;
			gchar* _tmp127_ = NULL;
			gchar* iter_type = NULL;
			gchar* _tmp135_;
			const gchar* _tmp136_;
			gchar* _tmp137_;
			const gchar* _tmp138_;
			gchar* _tmp139_;
			const gchar* _tmp140_;
			gchar* _tmp141_;
			const gchar* _tmp142_;
			ValaDataType* _tmp143_;
			ValaDataType* _tmp144_;
			gchar* _tmp145_;
			gchar* _tmp146_;
			gboolean _tmp147_;
			ValaDataType* _tmp181_;
			ValaDataType* _tmp182_;
			gchar* _tmp183_;
			gchar* _tmp184_;
			gboolean _tmp185_;
			const gchar* _tmp219_;
			const gchar* _tmp220_;
			const gchar* _tmp221_;
			gchar* _tmp222_;
			gchar* _tmp223_;
			gchar* _tmp224_;
			_tmp122_ = ret;
			_tmp123_ = string_replace (_tmp122_, ">*", ">");
			_tmp124_ = _tmp123_;
			_tmp125_ = string_replace (_tmp124_, "*>", ">");
			_g_free0 (ret);
			ret = _tmp125_;
			_g_free0 (_tmp124_);
			_tmp126_ = ret;
			ptr = string_index_of (_tmp126_, "<", 0);
			if (ptr == -1) {
				const gchar* _tmp128_;
				gchar* _tmp129_;
				_tmp128_ = ret;
				_tmp129_ = g_strdup (_tmp128_);
				_g_free0 (_tmp127_);
				_tmp127_ = _tmp129_;
			} else {
				const gchar* _tmp130_;
				const gchar* _tmp131_;
				gint _tmp132_;
				gint _tmp133_;
				gchar* _tmp134_;
				_tmp130_ = ret;
				_tmp131_ = ret;
				_tmp132_ = strlen (_tmp131_);
				_tmp133_ = _tmp132_;
				_tmp134_ = string_slice (_tmp130_, (glong) ptr, (glong) _tmp133_);
				_g_free0 (_tmp127_);
				_tmp127_ = _tmp134_;
			}
			_tmp135_ = _tmp127_;
			_tmp127_ = NULL;
			iter_type = _tmp135_;
			_tmp136_ = iter_type;
			_tmp137_ = string_replace (_tmp136_, "<", "");
			_g_free0 (iter_type);
			iter_type = _tmp137_;
			_tmp138_ = iter_type;
			_tmp139_ = string_replace (_tmp138_, ">", "");
			_g_free0 (iter_type);
			iter_type = _tmp139_;
			_tmp140_ = iter_type;
			_tmp141_ = string_replace (_tmp140_, "*", "");
			_g_free0 (iter_type);
			iter_type = _tmp141_;
			_tmp142_ = iter_type;
			if (g_strcmp0 (_tmp142_, "G*") == 0) {
				error ("Oops. No <G> type support.\n");
			}
			_tmp143_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp144_ = _tmp143_;
			_tmp145_ = vala_code_node_to_string ((ValaCodeNode*) _tmp144_);
			_tmp146_ = _tmp145_;
			_tmp147_ = string_index_of (_tmp146_, "RList", 0) != -1;
			_g_free0 (_tmp146_);
			if (_tmp147_) {
				const gchar* _tmp148_;
				const gchar* _tmp149_;
				gchar* _tmp150_;
				gchar* _tmp151_;
				gchar* _tmp152_;
				const gchar* _tmp153_;
				gchar* _tmp154_;
				const gchar* _tmp155_;
				gchar* _tmp156_;
				const gchar* _tmp157_;
				const gchar* _tmp158_;
				gchar* _tmp159_;
				gchar* _tmp160_;
				gchar* _tmp161_;
				const gchar* _tmp162_;
				const gchar* _tmp163_;
				const gchar* _tmp164_;
				gchar* _tmp165_;
				gchar* _tmp166_;
				gchar* _tmp167_;
				const gchar* _tmp168_;
				gchar* _tmp169_;
				const gchar* _tmp170_;
				const gchar* _tmp171_;
				gchar* _tmp172_;
				gchar* _tmp173_;
				gchar* _tmp174_;
				const gchar* _tmp175_;
				gchar* _tmp176_;
				const gchar* _tmp177_;
				gchar* _tmp178_;
				const gchar* _tmp179_;
				gchar* _tmp180_;
				_tmp148_ = fbdy;
				_tmp149_ = ret;
				_tmp150_ = g_strdup_printf ("\t\t%s ret;\n", _tmp149_);
				_tmp151_ = _tmp150_;
				_tmp152_ = g_strconcat (_tmp148_, _tmp151_, NULL);
				_g_free0 (fbdy);
				fbdy = _tmp152_;
				_g_free0 (_tmp151_);
				_tmp153_ = fbdy;
				_tmp154_ = g_strconcat (_tmp153_, "\t\tRList *list;\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp154_;
				_tmp155_ = fbdy;
				_tmp156_ = g_strconcat (_tmp155_, "\t\tRListIter *iter;\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp156_;
				_tmp157_ = fbdy;
				_tmp158_ = iter_type;
				_tmp159_ = g_strdup_printf ("\t\t%s *item;\n", _tmp158_);
				_tmp160_ = _tmp159_;
				_tmp161_ = g_strconcat (_tmp157_, _tmp160_, NULL);
				_g_free0 (fbdy);
				fbdy = _tmp161_;
				_g_free0 (_tmp160_);
				_tmp162_ = fbdy;
				_tmp163_ = cname;
				_tmp164_ = call_args;
				_tmp165_ = g_strdup_printf ("\t\tlist = %s (%s);\n", _tmp163_, _tmp164_);
				_tmp166_ = _tmp165_;
				_tmp167_ = g_strconcat (_tmp162_, _tmp166_, NULL);
				_g_free0 (fbdy);
				fbdy = _tmp167_;
				_g_free0 (_tmp166_);
				_tmp168_ = fbdy;
				_tmp169_ = g_strconcat (_tmp168_, "\t\tif (list)\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp169_;
				_tmp170_ = fbdy;
				_tmp171_ = iter_type;
				_tmp172_ = g_strdup_printf ("\t\tfor (iter = list->head; iter && (item = (%s*)iter->data); iter = i" \
"ter->n)\n", _tmp171_);
				_tmp173_ = _tmp172_;
				_tmp174_ = g_strconcat (_tmp170_, _tmp173_, NULL);
				_g_free0 (fbdy);
				fbdy = _tmp174_;
				_g_free0 (_tmp173_);
				_tmp175_ = fbdy;
				_tmp176_ = g_strconcat (_tmp175_, "\t\t\tret.push_back(*item);\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp176_;
				_tmp177_ = fbdy;
				_tmp178_ = g_strconcat (_tmp177_, "\t\treturn ret;\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp178_;
				_tmp179_ = fbdy;
				_tmp180_ = g_strconcat (_tmp179_, "\t}\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp180_;
			}
			_tmp181_ = vala_callable_get_return_type ((ValaCallable*) m);
			_tmp182_ = _tmp181_;
			_tmp183_ = vala_code_node_to_string ((ValaCodeNode*) _tmp182_);
			_tmp184_ = _tmp183_;
			_tmp185_ = string_index_of (_tmp184_, "SdbList", 0) != -1;
			_g_free0 (_tmp184_);
			if (_tmp185_) {
				const gchar* _tmp186_;
				const gchar* _tmp187_;
				gchar* _tmp188_;
				gchar* _tmp189_;
				gchar* _tmp190_;
				const gchar* _tmp191_;
				gchar* _tmp192_;
				const gchar* _tmp193_;
				gchar* _tmp194_;
				const gchar* _tmp195_;
				const gchar* _tmp196_;
				gchar* _tmp197_;
				gchar* _tmp198_;
				gchar* _tmp199_;
				const gchar* _tmp200_;
				const gchar* _tmp201_;
				const gchar* _tmp202_;
				gchar* _tmp203_;
				gchar* _tmp204_;
				gchar* _tmp205_;
				const gchar* _tmp206_;
				gchar* _tmp207_;
				const gchar* _tmp208_;
				const gchar* _tmp209_;
				gchar* _tmp210_;
				gchar* _tmp211_;
				gchar* _tmp212_;
				const gchar* _tmp213_;
				gchar* _tmp214_;
				const gchar* _tmp215_;
				gchar* _tmp216_;
				const gchar* _tmp217_;
				gchar* _tmp218_;
				_tmp186_ = fbdy;
				_tmp187_ = ret;
				_tmp188_ = g_strdup_printf ("\t\t%s ret;\n", _tmp187_);
				_tmp189_ = _tmp188_;
				_tmp190_ = g_strconcat (_tmp186_, _tmp189_, NULL);
				_g_free0 (fbdy);
				fbdy = _tmp190_;
				_g_free0 (_tmp189_);
				_tmp191_ = fbdy;
				_tmp192_ = g_strconcat (_tmp191_, "\t\tSdbList *list;\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp192_;
				_tmp193_ = fbdy;
				_tmp194_ = g_strconcat (_tmp193_, "\t\tSdbListIter *iter;\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp194_;
				_tmp195_ = fbdy;
				_tmp196_ = iter_type;
				_tmp197_ = g_strdup_printf ("\t\t%s *item;\n", _tmp196_);
				_tmp198_ = _tmp197_;
				_tmp199_ = g_strconcat (_tmp195_, _tmp198_, NULL);
				_g_free0 (fbdy);
				fbdy = _tmp199_;
				_g_free0 (_tmp198_);
				_tmp200_ = fbdy;
				_tmp201_ = cname;
				_tmp202_ = call_args;
				_tmp203_ = g_strdup_printf ("\t\tlist = %s (%s);\n", _tmp201_, _tmp202_);
				_tmp204_ = _tmp203_;
				_tmp205_ = g_strconcat (_tmp200_, _tmp204_, NULL);
				_g_free0 (fbdy);
				fbdy = _tmp205_;
				_g_free0 (_tmp204_);
				_tmp206_ = fbdy;
				_tmp207_ = g_strconcat (_tmp206_, "\t\tif (list)\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp207_;
				_tmp208_ = fbdy;
				_tmp209_ = iter_type;
				_tmp210_ = g_strdup_printf ("\t\tfor (iter = list->head; iter && (item = (%s*)iter->data); iter = i" \
"ter->n)\n", _tmp209_);
				_tmp211_ = _tmp210_;
				_tmp212_ = g_strconcat (_tmp208_, _tmp211_, NULL);
				_g_free0 (fbdy);
				fbdy = _tmp212_;
				_g_free0 (_tmp211_);
				_tmp213_ = fbdy;
				_tmp214_ = g_strconcat (_tmp213_, "\t\t\tret.push_back(*item);\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp214_;
				_tmp215_ = fbdy;
				_tmp216_ = g_strconcat (_tmp215_, "\t\treturn ret;\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp216_;
				_tmp217_ = fbdy;
				_tmp218_ = g_strconcat (_tmp217_, "\t}\n", NULL);
				_g_free0 (fbdy);
				fbdy = _tmp218_;
			}
			_tmp219_ = self->priv->vectors;
			_tmp220_ = iter_type;
			_tmp221_ = iter_type;
			_tmp222_ = g_strdup_printf ("\t%%template(%sVector) std::vector<%s>;\n", _tmp220_, _tmp221_);
			_tmp223_ = _tmp222_;
			_tmp224_ = g_strconcat (_tmp219_, _tmp223_, NULL);
			_g_free0 (self->priv->vectors);
			self->priv->vectors = _tmp224_;
			_g_free0 (_tmp223_);
			_g_free0 (iter_type);
			_g_free0 (_tmp127_);
		} else {
			const gchar* _tmp225_ = NULL;
			const gchar* _tmp226_;
			const gchar* _tmp227_;
			const gchar* _tmp228_;
			const gchar* _tmp229_;
			gchar* _tmp230_;
			gchar* _tmp231_;
			gchar* _tmp232_;
			_tmp226_ = ret;
			if (g_strcmp0 (_tmp226_, "void") == 0) {
				_tmp225_ = "";
			} else {
				_tmp225_ = "return ";
			}
			_tmp227_ = fbdy;
			_tmp228_ = cname;
			_tmp229_ = call_args;
			_tmp230_ = g_strdup_printf ("\t\t%s%s(%s);\n\t}\n", _tmp225_, _tmp228_, _tmp229_);
			_tmp231_ = _tmp230_;
			_tmp232_ = g_strconcat (_tmp227_, _tmp231_, NULL);
			_g_free0 (fbdy);
			fbdy = _tmp232_;
			_g_free0 (_tmp231_);
		}
		if (is_static) {
			const gchar* _tmp233_;
			const gchar* _tmp234_;
			const gchar* _tmp235_;
			const gchar* _tmp236_;
			gchar* _tmp237_;
			gchar* _tmp238_;
			gchar* _tmp239_;
			_tmp233_ = func;
			_tmp234_ = ret;
			_tmp235_ = alias;
			_tmp236_ = def_args;
			_tmp237_ = g_strdup_printf ("\tstatic %s %s(%s) {\n", _tmp234_, _tmp235_, _tmp236_);
			_tmp238_ = _tmp237_;
			_tmp239_ = g_strconcat (_tmp233_, _tmp238_, NULL);
			_g_free0 (func);
			func = _tmp239_;
			_g_free0 (_tmp238_);
		} else {
			const gchar* _tmp240_;
			const gchar* _tmp241_;
			const gchar* _tmp242_;
			const gchar* _tmp243_;
			gchar* _tmp244_;
			gchar* _tmp245_;
			gchar* _tmp246_;
			_tmp240_ = func;
			_tmp241_ = ret;
			_tmp242_ = alias;
			_tmp243_ = def_args;
			_tmp244_ = g_strdup_printf ("\t%s %s(%s) {\n", _tmp241_, _tmp242_, _tmp243_);
			_tmp245_ = _tmp244_;
			_tmp246_ = g_strconcat (_tmp240_, _tmp245_, NULL);
			_g_free0 (func);
			func = _tmp246_;
			_g_free0 (_tmp245_);
		}
		_tmp247_ = func;
		_tmp248_ = fbdy;
		_tmp249_ = g_strconcat (_tmp247_, _tmp248_, NULL);
		_g_free0 (func);
		func = _tmp249_;
		_tmp250_ = func;
		_tmp251_ = clears;
		_tmp252_ = g_strconcat (_tmp250_, _tmp251_, NULL);
		_g_free0 (func);
		func = _tmp252_;
		if (!parent_is_class) {
			const gchar* _tmp253_;
			const gchar* _tmp254_;
			gchar* _tmp255_;
			const gchar* _tmp256_;
			const gchar* _tmp257_;
			const gchar* _tmp258_;
			const gchar* _tmp259_;
			gchar* _tmp260_;
			gchar* _tmp261_;
			gchar* _tmp262_;
			_tmp253_ = self->priv->statics;
			_tmp254_ = func;
			_tmp255_ = g_strconcat (_tmp253_, _tmp254_, NULL);
			_g_free0 (self->priv->statics);
			self->priv->statics = _tmp255_;
			_tmp256_ = self->priv->extends;
			_tmp257_ = ret;
			_tmp258_ = alias;
			_tmp259_ = def_args;
			_tmp260_ = g_strdup_printf ("\tstatic %s %s(%s);\n", _tmp257_, _tmp258_, _tmp259_);
			_tmp261_ = _tmp260_;
			_tmp262_ = g_strconcat (_tmp256_, _tmp261_, NULL);
			_g_free0 (self->priv->extends);
			self->priv->extends = _tmp262_;
			_g_free0 (_tmp261_);
		} else {
			const gchar* _tmp263_;
			const gchar* _tmp264_;
			gchar* _tmp265_;
			_tmp263_ = self->priv->extends;
			_tmp264_ = func;
			_tmp265_ = g_strconcat (_tmp263_, _tmp264_, NULL);
			_g_free0 (self->priv->extends);
			self->priv->extends = _tmp265_;
		}
		_g_free0 (fbdy);
		_g_free0 (func);
	}
	_g_free0 (clears);
	_g_free0 (applys);
	_g_free0 (call_args);
	_g_free0 (def_args);
	_g_free0 (ret);
	_vala_code_node_unref0 (parent);
	_g_free0 (alias);
	_g_free0 (cname);
}

static void
swig_writer_real_visit_namespace (ValaCodeVisitor* base,
                                  ValaNamespace* ns)
{
	SwigWriter * self;
	gchar* name = NULL;
	gchar* _tmp0_;
	gboolean use = FALSE;
	const gchar* _tmp3_;
	const gchar* _tmp13_;
	self = (SwigWriter*) base;
	g_return_if_fail (ns != NULL);
	_tmp0_ = vala_symbol_get_full_name ((ValaSymbol*) ns);
	name = _tmp0_;
	use = valabind_writer_use_namespace ((ValabindWriter*) self, ns);
	if (use) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = name;
		_tmp2_ = g_strconcat (_tmp1_, ".", NULL);
		_g_free0 (self->priv->ns_pfx);
		self->priv->ns_pfx = _tmp2_;
	}
	_tmp3_ = self->priv->ns_pfx;
	if (_tmp3_ != NULL) {
		valabind_writer_add_includes ((ValabindWriter*) self, (ValaSymbol*) ns);
	}
	{
		ValaList* _n_list = NULL;
		ValaList* _tmp4_;
		gint _n_size = 0;
		ValaList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _n_index = 0;
		_tmp4_ = vala_namespace_get_namespaces (ns);
		_n_list = _tmp4_;
		_tmp5_ = _n_list;
		_tmp6_ = vala_collection_get_size ((ValaCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_n_size = _tmp7_;
		_n_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			ValaNamespace* n = NULL;
			ValaList* _tmp10_;
			gpointer _tmp11_;
			ValaNamespace* _tmp12_;
			_n_index = _n_index + 1;
			_tmp8_ = _n_index;
			_tmp9_ = _n_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _n_list;
			_tmp11_ = vala_list_get (_tmp10_, _n_index);
			n = (ValaNamespace*) _tmp11_;
			_tmp12_ = n;
			vala_code_node_accept ((ValaCodeNode*) _tmp12_, (ValaCodeVisitor*) self);
			_vala_code_node_unref0 (n);
		}
	}
	_tmp13_ = self->priv->ns_pfx;
	if (_tmp13_ != NULL) {
		{
			ValaList* _c_list = NULL;
			ValaList* _tmp14_;
			gint _c_size = 0;
			ValaList* _tmp15_;
			gint _tmp16_;
			gint _tmp17_;
			gint _c_index = 0;
			_tmp14_ = vala_namespace_get_constants (ns);
			_c_list = _tmp14_;
			_tmp15_ = _c_list;
			_tmp16_ = vala_collection_get_size ((ValaCollection*) _tmp15_);
			_tmp17_ = _tmp16_;
			_c_size = _tmp17_;
			_c_index = -1;
			while (TRUE) {
				gint _tmp18_;
				gint _tmp19_;
				ValaConstant* c = NULL;
				ValaList* _tmp20_;
				gpointer _tmp21_;
				ValaConstant* _tmp22_;
				_c_index = _c_index + 1;
				_tmp18_ = _c_index;
				_tmp19_ = _c_size;
				if (!(_tmp18_ < _tmp19_)) {
					break;
				}
				_tmp20_ = _c_list;
				_tmp21_ = vala_list_get (_tmp20_, _c_index);
				c = (ValaConstant*) _tmp21_;
				_tmp22_ = c;
				vala_code_node_accept ((ValaCodeNode*) _tmp22_, (ValaCodeVisitor*) self);
				_vala_code_node_unref0 (c);
			}
		}
		{
			ValaList* _e_list = NULL;
			ValaList* _tmp23_;
			gint _e_size = 0;
			ValaList* _tmp24_;
			gint _tmp25_;
			gint _tmp26_;
			gint _e_index = 0;
			_tmp23_ = vala_namespace_get_enums (ns);
			_e_list = _tmp23_;
			_tmp24_ = _e_list;
			_tmp25_ = vala_collection_get_size ((ValaCollection*) _tmp24_);
			_tmp26_ = _tmp25_;
			_e_size = _tmp26_;
			_e_index = -1;
			while (TRUE) {
				gint _tmp27_;
				gint _tmp28_;
				ValaEnum* e = NULL;
				ValaList* _tmp29_;
				gpointer _tmp30_;
				ValaEnum* _tmp31_;
				_e_index = _e_index + 1;
				_tmp27_ = _e_index;
				_tmp28_ = _e_size;
				if (!(_tmp27_ < _tmp28_)) {
					break;
				}
				_tmp29_ = _e_list;
				_tmp30_ = vala_list_get (_tmp29_, _e_index);
				e = (ValaEnum*) _tmp30_;
				_tmp31_ = e;
				vala_code_node_accept ((ValaCodeNode*) _tmp31_, (ValaCodeVisitor*) self);
				_vala_code_node_unref0 (e);
			}
		}
		{
			ValaList* _s_list = NULL;
			ValaList* _tmp32_;
			gint _s_size = 0;
			ValaList* _tmp33_;
			gint _tmp34_;
			gint _tmp35_;
			gint _s_index = 0;
			_tmp32_ = vala_namespace_get_structs (ns);
			_s_list = _tmp32_;
			_tmp33_ = _s_list;
			_tmp34_ = vala_collection_get_size ((ValaCollection*) _tmp33_);
			_tmp35_ = _tmp34_;
			_s_size = _tmp35_;
			_s_index = -1;
			while (TRUE) {
				gint _tmp36_;
				gint _tmp37_;
				ValaStruct* s = NULL;
				ValaList* _tmp38_;
				gpointer _tmp39_;
				ValaStruct* _tmp40_;
				_s_index = _s_index + 1;
				_tmp36_ = _s_index;
				_tmp37_ = _s_size;
				if (!(_tmp36_ < _tmp37_)) {
					break;
				}
				_tmp38_ = _s_list;
				_tmp39_ = vala_list_get (_tmp38_, _s_index);
				s = (ValaStruct*) _tmp39_;
				_tmp40_ = s;
				vala_code_node_accept ((ValaCodeNode*) _tmp40_, (ValaCodeVisitor*) self);
				_vala_code_node_unref0 (s);
			}
		}
		{
			ValaList* _c_list = NULL;
			ValaList* _tmp41_;
			gint _c_size = 0;
			ValaList* _tmp42_;
			gint _tmp43_;
			gint _tmp44_;
			gint _c_index = 0;
			_tmp41_ = vala_namespace_get_classes (ns);
			_c_list = _tmp41_;
			_tmp42_ = _c_list;
			_tmp43_ = vala_collection_get_size ((ValaCollection*) _tmp42_);
			_tmp44_ = _tmp43_;
			_c_size = _tmp44_;
			_c_index = -1;
			while (TRUE) {
				gint _tmp45_;
				gint _tmp46_;
				ValaClass* c = NULL;
				ValaList* _tmp47_;
				gpointer _tmp48_;
				ValaClass* _tmp49_;
				_c_index = _c_index + 1;
				_tmp45_ = _c_index;
				_tmp46_ = _c_size;
				if (!(_tmp45_ < _tmp46_)) {
					break;
				}
				_tmp47_ = _c_list;
				_tmp48_ = vala_list_get (_tmp47_, _c_index);
				c = (ValaClass*) _tmp48_;
				_tmp49_ = c;
				vala_code_node_accept ((ValaCodeNode*) _tmp49_, (ValaCodeVisitor*) self);
				_vala_code_node_unref0 (c);
			}
		}
	}
	if (use) {
		_g_free0 (self->priv->ns_pfx);
		self->priv->ns_pfx = NULL;
	}
	_g_free0 (name);
}

static void
swig_writer_real_write (ValabindWriter* base,
                        const gchar* file)
{
	SwigWriter * self;
	FILE* stream = NULL;
	FILE* _tmp0_;
	FILE* _tmp1_;
	ValaCodeContext* _tmp4_;
	ValaNamespace* _tmp5_;
	ValaNamespace* _tmp6_;
	FILE* _tmp7_;
	const gchar* _tmp8_;
	gboolean _tmp10_ = FALSE;
	const gchar* _tmp11_;
	FILE* _tmp21_;
	gboolean _tmp22_ = FALSE;
	FILE* _tmp26_;
	const gchar* _tmp27_;
	FILE* _tmp28_;
	const gchar* _tmp29_;
	FILE* _tmp30_;
	const gchar* _tmp31_;
	self = (SwigWriter*) base;
	g_return_if_fail (file != NULL);
	_tmp0_ = g_fopen (file, "w");
	stream = _tmp0_;
	_tmp1_ = stream;
	if (_tmp1_ == NULL) {
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = g_strdup_printf ("Cannot open %s for writing", file);
		_tmp3_ = _tmp2_;
		error (_tmp3_);
		_g_free0 (_tmp3_);
	}
	_tmp4_ = ((ValabindWriter*) self)->context;
	_tmp5_ = vala_code_context_get_root (_tmp4_);
	_tmp6_ = _tmp5_;
	vala_code_node_accept ((ValaCodeNode*) _tmp6_, (ValaCodeVisitor*) self);
	_tmp7_ = stream;
	_tmp8_ = ((ValabindWriter*) self)->modulename;
	fprintf (_tmp7_, "%%module %s\n%%{\n", _tmp8_);
	if (!self->priv->cxx_mode) {
		FILE* _tmp9_;
		_tmp9_ = stream;
		fprintf (_tmp9_, "%s", "\t#define bool int\n" "\t#define true 1\n" "\t#define false 0\n");
	}
	_tmp11_ = self->priv->statics;
	if (g_strcmp0 (_tmp11_, "") != 0) {
		_tmp10_ = TRUE;
	} else {
		GList* _tmp12_;
		_tmp12_ = ((ValabindWriter*) self)->includefiles;
		_tmp10_ = g_list_length (_tmp12_) > ((guint) 0);
	}
	if (_tmp10_) {
		GList* _tmp14_;
		FILE* _tmp18_;
		const gchar* _tmp19_;
		if (self->priv->cxx_mode) {
			FILE* _tmp13_;
			_tmp13_ = stream;
			fprintf (_tmp13_, "\textern \"C\" {\n");
		}
		_tmp14_ = ((ValabindWriter*) self)->includefiles;
		{
			GList* inc_collection = NULL;
			GList* inc_it = NULL;
			inc_collection = _tmp14_;
			for (inc_it = inc_collection; inc_it != NULL; inc_it = inc_it->next) {
				gchar* _tmp15_;
				gchar* inc = NULL;
				_tmp15_ = g_strdup ((const gchar*) inc_it->data);
				inc = _tmp15_;
				{
					FILE* _tmp16_;
					const gchar* _tmp17_;
					_tmp16_ = stream;
					_tmp17_ = inc;
					fprintf (_tmp16_, "\t#include <%s>\n", _tmp17_);
					_g_free0 (inc);
				}
			}
		}
		_tmp18_ = stream;
		_tmp19_ = self->priv->statics;
		fprintf (_tmp18_, "%s", _tmp19_);
		if (self->priv->cxx_mode) {
			FILE* _tmp20_;
			_tmp20_ = stream;
			fprintf (_tmp20_, "\t}\n\t#include <vector>\n");
		}
	}
	_tmp21_ = stream;
	fprintf (_tmp21_, "%%}\n");
	if (self->priv->cxx_mode) {
		const gchar* _tmp23_;
		_tmp23_ = self->priv->vectors;
		_tmp22_ = g_strcmp0 (_tmp23_, "") != 0;
	} else {
		_tmp22_ = FALSE;
	}
	if (_tmp22_) {
		FILE* _tmp24_;
		const gchar* _tmp25_;
		_tmp24_ = stream;
		_tmp25_ = self->priv->vectors;
		fprintf (_tmp24_, "%%include \"std_vector.i\"\n\nnamespace std {\n%s}\n", _tmp25_);
	}
	_tmp26_ = stream;
	_tmp27_ = self->priv->structs;
	fprintf (_tmp26_, "%s\n", _tmp27_);
	_tmp28_ = stream;
	_tmp29_ = self->priv->enums;
	fprintf (_tmp28_, "%s\n", _tmp29_);
	_tmp30_ = stream;
	_tmp31_ = self->priv->extends;
	fprintf (_tmp30_, "%s\n", _tmp31_);
	_fclose0 (stream);
}

static void
swig_writer_class_init (SwigWriterClass * klass,
                        gpointer klass_data)
{
	swig_writer_parent_class = g_type_class_peek_parent (klass);
	((ValaCodeVisitorClass *) klass)->finalize = swig_writer_finalize;
	g_type_class_adjust_private_offset (klass, &SwigWriter_private_offset);
	((ValabindWriterClass *) klass)->get_filename = (gchar* (*) (ValabindWriter*, const gchar*)) swig_writer_real_get_filename;
	((ValaCodeVisitorClass *) klass)->visit_constant = (void (*) (ValaCodeVisitor*, ValaConstant*)) swig_writer_real_visit_constant;
	((ValaCodeVisitorClass *) klass)->visit_enum = (void (*) (ValaCodeVisitor*, ValaEnum*)) swig_writer_real_visit_enum;
	((ValaCodeVisitorClass *) klass)->visit_struct = (void (*) (ValaCodeVisitor*, ValaStruct*)) swig_writer_real_visit_struct;
	((ValaCodeVisitorClass *) klass)->visit_class = (void (*) (ValaCodeVisitor*, ValaClass*)) swig_writer_real_visit_class;
	((ValaCodeVisitorClass *) klass)->visit_field = (void (*) (ValaCodeVisitor*, ValaField*)) swig_writer_real_visit_field;
	((ValaCodeVisitorClass *) klass)->visit_method = (void (*) (ValaCodeVisitor*, ValaMethod*)) swig_writer_real_visit_method;
	((ValaCodeVisitorClass *) klass)->visit_namespace = (void (*) (ValaCodeVisitor*, ValaNamespace*)) swig_writer_real_visit_namespace;
	((ValabindWriterClass *) klass)->write = (void (*) (ValabindWriter*, const gchar*)) swig_writer_real_write;
}

static void
swig_writer_instance_init (SwigWriter * self,
                           gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	self->priv = swig_writer_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->statics = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->priv->structs = _tmp1_;
	_tmp2_ = g_strdup ("");
	self->priv->extends = _tmp2_;
	_tmp3_ = g_strdup ("");
	self->priv->enums = _tmp3_;
	_tmp4_ = g_strdup ("");
	self->priv->vectors = _tmp4_;
}

static void
swig_writer_finalize (ValaCodeVisitor * obj)
{
	SwigWriter * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SWIG_WRITER, SwigWriter);
	_g_free0 (self->priv->statics);
	_g_free0 (self->priv->structs);
	_g_free0 (self->priv->extends);
	_g_free0 (self->priv->enums);
	_g_free0 (self->priv->vectors);
	_g_free0 (self->priv->ns_pfx);
	VALA_CODE_VISITOR_CLASS (swig_writer_parent_class)->finalize (obj);
}

static GType
swig_writer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwigWriterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) swig_writer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwigWriter), 0, (GInstanceInitFunc) swig_writer_instance_init, NULL };
	GType swig_writer_type_id;
	swig_writer_type_id = g_type_register_static (TYPE_VALABIND_WRITER, "SwigWriter", &g_define_type_info, 0);
	SwigWriter_private_offset = g_type_add_instance_private (swig_writer_type_id, sizeof (SwigWriterPrivate));
	return swig_writer_type_id;
}

GType
swig_writer_get_type (void)
{
	static volatile gsize swig_writer_type_id__once = 0;
	if (g_once_init_enter (&swig_writer_type_id__once)) {
		GType swig_writer_type_id;
		swig_writer_type_id = swig_writer_get_type_once ();
		g_once_init_leave (&swig_writer_type_id__once, swig_writer_type_id);
	}
	return swig_writer_type_id__once;
}

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 gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

